From a57d98aa448c90338fd8450fe6afe6ea3882bfb8 Mon Sep 17 00:00:00 2001 From: Alice R Date: Mon, 8 Jan 2024 04:18:24 -0700 Subject: [PATCH] Fix testworlds PID check and ps edge case found using chroot. (#412) * MZX 2.93 broke getting the process ID from mzxrun in run.sh. * Fixed a run.sh edge case that seems to occur only in chroot: mzxrun will not always appear in the process list unless `-e` is provided. --- docs/changelog.txt | 1 + testworlds/run.sh | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index a96dda3a0..534ebb165 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,6 @@ GIT ++ Fixed testworlds process running check edge cases. + Fixed config.sh and platform_endian.h detection for IBM Z and System/390 architecture. diff --git a/testworlds/run.sh b/testworlds/run.sh index f4fe58c56..48106892b 100755 --- a/testworlds/run.sh +++ b/testworlds/run.sh @@ -90,7 +90,8 @@ export SDL_AUDIODRIVER=dummy # might have issues detecting libraries and running from this folder, so run from # the base folder. [ "$quiet" = "yes" ] || printf "Running test worlds" -( + +dir="$(pwd)" cd .. LD_PRELOAD="$preload" \ @@ -101,19 +102,23 @@ LD_PRELOAD="$preload" \ standalone_mode=1 \ no_titlescreen=1 \ & -) -# Attempt to detect a hang (e.g. an error occurred). +cd "$dir" +# Attempt to detect a hang (e.g. an error occurred). +# Note: running mzxrun in a subshell breaks this. mzxrun_pid=$! - +psopt="" i="0" +# BusyBox ps may not support -e; mzxrun might not appear WITHOUT -e in a chroot. +if ps -e 1>/dev/null 2>/dev/null; then psopt='-e'; fi + # In some versions of MSYS2, mzxrun doesn't always appear in ps right away. :( sleep 1 [ "$quiet" = "yes" ] || printf "." -while ps | grep -q "$mzxrun_pid .*[m]zxrun" +while ps "$psopt" | grep -q "$mzxrun_pid .*[m]zxrun" do sleep 1 i=$((i+1))