From c3ec46daa21d9fb6a441e65a265637d151247485 Mon Sep 17 00:00:00 2001 From: Enrico Pozzobon Date: Tue, 23 Jul 2019 19:07:59 +0200 Subject: [PATCH] compile all has now an argument for choosing which tests to perform --- compile_all.py | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/compile_all.py b/compile_all.py index b3fc3c9..a840701 100755 --- a/compile_all.py +++ b/compile_all.py @@ -95,13 +95,19 @@ def find_test_vectors(d): def main(argv): submissions_dir = "all-lwc-submission-files" template_dir = "templates/linux" + include_list = None if len(argv) > 1: template_dir = argv[1] + if len(argv) > 2: + with open(argv[2], 'r') as includes: + include_list = [] + for line in includes.readlines(): + include_list.append(line.strip()) print("Using template %s" % template_dir) subs = os.listdir(submissions_dir) # get all the submissions by looking for files named "api.h" - files = [] + subfiles = [] for submission in subs: implementations_dir = os.path.join(submissions_dir, submission, "Implementations", "crypto_aead") @@ -120,32 +126,45 @@ def main(argv): for file in f: if file == "api.h": f = os.path.join(r, file) + subfiles.append(f) + c += 1 + + if c == 0: + raise Exception("No implementations found") - # Source directory d - d = os.path.split(f)[0] - assert os.path.isdir(d) - print(d) + if include_list is not None: + print("Include list has %d entries" % len(include_list)) - # Test vectors file t - t = find_test_vectors(d) - print(t) + files = [] + for f in subfiles: - # base name n - pieces = r.split(os.sep) - n = submission + "." + ".".join(pieces[4:]) - print(n) + # Source directory d + d = os.path.split(f)[0] + assert os.path.isdir(d) + print(d) - # Put all in a tuple and count - files.append((t, d, n)) - c += 1 + # Test vectors file t + t = find_test_vectors(d) + print(t) - if c == 0: - raise Exception("No implementations found") + # base name n + 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: + continue + + # Put all in a tuple and count + files.append((t, d, n)) # For testing, we only do the first 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'): -- libgit2 0.26.0