fix: Ctrl+C now properly kills running tests and stops immediately#12
Merged
haugoug merged 1 commit intogvsoc:mainfrom Mar 10, 2026
Merged
fix: Ctrl+C now properly kills running tests and stops immediately#12haugoug merged 1 commit intogvsoc:mainfrom
haugoug merged 1 commit intogvsoc:mainfrom
Conversation
The previous Ctrl+C implementation only cleared pending_tests but: - Tests already in the worker queue continued to run - Currently running processes were not killed - TestRun objects without status caused crashes in stats collection Now on Ctrl+C: 1. Clears pending_tests (tests not yet dispatched) 2. Drains the worker queue (tests queued but not started) 3. Kills all currently running test processes via SIGKILL 4. Workers check _interrupted flag before starting new tests 5. Command loop checks _interrupted between commands Also initializes status/output/timeout_reached in TestRun.__init__ so stats collection never crashes on uninitialized runs. 122 tests passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pressing Ctrl+C during a test run would only clear the
pending_testslist, but:Fix
On Ctrl+C the signal handler now:
pending_tests— tests not yet dispatchedWorkers also check
_interruptedbefore starting a test, so any test pulled from the queue after the interrupt is silently dropped.The command execution loop checks
_interruptedbetween commands, so multi-command tests abort quickly.Also initializes
status,output,timeout_reachedinTestRun.__init__so stats collection never crashes on runs that were created but never executed.Tested
sleep 30, 4 threads. Ctrl+C kills everything in <1s.