-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aunif-tests.py
56 lines (51 loc) · 1.99 KB
/
.aunif-tests.py
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
import shlex
from subprocess import Popen, PIPE
import time
import os
from src import utils as u
# setup
MAUDE = 'maude' # modify this with the full path of the maude executable
TESTS = 'tests' # tests folder
DIR = 'antiunification' # unification tests
EXPECTED_OUT = 'out' # the outputs are saved in the out folder under DIR
def run_tests():
dir = os.path.dirname(os.path.realpath(__file__))
tests = os.path.join(dir, TESTS, DIR)
log_dir = os.path.join(tests, EXPECTED_OUT)
passed = 0
failed = 0
failed_list = []
for test in os.listdir(tests):
if (test == 'tests-setup.maude' or test == "out"):
continue
file = os.path.join(tests, test)
file_log_out = os.path.join(tests, log_dir,
test.replace('.maude', ".out"))
print(u.BOLD + "[TESTING]" + u.ENDC, file)
(out, err, ex, tm) = u.system_call(MAUDE + " -no-banner " + file)
if (ex == 0):
out_decoded = out.decode('utf-8')
n = open(file_log_out, 'wb')
n.write(out)
if ('step-marker' in out_decoded):
print(u.FAIL + '[FAILURE]' + u.ENDC, 'proof failed, output saved in ',
file_log_out)
failed = failed + 1
failed_list.append(test)
else:
print(u.OKGREEN + '[OK]' + u.ENDC, 'check output saved in ',
file_log_out)
passed = passed + 1
else:
print(u.WARNING + '[MAUDE FAILURE]' + u.ENDC, err.decode('uft-8'))
failed = failed + 1
failed_list.append(test)
print(u.BOLD + u.HEADER + "[TOTAL TESTS]:", passed + failed, u.ENDC)
print(u.OKGREEN + "[PASSED]:", passed, u.ENDC)
print(u.FAIL + "[FAILED]:", failed, u.ENDC)
if (failed > 0):
print(u.BOLD + u.FAIL + "[FAILED TESTS]:", failed_list, u.ENDC)
def main():
u.check_maude_installation(MAUDE);
run_tests();
main()