-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgap-tests.sh
More file actions
executable file
·122 lines (100 loc) · 3.21 KB
/
Copy pathgap-tests.sh
File metadata and controls
executable file
·122 lines (100 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
# Test a GAP test suite
set -ex
TERM=${TERM:-dumb}
# --quitonbreak makes sure any Error() immediately exits GAP with exit code 1.
GAPauto="bin/gap.sh --quitonbreak -q -x 80 -r -m 200m -o 2g -K 4g"
GAP="${GAPauto} -A"
echo TEST_SUITE: $TEST_SUITE
echo GAPPKG : $GAPPKG
cd ${GAP_HOME}
case $TEST_SUITE in
testpackagesload)
cd pkg
# skip PolymakeInterface: no polymake installed (TODO: is there a polymake package we can use)
rm -rf PolymakeInterface*
# skip xgap: no X11 headers, and no means to test it
rm -rf xgap*
# also skip itc because it requires xgap
rm -rf itc*
cd ..
case ${GAPPKG} in
single|singleonlyneeded)
# loading each package in an individual GAP session, with all needed
# and suggested packages, or only with needed packages
if [[ "$GAPPKG" = singleonlyneeded ]]; then
GAPOPTION=":OnlyNeeded"
else
GAPOPTION=""
fi
# Load GAP (without packages) and save workspace to speed up test
# save names of all packages into a file to be able to iterate over them
$GAP -b <<GAPInput
SaveWorkspace("testpackagesload.wsp");
PrintTo("packagenames", JoinStringsWithSeparator( SortedList(RecNames( GAPInfo.PackagesInfo )),"\n") );
QUIT_GAP(0);
GAPInput
for pkg in $(cat packagenames)
do
$GAP -b -L testpackagesload.wsp <<GAPInput
Print("*** Loading $pkg ... \n");
if LoadPackage("$pkg",false $GAPOPTION) = true then
Print("OK\n");
else
Print("failed \n");
AppendTo("fail.log", "Loading failed : ", "$pkg", "\n");
fi;
GAPInput
done
if [[ -f fail.log ]]; then
echo "Some packages failed to load:"
cat fail.log
exit 1
fi
;;
all|allreversed)
# Test of `LoadAllPackages()` and `LoadAllPackages(:reversed)`
if [[ "$GAPPKG" = allreversed ]]; then
GAPOPTION=":reversed"
else
GAPOPTION=""
fi
$GAP <<GAPInput
SetInfoLevel(InfoPackageLoading,4);
LoadAllPackages($GAPOPTION);
SetInfoLevel(InfoPackageLoading,0);
unloads:= Filtered( SortedList(RecNames( GAPInfo.PackagesInfo ) ), s -> LoadPackage(s) = fail );;
if Length(unloads)=0 then
Print("*** Packages loading tests completed!\n");
QUIT_GAP(0);
else
Print("*** Packages loading tests failed because of:\n", unloads, "\n");
QUIT_GAP(1);
fi;
GAPInput
;;
esac
;;
*)
case ${GAPPKG} in
no)
$GAP <<GAPInput
TestDirectory( [ DirectoriesLibrary( "tst/${TEST_SUITE}" ) ], rec(exitGAP := true) );
FORCE_QUIT_GAP(1);
GAPInput
;;
auto)
$GAPauto <<GAPInput
TestDirectory( [ DirectoriesLibrary( "tst/${TEST_SUITE}" ) ], rec(exitGAP := true) );
FORCE_QUIT_GAP(1);
GAPInput
;;
all)
$GAP <<GAPInput
LoadAllPackages();
TestDirectory( [ DirectoriesLibrary( "tst/${TEST_SUITE}" ) ], rec(exitGAP := true) );
FORCE_QUIT_GAP(1);
GAPInput
;;
esac;
esac;