summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2019-08-17 00:33:05 +0200
committerGitHub <noreply@github.com>2019-08-17 00:33:05 +0200
commit192197dc6cd7b04984c07a4d99ed84b161776e39 (patch)
tree17accb9e91d352e04a1bf0d4b080f0ddb4aff0d6 /pkgs/applications/science/math/sage
parent63ce6bf9f380377bd41ccc897ab9889923c9f8e8 (diff)
parent41bb3194622637aa26fe5a28880165d9ecb2f2df (diff)
downloadnixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar.gz
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar.bz2
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar.lz
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar.xz
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.tar.zst
nixpkgs-192197dc6cd7b04984c07a4d99ed84b161776e39.zip
Merge pull request #65802 from timokau/sage-transient-debug
sage: add patch to debug transient issue
Diffstat (limited to 'pkgs/applications/science/math/sage')
-rw-r--r--pkgs/applications/science/math/sage/dist-tests.nix17
-rw-r--r--pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch19
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix6
-rw-r--r--pkgs/applications/science/math/sage/sage-tests.nix4
4 files changed, 45 insertions, 1 deletions
diff --git a/pkgs/applications/science/math/sage/dist-tests.nix b/pkgs/applications/science/math/sage/dist-tests.nix
new file mode 100644
index 00000000000..24a86a8f37a
--- /dev/null
+++ b/pkgs/applications/science/math/sage/dist-tests.nix
@@ -0,0 +1,17 @@
+# Lists past failures and files associated with it. The intention is to build
+# up a subset of a testsuite that catches 95% of failures that are relevant for
+# distributions while only taking ~5m to run. This in turn makes it more
+# reasonable to re-test sage on dependency changes and makes it easier for
+# users to override the sage derivation.
+# This is an experiment for now. If it turns out that there really is a small
+# subset of files responsible for the vast majority of packaging tests, we can
+# think about moving this upstream.
+[
+	"src/sage/env.py" # [1]
+	"src/sage/misc/persist.pyx" # [1]
+	"src/sage/misc/inline_fortran.py" # [1]
+	"src/sage/repl/ipython_extension.py" # [1]
+]
+
+# Numbered list of past failures to annotate files with
+# [1] PYTHONPATH related issue https://github.com/NixOS/nixpkgs/commit/ec7f569211091282410050e89e68832d4fe60528
diff --git a/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch
new file mode 100644
index 00000000000..e687281ad1a
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch
@@ -0,0 +1,19 @@
+diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
+index 67d7d2accf..18279581e2 100644
+--- a/src/sage/repl/configuration.py
++++ b/src/sage/repl/configuration.py
+@@ -9,10 +9,11 @@ the IPython simple prompt is being used::
+     sage: cmd = 'print([sys.stdin.isatty(), sys.stdout.isatty()])'
+     sage: import pexpect
+     sage: output = pexpect.run(
+-    ....:     'bash -c \'echo "{0}" | sage\''.format(cmd),
++    ....:     'bash -c \'export SAGE_BANNER=no; echo "{0}" | sage\''.format(cmd),
+     ....: ).decode('utf-8', 'surrogateescape')
+-    sage: 'sage: [False, True]' in output
+-    True
++    sage: print(output)
++    sage...[False, True]
++    sage...Exiting Sage ...
+ """
+ 
+ #*****************************************************************************
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 04a2cde9ba9..57d6c852be8 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -61,7 +61,11 @@ stdenv.mkDerivation rec {
   # Since sage unfortunately does not release bugfix releases, packagers must
   # fix those bugs themselves. This is for critical bugfixes, where "critical"
   # == "causes (transient) doctest failures / somebody complained".
-  bugfixPatches = [ ];
+  bugfixPatches = [
+    # To help debug the transient error in
+    # https://trac.sagemath.org/ticket/23087 when it next occurs.
+    ./patches/configurationpy-error-verbose.patch
+  ];
 
   # Patches needed because of package updates. We could just pin the versions of
   # dependencies, but that would lead to rebuilds, confusion and the burdons of
diff --git a/pkgs/applications/science/math/sage/sage-tests.nix b/pkgs/applications/science/math/sage/sage-tests.nix
index 591fa192d56..0cd5b5d976a 100644
--- a/pkgs/applications/science/math/sage/sage-tests.nix
+++ b/pkgs/applications/science/math/sage/sage-tests.nix
@@ -51,6 +51,10 @@ stdenv.mkDerivation rec {
     export HOME="$TMPDIR/sage-home"
     mkdir -p "$HOME"
 
+    # avoid running out of memory with many threads in subprocesses, see
+    # https://github.com/NixOS/nixpkgs/pull/65802
+    export GLIBC_TUNABLES=glibc.malloc.arena_max=4
+
     echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
     "sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
   '';