feat: Phase 3 — implement --max-output-len, --cmd/--cmd-exclude, thread safety, graceful Ctrl+C#7
Merged
haugoug merged 1 commit intogvsoc:mainfrom Mar 9, 2026
Merged
Conversation
1. Implement --max-output-len (was accepted but ignored) Output is now capped at the specified byte limit with a truncation notice appended. Tracked via _output_truncated flag per test run. 2. Implement --cmd / --cmd-exclude (were accepted but ignored) Commands within a test can now be filtered by name. --cmd runs only the named commands; --cmd-exclude skips named commands. 3. Fix thread safety for pending_tests list enqueue_test() now holds the lock when modifying pending_tests and nb_pending_tests. check_pending_tests() holds the lock when popping. 4. Graceful Ctrl+C handling SIGINT installs a handler that clears pending_tests and signals the run event so the main thread unblocks. A second Ctrl+C forces exit. Worker threads are now daemon threads so they exit with the process. 5. Add __init__.py with public API docstring 122 tests, all passing. Real-world testsuite (12/12) verified.
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.
Summary
Four improvements that fix long-standing gaps and harden the runner.
1. Implement
--max-output-lenThe flag was accepted by argparse but never enforced. Now caps test output at the specified byte limit with a notice appended:
2. Implement
--cmd/--cmd-excludeBoth flags were accepted but ignored. Now:
--cmd runruns only the command namedrunwithin each test--cmd-exclude cleanskips thecleancommand in every testUseful for skipping build steps when iterating on run/check logic.
3. Thread safety for
pending_testsenqueue_test()now holds the runner lock when modifyingpending_testsandnb_pending_tests.check_pending_tests()holds the lock when popping. Prevents a race between the main thread and workers.4. Graceful Ctrl+C
KeyboardInterrupt(force exit)daemon=Trueso they exit cleanly with the process5.
__init__.pyAdded with public API docstring.
Tests
122 tests, all passing. Real-world testsuite (12/12) verified.