forked from M-Labs/artiq
Tolerate assertion failures in tests when looking for diagnostics.
This commit is contained in:
parent
e58b811d6d
commit
64d2604aa8
|
@ -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
|
||||||
|
|
||||||
|
try:
|
||||||
mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine)
|
mod = Module.from_string("".join(fileinput.input()).expandtabs(), engine=engine)
|
||||||
print(repr(mod))
|
print(repr(mod))
|
||||||
|
except:
|
||||||
|
if not diag: raise
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue