https://github.com/mupq/pqm4
Revision 9ba479311c021e7702566e0cfd131d0debcfad50 authored by Matthias J. Kannwischer on 11 December 2018, 11:01:10 UTC, committed by Ko- on 11 December 2018, 11:01:10 UTC
1 parent 402048b
Tip revision: 9ba479311c021e7702566e0cfd131d0debcfad50 authored by Matthias J. Kannwischer on 11 December 2018, 11:01:10 UTC
add some canaries in tests to detect implementations reading/writing out of bounds (#32)
add some canaries in tests to detect implementations reading/writing out of bounds (#32)
Tip revision: 9ba4793
test.py
#!/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)
Computing file changes ...