lol

Merge pull request #231127 from Aleksanaa/unixbench

unixbench: init at unstable-2023-04-12

authored by

Weijia Wang and committed by
GitHub
43f5efa4 752edce5

+219
+108
pkgs/development/tools/misc/unixbench/common.patch
··· 1 + diff --git a/UnixBench/Run b/UnixBench/Run 2 + index 34d2c72..130b56e 100755 3 + --- a/UnixBench/Run 4 + +++ b/UnixBench/Run 5 + @@ -81,23 +81,23 @@ my $longIterCount = 10; 6 + my $shortIterCount = 3; 7 + 8 + # C compiler to use in compilation tests. 9 + -my $cCompiler = 'gcc'; 10 + +my $cCompiler = 'cc -w'; 11 + 12 + # Establish full paths to directories. These need to be full pathnames 13 + # (or do they, any more?). They can be set in env. 14 + # variable names are the first parameter to getDir() below. 15 + 16 + # Directory where the test programs live. 17 + -my $BINDIR = getDir('UB_BINDIR', $FindBin::Bin . "/pgms"); 18 + +my $BINDIR = getDir('UB_BINDIR', '@out@/libexec/pgms'); 19 + 20 + # Temp directory, for temp files. 21 + -my $TMPDIR = getDir('UB_TMPDIR', $FindBin::Bin . "/tmp"); 22 + +my $TMPDIR = getDir('UB_TMPDIR', "$ENV{'PWD'}/unixbench/temp"); 23 + 24 + # Directory to put results in. 25 + -my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results"); 26 + +my $RESULTDIR = getDir('UB_RESULTDIR', "$ENV{'PWD'}/unixbench/results"); 27 + 28 + # Directory where the tests are executed. 29 + -my $TESTDIR = getDir('UB_TESTDIR', $FindBin::Bin . "/testdir"); 30 + +my $TESTDIR = getDir('UB_TESTDIR', '@out@/share/testdir'); 31 + 32 + 33 + ############################################################################ 34 + @@ -330,19 +330,19 @@ my $testParams = { 35 + "logmsg" => "Shell Scripts (1 concurrent)", 36 + "cat" => 'system', 37 + "prog" => "${BINDIR}/looper", 38 + - "options" => "60 \"${BINDIR}/multi.sh\" 1", 39 + + "options" => "60 \"${BINDIR}/multi.sh\" 1 ${TMPDIR} ${TESTDIR}", 40 + }, 41 + "shell8" => { 42 + "logmsg" => "Shell Scripts (8 concurrent)", 43 + "cat" => 'system', 44 + "prog" => "${BINDIR}/looper", 45 + - "options" => "60 \"${BINDIR}/multi.sh\" 8", 46 + + "options" => "60 \"${BINDIR}/multi.sh\" 8 ${TMPDIR} ${TESTDIR}", 47 + }, 48 + "shell16" => { 49 + "logmsg" => "Shell Scripts (16 concurrent)", 50 + "cat" => 'system', 51 + "prog" => "${BINDIR}/looper", 52 + - "options" => "60 \"${BINDIR}/multi.sh\" 16", 53 + + "options" => "60 \"${BINDIR}/multi.sh\" 16 ${TMPDIR} ${TESTDIR}", 54 + }, 55 + 56 + ########################## 57 + @@ -434,7 +434,7 @@ my $testParams = { 58 + "logmsg" => "C Compiler Throughput ($cCompiler)", 59 + "cat" => 'misc', 60 + "prog" => "${BINDIR}/looper", 61 + - "options" => "60 $cCompiler cctest.c", 62 + + "options" => "60 $cCompiler $TESTDIR/cctest.c -o $TMPDIR/cctest", 63 + }, 64 + "arithoh" => { 65 + "logmsg" => "Arithoh", 66 + @@ -873,16 +873,6 @@ sub preChecks { 67 + # Set the language. 68 + $ENV{'LANG'} = $language; 69 + 70 + - # Check that the required files are in the proper places. 71 + - my $make = $ENV{MAKE} || "make"; 72 + - system("$make check"); 73 + - if ($? != 0) { 74 + - system("$make all"); 75 + - if ($? != 0) { 76 + - abortRun("\"$make all\" failed"); 77 + - } 78 + - } 79 + - 80 + # Create a script to kill this run. 81 + system("echo \"kill -9 $$\" > \"${TMPDIR}/kill_run\""); 82 + chmod(0755, $TMPDIR . "/kill_run"); 83 + @@ -923,7 +913,10 @@ sub parseArgs { 84 + $params->{'copies'} = [ ]; 85 + } 86 + push(@{$params->{'copies'}}, shift(@words)); 87 + - } else { 88 + + } elsif ($word eq "--help" || $word eq "-h") { 89 + + print "Run: please see ubench(1) for available options\n"; 90 + + exit 0; 91 + + }else { 92 + die("Run: unknown option $word\n"); 93 + } 94 + } 95 + diff --git a/UnixBench/pgms/multi.sh b/UnixBench/pgms/multi.sh 96 + index 72e8716..d2f5f48 100755 97 + --- a/UnixBench/pgms/multi.sh 98 + +++ b/UnixBench/pgms/multi.sh 99 + @@ -15,7 +15,8 @@ 100 + ############################################################################### 101 + ID="@(#)multi.sh:3.4 -- 5/15/91 19:30:24"; 102 + instance=1 103 + -sort_src=sort.src 104 + +sort_src=$3/sort.src 105 + +cd $2 106 + work_factor=${MULTI_SH_WORK_FACTOR:-1} 107 + if [ $work_factor -gt 1 ]; then 108 + inputs=
+109
pkgs/development/tools/misc/unixbench/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , makeWrapper 5 + , pandoc 6 + , installShellFiles 7 + , perl 8 + , xorg 9 + , libGL 10 + , coreutils 11 + , unixtools 12 + , targetPackages 13 + , gnugrep 14 + , gawk 15 + , withGL? true 16 + , withX11perf? true 17 + }: 18 + 19 + stdenv.mkDerivation rec { 20 + pname = "unixbench"; 21 + version = "unstable-2023-02-27"; 22 + 23 + src = fetchFromGitHub { 24 + owner = "kdlucas"; 25 + repo = "byte-unixbench"; 26 + rev = "a07fcc03264915c624f0e4818993c5b4df3fa703"; 27 + hash = "sha256-gmRWAqE9/HBb0S9rK0DXoaCoiGbtat0gmdeozhbv0NI="; 28 + }; 29 + 30 + patches = [ 31 + ./common.patch 32 + ]; 33 + 34 + patchFlags = [ "-p2" ]; 35 + 36 + sourceRoot = "source/UnixBench"; 37 + 38 + postPatch = '' 39 + substituteInPlace Makefile \ 40 + --replace "-Wa,-q" "" 41 + ''; 42 + 43 + nativeBuildInputs = [ 44 + makeWrapper 45 + pandoc 46 + installShellFiles 47 + ]; 48 + 49 + buildInputs = [ perl ] ++ lib.optionals withGL [ 50 + xorg.libX11 51 + xorg.libXext 52 + libGL 53 + ]; 54 + 55 + runtimeDependencies = [ 56 + coreutils 57 + unixtools.nettools 58 + unixtools.locale 59 + targetPackages.stdenv.cc 60 + gnugrep 61 + gawk 62 + ] ++ lib.optionals withX11perf [ 63 + xorg.x11perf 64 + ]; 65 + 66 + makeFlags = [ 67 + "CC=${stdenv.cc.targetPrefix}cc" 68 + ] ++ lib.optionals withGL [ 69 + "GRAPHIC_TESTS=defined" 70 + ]; 71 + 72 + installPhase = '' 73 + runHook preInstall 74 + mkdir -p $out/{bin,libexec,share} 75 + install -D Run $out/bin/ubench 76 + cp -r pgms $out/libexec/ 77 + cp -r testdir $out/share/ 78 + runHook postInstall 79 + ''; 80 + 81 + postInstall = '' 82 + substituteInPlace USAGE \ 83 + --replace 'Run"' 'ubench"' \ 84 + --replace './Run' 'ubench' \ 85 + --replace 'Run ' 'ubench ' 86 + pandoc -f rst -t man USAGE -o ubench.1 87 + installManPage ubench.1 88 + ''; 89 + 90 + preFixup = '' 91 + substituteInPlace $out/libexec/pgms/multi.sh \ 92 + --replace '/bin/sh "$' '${targetPackages.runtimeShell} "$' 93 + 94 + substituteInPlace $out/bin/ubench \ 95 + --subst-var out 96 + 97 + wrapProgram $out/bin/ubench \ 98 + --prefix PATH : ${lib.makeBinPath runtimeDependencies} 99 + ''; 100 + 101 + meta = with lib; { 102 + description = "A basic indicator of the performance of a Unix-like system"; 103 + homepage = "https://github.com/kdlucas/byte-unixbench"; 104 + license = licenses.gpl2Plus; 105 + mainProgram = "ubench"; 106 + maintainers = with maintainers; [ aleksana ]; 107 + platforms = platforms.unix; 108 + }; 109 + }
+2
pkgs/top-level/all-packages.nix
··· 13290 13290 13291 13291 unfs3 = callPackage ../servers/unfs3 { }; 13292 13292 13293 + unixbench = callPackage ../development/tools/misc/unixbench { }; 13294 + 13293 13295 unoconv = callPackage ../tools/text/unoconv { }; 13294 13296 13295 13297 unrtf = callPackage ../tools/text/unrtf { };