forked from M-Labs/artiq
1
0
Fork 0

Tolerate assertion failures in tests when looking for diagnostics.

This commit is contained in:
whitequark 2015-07-21 14:12:27 +03:00
parent e58b811d6d
commit 64d2604aa8
1 changed files with 7 additions and 2 deletions

View File

@ -5,11 +5,13 @@ from .. import Module
def main(): def main():
if len(sys.argv) > 1 and sys.argv[1] == "+diag": if len(sys.argv) > 1 and sys.argv[1] == "+diag":
del sys.argv[1] del sys.argv[1]
diag = True
def process_diagnostic(diag): def process_diagnostic(diag):
print("\n".join(diag.render(only_line=True))) print("\n".join(diag.render(only_line=True)))
if diag.level == "fatal": if diag.level == "fatal":
exit() exit()
else: else:
diag = False
def process_diagnostic(diag): def process_diagnostic(diag):
print("\n".join(diag.render())) print("\n".join(diag.render()))
if diag.level in ("fatal", "error"): if diag.level in ("fatal", "error"):
@ -18,8 +20,11 @@ def main():
engine = diagnostic.Engine() engine = diagnostic.Engine()
engine.process = process_diagnostic engine.process = process_diagnostic
mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine) try:
print(repr(mod)) mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine)
print(repr(mod))
except:
if not diag: raise
if __name__ == "__main__": if __name__ == "__main__":
main() main()