Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testworlds PID check and ps edge case found using chroot. #412

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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