about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2018-11-24 22:59:51 +0100
committerTimo Kaufmann <timokau@zoho.com>2018-11-25 19:39:13 +0100
commit883aa992263ffcb99f73e6a36efbd28711d66416 (patch)
treec2f976f11ef8cf3d1734c2932e6feef57db76d3f /pkgs/applications
parent8e7da1b8a44e39f45f46585e9497b1abb7a41fc4 (diff)
downloadnixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar.gz
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar.bz2
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar.lz
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar.xz
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.tar.zst
nixlib-883aa992263ffcb99f73e6a36efbd28711d66416.zip
sage: add short tests
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/science/math/sage/sage-tests.nix12
-rw-r--r--pkgs/applications/science/math/sage/sage.nix1
2 files changed, 10 insertions, 3 deletions
diff --git a/pkgs/applications/science/math/sage/sage-tests.nix b/pkgs/applications/science/math/sage/sage-tests.nix
index feccf75a7acb..12433e12fe90 100644
--- a/pkgs/applications/science/math/sage/sage-tests.nix
+++ b/pkgs/applications/science/math/sage/sage-tests.nix
@@ -3,7 +3,12 @@
 , sage-with-env
 , makeWrapper
 , files ? null # "null" means run all tests
-, longTests ? true # run tests marked as "long time"
+, longTests ? true # run tests marked as "long time" (roughly doubles runtime)
+# Run as many tests as possible in approximately n seconds. This will give each
+# file to test a "time budget" and stop tests if it is exceeded. 300 is the
+# upstream default value.
+# https://trac.sagemath.org/ticket/25270 for details.
+, timeLimit ? null
 }:
 
 # for a quick test of some source files:
@@ -14,6 +19,7 @@ let
   runAllTests = files == null;
   testArgs = if runAllTests then "--all" else testFileList;
   patienceSpecifier = if longTests then "--long" else "";
+  timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}";
   relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
   testFileList = lib.concatStringsSep " " (map relpathToArg files);
 in
@@ -45,7 +51,7 @@ stdenv.mkDerivation rec {
     export HOME="$TMPDIR/sage-home"
     mkdir -p "$HOME"
 
-    # "--long" tests are in the order of 1h, without "--long" its 1/2h
-    "sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${patienceSpecifier} ${testArgs}
+    echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
+    "sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
   '';
 }
diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix
index ac255643a348..541b9cb36dc2 100644
--- a/pkgs/applications/science/math/sage/sage.nix
+++ b/pkgs/applications/science/math/sage/sage.nix
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
 
   passthru = {
     tests = sage-tests;
+    quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
     doc = sagedoc;
     lib = sage-with-env.env.lib;
     kernelspec = jupyter-kernel-definition;