main - tests: avoid sleep on kill path
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7166bbd9c26cf5d06067cfb85eb86352b4152c3c Commit: 7166bbd9c26cf5d06067cfb85eb86352b4152c3c Parent: a7d7471906501eebb6cf418ab3d0d9326805449f Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Mar 22 22:05:22 2021 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Mar 22 22:51:24 2021 +0100
tests: avoid sleep on kill path
Before sleeping, check if pid is still there.
--- test/lib/aux.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
test/lib/aux.sh +4 -6
@@ -466,12 +466,10 @@ kill_sleep_kill_() { pid=$(< "$pidfile") rm -f "$pidfile" kill -TERM "$pid" 2>/dev/null || return 0 - if test "$slow" -eq 0 ; then sleep .1 ; else sleep 1 ; fi - kill -KILL "$pid" 2>/dev/null || true - local wait=0 - while ps "$pid" > /dev/null && test "$wait" -le 10; do - sleep .5 - wait=$(( wait + 1 )) + for i in {0..10} ; do + ps "$pid" >/dev/null || return 0 + if test "$slow" -eq 0 ; then sleep .2 ; else sleep 1 ; fi + kill -KILL "$pid" 2>/dev/null || true done fi }