New package: unixbench-5.1.3.20161007

This commit is contained in:
Andrea Brancaleoni 2016-10-25 19:56:36 +02:00
parent fa1c9eab12
commit 266ff9e6bc
2 changed files with 279 additions and 0 deletions

View File

@ -0,0 +1,258 @@
From 97f206220ef4047551e079dd8d6105ce47cdb2c4 Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Mon, 24 Oct 2016 15:07:29 +0200
Subject: [PATCH] install
---
UnixBench/Makefile | 61 ++++++++++++++++++++++++++++++-------------------
UnixBench/Run | 40 ++++++++++----------------------
UnixBench/pgms/multi.sh | 2 +-
UnixBench/src/execl.c | 4 +---
4 files changed, 52 insertions(+), 55 deletions(-)
diff --git a/UnixBench/Makefile b/UnixBench/Makefile
index 880743a..16531c2 100644
--- a/UnixBench/Makefile
+++ b/UnixBench/Makefile
@@ -141,12 +141,16 @@ BINS = $(PROGDIR)/arithoh $(PROGDIR)/register $(PROGDIR)/short \
## These compile only on some platforms...
# $(PROGDIR)/poll $(PROGDIR)/poll2 $(PROGDIR)/select
+PROGRAMS = $(BINS) \
+ $(PROGDIR)/multi.sh $(PROGDIR)/tst.sh \
+ $(PROGDIR)/gfx-x11
+
+DATAS = $(PROGDIR)/unixbench.logo $(PROGDIR)/index.base \
+ $(TESTDIR)/sort.src $(TESTDIR)/cctest.c \
+ $(TESTDIR)/dc.dat $(TESTDIR)/large.txt
+
# Required non-binary files.
-REQD = $(BINS) $(PROGDIR)/unixbench.logo \
- $(PROGDIR)/multi.sh $(PROGDIR)/tst.sh $(PROGDIR)/index.base \
- $(PROGDIR)/gfx-x11 \
- $(TESTDIR)/sort.src $(TESTDIR)/cctest.c $(TESTDIR)/dc.dat \
- $(TESTDIR)/large.txt
+REQD = $(PROGRAMS) $(DATAS)
# ######################### the big ALL ############################
all:
@@ -212,37 +216,37 @@ programs: $(BINS)
# (dependencies could be generated by modern compilers,
# but let's not assume modern compilers are present)
$(PROGDIR)/%:
- $(CC) -o $@ $(CFLAGS) $< $(LDFLAGS)
+ $(CC) -o $@ $(CFLAGS) $(CDECL) $< $(LDFLAGS) $(LIBS)
# Individual programs
# Sometimes the same source file is compiled in different ways.
# This limits the 'make' patterns that can usefully be applied.
$(PROGDIR)/arithoh: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/arithoh: CFLAGS += -Darithoh
+$(PROGDIR)/arithoh: CDECL += -Darithoh
$(PROGDIR)/register: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/register: CFLAGS += -Ddatum='register int'
+$(PROGDIR)/register: CDECL += -Ddatum='register int'
$(PROGDIR)/short: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/short: CFLAGS += -Ddatum=short
+$(PROGDIR)/short: CDECL += -Ddatum=short
$(PROGDIR)/int: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/int: CFLAGS += -Ddatum=int
+$(PROGDIR)/int: CDECL += -Ddatum=int
$(PROGDIR)/long: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/long: CFLAGS += -Ddatum=long
+$(PROGDIR)/long: CDECL += -Ddatum=long
$(PROGDIR)/float: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/float: CFLAGS += -Ddatum=float
+$(PROGDIR)/float: CDECL += -Ddatum=float
$(PROGDIR)/double: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
-$(PROGDIR)/double: CFLAGS += -Ddatum=double
+$(PROGDIR)/double: CDECL += -Ddatum=double
$(PROGDIR)/poll: $(SRCDIR)/time-polling.c
-$(PROGDIR)/poll: CFLAGS += -DUNIXBENCH -DHAS_POLL
+$(PROGDIR)/poll: CDECL += -DUNIXBENCH -DHAS_POLL
$(PROGDIR)/poll2: $(SRCDIR)/time-polling.c
-$(PROGDIR)/poll2: CFLAGS += -DUNIXBENCH -DHAS_POLL2
+$(PROGDIR)/poll2: CDECL += -DUNIXBENCH -DHAS_POLL2
$(PROGDIR)/select: $(SRCDIR)/time-polling.c
-$(PROGDIR)/select: CFLAGS += -DUNIXBENCH -DHAS_SELECT
+$(PROGDIR)/select: CDECL += -DUNIXBENCH -DHAS_SELECT
$(PROGDIR)/whetstone-double: $(SRCDIR)/whets.c
-$(PROGDIR)/whetstone-double: CFLAGS += -DDP -DGTODay -DUNIXBENCH
-$(PROGDIR)/whetstone-double: LDFLAGS += -lm
+$(PROGDIR)/whetstone-double: CDECL += -DDP -DGTODay -DUNIXBENCH
+$(PROGDIR)/whetstone-double: LIBS += -lm
$(PROGDIR)/pipe: $(SRCDIR)/pipe.c $(SRCDIR)/timeit.c
@@ -261,17 +265,17 @@ $(PROGDIR)/context1: $(SRCDIR)/context1.c $(SRCDIR)/timeit.c
$(PROGDIR)/looper: $(SRCDIR)/looper.c $(SRCDIR)/timeit.c
$(PROGDIR)/ubgears: $(SRCDIR)/ubgears.c
-$(PROGDIR)/ubgears: LDFLAGS += -lm $(GL_LIBS)
+$(PROGDIR)/ubgears: LIBS += -lm $(GL_LIBS)
-$(PROGDIR)/dhry2: CFLAGS += -DHZ=${HZ}
+$(PROGDIR)/dhry2: CDECL += -DHZ=${HZ}
$(PROGDIR)/dhry2: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c \
$(SRCDIR)/dhry.h $(SRCDIR)/timeit.c
- $(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c
+ $(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(LDFLAGS)
-$(PROGDIR)/dhry2reg: CFLAGS += -DHZ=${HZ} -DREG=register
+$(PROGDIR)/dhry2reg: CDECL += -DHZ=${HZ} -DREG=register
$(PROGDIR)/dhry2reg: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c \
$(SRCDIR)/dhry.h $(SRCDIR)/timeit.c
- $(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c
+ $(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(LDFLAGS)
# Run the benchmarks and create the reports
run:
@@ -283,4 +287,15 @@ clean:
spotless: clean
$(RM) $(RESULTDIR)/* $(TMPDIR)/*
+install: $(PROGRAMS)
+ mkdir -p $(DESTDIR)/usr/libexec/unixbench
+ for program in $(PROGRAMS); do \
+ install -m0755 $$program $(DESTDIR)/usr/libexec/unixbench; \
+ done
+ install -D -m0755 Run $(DESTDIR)/usr/bin/unixbench
+ mkdir -p $(DESTDIR)/usr/share/unixbench
+ for data in $(DATAS); do \
+ install -m0644 $$data $(DESTDIR)/usr/share/unixbench; \
+ done
+
## END ##
diff --git a/UnixBench/Run b/UnixBench/Run
index a16a5c9..a254b5c 100755
--- a/UnixBench/Run
+++ b/UnixBench/Run
@@ -7,7 +7,6 @@ use Time::HiRes;
use IO::Handle;
use FindBin;
-
############################################################################
# UnixBench - Release 5.1.3, based on:
# The BYTE UNIX Benchmarks - Release 3
@@ -87,16 +86,19 @@ my $cCompiler = 'gcc';
# variable names are the first parameter to getDir() below.
# Directory where the test programs live.
-my $BINDIR = getDir('UB_BINDIR', $FindBin::Bin . "/pgms");
+my $BINDIR = "/usr/libexec/unixbench";
+
+# Data directory.
+my $DATADIR = "/usr/share/unixbench";
# Temp directory, for temp files.
-my $TMPDIR = getDir('UB_TMPDIR', $FindBin::Bin . "/tmp");
+my $TMPDIR = "/tmp";
# Directory to put results in.
-my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results");
+my $RESULTDIR = "/var/lib/unixbench/results";
# Directory where the tests are executed.
-my $TESTDIR = getDir('UB_TESTDIR', $FindBin::Bin . "/testdir");
+my $TESTDIR = "/var/lib/unixbench/testdir";
############################################################################
@@ -838,26 +840,6 @@ sub abortRun {
# TEST SETUP
############################################################################
-# Do checks that everything's ready for testing.
-sub preChecks {
- # Set the language.
- $ENV{'LANG'} = $language;
-
- # Check that the required files are in the proper places.
- system("make check");
- if ($? != 0) {
- system("make all");
- if ($? != 0) {
- abortRun("\"make all\" failed");
- }
- }
-
- # Create a script to kill this run.
- system("echo \"kill -9 $$\" > \"${TMPDIR}/kill_run\"");
- chmod(0755, $TMPDIR . "/kill_run");
-}
-
-
# Parse the command arguments.
sub parseArgs {
my @words = @_;
@@ -1031,7 +1013,7 @@ sub indexResults {
# Read in the baseline result data. If we can't get it, just return
# without making indexed results.
- my $index = readResultsFromFile($BINDIR . "/index.base");
+ my $index = readResultsFromFile($DATADIR . "/index.base");
if (!defined($index)) {
return;
}
@@ -1254,6 +1236,9 @@ sub runOnePass {
# Remember where we are, and move to the test directory.
my $pwd = `pwd`;
+
+ system("mkdir -p $TESTDIR");
+ system("cp $DATADIR/* $TESTDIR");
chdir($TESTDIR);
# Execute N copies of the benchmark in parallel.
@@ -1823,7 +1808,6 @@ sub main {
$tests = $index;
}
- preChecks();
my $systemInfo = getSystemInfo();
# If the number of copies to run was not set, set it to 1
@@ -1837,7 +1821,7 @@ sub main {
}
# Display the program banner.
- system("cat \"${BINDIR}/unixbench.logo\"");
+ system("cat \"${DATADIR}/unixbench.logo\"");
if ($verbose > 1) {
printf "\n", join(", ", @$tests);
diff --git a/UnixBench/pgms/multi.sh b/UnixBench/pgms/multi.sh
index c65ba22..3987078 100755
--- a/UnixBench/pgms/multi.sh
+++ b/UnixBench/pgms/multi.sh
@@ -16,7 +16,7 @@
ID="@(#)multi.sh:3.4 -- 5/15/91 19:30:24";
instance=1
while [ $instance -le $1 ]; do
- /bin/sh "$UB_BINDIR/tst.sh" &
+ /bin/sh "/usr/libexec/unixbench/tst.sh" &
instance=`expr $instance + 1`
done
wait
diff --git a/UnixBench/src/execl.c b/UnixBench/src/execl.c
index 98f03dc..28c1996 100644
--- a/UnixBench/src/execl.c
+++ b/UnixBench/src/execl.c
@@ -68,9 +68,7 @@ char *argv[];
/* the first invocation */
{
dur_str = argv[1];
- if((ptr = getenv("UB_BINDIR")) != NULL)
- sprintf(path_str,"%s/execl",ptr);
- fullpath=path_str;
+ fullpath="/usr/libexec/unixbench/execl";
time(&start_time);
}
else /* one of those execl'd invocations */
--
2.10.1

View File

@ -0,0 +1,21 @@
# Template file for 'unixbench'
pkgname=unixbench
version=5.1.3.20161007
revision=1
_commit=35efe5e575c6a5b46eccec1ae98dc52d8b0e169a
wrksrc="byte-$pkgname-$_commit"
build_wrksrc="UnixBench"
build_style=gnu-makefile
depends="perl"
short_desc="BYTE UNIX benchmark suite"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="GPL-2"
homepage="https://github.com/kdlucas/byte-unixbench"
distfiles="$homepage/archive/$_commit.tar.gz"
checksum=e0e8ec77d27c23db9fe92201e8abe9e835b988716601cb650d0c2f2d294b83a7
patch_args="-p1"
pre_build() {
make clean
}