-
Notifications
You must be signed in to change notification settings - Fork 15
/
run_tests.m
63 lines (61 loc) · 1.43 KB
/
run_tests.m
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
// usage: magma target:=SUBSTRING exitsignal:=BOOL run_tests.m
if assigned filename then
if "Tests/" eq filename[1..6] then
filename := filename[7..#filename];
end if;
tests := [filename];
else
tests := Split(Pipe("ls Tests", ""), "\n");
end if;
if assigned debug then
SetDebugOnError(true);
end if;
_ := eval (Read("config.m") cat "return true;");
//load "config.m";
if assigned verbose then
try
verbose := StringToInteger(verbose);
catch e
verbose := 1;
end try;
SetVerbose("HilbertModularForms", verbose);
end if;
failed := [];
if not assigned target then
target := "";
end if;
counter := 0;
for filename in tests do
if target in filename then
counter +:=1;
fullPath := "Tests/" cat filename;
timestamp := Time();
if assigned debug then
printf "%o: ", filename;
assert eval (Read(fullPath) cat "return true;");
printf "Success! %o s\n", Time(timestamp);
else
try
printf "%o: ", filename;
assert eval (Read(fullPath) cat "return true;");
printf "Success! %o s\n", Time(timestamp);
catch e
Append(~failed, filename);
printf "Fail! %o s\n %o\n", e, Time(timestamp);;
end try;
end if;
end if;
end for;
if counter eq 0 then
print "No matching target";
exit 1;
end if;
if #failed gt 0 then
print "Tests failed:";
for f in failed do
print f;
end for;
end if;
if assigned exitsignal then
exit #failed;
end if;