This is an archive of the discontinued LLVM Phabricator instance.

[lit] Small cleanups in main.py
ClosedPublic

Authored by yln on Oct 10 2019, 2:45 PM.

Details

Summary
  • Extract separate function for running tests from main
  • Push single-usage imports to point of usage
  • Remove unnecessary sys.exit(0) calls

Diff Detail

Event Timeline

yln created this revision.Oct 10 2019, 2:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2019, 2:45 PM
rnk accepted this revision.Oct 11 2019, 1:36 PM

lgtm

llvm/utils/lit/lit/main.py
32

Unrelated, but I wonder if we should augment this logic to garbage collect old lit_tmp_ directories that are 24+ hours old. I routinely find lots of leaked lit_tmp_ directories because oftentimes the parent Python process is killed before it gets to the finally block below.

This revision is now accepted and ready to land.Oct 11 2019, 1:36 PM
yln marked an inline comment as done.Oct 11 2019, 2:46 PM
yln added inline comments.
llvm/utils/lit/lit/main.py
32

One of the improvements for lit that I want to explore is graceful shutdown on CTRL+C. If that isn't possible, we should implement your suggestion.

This revision was automatically updated to reflect the committed changes.