Skip to content

Commit c8f7086

Browse files
committed
fix: add Windows .exe compat to E2E tests 02, 35, 36; remove from WINDOWS_SKIP
Tests 02_new_build_run, 35_workspace, and 36_llvm_toolchain were skipped on Windows solely because they searched for binaries without the .exe suffix. Fix each by detecting MINGW/MSYS at runtime and searching for the .exe variant instead. Additional changes in 36_llvm_toolchain: - Detect LLVM root via USERPROFILE on Windows (HOME is not set) - Use clang++.exe for the availability check - Emit [toolchain] windows = "llvm@20.1.7" on Windows instead of linux Remove all three tests from WINDOWS_SKIP in run_all.sh so they run in Windows CI.
1 parent 226a5ae commit c8f7086

4 files changed

Lines changed: 37 additions & 13 deletions

File tree

tests/e2e/02_new_build_run.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ grep -q "std::println" src/main.cpp || { echo "main.cpp missing 'std::p
1919
# Build
2020
"$MCPP" build > build.log 2>&1
2121
[[ -d target ]] || { cat build.log; echo "no target/ dir"; exit 1; }
22-
binary="$(find target -name hello -type f | head -1)"
22+
# On Windows (MINGW/MSYS) the binary has a .exe suffix
23+
OS="$(uname -s)"
24+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
25+
binary="$(find target -name hello.exe -type f | head -1)"
26+
else
27+
binary="$(find target -name hello -type f | head -1)"
28+
fi
2329
[[ -n "$binary" ]] || { echo "binary not produced"; exit 1; }
2430
[[ -x "$binary" ]] || { echo "binary not executable"; exit 1; }
2531

tests/e2e/35_workspace.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ echo "workspace build: ok"
9494

9595
# ── Verify the binary runs correctly ────────────────────
9696
# target/ is created in the member dir (apps/hello/target/), not workspace root.
97-
BIN=$(find apps/hello/target -type f -name hello | head -1)
97+
# On Windows (MINGW/MSYS) the binary has a .exe suffix
98+
OS="$(uname -s)"
99+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
100+
BIN=$(find apps/hello/target -type f -name hello.exe | head -1)
101+
else
102+
BIN=$(find apps/hello/target -type f -name hello | head -1)
103+
fi
98104
test -n "$BIN" || { echo "FAIL: hello binary not found"; exit 1; }
99105
OUT=$("$BIN" 2>&1)
100106
echo "output: $OUT"

tests/e2e/36_llvm_toolchain.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
# 36_llvm_toolchain.sh — build a non-module C/C++ package with xlings LLVM.
33
set -e
44

5-
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
6-
if [[ ! -x "$LLVM_ROOT/bin/clang++" ]]; then
5+
OS="$(uname -s)"
6+
# On Windows the clang++ binary has a .exe suffix
7+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
8+
LLVM_ROOT="${USERPROFILE}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
9+
CLANGPP_BIN="$LLVM_ROOT/bin/clang++.exe"
10+
else
11+
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
12+
CLANGPP_BIN="$LLVM_ROOT/bin/clang++"
13+
fi
14+
if [[ ! -x "$CLANGPP_BIN" ]]; then
715
echo "SKIP: xlings llvm@20.1.7 is not installed"
816
exit 0
917
fi
@@ -16,7 +24,13 @@ source "$(dirname "$0")/_inherit_toolchain.sh"
1624
mkdir -p "$TMP/proj/src"
1725
cd "$TMP/proj"
1826

19-
cat > mcpp.toml <<'EOF'
27+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
28+
TC_KEY="windows"
29+
else
30+
TC_KEY="linux"
31+
fi
32+
33+
cat > mcpp.toml <<EOF
2034
[package]
2135
name = "hello_llvm"
2236
version = "0.1.0"
@@ -25,7 +39,7 @@ version = "0.1.0"
2539
import_std = false
2640
2741
[toolchain]
28-
linux = "llvm@20.1.7"
42+
${TC_KEY} = "llvm@20.1.7"
2943
EOF
3044

3145
cat > src/main.cpp <<'EOF'
@@ -63,7 +77,11 @@ grep -q 'Finished' "$TMP/build.log" || {
6377
exit 1
6478
}
6579

66-
binary=$(find target -type f -path '*/bin/hello_llvm' | head -1)
80+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
81+
binary=$(find target -type f -path '*/bin/hello_llvm.exe' | head -1)
82+
else
83+
binary=$(find target -type f -path '*/bin/hello_llvm' | head -1)
84+
fi
6785
[[ -n "$binary" && -x "$binary" ]] || {
6886
find target -maxdepth 5 -type f
6987
echo "FAIL: hello_llvm binary missing"

tests/e2e/run_all.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ MACOS_SKIP=(
6464
# additional Windows-specific exclusions.
6565
WINDOWS_SKIP=(
6666
"${MACOS_SKIP[@]}"
67-
# new/build/run checks for binary without .exe suffix
68-
02_new_build_run.sh
6967
# Symlinks (ln -sf) not available in Git Bash without elevated perms
7068
10_env_command.sh
7169
# test_failing expects non-zero exit but mcpp test returns 0 on Windows
@@ -86,10 +84,6 @@ WINDOWS_SKIP=(
8684
31_pack_publish_dry_run.sh
8785
# Semver merge uses path dependencies
8886
32_semver_merge.sh
89-
# Workspace test checks for binary without .exe suffix
90-
35_workspace.sh
91-
# LLVM toolchain test checks for binary without .exe suffix
92-
36_llvm_toolchain.sh
9387
# LLVM tests that need libc++ std.cppm (not available on Windows)
9488
37_llvm_import_std.sh
9589
38_llvm_std_compat.sh

0 commit comments

Comments
 (0)