diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /.github/scripts/smoke-launch-windows.sh | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to '.github/scripts/smoke-launch-windows.sh')
| -rwxr-xr-x | .github/scripts/smoke-launch-windows.sh | 62 |
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 |
