Skip to content

Commit 996c3d7

Browse files
committed
fix allocator-bench
1 parent 1792bcf commit 996c3d7

5 files changed

Lines changed: 25 additions & 3 deletions

File tree

.github/scripts/allocator_bench_alpine.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@ docker run --rm \
3434
# actions/upload-artifact can read them.
3535
sudo chown -R "$(id -u):$(id -g)" . 2>/dev/null || true
3636

37-
cat alpine-summary.md >> "$GITHUB_STEP_SUMMARY"
37+
# Cosmetic, like the summary itself: the measured rows live in
38+
# bench-results.tsv and are uploaded regardless.
39+
if [ -f alpine-summary.md ]; then
40+
cat alpine-summary.md >> "$GITHUB_STEP_SUMMARY"
41+
else
42+
echo "::warning::no alpine-summary.md (results are still in bench-results.tsv)"
43+
fi

.github/scripts/allocator_bench_report.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ cell_id="$2"
2828
a[j + 1] = t
2929
}
3030
}
31-
function stat(src, n, out, i, s[1], d[1], med) {
31+
# s and d are locals: awk gives a function extra parameters as fresh
32+
# locals, and they become arrays on first subscripted use. They must be
33+
# named plainly - "s[1]" in a parameter list is a syntax error, and mawk
34+
# (the default awk on Ubuntu runners) reports it as one.
35+
function stat(src, n, out, i, s, d, med) {
3236
for (i = 1; i <= n; i++) s[i] = src[i]
3337
isort(s, n); med = median(s, n)
3438
for (i = 1; i <= n; i++) d[i] = (s[i] > med) ? s[i] - med : med - s[i]

.github/scripts/allocator_bench_unix.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,13 @@ done
211211
IFS="$old_ifs"
212212
done
213213

214+
# The summary is cosmetic; bench-results.tsv is the artifact that matters and
215+
# the aggregate job reads that, not this. A formatting bug here must never
216+
# discard a cell that already ran to completion - which is exactly what an awk
217+
# syntax error did once, throwing away every measured repetition of the job.
214218
echo "$cells" | while read -r cell; do
215219
if [ -n "$cell" ]; then
216-
sh .github/scripts/allocator_bench_report.sh "$results" "$cell"
220+
sh .github/scripts/allocator_bench_report.sh "$results" "$cell" \
221+
|| echo "::warning::summary failed for $cell (results are still in $results)" >&2
217222
fi
218223
done

.github/scripts/allocator_bench_windows.ps1

100755100644
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ foreach ($workload in $workloads) {
201201

202202
# Median rather than mean, MAD rather than stddev: with 5 reps a single
203203
# descheduled run would drag a mean far enough to invent a difference.
204+
# Wrapped because the summary is cosmetic: bench-results.tsv is the
205+
# artifact the aggregate job reads, and a formatting bug must not discard
206+
# a cell that already ran to completion.
207+
try {
204208
$summary = @("### $cellId", '',
205209
"reps: $($rows.Count) &nbsp;&nbsp; cores: $cores &nbsp;&nbsp; rustc: $toolchain &nbsp;&nbsp; exe: $exeSha", '',
206210
'| metric | median | MAD |', '| --- | ---: | ---: |')
@@ -213,5 +217,8 @@ foreach ($workload in $workloads) {
213217
}
214218
$summary += ''
215219
($summary -join "`n") | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8
220+
} catch {
221+
Write-Host "::warning::summary failed for $cellId ($($_.Exception.Message)); results are still in $results"
222+
}
216223
}
217224
}

bench/gen_corpus.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)