Skip to content

Commit 3912ed1

Browse files
mjp41Copilot
andcommitted
coverage CI: fix four CI failures
- Validation regex: allow `.` in coverage-artifact-name so matrix labels like `ubuntu-24.04` pass. - FreeBSD: llvm19 port installs versioned binaries (clang19, clang++19, llvm-cov19, llvm-profdata19) directly under /usr/local/bin/, not /usr/local/llvm19/bin/. Update absolute paths. - macOS: brew clang on the Apple SDK warns -Wundef on the SDK's `__STDC_VERSION__` check because brew clang doesn't treat the SDK as system headers by default. Export SDKROOT in the dependencies step so brew clang picks up the SDK as a sysroot (system include path), suppressing -Wundef in those headers. - Self-host coverage export: ls with two glob arguments returns nonzero when one glob has no match (e.g. .dylib on Linux), and pipefail propagated the failure. Use bash nullglob + array instead. Co-authored-by: Copilot <copilot@github.com>
1 parent 193777b commit 3912ed1

3 files changed

Lines changed: 27 additions & 19 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ jobs:
5353
# `xcrun`). The coverage target's find_program(LLVM_COV ...)
5454
# only looks for unversioned/-19/-15 names, so we install
5555
# llvm@19 via brew and pass the explicit binary paths.
56-
dependencies: 'brew install --quiet ninja llvm@19'
56+
#
57+
# SDKROOT is exported in the dependencies step so brew
58+
# clang treats the Apple SDK as a system header path,
59+
# which suppresses -Wundef on Apple's _STDC_VERSION_
60+
# check inside <sys/cdefs.h>.
61+
dependencies: |
62+
brew install --quiet ninja llvm@19
63+
echo "SDKROOT=$(xcrun --show-sdk-path)" >> "$GITHUB_ENV"
5764
extra-cmake-flags: >-
5865
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm@19/bin/clang++
5966
-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm@19/bin/clang
@@ -114,20 +121,17 @@ jobs:
114121
- label: freebsd-14
115122
vm-type: freebsd
116123
vm-version: '14.1'
117-
# FreeBSD's llvm19 port installs binaries with a numeric
118-
# suffix and no dash (clang19, llvm-cov19,
119-
# llvm-profdata19) under /usr/local/llvm19/bin/. The base
120-
# CMakeLists.txt's find_program list only knows the
121-
# dashed forms (-19/-15) and bare names; we sidestep the
122-
# search entirely by passing absolute paths via -D so the
123-
# find_program cache is preset with a fully-qualified
124-
# binary that doesn't depend on PATH.
124+
# FreeBSD's llvm19 port installs versioned binaries
125+
# (clang19, clang++19, llvm-cov19, llvm-profdata19)
126+
# directly under /usr/local/bin/ — not under a
127+
# /usr/local/llvm19/bin/ subtree. Pass absolute paths so
128+
# find_program is preset and doesn't depend on PATH.
125129
dependencies: 'pkg install -y cmake ninja llvm19'
126130
cmake-flags: >-
127-
-DCMAKE_CXX_COMPILER=/usr/local/llvm19/bin/clang++19
128-
-DCMAKE_C_COMPILER=/usr/local/llvm19/bin/clang19
129-
-DLLVM_COV=/usr/local/llvm19/bin/llvm-cov19
130-
-DLLVM_PROFDATA=/usr/local/llvm19/bin/llvm-profdata19
131+
-DCMAKE_CXX_COMPILER=/usr/local/bin/clang++19
132+
-DCMAKE_C_COMPILER=/usr/local/bin/clang19
133+
-DLLVM_COV=/usr/local/bin/llvm-cov19
134+
-DLLVM_PROFDATA=/usr/local/bin/llvm-profdata19
131135
- label: netbsd-10
132136
vm-type: netbsd
133137
vm-version: '10.0'

.github/workflows/reusable-cmake-build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jobs:
8787
tests|tests+selfhost) ;;
8888
*) echo "::error::coverage-mode must be one of: off, tests, tests+selfhost (got '${{ inputs.coverage-mode }}')" ; exit 1 ;;
8989
esac
90-
if ! [[ "${{ inputs.coverage-artifact-name }}" =~ ^[A-Za-z0-9_-]+$ ]]; then
91-
echo "::error::coverage-artifact-name must match ^[A-Za-z0-9_-]+\$ when coverage-mode != 'off' (got '${{ inputs.coverage-artifact-name }}')"
90+
if ! [[ "${{ inputs.coverage-artifact-name }}" =~ ^[A-Za-z0-9._-]+$ ]]; then
91+
echo "::error::coverage-artifact-name must match ^[A-Za-z0-9._-]+\$ when coverage-mode != 'off' (got '${{ inputs.coverage-artifact-name }}')"
9292
exit 1
9393
fi
9494
@@ -203,11 +203,15 @@ jobs:
203203
# libsnmallocshim-checks.so) the caller is expected to schedule
204204
# one matrix leg per variant; this step exports against whichever
205205
# one is present in libs/.
206-
shim=$(ls libs/libsnmallocshim*.so libs/libsnmallocshim*.dylib 2>/dev/null | head -1)
207-
if [ -z "$shim" ]; then
206+
# Glob via bash nullglob so a missing pattern (e.g. no .dylib on
207+
# Linux) doesn't fail the pipeline under `pipefail`.
208+
shopt -s nullglob
209+
shims=( libs/libsnmallocshim*.so libs/libsnmallocshim*.dylib )
210+
if [ ${#shims[@]} -eq 0 ]; then
208211
echo "::error::no shim built; cannot export selfhost coverage"
209212
exit 1
210213
fi
214+
shim="${shims[0]}"
211215
llvm-profdata merge -sparse profiles/selfhost-*.profraw -o selfhost.profdata
212216
llvm-cov export -format=json -instr-profile=selfhost.profdata \
213217
-object "$shim" > selfhost.json

.github/workflows/reusable-vm-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
tests) ;;
6161
*) echo "::error::coverage-mode must be one of: off, tests (got '${{ inputs.coverage-mode }}')" ; exit 1 ;;
6262
esac
63-
if ! [[ "${{ inputs.coverage-artifact-name }}" =~ ^[A-Za-z0-9_-]+$ ]]; then
64-
echo "::error::coverage-artifact-name must match ^[A-Za-z0-9_-]+\$ when coverage-mode != 'off' (got '${{ inputs.coverage-artifact-name }}')"
63+
if ! [[ "${{ inputs.coverage-artifact-name }}" =~ ^[A-Za-z0-9._-]+$ ]]; then
64+
echo "::error::coverage-artifact-name must match ^[A-Za-z0-9._-]+\$ when coverage-mode != 'off' (got '${{ inputs.coverage-artifact-name }}')"
6565
exit 1
6666
fi
6767

0 commit comments

Comments
 (0)