forked from mupq/pqm4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·40 lines (31 loc) · 958 Bytes
/
test.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
#!/usr/bin/env python3
import serial
import sys
import os
import subprocess
import utils
try:
binaries = [x for x in os.listdir('bin') if 'test.bin' in x]
except FileNotFoundError:
print("There is no bin/ folder. Please first make binaries.")
sys.exit(1)
def doTest(binary):
binpath = os.path.join("bin", binary)
info = binary.split('_')
primitive = '_'.join(info[:2])
scheme = '_'.join(info[2:-2])
implementation = info[-2]
if utils.m4ignore(primitive, scheme, implementation):
return
if len(sys.argv) > 1 and scheme not in sys.argv[1:]:
return
result = utils.m4run(binpath)
print("Testing if tests were successful..")
contents = result.strip()
# can we find a nicer way of checking if tests ran correctly?
if contents.count("ERROR") != 0 or contents.count("OK") != 30:
print("FAILED!")
else:
print("passed.")
for binary in binaries:
doTest(binary)