Merge pull request 'Verify containers share cargo's package-cache lock: mount the shared volume as CARGO_HOME' (#43) from eureka-substrate/mutants-sccache into main

This commit is contained in:
Eureka 2026-11-03 01:37:08 +00:00
commit 8b17ed5ff5
3 changed files with 12 additions and 8 deletions

View file

@ -135,11 +135,13 @@ if [ "$1" = --host ]; then
trap cleanup EXIT; trap 'exit 143' TERM INT HUP trap cleanup EXIT; trap 'exit 143' TERM INT HUP
killed() { [ -n "${YGG_KILLED:-}" ] && [ -e "$YGG_KILLED" ]; } killed() { [ -n "${YGG_KILLED:-}" ] && [ -e "$YGG_KILLED" ]; }
now() { date +%s; } now() { date +%s; }
# The shared volume is CARGO_HOME itself so sibling containers share cargo's package-cache lock; a registry-only mount left
# the lock in each container's layer and concurrent unpacks removed each other's crate directories (2026-11-03).
# Every container carries the job label (the stopgap's watchdog kills by it) and the same caps. # Every container carries the job label (the stopgap's watchdog kills by it) and the same caps.
common=(--label "$YGG_LABEL" "--cpus=${YGG_CPUS:-4}" "--memory=${YGG_MEM:-6g}" common=(--label "$YGG_LABEL" "--cpus=${YGG_CPUS:-4}" "--memory=${YGG_MEM:-6g}"
-v "$YGG_WORK:/seed:ro" -v "$D:/cm:ro" -v /etc/machine-id:/etc/machine-id:ro -v "$YGG_WORK:/seed:ro" -v "$D:/cm:ro" -v /etc/machine-id:/etc/machine-id:ro
-v eureka-cargo-registry:/usr/local/cargo/registry -v eureka-nuget:/root/.nuget/packages -v eureka-sccache:/sccache -v eureka-cargo-home:/cargo-home -v eureka-nuget:/root/.nuget/packages -v eureka-sccache:/sccache
-e BASH_ENV=/tmp/.ygg-bash-env -e BASH_ENV=/tmp/.ygg-bash-env -e CARGO_HOME=/cargo-home
-e "WORKDIR=${WORKDIR:-.}" -e "BASE=$BASE" -e "TEST_ARGS=${TEST_ARGS:-}" -e "FILTERS=${FILTERS:-}" -e "CM_NAMES=${CM_NAMES:-}" -e "JOBS=$JOBS" -e "WORKDIR=${WORKDIR:-.}" -e "BASE=$BASE" -e "TEST_ARGS=${TEST_ARGS:-}" -e "FILTERS=${FILTERS:-}" -e "CM_NAMES=${CM_NAMES:-}" -e "JOBS=$JOBS"
-e "MIN_TEST_TIMEOUT=$MIN_TEST_TIMEOUT" -e "CONFIRM_TIMEOUT_MULT=$CONFIRM_TIMEOUT_MULT" -e "MIN_TEST_TIMEOUT=$MIN_TEST_TIMEOUT" -e "CONFIRM_TIMEOUT_MULT=$CONFIRM_TIMEOUT_MULT"
-e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e 'GIT_CONFIG_VALUE_0=*') -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e 'GIT_CONFIG_VALUE_0=*')
@ -208,7 +210,7 @@ if [ "$1" = --host ]; then
container_error() { # container_error <label> <out dir> container_error() { # container_error <label> <out dir>
local rc; rc=$(cat "$2/hostrc" 2>/dev/null) local rc; rc=$(cat "$2/hostrc" 2>/dev/null)
sum "ERROR $1 container exited ${rc:-?} (4 is a red baseline: the unmutated tests failed there)" sum "ERROR $1 container exited ${rc:-?} (4 is a red baseline: the unmutated tests failed there)"
tail -n 5 "$2/stdout" 2>/dev/null | sed "s|^|$SUMTAG: ERROR |" tail -n 25 "$2/stdout" 2>/dev/null | sed "s|^|$SUMTAG: ERROR |"
} }
# ---- stage 1: files whose filter selects tests (the plan container derived each file's filter and counted its tests) # ---- stage 1: files whose filter selects tests (the plan container derived each file's filter and counted its tests)

View file

@ -122,8 +122,8 @@ if [ "$1" = --host ]; then
# Every container carries the job label (the stopgap's watchdog kills by it) and the same caps. # Every container carries the job label (the stopgap's watchdog kills by it) and the same caps.
common=(--label "$YGG_LABEL" "--cpus=${YGG_CPUS:-4}" "--memory=${YGG_MEM:-6g}" common=(--label "$YGG_LABEL" "--cpus=${YGG_CPUS:-4}" "--memory=${YGG_MEM:-6g}"
-v "$bundle:/mt:ro" -v /etc/machine-id:/etc/machine-id:ro -v "$bundle:/mt:ro" -v /etc/machine-id:/etc/machine-id:ro
-v eureka-cargo-registry:/usr/local/cargo/registry -v eureka-nuget:/root/.nuget/packages -v eureka-sccache:/sccache -v eureka-cargo-home:/cargo-home -v eureka-nuget:/root/.nuget/packages -v eureka-sccache:/sccache
-e BASH_ENV=/tmp/.ygg-bash-env -e BASH_ENV=/tmp/.ygg-bash-env -e CARGO_HOME=/cargo-home
-e "WORKDIR=${WORKDIR:-.}" -e "BUILD=${BUILD:-}" -e "TEST=${TEST:-}" -e "MUT_TIMEOUT=${MUT_TIMEOUT:-600}" -e "JOB_TIMEOUT=${JOB_TIMEOUT:-}" -e "WORKDIR=${WORKDIR:-.}" -e "BUILD=${BUILD:-}" -e "TEST=${TEST:-}" -e "MUT_TIMEOUT=${MUT_TIMEOUT:-600}" -e "JOB_TIMEOUT=${JOB_TIMEOUT:-}"
-e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e 'GIT_CONFIG_VALUE_0=*') -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e 'GIT_CONFIG_VALUE_0=*')
[ -z "${YGG_NONCE:-}" ] || common+=(-e "YGG_NONCE=$YGG_NONCE") [ -z "${YGG_NONCE:-}" ] || common+=(-e "YGG_NONCE=$YGG_NONCE")

View file

@ -20,7 +20,7 @@
# the commit out detached. It is a real clone, not a worktree, because a # the commit out detached. It is a real clone, not a worktree, because a
# worktree's .git file points at a host path the container cannot see. # worktree's .git file points at a host path the container cannot see.
# 3. Runs <command> in <image> under a CPU and memory cap, niced. Each # 3. Runs <command> in <image> under a CPU and memory cap, niced. Each
# toolchain gets one shared registry cache. The build output directory # toolchain gets one shared cargo home (registry and package-cache lock). The build output directory
# stays inside the work directory and is never shared between checkouts. # stays inside the work directory and is never shared between checkouts.
# CARGO_TARGET_DIR is deliberately NOT set: cargo's default (<workspace>/ # CARGO_TARGET_DIR is deliberately NOT set: cargo's default (<workspace>/
# target) is already inside /src, and forcing it made cargo-mutants' --jobs # target) is already inside /src, and forcing it made cargo-mutants' --jobs
@ -405,10 +405,12 @@ else
# Priority is set inside the container: nice on the docker client does not reach a process # Priority is set inside the container: nice on the docker client does not reach a process
# containerd starts. Jobs run at nice 10 and idle IO class, so the swarm's daemons and turns # containerd starts. Jobs run at nice 10 and idle IO class, so the swarm's daemons and turns
# on the same disk go first (2026-10-31: three verify jobs held IO pressure at ~75% full). # on the same disk go first (2026-10-31: three verify jobs held IO pressure at ~75% full).
# Cargo's package-cache lock lives in $CARGO_HOME, so the shared volume is CARGO_HOME itself: a registry-only mount left the
# lock in each container's layer and sibling containers unpacking one crate removed each other's directories (2026-11-03).
sudo docker run --rm --name "$cname" --label "$label" --cpus="$cpus" --memory="$mem" \ sudo docker run --rm --name "$cname" --label "$label" --cpus="$cpus" --memory="$mem" \
-v "$work:/src" -v /etc/machine-id:/etc/machine-id:ro \ -v "$work:/src" -v /etc/machine-id:/etc/machine-id:ro \
-v eureka-cargo-registry:/usr/local/cargo/registry -v eureka-nuget:/root/.nuget/packages \ -v eureka-cargo-home:/cargo-home -v eureka-nuget:/root/.nuget/packages \
-v eureka-sccache:/sccache \ -v eureka-sccache:/sccache -e CARGO_HOME=/cargo-home \
-e BASH_ENV=/tmp/.ygg-bash-env ${nonce:+-e YGG_NONCE=$nonce} \ -e BASH_ENV=/tmp/.ygg-bash-env ${nonce:+-e YGG_NONCE=$nonce} \
-e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e GIT_CONFIG_VALUE_0='*' \ -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e GIT_CONFIG_VALUE_0='*' \
$docker_args \ $docker_args \