Commit f5de4e09 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Improve test script

Results are now displyed immediately, and build log is created on the fly
in case of error.
parent 98b9ad44
...@@ -23,11 +23,36 @@ def main(): ...@@ -23,11 +23,36 @@ def main():
paths = sys.argv[2:] paths = sys.argv[2:]
with futures.ProcessPoolExecutor(max_workers=cpu_count()) as executor: with futures.ProcessPoolExecutor(max_workers=cpu_count()) as executor:
for result in, rule), paths): fs = [executor.submit(partial(make, rule), path) for path in paths]
print("%40s: %s" % (result[3].replace("/", ""), colorMe(result[0], for each in futures.as_completed(fs):
'[OK]' if result[0]==0 else '[FAILED]'))) result = each.result()
errcode, stdout, stderr, path, rule = result
name = path.replace("/", "")
print("%40s: %s" % (name,
colorMe (errcode, '[OK]' if errcode==0
else '[FAILED] ... build log in /tmp/{}.err'.format(name))))
sys.stdout.flush() sys.stdout.flush()
if errcode != 0:
# Failure: save the log immediately
with open("/tmp/{}.err".format(name), 'w') as f:
f.write("=" * 80)
f.write("ERROR: %s %s" % (name, rule))
if stdout:
f.write("-- stdout " + "-" * 70)
if stderr:
f.write("-- stderr " + "-" * 70)
f.write("-" * 80)
results.append(result) results.append(result)
# don't use the map function, because it keeps the order of
# submission, meaning that even if a job finishes before the
# previous one started, the log output will be delayed
# for result in, rule), paths):
# print("%40s: %s" % (result[3].replace("/", ""), colorMe(result[0],
# '[OK]' if result[0]==0 else '[FAILED]')))
# sys.stdout.flush()
# results.append(result), 'clean'), paths), 'clean'), paths)
sys.stdout.write('\n') sys.stdout.write('\n')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment