diff --git a/qemu/tests/agent-test.sh b/qemu/tests/agent-test.sh index db9d8ec..be034ee 100755 --- a/qemu/tests/agent-test.sh +++ b/qemu/tests/agent-test.sh @@ -80,7 +80,10 @@ took=$(( $(date +%s) - start )) check "a script past its deadline answers 124" grep -qx '<>' "$WORK/late.out" check "the deadline holds (took ${took}s)" test "$took" -le 5 child="$(cat "$WORK/child.pid" 2>/dev/null)" -check "the script's child is killed too" bash -c "[ -n '$child' ] && ! kill -0 '$child' 2>/dev/null" +# Gone or a zombie: in a CI job container PID 1 reaps nothing, so a killed +# orphan stays a zombie that kill -0 still finds. +gone() { [ ! -r "/proc/$1/stat" ] || [ "$(sed 's/.*) //' "/proc/$1/stat" | cut -d' ' -f1)" = Z ]; } +check "the script's child is killed too" bash -c "[ -n '$child' ] && $(declare -f gone); sleep 0.5; gone '$child'" check "the agent answers after a timeout" grep -qx '<>' "$WORK/late.out" # Malformed requests: one error line each, nothing runs.