Skip to content

Commit 06ee2a1

Browse files
committed
test(e2e): 97 asserts the exe import table (objdump) + diagnostic output
The silent standalone-run failure gave nothing to debug — inspect DLL imports directly and dump them on any failure.
1 parent 0655091 commit 06ee2a1

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

tests/e2e/97_mingw_toolchain.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,27 @@ out=$("$MCPP" build 2>&1) || { echo "FAIL: build: $out"; exit 1; }
5959
run_out=$("$MCPP" run 2>&1) || { echo "FAIL: run: $run_out"; exit 1; }
6060
[[ "$run_out" == *"mingw-ok"* ]] || { echo "FAIL: run output: $run_out"; exit 1; }
6161

62-
# 4) portability: the exe must run from a clean dir WITHOUT the toolchain
63-
# bin dir on PATH (no libstdc++-6.dll / libgcc_s hitchhikers needed).
62+
# 4) portability: the exe's import table must not reference toolchain DLLs
63+
# (libstdc++-6 / libgcc_s / libwinpthread — static_stdlib defaults), and
64+
# it must run from a clean dir without the toolchain bin on PATH.
6465
EXE=$(find target -name "hello_mingw.exe" -path "*/bin/*" | head -1)
6566
[[ -n "$EXE" ]] || { echo "FAIL: no exe produced"; exit 1; }
67+
OBJDUMP="${MCPP_HOME:-$HOME/.mcpp}/registry/data/xpkgs/xim-x-mingw-gcc/16.1.0/bin/objdump.exe"
68+
imports=""
69+
if [[ -x "$OBJDUMP" ]]; then
70+
imports=$("$OBJDUMP" -p "$EXE" 2>/dev/null | grep -i "DLL Name" || true)
71+
echo "exe imports:"; echo "$imports"
72+
bad=$(echo "$imports" | grep -iE "libstdc|libgcc|libwinpthread" || true)
73+
[[ -z "$bad" ]] || { echo "FAIL: toolchain DLLs in import table: $bad"; exit 1; }
74+
fi
6675
ISO="$TMP/iso"; mkdir -p "$ISO"
6776
cp "$EXE" "$ISO/"
68-
iso_out=$(cd "$ISO" && PATH="/usr/bin:/c/Windows/System32" ./hello_mingw.exe 2>&1) \
69-
|| { echo "FAIL: exe not standalone (static libstdc++/libgcc?): $iso_out"; exit 1; }
70-
[[ "$iso_out" == *"mingw-ok"* ]] || { echo "FAIL: standalone output: $iso_out"; exit 1; }
77+
iso_rc=0
78+
iso_out=$(cd "$ISO" && PATH="/usr/bin:/c/Windows/System32" ./hello_mingw.exe 2>&1) || iso_rc=$?
79+
if [[ $iso_rc -ne 0 || "$iso_out" != *"mingw-ok"* ]]; then
80+
echo "FAIL: standalone run rc=$iso_rc out='$iso_out'"
81+
echo "$imports"
82+
exit 1
83+
fi
7184

7285
echo "PASS: mingw toolchain — install, default, modules build/run, standalone exe"

0 commit comments

Comments
 (0)