Detect panics early in test framework Output construction#1541
Open
Sim-hu wants to merge 4 commits intotrifectatechfoundation:mainfrom
Open
Detect panics early in test framework Output construction#1541Sim-hu wants to merge 4 commits intotrifectatechfoundation:mainfrom
Sim-hu wants to merge 4 commits intotrifectatechfoundation:mainfrom
Conversation
Add early panic detection in TryFrom<process::Output> for Output: - Check for exit code 101 (Rust's default panic exit code) - Check for "panicked" in stderr output Closes trifectatechfoundation#1375
bjorn3
reviewed
Apr 7, 2026
| } | ||
|
|
||
| if stderr.contains("panicked") { | ||
| panic!("program panicked\nstdout:\n{stdout}\n\nstderr:\n{stderr}"); |
Collaborator
There was a problem hiding this comment.
Suggested change
| panic!("program panicked\nstdout:\n{stdout}\n\nstderr:\n{stderr}"); | |
| panic!("program panicked with {}\nstdout:\n{stdout}\n\nstderr:\n{stderr}", output.status); |
for both panics and then it should be fine to merge both ifs together.
Author
There was a problem hiding this comment.
Collapsed the two checks into a single condition and switched both cases to the same panic message with output.status in e60c882.
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.
Closes #1375
This adds automatic panic detection when constructing
Outputfromprocess::Outputin the test framework. Instead of silently succeeding when a tested program panics, the test now fails immediately with a clear message.Two checks are added in
TryFrom<process::Output>:thread 'main' panicked at ...). If stderr contains this, the test fails regardless of exit code.Both checks run before the
Outputis returned, so any panic is caught at the earliest possible point rather than relying on individual tests to check for it manually.