Skip to content

Commit 2b8f674

Browse files
committed
fix: macOS E2E — skip Linux-specific tests + fix portability issues
- run_all.sh: skip tests that assume GCC/ELF/patchelf on macOS - sed -i → sed -i.bak for macOS compat (05, 09, 22) - target/x86_64-linux-*/ → target/*/ for platform-portable path (24, 25) Skipped on macOS (need future Clang/Mach-O adaptation): 03 (gcm BMI), 07/08 (ELF lib), 09 (gcm BMI), 20/21 (GCC P1689/dyndep), 22 (GCC fingerprint), 26/27/29 (GCC toolchain), 30 (patchelf), 33 (GCC mangling)
1 parent d650695 commit 2b8f674

6 files changed

Lines changed: 53 additions & 8 deletions

File tree

tests/e2e/05_errors.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ out=$("$MCPP" build 2>&1) && { echo "expected failure"; exit 1; }
6060
cd "$TMP"
6161
"$MCPP" new naming-ok > /dev/null
6262
cd naming-ok
63-
sed -i 's/name = "naming-ok"/name = "myorg.something"/' mcpp.toml
63+
sed -i.bak 's/name = "naming-ok"/name = "myorg.something"/' mcpp.toml && rm -f mcpp.toml.bak
6464
cat > src/foo.cppm <<'EOF'
6565
export module differentprefix;
6666
import std;

tests/e2e/09_path_dependency.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ grep -q 'mcpp.cache/mylibA.greet.gcm\|gcm.cache/mylibA.greet.gcm' "$ninja_file"
8181
# Path-resolution error reporting: declared name mismatch
8282
TMP2=$(mktemp -d)
8383
cp -r "$TMP/mylibA" "$TMP2/wrongname"
84-
sed -i 's/name = "mylibA"/name = "differentname"/' "$TMP2/wrongname/mcpp.toml"
84+
sed -i.bak 's/name = "mylibA"/name = "differentname"/' "$TMP2/wrongname/mcpp.toml" && rm -f "$TMP2/wrongname/mcpp.toml.bak"
8585
cat > mcpp.toml <<EOF
8686
[package]
8787
name = "myappB"

tests/e2e/22_doctor_cache_publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ out=$("$MCPP" cache list 2>&1)
3131
cd "$TMP"
3232
"$MCPP" new myapp >/dev/null
3333
cd myapp
34-
sed -i 's|^repo[[:space:]]*=.*|repo = "https://github.com/example/myapp"|' mcpp.toml
34+
sed -i.bak 's|^repo[[:space:]]*=.*|repo = "https://github.com/example/myapp"|' mcpp.toml && rm -f mcpp.toml.bak
3535
grep -q '^repo' mcpp.toml || cat >> mcpp.toml <<'EOF'
3636
3737
[package]

tests/e2e/24_git_dependency.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ rev = "$HEAD_REV"
7272
EOF
7373

7474
"$MCPP" build > build.log 2>&1
75-
triple=$(ls -d target/x86_64-linux-*/ | head -1)
75+
triple=$(ls -d target/*/ | head -1)
7676
fp_dir=$(ls "$triple")
7777
out=$(${triple}${fp_dir}/bin/myapp)
7878
[[ "$out" == *"hello from git dep"* ]] || {

tests/e2e/25_convention_mode.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ grep -q 'Inferred sources \[src/\*\*' build.log || { cat build.lo
2727
grep -q 'Inferred target tinyapp (bin from src/main.cpp)' build.log || { cat build.log; echo "FAIL: no Inferred target line"; exit 1; }
2828
grep -q 'Compiling tinyapp v0.1.0' build.log || { cat build.log; echo "FAIL: not compiling"; exit 1; }
2929

30-
triple=$(ls -d target/x86_64-linux-*/ | head -1)
30+
triple=$(ls -d target/*/ | head -1)
3131
fp_dir=$(ls "$triple")
3232
out=$("${triple}${fp_dir}/bin/tinyapp")
3333
[[ "$out" == "convention-mode bin OK" ]] || { echo "FAIL: runtime out='$out'"; exit 1; }
@@ -52,7 +52,7 @@ EOF
5252
"$MCPP" build > build.log 2>&1
5353
grep -q 'Inferred include_dirs \[include\]' build.log || {
5454
cat build.log; echo "FAIL: include/ not auto-picked"; exit 1; }
55-
triple=$(ls -d target/x86_64-linux-*/ | head -1)
55+
triple=$(ls -d target/*/ | head -1)
5656
fp_dir=$(ls "$triple")
5757
out=$("${triple}${fp_dir}/bin/inc")
5858
[[ "$out" == "answer = 42" ]] || { echo "FAIL: include resolution: $out"; exit 1; }
@@ -101,7 +101,7 @@ EOF
101101
if grep -q 'Inferred' build.log; then
102102
cat build.log; echo "FAIL: legacy schema fired Inferred banner unexpectedly"; exit 1
103103
fi
104-
triple=$(ls -d target/x86_64-linux-*/ | head -1)
104+
triple=$(ls -d target/*/ | head -1)
105105
fp_dir=$(ls "$triple")
106106
out=$("${triple}${fp_dir}/bin/legacy")
107107
[[ "$out" == "legacy schema OK" ]] || { echo "FAIL: legacy runtime: $out"; exit 1; }

tests/e2e/run_all.sh

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,58 @@ if [[ -z "${MCPP_HOME:-}" ]]; then
3131
fi
3232
echo "MCPP_HOME: $MCPP_HOME"
3333

34+
# Platform detection: some tests are Linux-only (ELF patchelf, musl-static,
35+
# GCC-specific BMI layout, etc.)
36+
OS="$(uname -s)"
37+
MACOS_SKIP=(
38+
# GCC-specific BMI assertions (gcm.cache/*.gcm)
39+
03_multi_module.sh
40+
# Static library test checks ELF ar output format
41+
07_static_library.sh
42+
# Shared library test hardcodes .so / ELF shared object
43+
08_shared_library.sh
44+
# Path dependency checks .gcm BMI format (GCC-specific)
45+
09_path_dependency.sh
46+
# Pack modes use patchelf (ELF-only)
47+
30_pack_modes.sh
48+
# Toolchain management tests assume GCC availability
49+
26_toolchain_management.sh
50+
29_toolchain_partial_versions.sh
51+
# P1689 scanner test hardcodes GCC ddi format
52+
20_p1689_scanner.sh
53+
# Ninja dyndep test hardcodes GCC module format
54+
21_ninja_dyndep.sh
55+
# Doctor/cache/publish uses GCC fingerprint
56+
22_doctor_cache_publish.sh
57+
# Self-contained home test assumes Linux sandbox layout
58+
27_self_contained_home.sh
59+
# Multi-version mangling test uses GCC module format
60+
33_multi_version_mangling.sh
61+
)
62+
63+
should_skip() {
64+
local name="$1"
65+
if [[ "$OS" == "Darwin" ]]; then
66+
for skip in "${MACOS_SKIP[@]}"; do
67+
[[ "$name" == "$skip" ]] && return 0
68+
done
69+
fi
70+
return 1
71+
}
72+
3473
PASS=0
3574
FAIL=0
75+
SKIP=0
3676
FAILED_TESTS=()
3777

3878
for test in "$HERE"/[0-9]*.sh; do
3979
name="$(basename "$test")"
4080
echo
81+
if should_skip "$name"; then
82+
echo "SKIP: $name (not applicable on $OS)"
83+
((SKIP++))
84+
continue
85+
fi
4186
echo "=== $name ==="
4287
if MCPP="$MCPP" bash "$test"; then
4388
echo "PASS: $name"
@@ -51,7 +96,7 @@ done
5196

5297
echo
5398
echo "==============================================="
54-
echo "E2E Summary: $PASS passed, $FAIL failed"
99+
echo "E2E Summary: $PASS passed, $FAIL failed, $SKIP skipped"
55100
if [[ $FAIL -gt 0 ]]; then
56101
echo "Failed: ${FAILED_TESTS[@]}"
57102
exit 1

0 commit comments

Comments
 (0)