Skip to content

Commit 79af5e7

Browse files
Felixoidsylvestre
authored andcommitted
Add failing test for cmake-modules + cmake 4 version
1 parent 5a08572 commit 79af5e7

4 files changed

Lines changed: 85 additions & 1 deletion

File tree

tests/integration/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export SCCACHE_PATH := /sccache/target/debug/sccache
2323
endif
2424

2525
BACKENDS := redis redis-deprecated memcached memcached-deprecated s3 azblob webdav basedirs
26-
TOOLS := gcc clang cmake cmake-modules autotools coverage zstd
26+
TOOLS := gcc clang cmake cmake-modules cmake-modules-v4 autotools coverage zstd
2727

2828
# Map backends to their compose profiles
2929
PROFILES_autotools := autotools
@@ -32,6 +32,7 @@ PROFILES_basedirs := basedirs redis memcached s3 azblob webdav
3232
PROFILES_clang := clang
3333
PROFILES_cmake := cmake
3434
PROFILES_cmake-modules := cmake-modules
35+
PROFILES_cmake-modules-v4 := cmake-modules-v4
3536
PROFILES_coverage := coverage
3637
PROFILES_gcc := gcc
3738
PROFILES_memcached := memcached
@@ -49,6 +50,7 @@ SERVICES_basedirs := redis memcached minio minio-setup azurite azurite-setup web
4950
SERVICES_clang :=
5051
SERVICES_cmake :=
5152
SERVICES_cmake-modules :=
53+
SERVICES_cmake-modules-v4 :=
5254
SERVICES_coverage :=
5355
SERVICES_gcc :=
5456
SERVICES_memcached := memcached
@@ -81,6 +83,7 @@ help:
8183
@echo "Build System Tests:"
8284
@echo " make test-cmake Run CMake integration test"
8385
@echo " make test-cmake-modules Run CMake C++20 modules test"
86+
@echo " make test-cmake-modules-v4 Run CMake 4.x C++20 modules test (xfail)"
8487
@echo " make test-autotools Run Autotools integration test"
8588
@echo ""
8689
@echo "Advanced Tests:"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM silkeh/clang:21-trixie
2+
RUN apt-get update -qq && apt-get install -y -qq ninja-build python3 python3-pip \
3+
&& pip install --break-system-packages cmake \
4+
&& rm -rf /var/lib/apt/lists/*

tests/integration/docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,19 @@ services:
285285
- test
286286
- cmake-modules
287287

288+
test-cmake-modules-v4:
289+
<<: *test-runner
290+
build:
291+
context: .
292+
dockerfile: cmake-modules-v4.Dockerfile
293+
entrypoint: /sccache/tests/integration/scripts/test-cmake-modules-v4.sh
294+
environment:
295+
<<: *common-env
296+
SCCACHE_DIR: /build/sccache
297+
profiles:
298+
- test
299+
- cmake-modules-v4
300+
288301
test-autotools:
289302
<<: *test-runner
290303
image: gcc:latest
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# XFAIL: cmake 4.x generates arguments that trigger sccache's @ response file
5+
# rejection in gcc.rs:349. This test tracks the issue and captures the actual
6+
# compiler commands for debugging.
7+
8+
SCCACHE="${SCCACHE_PATH:-/sccache/target/debug/sccache}"
9+
10+
echo "=========================================="
11+
echo "Testing: CMake 4.x C++20 Modules (XFAIL)"
12+
echo "=========================================="
13+
14+
echo "cmake version: $(cmake --version | head -1)"
15+
echo "clang version: $(clang++ --version | head -1)"
16+
17+
# Copy cmake-modules project to writable location
18+
cp -r /sccache/tests/integration/cmake-modules /build/cmake-modules
19+
20+
# Start sccache server
21+
"$SCCACHE" --start-server || true
22+
23+
echo ""
24+
echo "Build 1: Capture compiler commands"
25+
cd /build/cmake-modules
26+
cmake -B build -G Ninja \
27+
-DCMAKE_C_COMPILER=clang \
28+
-DCMAKE_CXX_COMPILER=clang++ \
29+
-DCMAKE_C_COMPILER_LAUNCHER="$SCCACHE" \
30+
-DCMAKE_CXX_COMPILER_LAUNCHER="$SCCACHE"
31+
32+
echo ""
33+
echo "=== Ninja build rules (grep for @ in commands) ==="
34+
grep '@' build/build.ninja || echo "(no @ found in build.ninja)"
35+
36+
echo ""
37+
echo "=== Full compiler commands (ninja -v) ==="
38+
cmake --build build -- -v 2>&1 | cat
39+
40+
echo ""
41+
echo "=== sccache stats ==="
42+
"$SCCACHE" --show-stats
43+
44+
STATS_JSON=$("$SCCACHE" --show-stats --stats-format=json)
45+
NOT_CACHED=$(echo "$STATS_JSON" | python3 -c "import sys, json; print(json.load(sys.stdin).get('stats', {}).get('not_cached', {}).get('@', 0))")
46+
CACHE_HITS=$(echo "$STATS_JSON" | python3 -c "import sys, json; stats = json.load(sys.stdin).get('stats', {}); print(stats.get('cache_hits', {}).get('counts', {}).get('C/C++', 0))")
47+
48+
echo ""
49+
echo "Cache hits: $CACHE_HITS"
50+
echo "Non-cacheable @: $NOT_CACHED"
51+
52+
if [ "$CACHE_HITS" -gt 0 ]; then
53+
echo "XPASS: CMake 4.x C++20 modules now cacheable! Remove XFAIL status."
54+
exit 1
55+
fi
56+
57+
if [ "$NOT_CACHED" -gt 0 ]; then
58+
echo "XFAIL: cmake 4.x @ issue reproduced (expected failure)"
59+
exit 0
60+
fi
61+
62+
echo "FAIL: Unexpected failure"
63+
echo "$STATS_JSON" | python3 -m json.tool
64+
exit 1

0 commit comments

Comments
 (0)