This is an archive of the discontinued LLVM Phabricator instance.

[lit] Factor out a helper for shell command results.
AbandonedPublic

Authored by ddunbar on May 26 2016, 8:50 PM.

Details

Summary

[lit] Improve readability of failing scripts.

  • This only applies to scripts executed by the _internal_ shell script interpreter.
  • This patch reworks the log to look more like a shell transcript, and be less verbose (but in the interest of calling attention to the important parts).

Here is an example of the new format, for commands with/without failures and
with/without output:

$ true
$ echo hi
hi

$ false
note: command had no output on stdout or stderr
error: command failed with exit status 1

[lit] Improve logging with file redirection.

  • This will cause lit to automatically include the first 1K of data in redirected output files when a command fails (previously if the command failed, but the main point of the test was, say, a FileCheck later on, then the log wasn't helpful in showing why the command failed).

Diff Detail

Event Timeline

ddunbar retitled this revision from to [lit] Factor out a helper for shell command results..
ddunbar updated this object.
ddunbar added reviewers: rnk, EricWF.
EricWF added inline comments.May 27 2016, 11:22 AM
utils/lit/lit/TestRunner.py
117

Default parameters are mutable in python. The default should either be None or outputFiles needs to be copied on initialization.

400

Is there a reason to sort the files?

ddunbar added inline comments.May 31 2016, 4:39 PM
utils/lit/lit/TestRunner.py
117

Good point, will fix.

400

To ensure the output is deterministic (and ordered in a canonical fashion), when shown to the user.

MatzeB added a subscriber: MatzeB.May 31 2016, 4:59 PM

Have you seen this mail thread: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160523/360023.html

If I understand this correctly this is a nicer solution for those cases. At a general level do you know if there are performance or correctness problems with just always using the integrated shell parses to get consistent behavior?

utils/lit/lit/TestRunner.py
387

I think you should use errors="replace" here to avoid lit aborting on strange inputs.

ddunbar accepted this revision.Jun 7 2016, 9:20 AM
ddunbar added a reviewer: ddunbar.

I merged this with corrections in 271608, 271610, and 272021.

This revision is now accepted and ready to land.Jun 7 2016, 9:20 AM
ddunbar abandoned this revision.Oct 12 2017, 8:30 AM