From f68f7f7e88b76eff9310dab57a6b0380bac575c4 Mon Sep 17 00:00:00 2001 From: Enrico Pozzobon Date: Tue, 16 Jul 2019 13:26:44 +0200 Subject: [PATCH] fixes for xoody --- .gitignore | 2 ++ compile_all.py | 12 +++++++++++- logs/.mkdir | 0 templates/uno/configure | 2 +- test.py | 10 ++++------ 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 logs/.mkdir diff --git a/.gitignore b/.gitignore index 65eb05b..50b16ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ build/ +measurements/ +logs/ all-lwc-submission-files/ *.log diff --git a/compile_all.py b/compile_all.py index 98360a2..1dbbbcc 100755 --- a/compile_all.py +++ b/compile_all.py @@ -148,12 +148,22 @@ def main(argv): test_script_path = os.path.join("build", "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") + test_script.write("mkdir -p measurements\n") for t, d in files: print() print(d) try: b = build(d, template_dir) - test_script.write("echo \"TESTING %s\"\n./test.py %s %s\n" % (d, t, os.path.join(b, 'test'))) + test_script.write("echo \"TESTING %s\"\n" % d) + test_script.write("./test.py %s %s 2> %s | tee %s\n" % ( + t, + os.path.join(b, 'test'), + os.path.join(b, 'test_stderr.log'), + os.path.join(b, 'test_stdout.log')) + + #./test.py all-lwc-submission-files/tinyjambu/Implementations/crypto_aead/tinyjambu192/LWC_AEAD_KAT_192_96.txt build/731759111/test 2> build/731759111/test_stderr.log | tee build/731759111/test_stdout.log + print("COMPILATION SUCCESS FOR %s" % d) except Exception: print("COMPILATION FAILED FOR %s" % d) diff --git a/logs/.mkdir b/logs/.mkdir new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/logs/.mkdir diff --git a/templates/uno/configure b/templates/uno/configure index a02d3c1..2b8a084 100755 --- a/templates/uno/configure +++ b/templates/uno/configure @@ -1,5 +1,5 @@ #!/bin/bash mv -n *.c *.C *.s *.S src/ -mv -n *.h *.H include/ +mv -n *.inc *.h *.H include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" exit 0 diff --git a/test.py b/test.py index c6dd13a..8d1f3cd 100755 --- a/test.py +++ b/test.py @@ -11,14 +11,13 @@ def main(argv): if len(argv) < 3: print("Usage: test.py LWC_AEAD_KAT.txt program [arguments]") - test_file = open(argv[1], 'r') cmd = argv[2:] for attempt in range(3): print("beginning test %d of '%s' using test vectors '%s'" % (attempt, ' '.join(cmd), argv[1])) measurements = begin_measurement() try: - test(test_file, cmd) + test(argv[1], cmd) print("TEST SUCCESSFUL") return 0 except Exception as ex: @@ -34,6 +33,7 @@ def main(argv): def test(test_file, cmd): + test_file = open(test_file, 'r') p = Popen(cmd, bufsize=0, stdin=PIPE, stdout=PIPE) def write(data): @@ -113,8 +113,6 @@ def test(test_file, cmd): if m != output: raise Exception("output of encryption is different from expected ciphertext") - - elif res is not None: if res[1].lower() == 'count': i = int(res[2], 10) @@ -129,9 +127,9 @@ def test(test_file, cmd): elif res[1].lower() == 'ct': c = bytes.fromhex(res[2]) else: - print("ERROR: unparsed line in test vectors file: '%s'" % res) + raise Exception("ERROR: unparsed line in test vectors file: '%s'" % res) else: - print("ERROR: unparsed line in test vectors file: '%s'" % line) + raise Exception("ERROR: unparsed line in test vectors file: '%s'" % line) def begin_measurement(): import saleae -- libgit2 0.26.0