This is an archive of the discontinued LLVM Phabricator instance.

[lit] Cleanly exit on user keyboard interrupt
ClosedPublic

Authored by yln on Apr 2 2020, 9:19 PM.

Details

Summary

Graceful lit shutdown on user keyboard interrupt [Ctrl+C] was a
longstanding goal of mine. After a few refactorings this revision
finally enables it.

Printing of a helpful summary for interrupted runs (just as the one for
completed runs) will be tackled in future revisions.

I tested this on macOS and Linux.

Diff Detail

Event Timeline

yln created this revision.Apr 2 2020, 9:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 9:19 PM
yln added a comment.Apr 2 2020, 9:26 PM

I tested this on macOS and Linux.

@rnk @jdenny
Can you try Windows? If it doesn't work we can put back the _install_win32_signal_handler part.

@yln: that's a clean and short answer to the solution, the blogpost you're quoting makes everything super clear, thanks! LGTM if it works on Windows.

This revision is now accepted and ready to land.Apr 3 2020, 12:17 AM
jdenny added a comment.Apr 3 2020, 7:19 AM

I don't regularly work in windows. I'll try to find some time to check it out next week if no one else gets there first.

Thanks for working on this.

rnk accepted this revision.Apr 3 2020, 12:19 PM

Worked well, this was the output I got:

$ ninja -j900 check-llvm
[1 processes, 0/2 @ ?/s : 0.000s ] ACTION //llvm/test:check-llvm(//llvm/utils/gn/build/toolchain:win)
-- Testing: 36824 tests, 32 workers --
Testing:  0
FAIL: LLVM-Unit :: CodeGen/./CodeGenTests.exe/MachineInstrBundleIteratorTest.CheckForBundles (2062 of 36824)
******************** TEST 'LLVM-Unit :: CodeGen/./CodeGenTests.exe/MachineInstrBundleIteratorTest.CheckForBundles' FAILED ********************
Note: Google Test filter = MachineInstrBundleIteratorTest.CheckForBundles
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MachineInstrBundleIteratorTest
[ RUN      ] MachineInstrBundleIteratorTest.CheckForBundles

********************
Testing:  0  interrupted by user, skipping remaining tests

Testing Time: 5.89s
  Expected Passes    : 1747
ninja: build stopped: interrupted by user.

The second time I tried, my interrupt got delivered to some random clang subprocesses, but after mashing Ctrl C enough it went through... Anyway, the new state is better than the old. Thanks a lot!

This revision was automatically updated to reflect the committed changes.