diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a77cd3fe13a..e1731134b78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -274,6 +274,15 @@ jobs: if: success() || failure() run: node scripts/ci-rust-reports.mjs collect + - name: Run cocotb VPI end-to-end test + id: cocotb-tests + if: needs.changes.outputs.rust_vpi_e2e != 'false' + env: + RUST_FULL: ${{ needs.changes.outputs.rust_full }} + BUILDS: ${{ needs.changes.outputs.rust_builds }} + run: | + CELOX_COCOTB_PYTHON="$(command -v python)" node scripts/run-ci-cocotb.mjs + - name: Retain Rust test reports if: (success() || failure()) && hashFiles('work/ci-reports/rust/*.xml') != '' uses: actions/upload-artifact@v7 @@ -289,14 +298,14 @@ jobs: token: ${{ secrets.MERGIFY_TOKEN }} report_path: work/ci-reports/rust/*.xml job_name: rust-tests - test_step_outcome: ${{ steps.workspace-tests.outcome != 'skipped' && steps.workspace-tests.outcome || steps.scoped-tests.outcome }} + test_step_outcome: ${{ steps.cocotb-tests.outcome == 'failure' && 'failure' || steps.workspace-tests.outcome != 'skipped' && steps.workspace-tests.outcome || steps.scoped-tests.outcome }} # nextest does not run documentation tests. - name: Run workspace documentation tests with CI features if: needs.changes.outputs.rust_full != 'false' run: >- cargo test --locked --workspace --exclude 'lydite*' --doc - --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus + --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases - name: Run the documentation tests of the changed libraries if: needs.changes.outputs.rust_full == 'false' && needs.changes.outputs.rust_libraries != '' @@ -309,27 +318,24 @@ jobs: if [ -n "$FEATURES" ]; then args+=(--features "$FEATURES"); fi cargo test --locked --doc "${args[@]}" + rust-default-tests: + name: Rust default-feature tests + needs: changes + if: ${{ !cancelled() && (needs.changes.result != 'success' || (needs.changes.outputs.rust == 'true' && (needs.changes.outputs.rust_full != 'false' || contains(format(' {0} ', needs.changes.outputs.rust_libraries), ' celox ')))) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + submodules: recursive + - uses: ./.github/actions/setup-rust + - uses: Swatinem/rust-cache@v2 + with: + save-if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - name: Verify default-feature library and documentation tests - if: needs.changes.outputs.rust_full != 'false' || contains(format(' {0} ', needs.changes.outputs.rust_libraries), ' celox ') run: | cargo test --locked -p celox --lib cargo test --locked -p celox --doc - - name: Run cocotb VPI end-to-end test - if: needs.changes.outputs.rust_vpi_e2e != 'false' - env: - FEATURES: ${{ needs.changes.outputs.rust_full != 'false' && 'celox/systemverilog' || needs.changes.outputs.rust_features }} - run: | - args=() - # Match the feature set of VPI's scoped nextest build. Features of - # other selected packages (such as external adapters) are unrelated. - for feature in ${FEATURES//,/ }; do - case "$feature" in celox/*) args+=(--features "$feature");; esac - done - CELOX_COCOTB_PYTHON="$(command -v python)" \ - cargo test --locked -p celox-vpi --features systemverilog "${args[@]}" --test cocotb_e2e \ - cocotb_ -- --ignored - external-suites: name: External suite (${{ matrix.suite }}, ${{ matrix.tool }}) needs: changes @@ -630,13 +636,15 @@ jobs: # into a successful check merely because a downstream job was skipped. rust: name: Rust Test & NAPI Build - needs: [changes, rust-tests, sv-tests, arm64-backend, napi-linux, napi-wasm, external-suites] + needs: [changes, rust-tests, rust-default-tests, sv-tests, arm64-backend, napi-linux, napi-wasm, external-suites] if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true' || needs.changes.outputs.napi == 'true') }} runs-on: ubuntu-latest env: CHANGES_RESULT: ${{ needs.changes.result }} RUST_REQUIRED: ${{ needs.changes.outputs.rust }} RUST_RESULT: ${{ needs.rust-tests.result }} + DEFAULT_REQUIRED: ${{ needs.changes.result != 'success' || (needs.changes.outputs.rust == 'true' && (needs.changes.outputs.rust_full != 'false' || contains(format(' {0} ', needs.changes.outputs.rust_libraries), ' celox '))) }} + DEFAULT_RESULT: ${{ needs.rust-default-tests.result }} SV_TESTS_REQUIRED: ${{ needs.changes.outputs.rust != 'false' && needs.changes.outputs.rust_sv_tests != 'false' }} SV_TESTS_RESULT: ${{ needs.sv-tests.result }} # Platform coverage is mandatory in queue and full validation runs. @@ -656,6 +664,9 @@ jobs: if [ "$RUST_REQUIRED" != false ] || [ "$RUST_RESULT" != skipped ]; then test "$RUST_RESULT" = success fi + if [ "$DEFAULT_REQUIRED" != false ] || [ "$DEFAULT_RESULT" != skipped ]; then + test "$DEFAULT_RESULT" = success + fi if [ "$SV_TESTS_REQUIRED" != false ] || [ "$SV_TESTS_RESULT" != skipped ]; then test "$SV_TESTS_RESULT" = success fi @@ -959,6 +970,7 @@ jobs: docs, lint, rust-tests, + rust-default-tests, sv-tests, external-suites, common-cells, diff --git a/.github/workflows/rust-cache.yml b/.github/workflows/rust-cache.yml index b7113223635..33fdcdb80c7 100644 --- a/.github/workflows/rust-cache.yml +++ b/.github/workflows/rust-cache.yml @@ -53,6 +53,47 @@ jobs: - name: Build test targets to populate dependencies if: steps.cache.outputs.cache-hit != 'true' run: >- - cargo nextest list --locked --workspace --message-format json + cargo nextest list --locked --workspace --exclude 'lydite*' --message-format json --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases > /dev/null + + rust-default-tests: + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + name: Populate default-feature dependency cache + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + submodules: recursive + - uses: ./.github/actions/setup-rust + - uses: Swatinem/rust-cache@v2 + id: cache + - name: Build default-feature library test dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: cargo test --locked -p celox --lib --no-run + + napi-windows: + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + name: Populate Windows NAPI dependency cache + runs-on: windows-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v7 + with: + submodules: recursive + - uses: ./.github/actions/setup-rust + - uses: Swatinem/rust-cache@v2 + id: cache + - uses: pnpm/action-setup@v6 + if: steps.cache.outputs.cache-hit != 'true' + - uses: actions/setup-node@v7 + if: steps.cache.outputs.cache-hit != 'true' + with: + node-version: 24 + cache: pnpm + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile --ignore-scripts + - name: Build NAPI with the CI command + if: steps.cache.outputs.cache-hit != 'true' + run: pnpm run build:napi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b178404a8a2..095a0dad575 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,13 +58,26 @@ ignored registrations deliberately. With `runtime-cases`, `.vtest` bodies are read from disk instead of embedded in Rust binaries, so edits to an existing case do not require recompilation. Adding -a test registration or changing Rust still requires a build. The first run builds -both the optimized executor and ordinary test binaries; the executor profile has -its own Cargo cache. Ordinary Cargo test commands retain the embedded, in-process -path. CI's Rust Tests job prepares the executor once and uses it for both full -workspace runs and scoped runs that include Celox. Scopes without Celox skip that -build. The default-branch cache warmer builds both executor and test dependencies -under the same cache key; vtest preparation failures fail the test job. +a test registration or changing Rust still requires a build. Both local commands +and CI build the optimized executor separately from ordinary test binaries. +CI keeps the normal test profile and existing dependency cache: sharing a Cargo +profile alone does not share artifacts when the executor and workspace resolve +different dependency features. Ordinary Cargo test commands retain the embedded, +in-process path. CI's Rust Tests job prepares the executor once and uses it for +full workspace runs and scoped runs that include Celox. Scopes without Celox +skip that build. The default-branch cache warmer builds both executor and test +dependencies under the same cache key; preparation failures fail the test job. +Cocotb runs through nextest with the exact packages, features and targets of its +original build, selecting +only the ignored `cocotb_` cases; an empty selection fails. Its reports are kept +separately and uploaded with the regular test results. + +Default-feature library and documentation tests run in a separate parallel job +with no extra features. The required Rust gate still requires this job whenever +Celox libraries or the full workspace are selected, and on detection failure. +The cache warmer also primes this job and Windows NAPI dependencies on master +using their CI job IDs, environments and build commands. Windows builds still +need a first cache fill after a toolchain or dependency change. The CI nextest profile also emits JUnit results. The Rust Tests job preserves each scoped invocation separately under `work/ci-reports/rust/`, retains the XML diff --git a/scripts/ci-rust-reports.mjs b/scripts/ci-rust-reports.mjs index ddfb851c8ee..3eb072ba73a 100644 --- a/scripts/ci-rust-reports.mjs +++ b/scripts/ci-rust-reports.mjs @@ -15,12 +15,12 @@ export function resetReports(directory, source = currentReport(process.cwd())) { clearCurrentReport(source); if (!existsSync(directory)) return; for (const name of readdirSync(directory)) { - if (/^nextest-(?:full|\d+)\.xml$/.test(name)) rmSync(resolve(directory, name)); + if (/^nextest-(?:full|cocotb-\d+|\d+)\.xml$/.test(name)) rmSync(resolve(directory, name)); } } export function saveCurrentReport(directory, name, source = currentReport(process.cwd())) { - if (!/^(?:full|\d+)$/.test(name)) throw new Error("Invalid Rust report name"); + if (!/^(?:full|cocotb-\d+|\d+)$/.test(name)) throw new Error("Invalid Rust report name"); // A build failure or an empty selection may produce no report. Keep the // Cargo exit status and any earlier reports; never reuse a previous result. if (!existsSync(source)) return; diff --git a/scripts/ci-rust-reports.test.mjs b/scripts/ci-rust-reports.test.mjs index e0ef8709eef..63cc287a2d5 100644 --- a/scripts/ci-rust-reports.test.mjs +++ b/scripts/ci-rust-reports.test.mjs @@ -34,7 +34,7 @@ test("initialization removes only this job's stale reports and creates no target resetReports(directory, source); assert.ok(!existsSync(directory)); mkdirSync(directory); - for (const name of ["nextest-full.xml", "nextest-0.xml", "unrelated.xml"]) + for (const name of ["nextest-full.xml", "nextest-0.xml", "nextest-cocotb-0.xml", "unrelated.xml"]) writeFileSync(join(directory, name), "old"); writeFileSync(source, "old"); resetReports(directory, source); @@ -49,3 +49,13 @@ test("full runs use a stable report name and reject invalid paths", (t) => { assert.ok(existsSync(source)); assert.equal(saveCurrentReport(directory, "full", source), join(directory, "nextest-full.xml")); }); + +test("cocotb reports do not overwrite normal test reports", (t) => { + const { source, directory } = fixture(t); + writeFileSync(source, "normal"); + saveCurrentReport(directory, "full", source); + writeFileSync(source, "cocotb failure"); + saveCurrentReport(directory, "cocotb-0", source); + assert.equal(readFileSync(join(directory, "nextest-full.xml"), "utf8"), "normal"); + assert.equal(readFileSync(join(directory, "nextest-cocotb-0.xml"), "utf8"), "cocotb failure"); +}); diff --git a/scripts/ci-workflow.test.mjs b/scripts/ci-workflow.test.mjs index ed9ff3e9e7c..f9122c8d15c 100644 --- a/scripts/ci-workflow.test.mjs +++ b/scripts/ci-workflow.test.mjs @@ -23,7 +23,7 @@ test("the required gate rejects failures and only accepts explicitly optional sk assert.match(gate, /if: \$\{\{ !cancelled\(\)/); assert.match( gate, - /needs: \[changes, rust-tests, sv-tests, arm64-backend, napi-linux, napi-wasm, external-suites\]/, + /needs: \[changes, rust-tests, rust-default-tests, sv-tests, arm64-backend, napi-linux, napi-wasm, external-suites\]/, ); assert.match( gate, @@ -39,6 +39,8 @@ test("the required gate rejects failures and only accepts explicitly optional sk CHANGES_RESULT: "success", RUST_REQUIRED: "true", RUST_RESULT: "success", + DEFAULT_REQUIRED: "true", + DEFAULT_RESULT: "success", SV_TESTS_REQUIRED: "true", SV_TESTS_RESULT: "success", ARM64_REQUIRED: "true", @@ -50,6 +52,9 @@ test("the required gate rejects failures and only accepts explicitly optional sk EXTERNAL_RESULT: "skipped", }; const cases = [ + { env: { ...success, DEFAULT_REQUIRED: "false", DEFAULT_RESULT: "skipped" }, passes: true }, + { env: { ...success, DEFAULT_REQUIRED: "", DEFAULT_RESULT: "skipped" }, passes: false }, + { env: { ...success, DEFAULT_REQUIRED: "false", DEFAULT_RESULT: "failure" }, passes: false }, { env: { ...success, RUST_REQUIRED: "", RUST_RESULT: "skipped" }, passes: false, @@ -69,6 +74,7 @@ test("the required gate rejects failures and only accepts explicitly optional sk for (const producer of [ "CHANGES_RESULT", "RUST_RESULT", + "DEFAULT_RESULT", "SV_TESTS_RESULT", "ARM64_RESULT", "NATIVE_RESULT", @@ -358,7 +364,7 @@ test("PR caches cannot evict the shared default-branch Rust caches", () => { / - uses: Swatinem\/rust-cache@v2\n([\s\S]*?)(?=\n -|\n [a-z]|$)/g, ), ]; - assert.equal(cacheSteps.length, 9); + assert.equal(cacheSteps.length, 10); for (const [, step] of cacheSteps) { assert.match( step, @@ -378,7 +384,7 @@ test("cache warming shares the Rust Tests key and builds without running tests", assert.match(warm, /cancel-in-progress: false/); assert.doesNotMatch( warm, - /pull_request:|cargo nextest run|cargo test|shared-key:/, + /pull_request:|cargo nextest run|shared-key:/, ); assert.match(warm, /steps.cache.outputs.cache-hit != 'true'/); for (const text of [warm, job("rust-tests")]) { @@ -389,7 +395,7 @@ test("cache warming shares the Rust Tests key and builds without running tests", assert.match(warm, /"scripts\/run-vtest.mjs"/); assert.match( warm, - /cargo nextest list --locked --workspace --message-format json/, + /cargo nextest list --locked --workspace --exclude 'lydite\*' --message-format json/, ); const features = job("rust-tests").match(/--features (\S+)/)[1]; assert.ok(warm.includes(`--features ${features}`)); @@ -492,13 +498,55 @@ test("scoped checks preserve full-run fallbacks and use their own package scopes assert.match(lint, /name: Build the API documentation this pull request can affect\n if: .*outputs\.rust_doc_libraries != ''/); }); -test("cocotb retains Celox features without enabling unrelated adapter features", () => { +test("cocotb reuses the original scoped Cargo build", () => { + const builds = [{ packages: ["celox", "celox-vpi", "celox-test-suite"], targets: [], + features: ["celox/systemverilog", "celox-test-suite/icarus"] }]; const args = cargoArguments("rust-tests", "Run cocotb VPI end-to-end test", { - FEATURES: "celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus", + RUST_FULL: "false", BUILDS: JSON.stringify(builds), }); - assert.deepEqual(args, ["test", "--locked", "-p", "celox-vpi", "--features", "systemverilog", "--features", "celox/systemverilog", "--test", "cocotb_e2e", - "cocotb_", "--", "--ignored"]); - assert.match(job("rust-tests"), /name: Run cocotb VPI end-to-end test\n if: needs.changes.outputs.rust_vpi_e2e != 'false'/); + assert.deepEqual(args, ["nextest", "run", "--locked", "--profile", "ci", + "-p", "celox", "-p", "celox-vpi", "-p", "celox-test-suite", "--features", + "celox/systemverilog,celox-test-suite/icarus,celox-test-suite/runtime-cases", + "-E", 'binary_id(celox-vpi::cocotb_e2e) & test(/^cocotb_/)', "--run-ignored", "only"]); +}); + +test("full cocotb runs reuse the workspace build and report failures before upload", () => { + const rust = job("rust-tests"); + const full = rust.match(/run: >-\n\s+(cargo nextest run[^\n]*)\n\s+(--features [^\n]*)/); + assert.ok(full); + const original = `${full[1]} ${full[2]}`.replaceAll("'", "").split(/\s+/).slice(1); + const args = cargoArguments("rust-tests", "Run cocotb VPI end-to-end test", { RUST_FULL: "true" }); + assert.deepEqual(args.slice(0, -4), original); + assert.ok(rust.indexOf("Collect Rust test reports") < rust.indexOf("Run cocotb VPI end-to-end test")); + assert.ok(rust.indexOf("Run cocotb VPI end-to-end test") < rust.indexOf("Retain Rust test reports")); + assert.match(rust, /test_step_outcome: .*steps.cocotb-tests.outcome == 'failure' && 'failure'/); +}); + +test("default-feature validation is parallel and mandatory when selected", () => { + const defaults = job("rust-default-tests"); + assert.match(defaults, /needs: changes/); + assert.match(defaults, /needs.changes.result != 'success'/); + assert.match(defaults, /outputs.rust_full != 'false'/); + assert.match(defaults, /outputs.rust_libraries/); + assert.match(defaults, /cargo test --locked -p celox --lib/); + assert.match(defaults, /cargo test --locked -p celox --doc/); + assert.doesNotMatch(defaults, /--features|--no-default-features/); + assert.doesNotMatch(job("rust-tests"), /cargo test --locked -p celox --lib/); + assert.match(job("rust"), /DEFAULT_RESULT: .*needs.rust-default-tests.result/); + assert.match(job("report-full-validation"), /rust-default-tests,/); +}); + +test("CI retains the normal test profile and warms each platform's cache", () => { + const rust = job("rust-tests"); + assert.doesNotMatch(rust, /--cargo-profile/); + assert.match(rust, /cargo test --locked --workspace/); + const warm = readFileSync(new URL("../.github/workflows/rust-cache.yml", import.meta.url), "utf8"); + const windows = warm.split(" napi-windows:")[1]; + assert.match(windows, /runs-on: windows-latest/); + assert.match(windows, /run: pnpm run build:napi/); + assert.match(windows, /steps.cache.outputs.cache-hit != 'true'/); + assert.match(windows, /if: github.ref == format/); + assert.match(warm, /rust-default-tests:[\s\S]*cargo test --locked -p celox --lib --no-run/); }); test("full Clippy validation covers every workspace crate", () => { diff --git a/scripts/run-ci-cocotb.mjs b/scripts/run-ci-cocotb.mjs new file mode 100644 index 00000000000..30765f798c0 --- /dev/null +++ b/scripts/run-ci-cocotb.mjs @@ -0,0 +1,39 @@ +import { spawnSync } from "node:child_process"; +import { pathToFileURL } from "node:url"; +import { clearCurrentReport, saveCurrentReport } from "./ci-rust-reports.mjs"; +import { cargoCommands } from "./run-ci-rust-scope.mjs"; + +export const cocotbFilter = 'binary_id(celox-vpi::cocotb_e2e) & test(/^cocotb_/)'; + +// Keep exactly the original packages, features, targets and Cargo profile. +// Narrowing -p to celox-vpi would resolve a different dependency feature graph. +export function cocotbCommands(full, builds) { + if (full !== "false") return [[ + "nextest", "run", "--locked", "--workspace", "--exclude", "lydite*", + "--profile", "ci", + "--features", "celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases", + "--run-ignored", "only", "-E", cocotbFilter, + ]]; + // Validate all plans first, including ones we do not need to execute. + const commands = cargoCommands("test", builds, cocotbFilter); + const selected = commands.filter((_, i) => builds[i].packages.includes("celox-vpi") + && (!builds[i].targets.length || builds[i].targets.includes("cocotb_e2e"))); + if (!selected.length) throw new Error("Cocotb CI requires a VPI test build"); + return selected.map(args => [ + ...args.filter(arg => arg !== "--no-tests=pass"), "--run-ignored", "only", + ]); +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + if (!process.env.CELOX_COCOTB_PYTHON) throw new Error("Cocotb Python interpreter is required"); + let reportIndex = 0; + for (const args of cocotbCommands(process.env.RUST_FULL, + process.env.RUST_FULL === "false" ? JSON.parse(process.env.BUILDS) : null)) { + if (process.env.CELOX_CI_REPORT_DIR) clearCurrentReport(); + const result = spawnSync("cargo", args, { stdio: "inherit" }); + if (process.env.CELOX_CI_REPORT_DIR) + saveCurrentReport(process.env.CELOX_CI_REPORT_DIR, `cocotb-${reportIndex++}`); + if (result.error) throw result.error; + if (result.status !== 0) process.exit(result.status ?? 1); + } +} diff --git a/scripts/run-ci-cocotb.test.mjs b/scripts/run-ci-cocotb.test.mjs new file mode 100644 index 00000000000..a53a46060d6 --- /dev/null +++ b/scripts/run-ci-cocotb.test.mjs @@ -0,0 +1,57 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { spawnSync } from "node:child_process"; +import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { cocotbCommands, cocotbFilter } from "./run-ci-cocotb.mjs"; +import { cargoCommands } from "./run-ci-rust-scope.mjs"; + +test("cocotb preserves build resolution and selects only its ignored tests", () => { + const builds = [ + { packages: ["celox-heap"], targets: [], features: [] }, + { packages: ["celox", "celox-vpi"], targets: [], features: ["celox/systemverilog"] }, + ]; + const original = structuredClone(builds); + const expected = cargoCommands("test", builds, cocotbFilter)[1] + .filter(arg => arg !== "--no-tests=pass"); + assert.deepEqual(cocotbCommands("false", builds), [[...expected, "--run-ignored", "only"]]); + assert.deepEqual(builds, original); + for (const full of ["true", "", undefined]) { + const [args] = cocotbCommands(full, null); + assert.ok(args.includes("--workspace")); + assert.ok(!args.includes("--cargo-profile")); + assert.ok(!args.includes("--no-tests=pass")); + assert.deepEqual(args.slice(-4), ["--run-ignored", "only", "-E", cocotbFilter]); + } +}); + +test("missing or wrong VPI targets fail closed", () => { + for (const builds of [[], [{ packages: ["celox"], targets: [], features: [] }], + [{ packages: ["celox-vpi"], targets: ["other_test"], features: [] }]]) + assert.throws(() => cocotbCommands("false", builds)); + const [args] = cocotbCommands("false", [{ packages: ["celox-vpi"], targets: ["cocotb_e2e"], features: [] }]); + assert.equal(args[args.indexOf("--test") + 1], "cocotb_e2e"); +}); + +test("cocotb requires Python and propagates Cargo failures without running later plans", () => { + const directory = mkdtempSync(join(tmpdir(), "celox-cocotb-command-")); + try { + const executable = join(directory, "cargo"); + const log = join(directory, "calls"); + writeFileSync(executable, '#!/bin/sh\necho called >> "$COCOTB_CALL_LOG"\nexit 17\n'); + chmodSync(executable, 0o755); + const build = { packages: ["celox-vpi"], targets: [], features: [] }; + const env = { ...process.env, RUST_FULL: "false", BUILDS: JSON.stringify([build, build]), + PATH: `${directory}:${process.env.PATH}`, COCOTB_CALL_LOG: log, + CELOX_CI_REPORT_DIR: "", CELOX_COCOTB_PYTHON: "" }; + const missing = spawnSync(process.execPath, ["scripts/run-ci-cocotb.mjs"], { env, encoding: "utf8" }); + assert.notEqual(missing.status, 0); + assert.match(missing.stderr, /Python interpreter is required/); + const failed = spawnSync(process.execPath, ["scripts/run-ci-cocotb.mjs"], { + env: { ...env, CELOX_COCOTB_PYTHON: "/test/python" }, encoding: "utf8", + }); + assert.equal(failed.status, 17); + assert.equal(readFileSync(log, "utf8"), "called\n"); + } finally { rmSync(directory, { recursive: true, force: true }); } +});