Skip to content

Commit 7ad0e93

Browse files
committed
debug: add diagnostic output to 28_target_static.sh
1 parent f20126c commit 7ad0e93

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

tests/e2e/28_target_static.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ then
1919
exit 0
2020
fi
2121

22-
TMP=$(mktemp -d)
23-
trap "rm -rf $TMP" EXIT
24-
25-
export MCPP_HOME="$TMP/mcpp-home"
26-
source "$(dirname "$0")/_inherit_toolchain.sh"
27-
28-
# Detect installed GNU gcc version for the default-build regression check
29-
# (step 2 below). Without a known GNU toolchain the default build would
30-
# auto-install musl-gcc and produce another musl binary, making the
31-
# "default GNU binary" assertion meaningless.
22+
# Detect installed GNU gcc version for the default-build regression check.
23+
# Without a known GNU toolchain the default build would auto-install
24+
# musl-gcc and produce another musl binary, making the assertion meaningless.
25+
XPKGS="${MCPP_HOME:-$HOME/.mcpp}/registry/data/xpkgs"
3226
GNU_GCC_VER=""
33-
if [[ -d "$MCPP_HOME/registry/data/xpkgs/xim-x-gcc" ]]; then
34-
GNU_GCC_VER=$(ls "$MCPP_HOME/registry/data/xpkgs/xim-x-gcc" 2>/dev/null | sort -V | tail -1)
27+
if [[ -d "$XPKGS/xim-x-gcc" ]]; then
28+
GNU_GCC_VER=$(ls "$XPKGS/xim-x-gcc" 2>/dev/null | sort -V | tail -1)
3529
fi
3630

31+
# Diagnostic: show what we detected
32+
echo "DIAG: MCPP_HOME=${MCPP_HOME:-<unset>}"
33+
echo "DIAG: XPKGS=$XPKGS"
34+
echo "DIAG: GNU_GCC_VER=${GNU_GCC_VER:-<empty>}"
35+
echo "DIAG: xim-x-gcc contents: $(ls "$XPKGS/xim-x-gcc" 2>&1 || echo 'N/A')"
36+
echo "DIAG: config.toml toolchain line: $(grep -i toolchain "${MCPP_HOME:-$HOME/.mcpp}/config.toml" 2>/dev/null || echo 'none')"
37+
38+
TMP=$(mktemp -d)
39+
trap "rm -rf $TMP" EXIT
40+
3741
cd "$TMP"
3842
"$MCPP" new staticapp >/dev/null
3943
cd staticapp
@@ -60,6 +64,9 @@ linkage = "static"
6064
EOF
6165
fi
6266

67+
echo "DIAG: mcpp.toml:"
68+
cat mcpp.toml
69+
6370
"$MCPP" build --target x86_64-linux-musl > build.log 2>&1 || {
6471
cat build.log; echo "build failed"; exit 1; }
6572

@@ -89,6 +96,8 @@ fi
8996
if [[ -n "$GNU_GCC_VER" ]]; then
9097
"$MCPP" build > build-gnu.log 2>&1 || {
9198
cat build-gnu.log; echo "default GNU build broke after musl build"; exit 1; }
99+
echo "DIAG: target/ tree after GNU build:"
100+
find target -type f -name staticapp 2>&1
92101
gnu_binary=$(find target -type d -name x86_64-linux-musl -prune -o -type f -name staticapp -print | head -1)
93102
[[ -n "$gnu_binary" ]] || { echo "default GNU binary missing"; exit 1; }
94103
else

0 commit comments

Comments
 (0)