tsc-platform: TSC_TEST_CRASH to check crash reports in release builds

crash::test_crash_if_requested() panics when TSC_TEST_CRASH is set, for
the manual test matrix. A test runs it in a child process and finds the
report afterwards, as the app would on its next start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
Claude committed 2026-09-26 10:21:58 +00:00
1 parent 087bb8e866
commit 57d6888b46
2 files changed
+45 -3

No files matched your search

+9
View File
@@ -101,6 +101,15 @@ pub fn install(dir: impl Into<PathBuf>, enabled: bool) {
});
}
/// Panic if the `TSC_TEST_CRASH` environment variable is set, so testers can
/// check crash reports with a release build (docs/testing/manual-matrix.md).
/// Call right after [`install`].
pub fn test_crash_if_requested() {
if std::env::var_os("TSC_TEST_CRASH").is_some_and(|v| !v.is_empty()) {
panic!("test crash requested with TSC_TEST_CRASH");
}
}
/// Turn recording on or off (the settings switch). No effect before
/// [`install`].
pub fn set_enabled(enabled: bool) {