Try to fix tests for Solaris' ps

This commit is contained in:
Fabian Homborg 2021-06-24 18:19:28 +02:00
parent 49bac252f6
commit 66bc6ce77d

View File

@ -1,7 +1,14 @@
#RUN: %fish %s
# Ensure there's no zombies before we start, otherwise the tests will mysteriously fail.
set zombies_among_us (ps -o stat | string match 'Z*' | count)
set -l zombies_among_us
if not contains (uname) SunOS
set zombies_among_us (ps -o stat | string match 'Z*' | count)
else
# Solaris' ps is awkward, I don't know if this actually works
set zombies_among_us (ps -o s | string match 'Z*' | count)
end
[ "$zombies_among_us" -eq "0" ]
or begin
echo "Found existing zombie processes. Clean up zombies before running this test."
@ -23,7 +30,11 @@ sleep 0.1
# be gone by the time we get here. Unfortunately, kill from procps on pre-2016 distributions
# does not print an error for non-existent PIDs, so instead look for zombies in this session
# (there should be none).
ps -o stat | string match 'Z*'
if not contains (uname) SunOS
ps -o stat | string match 'Z*'
else
ps -o s | string match 'Z*'
end
# Verify disown can be used with last_pid, even if it is separate from the pgroup.
# This should silently succeed.