requirements.test-coverage.failures
Requirements index · View definition
Requirement
The coverage workflow MUST return a failing exit status when test execution or coverage collection fails, preserve any profiles already collected, and report the failure. Collecting coverage MUST NOT turn a failing test run into a successful command.
Rationale
The reviewed tests cover each obligation in requirements.test-coverage.failures. I did not request implementation source, because the supplied tests were enough to judge.
1. A failing exit status when test execution fails
tests/execution_coverage.rs#fn[real_parallel_processes_retries_child_profiles_and_filtered_reruns]runs a failing test with--retries 0. It asserts that the command is unsuccessful. It also asserts that the saved run outcome and the attempt outcome are bothfailed, so collecting coverage does not turn a failing test run into a success.- The same test asserts an empty test selection exits with code 4, and that a
compile_error!build fails. fn[a_build_that_cannot_start_retains_failed_run_metadata]covers a build that cannot start.fn[a_process_that_cannot_start_is_failed_with_retained_attempt_metadata]covers a test process that cannot start. Both assert a non-success status and afailedoutcome.fn[interrupting_the_parent_preserves_started_attempt_metadata]covers an interrupted run. It asserts exit code 130 and aninterruptedoutcome.
2. A failing exit status when coverage collection fails
fn[passing_tests_with_missing_or_corrupt_profiles_fail_collection_and_retain_partial_reports]covers this case. All attempts reportsuccess, because the tests themselves pass. One test writes no profile and one writes a corrupt profile. The command still fails, in both thecoveragerun and the full flow. The run outcome isfailed.fn[unreadable_build_inputs_fail_preparation_before_any_tests_start]covers a preparation failure. It asserts a non-success status and afailedoutcome.
3. Preserving profiles already collected
- The first test re-checks after later failures that the first run still has 6 attempts. It also checks that every profile file listed in the earlier attempt records still exists on disk.
- The missing/corrupt-profile test asserts that the profile files of the good and corrupt attempts exist, and that the partial results and run records are retained.
- The failed-run tests assert that the failed run itself keeps its metadata, including empty attempts.
4. Reporting the failure
- The missing/corrupt-profile test asserts that stderr contains “partial profiles and reports have been retained”. It also asserts that the full flow does not print “Coverage check”.
fn[unreadable_build_inputs_fail_preparation_before_any_tests_start]asserts that stderr contains “Coverage preparation failed”.- Other tests assert run diagnostics: “Instrumented compilation”, “Cannot start instrumented compilation”, “Cannot start test process”, “Empty test selection”, and “before test startup”.
- The unit test
runner.rs#mod[tests]/fn[parallel_conversion_is_bounded_and_retains_every_result_in_order]covers a failed conversion result being retained in order. It also checks that progress still completes for failed work.
Every failure mode the text names has a test with assertions: test failure, collection failure, preservation of profiles, and reporting. I found no gap.
Inputs
Tests
Input 2: outline src/execution_coverage/runner.rs mod[tests]/fn[parallel_conversion_is_bounded_and_retains_every_result_in_order]
- File:
src/execution_coverage/runner.rs - Selector:
mod[tests]/fn[parallel_conversion_is_bounded_and_retains_every_result_in_order] - Kind:
fn src/execution_coverage/runner.rs:1637–1706
// {test}`requirements.test-coverage.processes`
// {test}`requirements.test-coverage.processes.reports`
// {test}`requirements.test-coverage.failures`
// {test}`requirements.test-coverage.processes.progress`
#[test]
fn parallel_conversion_is_bounded_and_retains_every_result_in_order() {
use std::sync::{Condvar, Mutex};
use std::time::Duration;
for workers in [2, 8] {
let total = workers * 2;
let active = AtomicUsize::new(0);
let peak = AtomicUsize::new(0);
let visits: Vec<_> = (0..total).map(|_| AtomicUsize::new(0)).collect();
let finished: Vec<_> = (0..total).map(|_| AtomicBool::new(false)).collect();
let rendezvous = (Mutex::new(false), Condvar::new());
let mut completed = 0;
let results = parallel_collect(
&(0..total).collect::<Vec<_>>(),
workers,
|&index| {
visits[index].fetch_add(1, Ordering::SeqCst);
let concurrent = active.fetch_add(1, Ordering::SeqCst) + 1;
peak.fetch_max(concurrent, Ordering::SeqCst);
if index < workers {
let mut met = rendezvous.0.lock().unwrap();
if concurrent == workers {
*met = true;
rendezvous.1.notify_all();
}
let (met, timeout) = rendezvous
.1
.wait_timeout_while(met, Duration::from_secs(5), |met| !*met)
.unwrap();
assert!(
*met && !timeout.timed_out(),
"conversion was not concurrent"
);
}
active.fetch_sub(1, Ordering::SeqCst);
finished[index].store(true, Ordering::SeqCst);
if index == 3 {
Err("unreadable profile")
} else {
Ok(index)
}
},
|index| {
assert!(
finished[index].load(Ordering::SeqCst),
"progress advanced before conversion finished"
);
completed += 1;
},
);
assert_eq!(peak.load(Ordering::SeqCst), workers);
assert!(visits.iter().all(|count| count.load(Ordering::SeqCst) == 1));
assert_eq!(completed, total, "failed work also completes a conversion");
assert_eq!(
results,
(0..total)
.map(|index| if index == 3 {
Err("unreadable profile")
} else {
Ok(index)
})
.collect::<Vec<_>>()
);
}
}
Input 3: outline tests/execution_coverage.rs fn[real_parallel_processes_retries_child_profiles_and_filtered_reruns]
- File:
tests/execution_coverage.rs - Selector:
fn[real_parallel_processes_retries_child_profiles_and_filtered_reruns] - Kind:
fn tests/execution_coverage.rs:741–1018
// {test}`requirements.test-coverage.run`
// {test}`requirements.test-coverage.processes`
// {test}`requirements.test-coverage.processes.reports`
// {test}`requirements.test-coverage.storage`
// {test}`requirements.test-coverage.storage.provenance`
// {test}`requirements.test-coverage.storage.configuration`
// {test}`requirements.test-coverage.storage.outcomes`
// {test}`requirements.test-coverage.failures`
#[test]
fn real_parallel_processes_retries_child_profiles_and_filtered_reruns() {
let temp = fixture();
let root = temp.path();
assert_success(&coverage(
root,
&["--workspace", "--retries", "1", "-j", "2", "--no-fail-fast"],
));
let saved = runs(root);
assert_eq!(saved.len(), 1);
let first = &saved[0].0;
assert_eq!(
saved[0].1["id"],
first.file_name().unwrap().to_str().unwrap()
);
assert!(saved[0].1["started"].as_u64().unwrap() > 0);
assert_eq!(saved[0].1["command"][0], "cargo nextest run");
assert!(
saved[0].1["selection"]
.as_array()
.unwrap()
.iter()
.any(|arg| arg == "--workspace")
);
assert!(saved[0].1["revision"].is_null());
assert!(saved[0].1["dirty"].is_null());
assert!(
saved[0].1["inputs"]
.get(root.join("src/lib.rs").to_str().unwrap())
.is_some()
);
let records = attempts(first);
assert_eq!(records.len(), 6); // five tests, one retried
let retry = records
.iter()
.filter(|record| record["test"] == "retries")
.collect::<Vec<_>>();
assert_eq!(retry.len(), 2);
assert!(
retry
.iter()
.any(|record| record["outcome"] == "failed" && record["attempt"] == "1")
);
assert!(
retry
.iter()
.any(|record| record["outcome"] == "success" && record["attempt"] == "2")
);
let child = records
.iter()
.find(|record| record["test"] == "child_process")
.unwrap();
assert_eq!(child["processes"].as_array().unwrap().len(), 2);
assert!(
child["processes"]
.as_array()
.unwrap()
.iter()
.all(|process| process["diagnostic"].is_null()
&& !process["lines"].as_object().unwrap().is_empty())
);
assert!(
records
.iter()
.all(|record| !record["processes"].as_array().unwrap().is_empty())
);
assert_eq!(
records
.iter()
.filter(|record| record["test"].as_str().unwrap().ends_with("same_name"))
.count(),
2
);
let same_named = records
.iter()
.filter(|record| record["test"].as_str().unwrap().ends_with("same_name"))
.collect::<Vec<_>>();
let binaries = same_named
.iter()
.map(|record| record["binary"].as_str().unwrap())
.collect::<std::collections::BTreeSet<_>>();
assert_eq!(
binaries,
std::collections::BTreeSet::from(["coverage-fixture", "coverage-fixture::processes"])
);
let identities = records
.iter()
.map(|record| record["id"].as_str().unwrap())
.collect::<std::collections::BTreeSet<_>>();
assert_eq!(identities.len(), records.len());
for record in &records {
for process in record["processes"].as_array().unwrap() {
for profile in process["profiles"].as_array().unwrap() {
assert!(
first
.join("attempts")
.join(record["id"].as_str().unwrap())
.join(profile.as_str().unwrap())
.is_file()
);
}
}
}
let configuration = &saved[0].1["configuration_inputs"];
assert!(
configuration["rustc"]
.as_str()
.unwrap()
.contains("LLVM version:")
);
assert!(!configuration["target"].as_str().unwrap().is_empty());
assert_eq!(configuration["cargo-profile"], "test");
assert!(
configuration["instrumentation"]
.as_str()
.unwrap()
.contains("-C instrument-coverage")
);
assert!(first.join("maps.json").is_file());
assert!(
saved[0].1["sources"]["src/lib.rs"]
.as_str()
.unwrap()
.contains("pub fn value")
);
assert_success(&coverage(root, &["-E", "test(second)"]));
let saved = runs(root);
assert_eq!(saved.len(), 2);
assert_eq!(attempts(&saved[1].0).len(), 1);
assert_eq!(saved[0].1["configuration"], saved[1].1["configuration"]);
assert_eq!(
saved[1].1["selection"],
serde_json::json!(["-E", "test(second)"])
);
// A scheduling profile doesn't split build compatibility.
let config = root.join(".config/nextest.toml");
let mut source = fs::read_to_string(&config).unwrap();
source.push_str("\n[profile.focused]\ntest-threads = 1\n");
fs::write(config, source).unwrap();
assert_success(&coverage(
root,
&["--profile", "focused", "-E", "test(second)"],
));
let saved = runs(root);
assert_eq!(saved[0].1["configuration"], saved[2].1["configuration"]);
assert_eq!(attempts(&saved[0].0).len(), 6); // historical profiles were retained
// Collection must preserve failure, including a retry's attempt outcome.
let failed = coverage(root, &["-E", "test(retries)", "--retries", "0"]);
assert!(!failed.status.success());
let saved = runs(root);
let newest = saved.last().unwrap();
assert_eq!(newest.1["outcome"], "failed");
assert_eq!(attempts(&newest.0)[0]["outcome"], "failed");
// Empty selection has nextest's own exit result and a visible run diagnostic.
let empty = coverage(
root,
&["-E", "test(definitely_missing)", "--no-tests", "pass"],
);
assert_success(&empty);
let saved = runs(root);
assert!(attempts(&saved.last().unwrap().0).is_empty());
assert!(
saved.last().unwrap().1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Empty test selection")
);
let empty_failure = coverage(root, &["-E", "test(definitely_missing)"]);
assert_eq!(
empty_failure.status.code(),
Some(4),
"{}",
String::from_utf8_lossy(&empty_failure.stderr)
);
let saved = runs(root);
let newest = saved.last().unwrap();
assert_eq!(newest.1["outcome"], "failed");
assert!(attempts(&newest.0).is_empty());
assert!(
newest.1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Empty test selection")
);
assert_success(&coverage(
root,
&["--features", "alpha", "-Fbeta", "-E", "test(second)"],
));
let saved = runs(root);
let newest = saved.last().unwrap();
assert_ne!(newest.1["configuration"], saved[0].1["configuration"]);
let enabled: Value = serde_json::from_str(
newest.1["configuration_inputs"]["enabled-features"]
.as_str()
.unwrap(),
)
.unwrap();
assert!(enabled.as_object().unwrap().values().any(|features| {
features
.as_array()
.unwrap()
.contains(&Value::String("alpha".into()))
&& features
.as_array()
.unwrap()
.contains(&Value::String("beta".into()))
}));
assert_success(&coverage(
root,
&[
"--config",
"build.build-dir='custom-build'",
"-E",
"test(second)",
],
));
let saved = runs(root);
assert_eq!(attempts(&saved.last().unwrap().0).len(), 1);
assert!(!root.join("custom-build").exists());
assert_success(&coverage(root, &["--no-run", "-E", "test(second)"]));
let saved = runs(root);
let newest = saved.last().unwrap();
assert_eq!(newest.1["outcome"], "success");
assert!(attempts(&newest.0).is_empty());
assert!(
newest.1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Compilation-only")
);
assert!(
!newest.1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Empty")
);
// Compilation failures also retain run identity and all earlier process data.
fs::write(
root.join("src/lib.rs"),
"compile_error!(\"deliberate build failure\");\n",
)
.unwrap();
let failed_build = coverage(root, &["-E", "test(second)"]);
assert!(!failed_build.status.success());
let saved = runs(root);
let newest = saved.last().unwrap();
assert_eq!(newest.1["outcome"], "failed");
assert!(attempts(&newest.0).is_empty());
assert!(
newest.1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Instrumented compilation")
);
assert_eq!(attempts(first).len(), 6);
for record in &records {
for process in record["processes"].as_array().unwrap() {
for profile in process["profiles"].as_array().unwrap() {
assert!(
first
.join("attempts")
.join(record["id"].as_str().unwrap())
.join(profile.as_str().unwrap())
.is_file()
);
}
}
}
}
Input 4: outline tests/execution_coverage.rs fn[a_build_that_cannot_start_retains_failed_run_metadata]
- File:
tests/execution_coverage.rs - Selector:
fn[a_build_that_cannot_start_retains_failed_run_metadata] - Kind:
fn tests/execution_coverage.rs:1057–1110
// {test}`requirements.test-coverage.failures`
// {test}`requirements.test-coverage.storage.outcomes`
#[cfg(unix)]
#[test]
fn a_build_that_cannot_start_retains_failed_run_metadata() {
use std::os::unix::{fs::PermissionsExt, fs::symlink};
let temp = fixture();
let root = temp.path();
let sysroot = Command::new("rustc")
.args(["--print", "sysroot"])
.output()
.unwrap();
assert_success(&sysroot);
let toolchain = std::path::PathBuf::from(String::from_utf8(sysroot.stdout).unwrap().trim());
let bin = root.join("fake-tools");
fs::create_dir(&bin).unwrap();
symlink(toolchain.join("bin/rustc"), bin.join("rustc")).unwrap();
let nextest = std::env::split_paths(&std::env::var_os("PATH").unwrap())
.map(|directory| directory.join("cargo-nextest"))
.find(|path| path.is_file())
.expect("cargo-nextest is installed");
symlink(nextest, bin.join("cargo-nextest")).unwrap();
let cargo = bin.join("cargo");
fs::write(&cargo, "#!/bin/sh\nif [ \"$1\" = metadata ]; then\n\"$HABEAS_TEST_CARGO_PATH\" \"$@\"\nresult=$?\n/bin/rm \"$0\"\nexit \"$result\"\nfi\nexec \"$HABEAS_TEST_CARGO_PATH\" \"$@\"\n").unwrap();
fs::set_permissions(&cargo, fs::Permissions::from_mode(0o755)).unwrap();
let output = Command::new(env!("CARGO_BIN_EXE_habeas"))
.arg("coverage")
.arg("--")
.args(["-E", "test(second)"])
.current_dir(root)
.env(
"PATH",
std::env::join_paths([bin.as_path(), Path::new("/usr/bin"), Path::new("/bin")])
.unwrap(),
)
.env("HABEAS_TEST_CARGO_PATH", toolchain.join("bin/cargo"))
.env("CARGO_NET_OFFLINE", "true")
.env_remove("CARGO_TARGET_DIR")
.env_remove("CARGO_BUILD_TARGET_DIR")
.env_remove("RUSTC_WORKSPACE_WRAPPER")
.output()
.unwrap();
assert!(!output.status.success());
let saved = runs(root);
assert_eq!(saved.len(), 1);
assert_eq!(saved[0].1["outcome"], "failed");
assert!(attempts(&saved[0].0).is_empty());
assert!(
saved[0].1["diagnostics"][0]
.as_str()
.unwrap()
.contains("Cannot start instrumented compilation")
);
}
Input 5: outline tests/execution_coverage.rs fn[passing_tests_with_missing_or_corrupt_profiles_fail_collection_and_retain_partial_reports]
- File:
tests/execution_coverage.rs - Selector:
fn[passing_tests_with_missing_or_corrupt_profiles_fail_collection_and_retain_partial_reports] - Kind:
fn tests/execution_coverage.rs:1228–1323
// {test}`requirements.test-coverage.failures`
// {test}`requirements.test-coverage.storage.outcomes`
// {test}`requirements.test-coverage.processes.reports`
// {test}`requirements.test-coverage.test`
#[cfg(unix)]
#[test]
fn passing_tests_with_missing_or_corrupt_profiles_fail_collection_and_retain_partial_reports() {
let temp = fixture();
let root = temp.path();
fs::write(root.join("tests/processes.rs"), "").unwrap();
fs::write(root.join("src/lib.rs"), r#"
#[test] fn good_profile() { assert_eq!(std::hint::black_box(1), 1); }
unsafe extern "C" { fn _exit(status: i32) -> !; }
#[test] fn missing_profile() { unsafe { _exit(0) } }
#[test] fn corrupt_profile() {
let template = std::path::PathBuf::from(std::env::var("LLVM_PROFILE_FILE").unwrap());
std::fs::write(template.parent().unwrap().join(format!("{}-corrupt.profraw", std::process::id())), "not an LLVM profile").unwrap();
}
"#).unwrap();
let output = coverage(root, &["--workspace"]);
assert!(!output.status.success());
assert!(
String::from_utf8_lossy(&output.stderr)
.contains("partial profiles and reports have been retained")
);
let combined = full_flow(root);
assert!(!combined.status.success());
assert!(!String::from_utf8_lossy(&combined.stdout).contains("Coverage check"));
assert!(
String::from_utf8_lossy(&combined.stderr)
.contains("partial profiles and reports have been retained")
);
let saved = runs(root);
assert_eq!(saved[0].1["outcome"], "failed");
let records = attempts(&saved[0].0);
assert_eq!(records.len(), 3);
assert!(
records
.iter()
.all(|attempt| attempt["outcome"] == "success"),
"test execution itself succeeds: {records:?}"
);
let missing = records
.iter()
.find(|attempt| attempt["test"] == "missing_profile")
.unwrap();
assert!(
missing["diagnostics"]
.as_array()
.unwrap()
.iter()
.any(|diagnostic| diagnostic
.as_str()
.unwrap()
.contains("No LLVM profile was written"))
);
let corrupt = records
.iter()
.find(|attempt| attempt["test"] == "corrupt_profile")
.unwrap();
assert!(
corrupt["processes"]
.as_array()
.unwrap()
.iter()
.any(|process| !process["diagnostic"].is_null()
&& process["lines"].as_object().unwrap().is_empty())
);
let good = records
.iter()
.find(|attempt| attempt["test"] == "good_profile")
.unwrap();
assert!(
!good["processes"][0]["lines"]
.as_object()
.unwrap()
.is_empty()
);
for attempt in [&good, &corrupt] {
for profile in attempt["processes"]
.as_array()
.unwrap()
.iter()
.flat_map(|process| process["profiles"].as_array().unwrap())
{
assert!(
saved[0]
.0
.join("attempts")
.join(attempt["id"].as_str().unwrap())
.join(profile.as_str().unwrap())
.is_file()
);
}
}
}
Input 6: outline tests/execution_coverage.rs fn[a_process_that_cannot_start_is_failed_with_retained_attempt_metadata]
- File:
tests/execution_coverage.rs - Selector:
fn[a_process_that_cannot_start_is_failed_with_retained_attempt_metadata] - Kind:
fn tests/execution_coverage.rs:1325–1350
// {test}`requirements.test-coverage.storage.outcomes`
// {test}`requirements.test-coverage.failures`
#[test]
fn a_process_that_cannot_start_is_failed_with_retained_attempt_metadata() {
let temp = tempfile::tempdir().unwrap();
let run = temp.path().join("run");
let output = Command::new(env!("CARGO_BIN_EXE_habeas"))
.arg("coverage-process")
.arg(temp.path().join("nonexistent-test-program"))
.env("HABEAS_COVERAGE_RUN", &run)
.env("NEXTEST_BINARY_ID", "fixture::lib")
.env("NEXTEST_TEST_NAME", "cannot_start")
.env("NEXTEST_ATTEMPT", "1")
.output()
.unwrap();
assert!(!output.status.success());
let records = attempts(&run);
assert_eq!(records.len(), 1);
assert_eq!(records[0]["outcome"], "failed");
assert!(
records[0]["diagnostics"][0]
.as_str()
.unwrap()
.contains("Cannot start test process")
);
}
Input 7: outline tests/execution_coverage.rs fn[unreadable_build_inputs_fail_preparation_before_any_tests_start]
- File:
tests/execution_coverage.rs - Selector:
fn[unreadable_build_inputs_fail_preparation_before_any_tests_start] - Kind:
fn tests/execution_coverage.rs:1352–1381
// {test}`requirements.test-coverage.storage.outcomes`
// {test}`requirements.test-coverage.storage.provenance`
// {test}`requirements.test-coverage.failures`
#[cfg(unix)]
#[test]
fn unreadable_build_inputs_fail_preparation_before_any_tests_start() {
use std::os::unix::fs::PermissionsExt;
let temp = fixture();
let root = temp.path();
fs::write(
root.join("build.rs"),
"fn main() { println!(\"cargo::rerun-if-changed=input.data\"); }\n",
)
.unwrap();
fs::write(root.join("input.data"), "private build input").unwrap();
fs::set_permissions(root.join("input.data"), fs::Permissions::from_mode(0o000)).unwrap();
let output = coverage(root, &["-E", "test(second)"]);
fs::set_permissions(root.join("input.data"), fs::Permissions::from_mode(0o600)).unwrap();
assert!(!output.status.success());
assert!(String::from_utf8_lossy(&output.stderr).contains("Coverage preparation failed"));
let saved = runs(root);
assert_eq!(saved[0].1["outcome"], "failed");
assert!(attempts(&saved[0].0).is_empty());
assert!(
saved[0].1["diagnostics"][0]
.as_str()
.unwrap()
.contains("before test startup")
);
}
Input 8: outline tests/execution_coverage.rs fn[interrupting_the_parent_preserves_started_attempt_metadata]
- File:
tests/execution_coverage.rs - Selector:
fn[interrupting_the_parent_preserves_started_attempt_metadata] - Kind:
fn tests/execution_coverage.rs:1383–1442
// {test}`requirements.test-coverage.storage.outcomes`
// {test}`requirements.test-coverage.failures`
#[cfg(unix)]
#[test]
fn interrupting_the_parent_preserves_started_attempt_metadata() {
let temp = fixture();
let root = temp.path();
fs::write(root.join("src/lib.rs"), "#[test] fn waits() { std::fs::write(\"started\", \"ready\").unwrap(); loop { std::thread::sleep(std::time::Duration::from_millis(20)); } }\n").unwrap();
fs::write(root.join("tests/processes.rs"), "").unwrap();
let mut child = Command::new(env!("CARGO_BIN_EXE_habeas"))
.args(["coverage", "--", "-E", "test(waits)"])
.current_dir(root)
.env("CARGO_NET_OFFLINE", "true")
.env_remove("CARGO_TARGET_DIR")
.env_remove("CARGO_BUILD_TARGET_DIR")
.env_remove("RUSTC_WORKSPACE_WRAPPER")
.env_remove("HABEAS_COVERAGE_RUN")
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn()
.unwrap();
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60);
while !root.join("started").exists() && std::time::Instant::now() < deadline {
if let Some(status) = child.try_wait().unwrap() {
panic!("coverage exited before the test started: {status}");
}
std::thread::sleep(std::time::Duration::from_millis(20));
}
if !root.join("started").exists() {
child.kill().unwrap();
child.wait().unwrap();
panic!("test did not start before the readiness deadline");
}
assert!(
Command::new("kill")
.args(["-INT", &child.id().to_string()])
.status()
.unwrap()
.success()
);
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(15);
let status = loop {
if let Some(status) = child.try_wait().unwrap() {
break status;
}
if std::time::Instant::now() >= deadline {
child.kill().unwrap();
child.wait().unwrap();
panic!("coverage did not finish after interruption");
}
std::thread::sleep(std::time::Duration::from_millis(20));
};
assert_eq!(status.code(), Some(130));
let saved = runs(root);
assert_eq!(saved[0].1["outcome"], "interrupted");
let records = attempts(&saved[0].0);
assert_eq!(records.len(), 1);
assert_eq!(records[0]["test"], "waits");
assert_eq!(records[0]["outcome"], "interrupted");
}
Other sources
Input 1: requirements selection requirements.test-coverage.failures
requirements.test-coverage.failures:md/requirements/test-coverage.md:145–150
:::{req} failures
The coverage workflow MUST return a failing exit status when test execution or
coverage collection fails, preserve any profiles already collected, and report
the failure. Collecting coverage MUST NOT turn a failing test run into a
successful command.
:::