Commit 69d96640 by Enrico Pozzobon

less complicated test.py and less aggressive compile_all.py

parent b5fadc28
......@@ -9,6 +9,9 @@ import subprocess
def build(algo_dir, template_dir, build_dir):
if os.path.isdir(build_dir):
return None
# create a new directory for the build
while build_dir is None:
r = "%09d" % random.randint(0, 999999999)
......@@ -172,10 +175,8 @@ def main(argv):
#files = files[:1]
print("%d algorithms will be compiled" % len(files))
# Clear the build directory as it is a leftover from the previous execution
if os.path.isdir('build'):
shutil.rmtree('build')
os.mkdir('build')
if not os.path.isdir('build'):
os.mkdir('build')
print()
......@@ -191,6 +192,8 @@ def main(argv):
try:
build_dir = os.path.join("build", name)
b = build(d, template_dir, build_dir)
if b is None:
continue
test_script.write("\n\necho \"TEST NUMBER %03d: TESTING %s\"\n" % (i, d))
test_script.write("python3 -u ./test.py %s %s 2> %s | tee %s\n" % (
t,
......
......@@ -6,8 +6,6 @@ import sys
import struct
from subprocess import Popen, PIPE
MEASURE_TIME = True
MEASURE_RAM = False
def main(argv):
if len(argv) < 3:
......@@ -18,13 +16,11 @@ def main(argv):
for attempt in range(3):
print("beginning test %d of '%s' using test vectors '%s'" % (attempt, ' '.join(cmd), argv[1]))
try:
if MEASURE_TIME:
measurements = begin_measurement()
measurements = begin_measurement()
try:
test(argv[1], cmd)
finally:
if MEASURE_TIME:
end_measurement(measurements)
end_measurement(measurements)
print("TEST SUCCESSFUL")
return 0
......@@ -118,12 +114,6 @@ def test(test_file, cmd):
print(" m = %s" % output.hex())
if m != output:
raise Exception("output of encryption is different from expected ciphertext")
if MEASURE_RAM:
write(b'u')
output = obtain()
print(" untouched memory = %d" % struct.unpack("<I", output))
break
elif res is not None:
if res[1].lower() == 'count':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment