diff --git a/test/units/testsuite-74.coredump.sh b/test/units/testsuite-74.coredump.sh index d5039b70f4..d30fd73717 100755 --- a/test/units/testsuite-74.coredump.sh +++ b/test/units/testsuite-74.coredump.sh @@ -42,7 +42,17 @@ sig="${2:?}" ulimit -c unlimited "$bin" infinity & pid=$! -sleep 1 +# Sync with the "fake" binary, so we kill it once it's fully forked off, +# otherwise we might kill it during fork and kernel would then report +# "wrong" binary name (i.e. $MAKE_DUMP_SCRIPT instead of $CORE_TEST_BIN). +# In this case, wait until the "fake" binary (sleep in this case) enters +# the "interruptible sleep" state, at which point it should be ready +# to be sacrificed. +for _ in {0..9}; do + read -ra self_stat <"/proc/$pid/stat" + [[ "${self_stat[2]}" == S ]] && break + sleep .5 +done kill -s "$sig" "$pid" # This should always fail ! wait "$pid"