summary refs log tree commit diff
path: root/pkgs/tools/misc/phoronix-test-suite
diff options
context:
space:
mode:
authordavidak <git@davidak.de>2019-12-06 21:04:09 +0100
committerdavidak <git@davidak.de>2019-12-10 10:02:12 +0100
commite9007b3e3ebc31db7ae893f325e3824e91fe85dd (patch)
treee33276a302eaa076e9200f8c9f458cc029c6fc9b /pkgs/tools/misc/phoronix-test-suite
parent963e635dc9381d63fef1ffed36a60d6683534bb8 (diff)
downloadnixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar.gz
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar.bz2
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar.lz
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar.xz
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.tar.zst
nixpkgs-e9007b3e3ebc31db7ae893f325e3824e91fe85dd.zip
phoronix-test-suite: add tests
Diffstat (limited to 'pkgs/tools/misc/phoronix-test-suite')
-rw-r--r--pkgs/tools/misc/phoronix-test-suite/default.nix6
-rw-r--r--pkgs/tools/misc/phoronix-test-suite/tests.nix20
2 files changed, 25 insertions, 1 deletions
diff --git a/pkgs/tools/misc/phoronix-test-suite/default.nix b/pkgs/tools/misc/phoronix-test-suite/default.nix
index 2436bbe4381..ebd317724f6 100644
--- a/pkgs/tools/misc/phoronix-test-suite/default.nix
+++ b/pkgs/tools/misc/phoronix-test-suite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, php, which, gnused, makeWrapper, gnumake, gcc }:
+{ stdenv, fetchurl, php, which, gnused, makeWrapper, gnumake, gcc, callPackage }:
 
 stdenv.mkDerivation rec {
   pname = "phoronix-test-suite";
@@ -19,6 +19,10 @@ stdenv.mkDerivation rec {
     --prefix PATH : ${stdenv.lib.makeBinPath [ gnumake gcc ]}
   '';
 
+  passthru.tests = {
+    simple-execution = callPackage ./tests.nix { };
+  };
+
   meta = with stdenv.lib; {
     description = "Open-Source, Automated Benchmarking";
     homepage = https://www.phoronix-test-suite.com/;
diff --git a/pkgs/tools/misc/phoronix-test-suite/tests.nix b/pkgs/tools/misc/phoronix-test-suite/tests.nix
new file mode 100644
index 00000000000..06bd9def9aa
--- /dev/null
+++ b/pkgs/tools/misc/phoronix-test-suite/tests.nix
@@ -0,0 +1,20 @@
+{ runCommand, phoronix-test-suite }:
+
+let
+  inherit (phoronix-test-suite) pname version;
+in
+
+runCommand "${pname}-tests" { meta.timeout = 3; }
+  ''
+    # automatic initial setup to prevent interactive questions
+    ${phoronix-test-suite}/bin/phoronix-test-suite enterprise-setup >/dev/null
+    # get version of installed program and compare with package version
+    if [[ `${phoronix-test-suite}/bin/phoronix-test-suite version` != *"${version}"*  ]]; then
+      echo "Error: program version does not match package version"
+      exit 1
+    fi
+    # run dummy command
+    ${phoronix-test-suite}/bin/phoronix-test-suite dummy_module.dummy-command >/dev/null
+    # needed for Nix to register the command as successful
+    touch $out
+  ''