Skip to content

Commit d990a85

Browse files
committed
ci(test): strip test binaries and record CI resource usage
--all-features test binaries statically link the full dependency closure across hundreds of binaries, running target/ up to roughly 100 GB and exhausting a stock runner's disk mid-link, where the linker's mmap-backed write aborts with SIGBUS instead of a clean ENOSPC. Stripping symbols from test binaries removes over a third of each one, and recording memory/disk/CPU before and after the build makes future exhaustion attributable instead of read as a linker crash.
1 parent aca1934 commit d990a85

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,19 @@ jobs:
7575
runs-on: ubuntu-latest
7676
steps:
7777
- uses: actions/checkout@v7
78-
- name: Free disk space
79-
# The --all-features suite links hundreds of statically linked test
80-
# binaries into target/; on a stock runner that fills the root disk,
81-
# and the linker (rust-lld) then fails its mmap-backed output write
82-
# with SIGBUS (signal 7) at link time. Reclaim the large preinstalled
83-
# toolchains this build never uses so the link always has headroom.
78+
- name: Reclaim disk and record resources
79+
# Building the workspace's test binaries with --all-features writes on
80+
# the order of 100 GB into target/: every test binary statically links
81+
# the full dependency closure and lands in the hundreds of MB, and there
82+
# are hundreds of them. A stock runner starts with barely more free
83+
# space than that, and when it runs out mid-link the linker's
84+
# memory-mapped write aborts with SIGBUS (signal 7) rather than a clean
85+
# ENOSPC — which reads like a linker crash and not a full disk.
86+
#
87+
# Reclaim the large preinstalled toolchains this build never uses, then
88+
# record the resources a failed mmap actually depends on. The `df` runs
89+
# BEFORE the build, so it shows the headroom available to it, not what
90+
# remained; read it as the budget, not the outcome.
8491
run: |
8592
sudo rm -rf \
8693
/usr/local/lib/android \
@@ -89,7 +96,9 @@ jobs:
8996
/opt/hostedtoolcache/CodeQL \
9097
/usr/share/swift
9198
sudo docker image prune -af || true
92-
df -h /
99+
echo "== memory =="; free -h
100+
echo "== filesystems =="; df -h / /tmp /dev/shm
101+
echo "== cpus =="; nproc
93102
- name: Install Rust
94103
uses: dtolnay/rust-toolchain@stable
95104
- uses: Swatinem/rust-cache@v2
@@ -119,6 +128,15 @@ jobs:
119128
--all-features \
120129
--cargo-profile ci --profile ci \
121130
--no-fail-fast
131+
- name: Record disk after build
132+
if: always()
133+
# Counterpart to the pre-build reading: that one is the budget, this is
134+
# what the build actually left. Runs even on failure, so a linker abort
135+
# can be attributed to a full disk instead of inferred. `target/` is
136+
# reported separately because it is what grows.
137+
run: |
138+
echo "== filesystems =="; df -h / /tmp /dev/shm
139+
echo "== target/ =="; du -sh target 2>/dev/null || true
122140
- name: Upload JUnit report
123141
if: always()
124142
uses: actions/upload-artifact@v7

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,15 @@ debug = false
273273
inherits = "dev"
274274
debug = false
275275
incremental = false
276+
# Drop symbol tables from the linked test binaries. With --all-features every
277+
# test binary statically links the full dependency closure, and there are
278+
# hundreds of them, so target/ runs to roughly 100 GB — enough to exhaust a CI
279+
# runner mid-link, where the linker's memory-mapped write aborts with SIGBUS
280+
# instead of reporting a full disk. Stripping removes better than a third of
281+
# each binary, which is the difference between fitting and not. Backtraces here
282+
# are already unsymbolised (`debug = false`), so this costs no diagnostic value
283+
# the profile had.
284+
strip = true
276285

277286
[profile.debugging]
278287
inherits = "dev"

0 commit comments

Comments
 (0)