2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-19 08:26:30 +08:00

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

View File

@ -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()