diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 35fa852..542a3a2 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -24,11 +24,17 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 90 env: - # Test builds without debug info, which mutation testing does not use. The job used to be - # stopped by the runner after 14-20 minutes, five runs in a row: measured on 2026-11-06 with - # the same flags, target is 4.0 GB and cargo-mutants' two build copies 9 GB, against the - # 14 GB disk of a standard runner. Without debug info target is 1.7 GB. + # Test builds without debug info, which mutation testing does not use: target is 1.7 GB + # instead of 4.0 GB (measured 2026-11-06), and the builds are faster. CARGO_PROFILE_DEV_DEBUG: "0" + # Test binaries run under a 4 GiB cap (scripts/memory-capped.sh); the builds do not. Some + # mutants (FrameReader::next_frame, complete_len, Master::receive handing back frames at + # once) make a read loop spin and grow the tests' traffic log until memory runs out: the + # runner died with "received a shutdown signal" before any result (runs 7 to 12; the disk + # was not the cause, 86 GB were free). Measured 2026-11-07: without the cap, 14.8 GB to + # under 2 GB available in 25-30 s per mutant; with it, the unmutated tests pass and the 7 + # such mutants are caught in 62 s, memory never under 12.6 GB. + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: ${{ github.workspace }}/scripts/memory-capped.sh steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: @@ -64,10 +70,6 @@ jobs: if: steps.results.outputs.cache-hit != 'true' run: mkdir -p dist - - name: Disk before mutating - if: steps.results.outputs.cache-hit != 'true' - run: df -h / && (du -sh src-tauri/target || true) - # --copy-target starts every scratch build from the restored dependency cache instead of # a cold build. Scope and analysed exclusions: src-tauri/.cargo/mutants.toml. The exit code # is stored with the results so a cached run is judged like a fresh one. @@ -79,11 +81,6 @@ jobs: cargo mutants -j 2 --timeout 60 --copy-target=true echo $? > mutants.out/exit-code - # Also after a failure: whether the disk was the limit is the question this answers. - - name: Disk after mutating - if: always() && steps.results.outputs.cache-hit != 'true' - run: df -h / - # Saved when the gate fails too: a measurement stays a measurement for this commit. # A run that did not finish (baseline failure, crash) is not saved. - name: Save this commit's mutation results diff --git a/scripts/memory-capped.sh b/scripts/memory-capped.sh new file mode 100755 index 0000000..3365956 --- /dev/null +++ b/scripts/memory-capped.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Runs a test binary with at most 4 GiB of address space, for mutation testing: a mutant that +# makes a loop spin fills the tests' traffic log until the runner dies with no result. Under +# the cap the allocation fails, the test aborts, and the mutant counts as caught. +ulimit -v 4194304 +exec "$@"