Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(rust-coverage-status): update tests for new failure recording behaviour

Steven Enamakel9eb5923cca9a
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
index 55c875b5d3..15c891bd06 100644
--- a/scripts/__tests__/rust-coverage-status.test.mjs
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -42,28 +42,50 @@ function withRunnerFunctions(functions, preamble, body) {
}
}
-test("a failed raw coverage module fails before later modules run", () => {
+test("a failed raw coverage module is recorded and later modules still run", () => {
const result = withRunnerFunctions(
- ["target_features_satisfied", "run_integration_target"],
+ ["suite", "target_features_satisfied", "run_integration_target"],
[
'TEST_TARGET_REQS=""',
'PRODUCT_FEATURES=""',
+ "FAILED_SUITES=()",
"log() { printf '%s\\n' \"$*\"; }",
"raw_coverage_modules() { printf 'first\\nsecond\\n'; }",
'llvm_cov() { for arg in "$@"; do case "$arg" in first::) return 7 ;; esac; done; echo RAN-LATER; }',
].join("\n"),
+ 'run_integration_target raw_coverage_all; printf "failed=%s\\n" "${FAILED_SUITES[@]}"',
+ );
+
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /running raw coverage module: second/);
+ assert.match(result.output, /RAN-LATER/);
+ assert.match(result.output, /failed=raw_coverage_all::first \(exit 7\)/);
+});
+
+test("a cancelled raw coverage module stops the run at once", () => {
+ const result = withRunnerFunctions(
+ ["suite", "target_features_satisfied", "run_integration_target"],
+ [
+ 'TEST_TARGET_REQS=""',
+ 'PRODUCT_FEATURES=""',
+ "FAILED_SUITES=()",
+ "log() { printf '%s\\n' \"$*\"; }",
+ "raw_coverage_modules() { printf 'first\\nsecond\\n'; }",
+ 'llvm_cov() { for arg in "$@"; do case "$arg" in first::) return 143 ;; esac; done; echo RAN-LATER; }',
+ ].join("\n"),
"run_integration_target raw_coverage_all",
);
- assert.equal(result.status, 7, result.output);
+ assert.equal(result.status, 143, result.output);
assert.doesNotMatch(result.output, /running raw coverage module: second/);
assert.doesNotMatch(result.output, /RAN-LATER/);
});
test("an integration target missing a required product feature is skipped", () => {
const result = withRunnerFunctions(
- ["target_features_satisfied", "run_integration_target"],
+ ["suite", "target_features_satisfied", "run_integration_target"],
[
+ "FAILED_SUITES=()",
"TEST_TARGET_REQS=$'memory_artifacts_e2e\\tmemory-git'",
'PRODUCT_FEATURES="channels,flows"',
"log() { printf '%s\\n' \"$*\"; }",
@@ -79,8 +101,9 @@ test("an integration target missing a required product feature is skipped", () =
test("an integration target with all required product features runs", () => {
const result = withRunnerFunctions(
- ["target_features_satisfied", "run_integration_target"],
+ ["suite", "target_features_satisfied", "run_integration_target"],
[
+ "FAILED_SUITES=()",
"TEST_TARGET_REQS=$'memory_artifacts_e2e\\tmemory-git'",
'PRODUCT_FEATURES="memory-github,memory-git,flows"',
"log() { printf '%s\\n' \"$*\"; }",