* main - tests: avoid sleep on kill path
@ 2021-03-22 21:53 Zdenek Kabelac
0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2021-03-22 21:53 UTC (permalink / raw)
To: lvm-devel
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7166bbd9c26cf5d06067cfb85eb86352b4152c3c
Commit: 7166bbd9c26cf5d06067cfb85eb86352b4152c3c
Parent: a7d7471906501eebb6cf418ab3d0d9326805449f
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Mon Mar 22 22:05:22 2021 +0100
Committer: Zdenek Kabelac <zkabelac@redhat.com>
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(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 2bc3da2c9..e406e47ce 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -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
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-22 21:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-22 21:53 main - tests: avoid sleep on kill path Zdenek Kabelac
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.