Skip to content

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

test: execute the real isolated runtime reaper in both Rust runners

Steven Enamakelcbe4555ad277
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
index 14fa9424d8..50f290cf34 100644
--- a/scripts/__tests__/rust-coverage-status.test.mjs
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -12,8 +12,8 @@ const repoRoot = path.join(
);
const runner = path.join(repoRoot, "scripts", "ci", "rust-coverage.sh");
-function extractFunction(name) {
- const source = fs.readFileSync(runner, "utf8");
+function extractFunction(name, scriptPath = runner) {
+ const source = fs.readFileSync(scriptPath, "utf8");
const start = source.indexOf(`${name}() {`);
assert.notEqual(start, -1, `${name}() not found in ${runner}`);
const end = source.indexOf("\n}\n", start);
@@ -26,7 +26,7 @@ function withRunnerFunctions(functions, preamble, body) {
"set -euo pipefail",
"exec 2>&1",
preamble,
- ...functions.map(extractFunction),
+ ...functions.map((name) => extractFunction(name)),
body,
].join("\n");
try {
@@ -116,14 +116,13 @@ test("an integration target with all required product features runs", () => {
assert.match(result.output, /RAN-TARGET/);
});
-
test("headless Embed coverage gets an isolated disposable encryption key", () => {
const result = withRunnerFunctions(
["llvm_cov_product_facade", "llvm_cov_embed"],
[
'PRODUCT_FEATURES="channels"',
- 'export OPENHUMAN_KEYRING_MASTER_KEY=operator-key',
- 'export OPENHUMAN_KEYRING_MASTER_KEY_FILE=operator-file',
+ "export OPENHUMAN_KEYRING_MASTER_KEY=operator-key",
+ "export OPENHUMAN_KEYRING_MASTER_KEY_FILE=operator-file",
'bash() { [[ "${OPENHUMAN_KEYRING_MASTER_KEY:-}" =~ ^[0-9a-f]{64}$ ]] || return 9; [[ -z "${OPENHUMAN_KEYRING_MASTER_KEY_FILE:-}" ]] || return 10; echo DISPOSABLE-KEY; }',
].join("\n"),
'llvm_cov_embed --no-report -p openhuman-embed; [[ "$OPENHUMAN_KEYRING_MASTER_KEY" == operator-key ]]; [[ "$OPENHUMAN_KEYRING_MASTER_KEY_FILE" == operator-file ]]; echo PARENT-UNCHANGED',
@@ -132,3 +131,35 @@ test("headless Embed coverage gets an isolated disposable encryption key", () =>
assert.match(result.output, /DISPOSABLE-KEY/);
assert.match(result.output, /PARENT-UNCHANGED/);
});
+
+for (const [label, scriptPath, invoke] of [
+ [
+ "mock runner",
+ path.join(repoRoot, "scripts", "test-rust-with-mock.sh"),
+ "cargo_test",
+ ],
+ ["coverage runner", runner, "llvm_cov"],
+]) {
+ test(`${label} selects the real isolated runtime-reaper regression`, () => {
+ const script = [
+ "set -euo pipefail",
+ 'suite() { shift; "$@"; }',
+ `${invoke}() { printf '%s\\n' "$@"; }`,
+ extractFunction("run_build_only_reaper_test", scriptPath),
+ "run_build_only_reaper_test",
+ ].join("\n");
+ const args = execFileSync("bash", ["-c", script], { encoding: "utf8" })
+ .trim()
+ .split("\n");
+ assert.ok(
+ args.includes("--exact"),
+ "the runtime singleton requires its own process",
+ );
+ assert.ok(
+ args.includes(
+ "agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked",
+ ),
+ `the libtest selector must reach the declared regression: ${args.join(" ")}`,
+ );
+ });
+}
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index d4229f0e86..d0c9a790d4 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -166,6 +166,12 @@ run_integration_target() {
fi
}
+run_build_only_reaper_test() {
+ suite "openhuman reaper (isolated)" llvm_cov --no-report --no-fail-fast -p openhuman --lib -- \
+ agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked \
+ --exact --test-threads=1
+}
+
if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
# One process per test means one .profraw per process by default (the name
# carries %p): ~11,800 files and ~50 GB for the core alone, which the report
@@ -222,9 +228,7 @@ else
--skip a_build_only_runtime_is_swept_before_it_can_be_invoked
log "running isolated build-only reaper test"
- suite "openhuman reaper (isolated)" llvm_cov --no-report --no-fail-fast -p openhuman --lib -- \
- openhuman::agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked \
- --exact --test-threads=1
+ run_build_only_reaper_test
fi
# Run every root-workspace Rust support crate rather than only crates named by
diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh
index a218419a42..d34ddf82a2 100755
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@ -246,7 +246,7 @@ run_build_only_reaper_test() {
# Keep this real build-path regression in a fresh process so it cannot narrow
# the DomainSet observed by later registry and domain tests.
cargo_test --lib \
- "openhuman::agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked" \
+ "agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked" \
-- --exact --test-threads=1 "$@"
}