Skip to content

Commit efbd7d0

Browse files
committed
fix(e2e): Windows portability for tests 19, 24, 27, 32, 37-41
Fix 3 (_inherit_toolchain.sh): add cp -r fallback after ln -sf 2>/dev/null so toolchain inheritance works on Windows without symlink privileges. Fix 4 (19_bmi_cache_reuse.sh): replace bash-specific compgen -G with portable `find ... | grep -q .`; remove unix-shell requirement. Fix 5 (38_self_config_mirror.sh): remove unix-shell requirement since _inherit_toolchain.sh now handles symlinks portably. Fix 6 (37_llvm_import_std, 38_llvm_modules, 40_llvm_bmi_cache, 41_llvm_std_compat): add Windows early-exit guard (libc++ std.cppm not available on Windows); also add cp -r fallback in 40 for mcpplibs link. Tags update: remove symlink requirement from 24_git_dependency, 27_namespace_dependencies, and 32_semver_merge (only used _inherit_toolchain.sh or now have cp -r fallback); also add cp -r fallback to 32's direct ln -sf calls.
1 parent 15ebb4a commit efbd7d0

10 files changed

Lines changed: 59 additions & 13 deletions

tests/e2e/19_bmi_cache_reuse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# requires: unix-shell
2+
# requires:
33
# 19_bmi_cache_reuse.sh — verify M3.2 BMI persistent cache wiring.
44
#
55
# 1. Path deps don't populate the cache (correctness invariant from docs/26).
@@ -71,7 +71,7 @@ EOF
7171

7272
# bmi/ should exist (env init creates it) but no deps/ entry for path deps.
7373
[[ -d "$MCPP_HOME/bmi" ]] || { echo "missing $MCPP_HOME/bmi"; exit 1; }
74-
if compgen -G "$MCPP_HOME/bmi/*/deps/*/mylibA*" > /dev/null; then
74+
if find "$MCPP_HOME/bmi" -path "*/deps/*/mylibA*" 2>/dev/null | grep -q .; then
7575
echo "FAIL: path dep mylibA was populated into BMI cache (must be skipped)"
7676
find "$MCPP_HOME/bmi" -maxdepth 5
7777
exit 1

tests/e2e/24_git_dependency.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# requires: symlink
2+
# requires:
33
# 24_git_dependency.sh — M4 #5: git-based dep clones to ~/.mcpp/git/<hash>/
44
# and is treated as a path dep.
55
set -e

tests/e2e/27_namespace_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# requires: symlink
2+
# requires:
33
# Namespaced dependencies: `[dependencies.<ns>] name = { path = "..." }`
44
# is parsed correctly and the dep is actually picked up by the build.
55
# Also verifies that the legacy `"<ns>.<name>" = "..."` quoted form still

tests/e2e/32_semver_merge.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# requires: symlink
2+
# requires:
33
# 32_semver_merge.sh — SemVer merge in the transitive walker:
44
# * Two consumers of the same package with overlapping constraints
55
# (one exact, one range) merge to a single satisfying version
@@ -19,13 +19,17 @@ mkdir -p "$MCPP_HOME/registry/data"
1919
for idx_name in mcpplibs mcpp-index; do
2020
if [[ -d "$HOME/.mcpp/registry/data/$idx_name" ]]; then
2121
ln -sf "$HOME/.mcpp/registry/data/$idx_name" \
22-
"$MCPP_HOME/registry/data/$idx_name"
22+
"$MCPP_HOME/registry/data/$idx_name" 2>/dev/null \
23+
|| cp -r "$HOME/.mcpp/registry/data/$idx_name" \
24+
"$MCPP_HOME/registry/data/$idx_name"
2325
fi
2426
done
2527
# Pre-cached xpkg downloads so the test doesn't re-fetch the world.
2628
if [[ -d "$HOME/.mcpp/registry/data/xpkgs" ]]; then
2729
[[ -e "$MCPP_HOME/registry/data/xpkgs" ]] \
2830
|| ln -sf "$HOME/.mcpp/registry/data/xpkgs" \
31+
"$MCPP_HOME/registry/data/xpkgs" 2>/dev/null \
32+
|| cp -r "$HOME/.mcpp/registry/data/xpkgs" \
2933
"$MCPP_HOME/registry/data/xpkgs"
3034
fi
3135

tests/e2e/37_llvm_import_std.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
# 37_llvm_import_std.sh — build an import-std package with xlings LLVM/libc++.
44
set -e
55

6+
OS="$(uname -s)"
7+
# libc++ std.cppm is only available on Linux/macOS — on Windows there is no
8+
# libc++ module distribution. Exit gracefully; the import-std-libcxx capability
9+
# check in run_all.sh already gates this, but guard here too for direct runs.
10+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
11+
echo "SKIP: libc++ std.cppm not available on Windows"
12+
exit 0
13+
fi
14+
615
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
716
if [[ ! -x "$LLVM_ROOT/bin/clang++" ]]; then
817
echo "SKIP: xlings llvm@20.1.7 is not installed"

tests/e2e/38_llvm_modules.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
# -fmodule-output / -fprebuilt-module-path flags.
88
set -e
99

10+
OS="$(uname -s)"
11+
# libc++ std.cppm is only available on Linux/macOS — on Windows there is no
12+
# libc++ module distribution. Exit gracefully; the import-std-libcxx capability
13+
# check in run_all.sh already gates this, but guard here too for direct runs.
14+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
15+
echo "SKIP: libc++ std.cppm not available on Windows"
16+
exit 0
17+
fi
18+
1019
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
1120
if [[ ! -x "$LLVM_ROOT/bin/clang++" ]]; then
1221
echo "SKIP: xlings llvm@20.1.7 is not installed"

tests/e2e/38_self_config_mirror.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# requires: unix-shell
2+
# requires:
33
# 38_self_config_mirror.sh — configure xlings mirror through mcpp self config.
44
set -e
55

tests/e2e/40_llvm_bmi_cache.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
# 40_llvm_bmi_cache.sh — Clang BMI cache reuse for dependency packages.
44
set -e
55

6+
OS="$(uname -s)"
7+
# libc++ std.cppm is only available on Linux/macOS — on Windows there is no
8+
# libc++ module distribution. Exit gracefully; the import-std-libcxx capability
9+
# check in run_all.sh already gates this, but guard here too for direct runs.
10+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
11+
echo "SKIP: libc++ std.cppm not available on Windows"
12+
exit 0
13+
fi
14+
615
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
716
if [[ ! -x "$LLVM_ROOT/bin/clang++" ]]; then
817
echo "SKIP: xlings llvm@20.1.7 is not installed"
@@ -24,7 +33,8 @@ USER_MCPP="${HOME}/.mcpp"
2433
if [[ -d "$USER_MCPP/registry/data/mcpplibs" ]]; then
2534
mkdir -p "$MCPP_HOME/registry/data"
2635
[[ -e "$MCPP_HOME/registry/data/mcpplibs" ]] \
27-
|| ln -sf "$USER_MCPP/registry/data/mcpplibs" "$MCPP_HOME/registry/data/mcpplibs"
36+
|| ln -sf "$USER_MCPP/registry/data/mcpplibs" "$MCPP_HOME/registry/data/mcpplibs" 2>/dev/null \
37+
|| cp -r "$USER_MCPP/registry/data/mcpplibs" "$MCPP_HOME/registry/data/mcpplibs"
2838
fi
2939

3040
mkdir -p "$TMP/proj/src"

tests/e2e/41_llvm_std_compat.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
# 41_llvm_std_compat.sh — build a project that uses import std.compat with Clang.
44
set -e
55

6+
OS="$(uname -s)"
7+
# libc++ std.compat.cppm is only available on Linux/macOS — on Windows there
8+
# is no libc++ module distribution. Exit gracefully; the import-std-libcxx
9+
# capability check in run_all.sh already gates this, but guard here too.
10+
if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
11+
echo "SKIP: libc++ std.compat.cppm not available on Windows"
12+
exit 0
13+
fi
14+
615
LLVM_ROOT="${HOME}/.mcpp/registry/data/xpkgs/xim-x-llvm/20.1.7"
716
if [[ ! -x "$LLVM_ROOT/bin/clang++" ]]; then
817
echo "SKIP: xlings llvm@20.1.7 is not installed"

tests/e2e/_inherit_toolchain.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,33 @@ USER_MCPP="${HOME}/.mcpp"
1717
if [[ -d "$USER_MCPP/registry/data/xpkgs" ]]; then
1818
mkdir -p "$MCPP_HOME/registry/data"
1919
[[ -e "$MCPP_HOME/registry/data/xpkgs" ]] \
20-
|| ln -sf "$USER_MCPP/registry/data/xpkgs" "$MCPP_HOME/registry/data/xpkgs"
20+
|| ln -sf "$USER_MCPP/registry/data/xpkgs" "$MCPP_HOME/registry/data/xpkgs" 2>/dev/null \
21+
|| cp -r "$USER_MCPP/registry/data/xpkgs" "$MCPP_HOME/registry/data/xpkgs"
2122
fi
2223
if [[ -d "$USER_MCPP/registry/data/xim-pkgindex" ]]; then
2324
mkdir -p "$MCPP_HOME/registry/data"
2425
[[ -e "$MCPP_HOME/registry/data/xim-pkgindex" ]] \
25-
|| ln -sf "$USER_MCPP/registry/data/xim-pkgindex" "$MCPP_HOME/registry/data/xim-pkgindex"
26+
|| ln -sf "$USER_MCPP/registry/data/xim-pkgindex" "$MCPP_HOME/registry/data/xim-pkgindex" 2>/dev/null \
27+
|| cp -r "$USER_MCPP/registry/data/xim-pkgindex" "$MCPP_HOME/registry/data/xim-pkgindex"
2628
fi
2729
if [[ -d "$USER_MCPP/registry/data/xim-index-repos" ]]; then
2830
mkdir -p "$MCPP_HOME/registry/data"
2931
[[ -e "$MCPP_HOME/registry/data/xim-index-repos" ]] \
30-
|| ln -sf "$USER_MCPP/registry/data/xim-index-repos" "$MCPP_HOME/registry/data/xim-index-repos"
32+
|| ln -sf "$USER_MCPP/registry/data/xim-index-repos" "$MCPP_HOME/registry/data/xim-index-repos" 2>/dev/null \
33+
|| cp -r "$USER_MCPP/registry/data/xim-index-repos" "$MCPP_HOME/registry/data/xim-index-repos"
3134
fi
3235
if [[ "${MCPP_INHERIT_SUBOS:-1}" != "0" && -d "$USER_MCPP/registry/subos" ]]; then
3336
mkdir -p "$MCPP_HOME/registry"
3437
[[ -e "$MCPP_HOME/registry/subos" ]] \
35-
|| ln -sf "$USER_MCPP/registry/subos" "$MCPP_HOME/registry/subos"
38+
|| ln -sf "$USER_MCPP/registry/subos" "$MCPP_HOME/registry/subos" 2>/dev/null \
39+
|| cp -r "$USER_MCPP/registry/subos" "$MCPP_HOME/registry/subos"
3640
fi
3741
if [[ "${MCPP_INHERIT_CONFIG:-1}" != "0" && -f "$USER_MCPP/config.toml" ]]; then
3842
cp -f "$USER_MCPP/config.toml" "$MCPP_HOME/config.toml" 2>/dev/null || true
3943
fi
4044
if [[ -d "$USER_MCPP/bin" ]]; then
4145
mkdir -p "$MCPP_HOME"
4246
[[ -e "$MCPP_HOME/bin" ]] \
43-
|| ln -sf "$USER_MCPP/bin" "$MCPP_HOME/bin"
47+
|| ln -sf "$USER_MCPP/bin" "$MCPP_HOME/bin" 2>/dev/null \
48+
|| cp -r "$USER_MCPP/bin" "$MCPP_HOME/bin"
4449
fi

0 commit comments

Comments
 (0)