void-packages/srcpkgs/unixbench/patches/install.patch

209 lines
6.4 KiB
Diff

From 659ebeb12cbfa4035649f0a68d4be78fc0009eff 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 | 29 ++++++++++++++++++++++-------
UnixBench/Run | 42 ++++++++++++++----------------------------
UnixBench/pgms/multi.sh | 2 +-
UnixBench/src/execl.c | 4 +---
4 files changed, 38 insertions(+), 39 deletions(-)
diff --git a/UnixBench/Makefile b/UnixBench/Makefile
index 880743a..748a2a4 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:
@@ -266,12 +270,12 @@ $(PROGDIR)/ubgears: LDFLAGS += -lm $(GL_LIBS)
$(PROGDIR)/dhry2: CFLAGS += -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: $(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..80f2a8d 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";
############################################################################
@@ -593,6 +595,8 @@ sub logFile {
# Use the date in the base file name.
my $ymd = strftime "%Y-%m-%d", localtime;
+ system("mkdir -p $RESULTDIR");
+
while (1) {
my $log = sprintf "%s/%s-%s-%02d",
${RESULTDIR}, $sysInfo->{'name'}, $ymd, $count;
@@ -838,26 +842,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 +1015,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 +1238,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 +1810,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 +1823,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