Skip to content

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

fix(ci): route nextest coverage through suite-aware wrapper

Steven Enamakel5baae36bce1b
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
index a335470072..525f7b3e67 100644
--- a/scripts/__tests__/rust-coverage-status.test.mjs
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -208,9 +208,11 @@ test("coverage finalizer retains interrupted reports and the cancellation status
function runMockedCoverage(exitCode) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rust-coverage-runner-"));
try {
- for (const folder of ["bin", "scripts/ci", "crates/openhuman-cli"])
+ for (const folder of ["bin", "scripts/ci", "crates/openhuman-cli", ".config", "tests"])
fs.mkdirSync(path.join(dir, folder), { recursive: true });
const write = (name, content) => fs.writeFileSync(path.join(dir, name), content, { mode: 0o755 });
+ for (const name of ["scripts/ci/nextest-coverage.sh", "scripts/ci/nextest-report.mjs", ".config/nextest.toml"])
+ fs.copyFileSync(path.join(repoRoot, name), path.join(dir, name));
write("scripts/ci/product-features.sh", "#!/bin/bash\necho channels\n");
write("scripts/ci-cancel-aware.sh", '#!/bin/bash\nexec "$@"\n');
write("scripts/ci/assert-coverage-presence.sh", "#!/bin/bash\nexit 0\n");
@@ -218,7 +220,17 @@ function runMockedCoverage(exitCode) {
write("bin/rustup", "#!/bin/bash\nexit 1\n");
write("bin/cargo", `#!/bin/bash
printf '%s\\n' "$*" >> "$MOCK_CALLS"
-case "$*" in *"-p openhuman --lib --bins"*) exit "${exitCode}" ;; esac
+case "$*" in *"-p openhuman --lib --bins"*) [ "${exitCode}" = 0 ] || exit "${exitCode}" ;; esac
+node - "$@" <<'JS'
+const fs = require('node:fs');
+const args = process.argv.slice(2);
+const pos = args.indexOf('--config-file');
+if (pos >= 0) {
+ const config = fs.readFileSync(args[pos + 1], 'utf8');
+ const report = JSON.parse(config.split('\\n').find(line => line.startsWith('path = ')).slice(7));
+ fs.writeFileSync(report, '<testsuites><testsuite name="mock" tests="1"></testsuite></testsuites>');
+}
+JS
`);
let status = 0;
try {
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index 566fae6346..9a0b2ae899 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -34,7 +34,7 @@ llvm_cov() {
;;
*)
if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
- bash scripts/ci-cancel-aware.sh cargo llvm-cov nextest --profile ci --no-tests=fail \
+ bash scripts/ci/nextest-coverage.sh "${COV_SUITE:-coverage}" cargo llvm-cov nextest --profile ci --no-tests=fail \
--features "${CORE_PRODUCT_FEATURES}" "$@"
else
bash scripts/ci-cancel-aware.sh cargo llvm-cov \
@@ -46,7 +46,7 @@ llvm_cov() {
llvm_cov_package() {
if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
- bash scripts/ci-cancel-aware.sh cargo llvm-cov nextest --profile ci --no-tests=fail "$@"
+ bash scripts/ci/nextest-coverage.sh "${COV_SUITE:-coverage}" cargo llvm-cov nextest --profile ci --no-tests=fail "$@"
else
bash scripts/ci-cancel-aware.sh cargo llvm-cov "$@"
fi
@@ -54,7 +54,7 @@ llvm_cov_package() {
llvm_cov_product_facade() {
if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
- bash scripts/ci-cancel-aware.sh cargo llvm-cov nextest --profile ci --no-tests=fail \
+ bash scripts/ci/nextest-coverage.sh "${COV_SUITE:-coverage}" cargo llvm-cov nextest --profile ci --no-tests=fail \
--features "${CORE_PRODUCT_FEATURES}" "$@"
else
bash scripts/ci-cancel-aware.sh cargo llvm-cov \
@@ -125,7 +125,7 @@ FAILED_SUITES=()
suite() {
local name="$1" rc=0
shift
- "$@" || rc=$?
+ COV_SUITE="$(printf '%s' "$name" | tr -cs '[:alnum:]' '-')" "$@" || rc=$?
case "${rc}" in
0) ;;
130 | 143)
@@ -256,6 +256,16 @@ if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
# other without the per-module and serial invocations below. Cargo skips a
# target whose required-features are not in the product set; `kind(test)`
# keeps the run to the integration targets, as the loop below runs them.
+ mkdir -p ci-out/nextest
+ expected_targets="${PWD}/ci-out/nextest/cli-expected-targets.txt"
+ : >"${expected_targets}"
+ while IFS= read -r target; do
+ [ -n "${target}" ] || continue
+ if target_features_satisfied "${target}"; then
+ printf '%s\n' "${target}" >>"${expected_targets}"
+ fi
+ done < <(integration_test_targets)
+ NEXTEST_EXPECTED_TARGETS="${expected_targets}" \
suite "openhuman-cli integration tests (nextest)" llvm_cov \
--no-report --no-fail-fast -p openhuman-cli --tests -E 'kind(test)'
else