-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun_tests.m
More file actions
44 lines (42 loc) · 1.06 KB
/
run_tests.m
File metadata and controls
44 lines (42 loc) · 1.06 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
// usage: magma exitsignal:=EXITSIGNAL target:=SUBSTRING run_tests.m
if assigned filename then
tests := [filename];
else
tests := Split(Pipe("ls tests", ""), "\n");
end if;
ROOT_DIR := "./";
v1, v2, v3 := GetVersion();
version := Vector([v1, v2, v3]);
if version lt Vector([2,19,6]) then
error Sprintf("This package only supports Magma version >= 2.19-6!
This is version %o.%o-%o!", v1, v2, v3);
end if;
AttachSpec(ROOT_DIR cat "ModFrmAlg.spec");
failed := [];
if not assigned target then
target := "";
end if;
for filename in tests do
if target in filename then
fullPath := "tests/" cat filename;
timestamp := Time();
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 for;
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;
exit;