summaryrefslogtreecommitdiff
path: root/.github/scripts/smoke-launch-windows.sh
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /.github/scripts/smoke-launch-windows.sh
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to '.github/scripts/smoke-launch-windows.sh')
-rwxr-xr-x.github/scripts/smoke-launch-windows.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/.github/scripts/smoke-launch-windows.sh b/.github/scripts/smoke-launch-windows.sh
new file mode 100755
index 00000000..e6dda339
--- /dev/null
+++ b/.github/scripts/smoke-launch-windows.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# Launch a Windows executable with the MinGW runtime directory removed from
+# PATH and assert it does NOT fail with STATUS_DLL_NOT_FOUND (0xC0000135).
+#
+# This reproduces the failure class behind "map65.exe won't start": a missing
+# runtime DLL (libgomp-1.dll, libportaudio-2.dll, libgfortran-5.dll, ...) makes
+# the process exit at load time, before main(), with exit code 0xC0000135. A
+# build that links and packages correctly survives a launch from a clean PATH;
+# one that relies on the dev shell's /mingw64/bin does not.
+#
+# The launched command must exit on its own. A bounded timeout turns a hung
+# process or modal startup error into a test failure.
+#
+# Usage: smoke-launch-windows.sh <exe> [args...]
+set -u
+
+# 0xC0000135 as a bash exit status. Windows returns the 32-bit NTSTATUS; MSYS2
+# bash surfaces it as 3221225781 (unsigned) for processes that exit on their
+# own. The 128+signal form does not apply here — this is a real process exit.
+readonly STATUS_DLL_NOT_FOUND=3221225781
+readonly TIMEOUT_SECS=20
+
+exe="${1:?usage: smoke-launch-windows.sh <exe> [args...]}"
+shift || true
+
+if [ ! -f "$exe" ]; then
+ echo "::error::smoke-launch: executable not found: $exe"
+ exit 1
+fi
+
+# Strip the MinGW runtime dir from PATH so only DLLs the build/packaging step
+# placed beside the exe (or in still-present system dirs) can resolve.
+cleaned_path=$(echo "$PATH" | tr ':' '\n' | grep -ivE '(^|/)mingw64/bin/?$' | paste -sd: -)
+echo "smoke-launch: $exe $* (PATH cleaned of /mingw64/bin)"
+
+# timeout returns 124 when it had to kill the process.
+PATH="$cleaned_path" timeout "${TIMEOUT_SECS}s" "$exe" "$@" >launch.out 2>&1
+code=$?
+
+if [ "$code" -eq "$STATUS_DLL_NOT_FOUND" ]; then
+ echo "::error::smoke-launch: $exe exited 0xC0000135 (STATUS_DLL_NOT_FOUND) — a runtime DLL is missing from the clean-PATH launch context"
+ echo "----- output -----"; cat launch.out || true
+ exit 1
+fi
+
+if [ "$code" -eq 124 ]; then
+ echo "::error::smoke-launch: $exe did not exit within ${TIMEOUT_SECS}s"
+ echo "----- output -----"; cat launch.out || true
+ exit 1
+fi
+
+if [ "$code" -eq 0 ]; then
+ cat launch.out || true
+ echo "smoke-launch OK: $exe loaded and exited cleanly"
+ exit 0
+fi
+
+# Any other non-zero code is a real fault (a missing DLL is the thing we guard
+# against; a usage/help non-zero exit would also surface here, so print it).
+echo "::error::smoke-launch: $exe exited with code $code"
+echo "----- output -----"; cat launch.out || true
+exit 1