Skip to content

Commit

Permalink
Add tests for GAP running out of memory
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson authored and fingolfin committed Jan 7, 2020
1 parent cf99d6c commit eef306a
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tst/testspecial/64bit/low-mem-list-types.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ListWithIdenticalEntries(2^50, 'a');
quit;
ListWithIdenticalEntries(2^50, true);
quit;
ListWithIdenticalEntries(2^50, 2);
quit;
quit;

16 changes: 16 additions & 0 deletions tst/testspecial/64bit/low-mem-list-types.g.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
gap> ListWithIdenticalEntries(2^50, 'a');
Error, Cannot allocate 1125899906842633 bytes: cannot extend the workspace any more!!
not in any function at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
gap> ListWithIdenticalEntries(2^50, true);
Error, Cannot allocate 140737488355336 bytes: cannot extend the workspace any more!!
not in any function at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
gap> ListWithIdenticalEntries(2^50, 2);
Error, Cannot allocate 9007199254741000 bytes: cannot extend the workspace any more!!
not in any function at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
gap> quit;
9 changes: 9 additions & 0 deletions tst/testspecial/64bit/low-mem-plist-1.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
l := [];
l[2^50] := 1;
quit;
l[2^50] := 2;
quit;
l[3] := 3;
l;
quit;

17 changes: 17 additions & 0 deletions tst/testspecial/64bit/low-mem-plist-1.g.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
gap> l := [];
[ ]
gap> l[2^50] := 1;
Error, Cannot allocate 9007199254741000 bytes: cannot extend the workspace any more!!!!
not in any function at *stdin*:3
type 'quit;' to quit to outer loop
brk> quit;
gap> l[2^50] := 2;
Error, Cannot allocate 9007199254741000 bytes: cannot extend the workspace any more!!!!
not in any function at *stdin*:3
type 'quit;' to quit to outer loop
brk> quit;
gap> l[3] := 3;
3
gap> l;
[ ,, 3 ]
gap> quit;
6 changes: 6 additions & 0 deletions tst/testspecial/64bit/low-mem-plist-2.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EmptyPlist(2^50);
quit;
EmptyPlist(2^50);
quit;
quit;

11 changes: 11 additions & 0 deletions tst/testspecial/64bit/low-mem-plist-2.g.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gap> EmptyPlist(2^50);
Error, Cannot allocate 9007199254741000 bytes: cannot extend the workspace any more!!
not in any function at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
gap> EmptyPlist(2^50);
Error, Cannot allocate 9007199254741000 bytes: cannot extend the workspace any more!!
not in any function at *stdin*:2
type 'quit;' to quit to outer loop
brk> quit;
gap> quit;
4 changes: 3 additions & 1 deletion tst/testspecial/regenerate_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -ex
GAPDIR=${GAPDIR:-../..}

gap="$GAPDIR/bin/gap.sh"
for gfile in *.g; do

echo This script should only be run with a 64-bit GAP
for gfile in *.g 64bit/*.g; do
./run_gap.sh "${gap}" "${gfile}" > "${gfile}.out"
done
9 changes: 8 additions & 1 deletion tst/testspecial/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ GAPDIR=${GAPDIR:-../..}

retvalue=0
gap="$GAPDIR/bin/gap.sh"
for gfile in *.g; do
if "${gap}" -A -b -c 'QUIT_GAP(GAPInfo.BytesPerVariable - 8);'; then
echo "Running 64-bit special tests"
tocheck="*.g 64bit/*.g"
else
echo "Running 32-bit special tests"
tocheck="*.g"
fi;
for gfile in $tocheck; do
./run_gap.sh "${gap}" "${gfile}" > "${gfile}.bad"
if ! diff -b "${gfile}.out" "${gfile}.bad"; then
echo "${gfile}" failed
Expand Down

0 comments on commit eef306a

Please sign in to comment.