Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 230 forks source link

RunExternalM2 tests failing (sometimes) #1330

Closed d-torrance closed 4 years ago

d-torrance commented 4 years ago

I just got the following while running make check:

--making test results
if ! grep "CacheExampleOutput => true" ./RunExternalM2.m2 >/dev/null ; then /build/macaulay2-1.15.1.0+git575.6c49cc1+ds/M2/usr-dist/x86_64-Linux-Debian-unknown/bin/M2 -q --stop --silent -e "needsPackage(\"RunExternalM2\",LoadDocumentation=>true,DebuggingMode=>true); check(RunExternalM2,UserMode=>false); exit 0" ; fi 
--running test 0 of package RunExternalM2 on line 909 in file ./RunExternalM2.m2
--    rerun with: check_0 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-3914-0/1-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/build/macaulay2-1.15.1.0+git575.6c49cc1+ds/M2/usr-dist/x86_64-Linux-Debian-unknown/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 0 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/build/macaulay2-1.15.1.0+git575.6c49cc1+ds/M2/Macaulay2/packages/RunExternalM2.m2")' <"/tmp/M2-3914-0/0.m2" >>"/tmp/M2-3914-0/0.tmp" 2>&1
/tmp/M2-3914-0/0.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-3914-0/0.m2:0:1: (input file)
M2: *** Error 1

[snip]

../m2/debugging.m2:20:6:(1):[6]: error: 5 error(s) occurred running tests for package RunExternalM2
../m2/installPackage.m2:565:30:(1):[5]: --back trace--
../m2/methods.m2:119:80:(1):[4]: --back trace--
../m2/option.m2:16:8:(1):[3]: --back trace--
currentString:1:76:(3):[2]: --back trace--
../m2/startup.m2.in:557:33:(0):[1]: --back trace--
../m2/startup.m2.in:668:6:(0): --back trace--
make[4]: *** [Makefile:39: check-RunExternalM2] Error 1

All the failed assertions are preceded by a RunExternalM2: expected answer file does not exist warning like this one:

-- -*- M2-comint -*- hash: 854123904

i1 : --/build/macaulay2-1.15.1.0+git575.6c49cc1+ds/M2/Macaulay2/packages/RunExternalM2.m2:909: location of test code

     fn=temporaryFileName()|".m2";

i2 : fn<<flush;

i3 : 
     assert(isExternalM2Child()===false);

i4 : assert(isExternalM2Parent()===true);

i5 : h=runExternalM2(fn,isExternalM2Child,());
Running (true && (/build/macaulay2-1.15.1.0+git575.6c49cc1+ds/M2/usr-dist/x86_64-Linux-Debian-unknown/bin/M2-binary  --stop --no-debug --silent  <"/tmp/M2-3930-0/1.m2" >"/tmp/M2-3930-0/1.out" 2>&1 ))
Finished running.
RunExternalM2: expected answer file does not exist

i6 : assert(h#value===true);
stdio:9:1:(3): error: assertion failed

However, running make check-RunExternalM2 immediately afterward works as expected.

DanGrayson commented 4 years ago

That's strange! It would be good to track that down. If I try it here with M2 1.12 I get something similar. I see code in the package that deletes the output files if the command fails, which I assume means to return with a nonzero exit code.

d-torrance commented 4 years ago

I think I've identified the underlying cause: it seems to be failing when we don't have permission to write to the home directory. For example, if I set HOME to some nonsense directory:

profzoom@orange:~/src/macaulay2/M2$ HOME=/foo M2 --silent --stop -q -E 'check "RunExternalM2"'
-- running test 0 of package RunExternalM2 on line 909 in file /usr/share/Macaulay2/RunExternalM2.m2
--    rerun with: check_0 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1200-0/1-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/usr/share/Macaulay2/RunExternalM2.m2")' <"/tmp/M2-1200-0/0.m2" >>"/tmp/M2-1200-0/0.tmp" 2>&1
/tmp/M2-1200-0/0.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-1200-0/0.m2:0:1: (input file)
M2: *** Error 1
-- running test 1 of package RunExternalM2 on line 931 in file /usr/share/Macaulay2/RunExternalM2.m2
--    rerun with: check_1 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1200-0/3-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/usr/share/Macaulay2/RunExternalM2.m2")' <"/tmp/M2-1200-0/2.m2" >>"/tmp/M2-1200-0/2.tmp" 2>&1
/tmp/M2-1200-0/2.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-1200-0/2.m2:0:1: (input file)
M2: *** Error 1
-- running test 2 of package RunExternalM2 on line 973 in file /usr/share/Macaulay2/RunExternalM2.m2
--    rerun with: check_2 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1200-0/5-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/usr/share/Macaulay2/RunExternalM2.m2")' <"/tmp/M2-1200-0/4.m2" >>"/tmp/M2-1200-0/4.tmp" 2>&1
/tmp/M2-1200-0/4.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
stdio:13:9:(3):[1]: error: assertion failed
/tmp/M2-1200-0/4.m2:0:1: (input file)
M2: *** Error 1
-- running test 3 of package RunExternalM2 on line 1047 in file /usr/share/Macaulay2/RunExternalM2.m2
--    rerun with: check_3 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1200-0/7-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/usr/share/Macaulay2/RunExternalM2.m2")' <"/tmp/M2-1200-0/6.m2" >>"/tmp/M2-1200-0/6.tmp" 2>&1
/tmp/M2-1200-0/6.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
stdio:17:9:(3):[1]: error: assertion failed
/tmp/M2-1200-0/6.m2:0:1: (input file)
M2: *** Error 1
-- running test 4 of package RunExternalM2 on line 1069 in file /usr/share/Macaulay2/RunExternalM2.m2
--    rerun with: check_4 "RunExternalM2"
--making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1200-0/9-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("RunExternalM2", Reload => true, FileName => "/usr/share/Macaulay2/RunExternalM2.m2")' <"/tmp/M2-1200-0/8.m2" >>"/tmp/M2-1200-0/8.tmp" 2>&1
/tmp/M2-1200-0/8.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-1200-0/8.m2:0:1: (input file)
M2: *** Error 1
/usr/share/Macaulay2/Core/debugging.m2:20:6:(1):[9]: error: 5 error(s) occurred running tests for package RunExternalM2
/usr/share/Macaulay2/Core/testing.m2:45:22:(1):[8]: --back trace--
/usr/share/Macaulay2/Core/methods.m2:119:80:(1):[7]: --back trace--
/usr/share/Macaulay2/Core/option.m2:16:8:(1):[6]: --back trace--
/usr/share/Macaulay2/Core/testing.m2:41:33:(1):[5]: --back trace--
/usr/share/Macaulay2/Core/methods.m2:119:80:(1):[4]: --back trace--
currentString:1:1:(3):[2]: --back trace--
/home/dan/src/M2/M2/Macaulay2/m2/startup.m2.in:557:33:(0):[1]: --back trace--
/home/dan/src/M2/M2/Macaulay2/m2/startup.m2.in:658:17:(0): --back trace--