[PATCH] D44598: [lit] Report line number for failed RUN command

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 09:45:49 PDT 2018


delcypher requested changes to this revision.
delcypher added inline comments.
This revision now requires changes to proceed.


================
Comment at: utils/lit/lit/TestRunner.py:792
 
+    if cmd.commands[0].args[0] == ':':
+        if len(cmd.commands) != 1:
----------------
The null command is pretty esoteric but occasionally useful in normal shell script. What's the reason it's not supported?
I guess we don't normally need it and it's a waste of time to implement it for the internal shell?


================
Comment at: utils/lit/lit/TestRunner.py:1367
                 output = []
+            line = ': \'' + keyword + ' at line ' + str(line_number) + \
+                   '\'; ' + line
----------------
I think this would be more readable as

```
line = ": '{keyword} at line {line}'; {real_command}".format(
  keyword=keyword,
  line=line,
  real_command=line)
```

Or something similar. There's no reason for the `\'` if you use `"` quotes instead.


================
Comment at: utils/lit/tests/unit/TestRunner.py:103
+        self.assertEqual(value[0].strip(), ': \'MY_RUN: at line 4\';  baz')
+        self.assertEqual(value[1].strip(), ': \'MY_RUN: at line 7\';  foo  bar')
 
----------------
Again if you use `"` quotes you can avoid having to escape the `'` quotes.


https://reviews.llvm.org/D44598





More information about the llvm-commits mailing list