From 64d2604aa8416fea585a525400177a82b07b4bd6 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 21 Jul 2015 14:12:27 +0300 Subject: [PATCH] Tolerate assertion failures in tests when looking for diagnostics. --- artiq/compiler/testbench/module.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/testbench/module.py b/artiq/compiler/testbench/module.py index b5eab3861..1882260bf 100644 --- a/artiq/compiler/testbench/module.py +++ b/artiq/compiler/testbench/module.py @@ -5,11 +5,13 @@ from .. import Module def main(): if len(sys.argv) > 1 and sys.argv[1] == "+diag": del sys.argv[1] + diag = True def process_diagnostic(diag): print("\n".join(diag.render(only_line=True))) if diag.level == "fatal": exit() else: + diag = False def process_diagnostic(diag): print("\n".join(diag.render())) if diag.level in ("fatal", "error"): @@ -18,8 +20,11 @@ def main(): engine = diagnostic.Engine() engine.process = process_diagnostic - mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine) - print(repr(mod)) + try: + mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine) + print(repr(mod)) + except: + if not diag: raise if __name__ == "__main__": main()