Skip to content

Commit 6c98764

Browse files
committed
Fix test
1 parent 551189d commit 6c98764

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

bin_tests/src/test_runner.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ where
190190
/// This is more flexible than `run_crash_test_with_artifacts` and allows for:
191191
/// - Custom binary selection (e.g., crashing_test_app instead of crashtracker_bin_test)
192192
/// - Custom command arguments
193-
/// - Custom exit status expectations
193+
///
194+
/// Note: This function always expects the test to crash (exit with non-success status).
195+
/// All current uses of this function test crash scenarios, not successful exits.
194196
///
195197
/// # Example
196198
/// ```no_run
@@ -223,7 +225,6 @@ where
223225
/// .arg(&artifacts_map[&receiver])
224226
/// .arg(&fixtures.output_dir);
225227
/// },
226-
/// false, // expect crash (not success)
227228
/// |payload, _fixtures| {
228229
/// // Custom validation
229230
/// Ok(())
@@ -235,7 +236,6 @@ where
235236
pub fn run_custom_crash_test<CB, V>(
236237
binary_path: &std::path::Path,
237238
command_builder: CB,
238-
expect_success: bool,
239239
validator: V,
240240
) -> Result<()>
241241
where
@@ -251,13 +251,10 @@ where
251251

252252
let exit_status = crate::timeit!("exit after signal", { p.wait()? });
253253

254-
// Validate exit status
255-
let actual_success = exit_status.success();
254+
// Validate exit status - custom crash tests always expect failure
256255
anyhow::ensure!(
257-
expect_success == actual_success,
258-
"Exit status mismatch: expected success={}, got success={} (exit code: {:?})",
259-
expect_success,
260-
actual_success,
256+
!exit_status.success(),
257+
"Expected test to crash (non-success exit), but it succeeded with code: {:?}",
261258
exit_status.code()
262259
);
263260

bin_tests/tests/crashtracker_bin_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,11 @@ fn test_crash_tracking_bin_panic_hook_after_fork() {
379379
message
380380
);
381381

382-
// Verify it's marked as a panic
382+
// TODO change the kind into Panic instead
383383
let kind = error["kind"].as_str().unwrap();
384384
assert_eq!(
385-
kind, "Panic",
386-
"Expected error kind to be Panic, got: {}",
385+
kind, "UnixSignal",
386+
"Expected error kind to be UnixSignal, got: {}",
387387
kind
388388
);
389389

0 commit comments

Comments
 (0)