sage: add short tests
This commit is contained in:
parent
8e7da1b8a4
commit
883aa99226
|
@ -3,7 +3,12 @@
|
||||||
, sage-with-env
|
, sage-with-env
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, files ? null # "null" means run all tests
|
, 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:
|
# for a quick test of some source files:
|
||||||
|
@ -14,6 +19,7 @@ let
|
||||||
runAllTests = files == null;
|
runAllTests = files == null;
|
||||||
testArgs = if runAllTests then "--all" else testFileList;
|
testArgs = if runAllTests then "--all" else testFileList;
|
||||||
patienceSpecifier = if longTests then "--long" else "";
|
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
|
relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
|
||||||
testFileList = lib.concatStringsSep " " (map relpathToArg files);
|
testFileList = lib.concatStringsSep " " (map relpathToArg files);
|
||||||
in
|
in
|
||||||
|
@ -45,7 +51,7 @@ stdenv.mkDerivation rec {
|
||||||
export HOME="$TMPDIR/sage-home"
|
export HOME="$TMPDIR/sage-home"
|
||||||
mkdir -p "$HOME"
|
mkdir -p "$HOME"
|
||||||
|
|
||||||
# "--long" tests are in the order of 1h, without "--long" its 1/2h
|
echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
|
||||||
"sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${patienceSpecifier} ${testArgs}
|
"sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests = sage-tests;
|
tests = sage-tests;
|
||||||
|
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
|
||||||
doc = sagedoc;
|
doc = sagedoc;
|
||||||
lib = sage-with-env.env.lib;
|
lib = sage-with-env.env.lib;
|
||||||
kernelspec = jupyter-kernel-definition;
|
kernelspec = jupyter-kernel-definition;
|
||||||
|
|
Loading…
Reference in New Issue