Skip to content

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

fix(scripts): reject empty test enumeration in rust e2e suite

Steven Enamakele443e1cec692
diff --git a/scripts/__tests__/rust-e2e-enumeration.test.mjs b/scripts/__tests__/rust-e2e-enumeration.test.mjs
index 9d0a14590a..dce1d69862 100644
--- a/scripts/__tests__/rust-e2e-enumeration.test.mjs
+++ b/scripts/__tests__/rust-e2e-enumeration.test.mjs
@@ -179,6 +179,18 @@ test("a listing that fails part-way runs none of the names it printed", () => {
);
});
+test("a successful listing with no test rows fails the suite", () => {
+ const res = runSuite({
+ listStdout: "0 tests, 0 benchmarks\n",
+ listStatus: 0,
+ });
+
+ assert.notEqual(res.status, 0, res.output);
+ assert.doesNotMatch(res.output, /SUITE-REPORTED-SUCCESS/);
+ assert.match(res.output, /enumeration returned no tests/);
+ assert.deepEqual(res.runs, []);
+});
+
test("a successful listing runs each case once, in its own process, with EXTRA_ARGS", () => {
// libtest's real `--list` shape: `name: test` rows, a blank line, a summary.
// Only the `: test` rows are cases.
diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.sh
index 3ef6af0c61..92298a089d 100755
--- a/scripts/test-rust-e2e.sh
+++ b/scripts/test-rust-e2e.sh
@@ -176,7 +176,7 @@ run_json_rpc_e2e_suite() {
# failed to compile listed nothing, the loop ran zero times, and the suite
# reported success. A listing that fails part-way is refused whole, so a
# partial list is never run as though it were complete.
- local listing test_name
+ local listing test_names test_name
if ! listing="$(
"$CARGO_BIN" test --manifest-path Cargo.toml --features "$PRODUCT_FEATURES" \
--test json_rpc_e2e -- --list
@@ -185,14 +185,19 @@ run_json_rpc_e2e_suite() {
return 1
fi
+ test_names="$(printf '%s\n' "$listing" | sed -n 's/: test$//p')"
+ if [ -z "$test_names" ]; then
+ echo "[rust-e2e] ERROR: json_rpc_e2e enumeration returned no tests; refusing to report success." >&2
+ return 1
+ fi
+
while IFS= read -r test_name; do
- [ -n "$test_name" ] || continue
echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test json_rpc_e2e $test_name"
bash "$SCRIPT_DIR/ci-cancel-aware.sh" "$CARGO_BIN" test \
--manifest-path Cargo.toml --features "$PRODUCT_FEATURES" \
--test json_rpc_e2e "$test_name" -- \
--exact --test-threads=1 "${EXTRA_ARGS[@]}"
- done <<<"$(printf '%s\n' "$listing" | sed -n 's/: test$//p')"
+ done <<<"$test_names"
}
for suite in "${SUITES[@]}"; do