From 7e04bbd8277f614154bf8592f05d9ba98fd1297d Mon Sep 17 00:00:00 2001 From: Julian P Samaroo Date: Mon, 30 Nov 2026 20:57:03 -0700 Subject: [PATCH] Collect coverage from the MPI rank processes that run the tests The launcher selected only the Julia executable and dropped enabled coverage options; MPI tests ran but emitted no rank reports, leaving MPIExt unmeasured. Preserve user/all/path instrumentation and collect/upload coverage in only the existing latest-Julia two-rank CPU cell, using the current processcoverage/Codecov pattern. Other nine cells retain their usual cost; no threshold, credentials or executable MPI feature changes. The same launcher bytes pass real two-rank user/path/none execution controls and all-mode child flag assertions under emptyHOME/no-network/clearenv isolation. PID-qualified rank coverage files contain nonzero MPI extension execution counts. Static matrix expansion remains10cells with exactly1instrumented. Julia1.10/current source definitions confirm coverage modes and tracked_path layout. Written by an AI agent on jpsamaroo's review feedback. --- .github/workflows/CI.yml | 15 ++++++++++++++- AGENTS.md | 6 ++++++ test/mpi/run.jl | 16 +++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8767be61..e4fc9158e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -447,6 +447,11 @@ jobs: ranks: - 2 - 4 + include: + # Instrument one existing cell; the other nine keep their normal cost. + - version: '1' + ranks: 2 + coverage: true steps: - uses: actions/checkout@v7 - uses: julia-actions/setup-julia@v3 @@ -463,7 +468,15 @@ jobs: - name: Instantiate CPU MPI environment run: julia --project=test/mpi/env -e 'using Pkg; Pkg.develop([PackageSpec(path=pwd()), PackageSpec(path="lib/TimespanLogging")]); Pkg.instantiate()' - name: Run CPU MPI tests - run: julia --project=test/mpi/env test/mpi/run.jl ${{ matrix.ranks }} 2 test/mpi/cpu.jl + run: julia ${{ matrix.coverage && '--code-coverage=user' || '' }} --project=test/mpi/env test/mpi/run.jl ${{ matrix.ranks }} 2 test/mpi/cpu.jl + - uses: julia-actions/julia-processcoverage@v1 + if: matrix.coverage + - uses: codecov/codecov-action@v7 + if: matrix.coverage + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false mpi-opencl: # OpenCL runs against a CPU-backed ICD (no physical GPU required), unlike diff --git a/AGENTS.md b/AGENTS.md index ad8c5740e..b533f706c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1217,3 +1217,9 @@ this section verbatim). Each entry is one bullet starting with `- `. the protocol alone is not enough for them. Test with a remote reader *and* a remote writer, in both orders: in one process every slot is the argument itself, so none of this is visible. + +109. **Enable coverage in MPI ranks, not only in their launcher.** Selecting + `Base.julia_cmd().exec[1]` keeps the executable but drops coverage options. + A launcher can therefore be instrumented while the extension exercised by + every rank reports zero hits. Forward the enabled mode/path and merge the + PID-qualified rank reports. diff --git a/test/mpi/run.jl b/test/mpi/run.jl index a670d63fb..ec86deae2 100644 --- a/test/mpi/run.jl +++ b/test/mpi/run.jl @@ -16,9 +16,23 @@ script = ARGS[3] extra = ARGS[4:end] project = Base.active_project() juliabin = Base.julia_cmd().exec[1] +# Base.julia_cmd().exec[1] selects only the executable. Preserve enabled +# instrumentation explicitly so ranks emit coverage too. Each rank uses +# Julia's default PID-qualified .cov files, which the coverage action merges. +options = Base.JLOptions() +coverage_args = if options.code_coverage == 1 + ["--code-coverage=user"] +elseif options.code_coverage == 2 + ["--code-coverage=all"] +elseif options.code_coverage == 3 + ["--code-coverage=@$(unsafe_string(options.tracked_path))"] +else + String[] +end + MPI.mpiexec() do mpiexec - cmd = `$mpiexec -n $nranks $juliabin --project=$project --threads=$threads $script $extra` + cmd = `$mpiexec -n $nranks $juliabin $coverage_args --project=$project --threads=$threads $script $extra` @info "Launching MPI job" nranks threads script proc = run(ignorestatus(cmd)) exit(proc.exitcode)