Commit f06d7886 by Enrico Pozzobon

work in progress in new test setup

parent 30d6aa6a
......@@ -4,19 +4,13 @@ import os
import sys
import stat
import shutil
import random
import subprocess
def build(algo_dir, template_dir, build_dir):
# create a new directory for the build
while build_dir is None:
r = "%09d" % random.randint(0, 999999999)
d = os.path.join("build", r)
if not os.path.isdir(d):
build_dir = d
print("Building in %s" % build_dir)
# copy all the files from the submitted algorithm into the build directory
shutil.copytree(algo_dir, build_dir)
......@@ -69,7 +63,6 @@ def build(algo_dir, template_dir, build_dir):
p.wait()
assert p.returncode == 0
finally:
sys.stdout.flush()
sys.stderr.flush()
......@@ -101,6 +94,7 @@ def find_test_vectors(d):
def main(argv):
submissions_dir = "all-lwc-submission-files"
template_dir = "templates/linux"
build_dir = 'build'
include_list = None
if len(argv) > 1:
template_dir = argv[1]
......@@ -115,7 +109,8 @@ def main(argv):
# get all the submissions by looking for files named "api.h"
subfiles = []
for submission in subs:
implementations_dir = os.path.join(submissions_dir, submission, "Implementations", "crypto_aead")
implementations_dir = os.path.join(
submissions_dir, submission, "Implementations", "crypto_aead")
if not os.path.isdir(implementations_dir):
continue
......@@ -157,30 +152,28 @@ def main(argv):
pieces = f.split(os.sep)
n = pieces[1] + "." + ".".join(pieces[4:-1])
print(n)
# if include_list was provided, skip elements not in the list
if include_list is not None:
if not n in include_list:
if n not in include_list:
continue
# Put all in a tuple and count
files.append((t, d, n))
# For testing, we only do the first 1
#files = files[:1]
# 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 os.path.isdir(build_dir):
shutil.rmtree(build_dir)
os.mkdir(build_dir)
print()
# Write a script that executes all the tests one after the other
test_script_path = os.path.join("build", "test_all.sh")
test_script_path = os.path.join(build_dir, "test_all.sh")
with open(test_script_path, 'w') as test_script:
test_script.write("#!/bin/sh\n")
test_script.write("mkdir -p logs\n")
......@@ -189,10 +182,13 @@ def main(argv):
print()
print(d)
try:
build_dir = os.path.join("build", name)
b = build(d, template_dir, build_dir)
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" % (
b = build(d, template_dir, os.path.join(build_dir, name))
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,
os.path.join(b, 'test'),
os.path.join(b, 'test_stderr.log'),
......
......@@ -112,7 +112,7 @@ class UARTP:
tag_old = tag
tag = self.uart_read()
tag_old = tag
l = self.uart_read()
if l & 0x80:
l &= 0x7f
......@@ -137,6 +137,7 @@ class UARTP:
else:
return buf
def main(argv):
eprint(argv[0])
script_dir = os.path.split(argv[0])[0]
......@@ -238,8 +239,7 @@ def main(argv):
else:
raise Exception("Unknown action %c" % action)
return 0
......
This diff is collapsed. Click to expand it.
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