Skip to content

Commit 98fe152

Browse files
author
whitequark
committedJun 6, 2015
Add lit-based tests for diagnostics.
1 parent 7f77632 commit 98fe152

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed
 

Diff for: ‎artiq/py2llvm/typing.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,11 @@ def generic_visit(self, node):
358358
def main():
359359
import sys, fileinput, os
360360

361-
inference_mode = True
361+
if sys.argv[1] == '+diag':
362+
del sys.argv[1]
363+
inference_mode = False
364+
else:
365+
inference_mode = True
362366

363367
engine = diagnostic.Engine(all_errors_are_fatal=True)
364368
try:
@@ -375,6 +379,8 @@ def main():
375379
if inference_mode:
376380
print("\n".join(e.diagnostic.render()), file=sys.stderr)
377381
exit(1)
382+
else:
383+
print("\n".join(e.diagnostic.render(only_line=True)))
378384

379385
if __name__ == "__main__":
380386
main()

Diff for: ‎lit-test/harness.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
import sys, os, argparse, importlib
1313

1414
parser = argparse.ArgumentParser(description=__doc__)
15-
parser.add_argument('-m', metavar='mod', type=str, help='run library module as a script')
16-
parser.add_argument('args', type=str, nargs='+', help='arguments passed to program in sys.argv[1:]')
15+
parser.add_argument('-m', metavar='mod', type=str, required=True,
16+
help='run library module as a script')
17+
parser.add_argument('args', type=str, nargs='+',
18+
help='arguments passed to program in sys.argv[1:]')
1719
args = parser.parse_args(sys.argv[1:])
1820

1921
artiq_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

Diff for: ‎lit-test/py2llvm/typing/error_unify.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# RUN: %python -m artiq.py2llvm.typing +diag %s >%t
2+
# RUN: OutputCheck %s --file-to-check=%t
3+
4+
a = 1
5+
b = []
6+
7+
# CHECK-L: ${LINE:+1}: fatal: cannot unify int(width='a) with list(elt='b)
8+
a = b

0 commit comments

Comments
 (0)
Please sign in to comment.