Skip to content

Commit

Permalink
Fix testworlds PID check and ps edge case found using chroot. (#412)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
AliceLR authored Jan 8, 2024
1 parent 93eeddd commit a57d98a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
15 changes: 10 additions & 5 deletions testworlds/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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))
Expand Down

0 comments on commit a57d98a

Please sign in to comment.