This is an archive of the discontinued LLVM Phabricator instance.

[LIT] add a -vv option to echo all executed commands
ClosedPublic

Authored by george.karpenkov on Jul 12 2017, 2:50 PM.

Details

Summary

Debugging LIT scripts can be rather painful, as LIT directly does not specify which line has failed.
Rather, FileCheck is expected to report the failing location, but it can be often ambiguous if multiple commands are tested against the same prefix.
This change adds a -vv option, which echoes all output.
Then detecting the error becomes straightforward: last printed line is the failing one.

Of course, it could be desired to try to get failing line number directly from bash, but it involves excessive hacks on older bash versions (cf. https://stackoverflow.com/questions/24398691/how-to-get-the-real-line-number-of-a-failing-bash-command)

Furthermore, it would be good to support this option in the LIT's own shell, but I am not sure how could that easily be done.

Diff Detail

Repository
rL LLVM

Event Timeline

ddunbar accepted this revision.Jul 13 2017, 12:05 PM

LGTM, with one inline request, thanks!

utils/lit/lit/main.py
207 ↗(On Diff #106318)

Please make -vv imply -v, since this is generally how such options work.

This revision is now accepted and ready to land.Jul 13 2017, 12:05 PM
utils/lit/lit/main.py
207 ↗(On Diff #106318)

But it does, see two lines below:

if opts.echoAllCommands:
        opts.showOutput = True
This revision was automatically updated to reflect the committed changes.