Commit 64dd645a by Enrico Pozzobon

sane build names

parent 519db3c9
...@@ -8,9 +8,8 @@ import random ...@@ -8,9 +8,8 @@ import random
import subprocess import subprocess
def build(algo_dir, template_dir): def build(algo_dir, template_dir, build_dir):
# create a new directory for the build # create a new directory for the build
build_dir = None
while build_dir is None: while build_dir is None:
r = "%09d" % random.randint(0, 999999999) r = "%09d" % random.randint(0, 999999999)
d = os.path.join("build", r) d = os.path.join("build", r)
...@@ -121,12 +120,23 @@ def main(argv): ...@@ -121,12 +120,23 @@ def main(argv):
for file in f: for file in f:
if file == "api.h": if file == "api.h":
f = os.path.join(r, file) f = os.path.join(r, file)
# Source directory d
d = os.path.split(f)[0] d = os.path.split(f)[0]
assert os.path.isdir(d) assert os.path.isdir(d)
print(d) print(d)
# Test vectors file t
t = find_test_vectors(d) t = find_test_vectors(d)
print(t) print(t)
files.append((t, d))
# base name n
pieces = r.split(os.sep)
n = submission + "." + ".".join(pieces[4:])
print(n)
# Put all in a tuple and count
files.append((t, d, n))
c += 1 c += 1
if c == 0: if c == 0:
...@@ -150,12 +160,13 @@ def main(argv): ...@@ -150,12 +160,13 @@ def main(argv):
test_script.write("#!/bin/sh\n") test_script.write("#!/bin/sh\n")
test_script.write("mkdir -p logs\n") test_script.write("mkdir -p logs\n")
test_script.write("mkdir -p measurements\n") test_script.write("mkdir -p measurements\n")
for t, d in files: for i, (t, d, name) in enumerate(files):
print() print()
print(d) print(d)
try: try:
b = build(d, template_dir) build_dir = os.path.join("build", name)
test_script.write("echo \"TESTING %s\"\n" % d) 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" % ( test_script.write("python3 -u ./test.py %s %s 2> %s | tee %s\n" % (
t, t,
os.path.join(b, 'test'), os.path.join(b, 'test'),
...@@ -164,8 +175,9 @@ def main(argv): ...@@ -164,8 +175,9 @@ def main(argv):
) )
print("COMPILATION SUCCESS FOR %s" % d) print("COMPILATION SUCCESS FOR %s" % d)
except Exception: except Exception as ex:
print("COMPILATION FAILED FOR %s" % d) print("COMPILATION FAILED FOR %s" % d)
print(ex)
st = os.stat(test_script_path) st = os.stat(test_script_path)
os.chmod(test_script_path, st.st_mode | stat.S_IEXEC) os.chmod(test_script_path, st.st_mode | stat.S_IEXEC)
......
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