From 8a2839c8675d428681c10a614175e88690fee319 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 9 Apr 2024 23:29:15 +0200 Subject: [PATCH] tests: update for faster dmeventd We can drop sleep 6, since dmeventd will quit immediatelly when no running dmeventd can be restarted. Also restart itself check more conditions. --- test/shell/dmeventd-restart.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/shell/dmeventd-restart.sh b/test/shell/dmeventd-restart.sh index 13feb3745..ed04f8533 100644 --- a/test/shell/dmeventd-restart.sh +++ b/test/shell/dmeventd-restart.sh @@ -16,17 +16,26 @@ SKIP_WITH_LVMPOLLD=1 . lib/inittest _restart_dmeventd() { + local pid= #rm -f debug.log* dmeventd -R -fldddd -e "$PWD/test_nologin" > debug.log_DMEVENTD_$RANDOM 2>&1 & echo $! >LOCAL_DMEVENTD - for i in $(seq 1 10); do - test "$(pgrep -o dmeventd)" = "$(< LOCAL_DMEVENTD)" && break - sleep .1 + for i in {1..10}; do + pid=$(pgrep -o dmeventd || true) + test -n "$pid" || break; # no dmeventd running + test "$pid" = "$(< LOCAL_DMEVENTD)" && break + sleep .2 done + # wait a bit, so we talk to the new dmeventd later - dmeventd -i || true + if test -n "$pid" ; then + for i in {1..10}; do + dmeventd -i && break; + sleep .1 + done + fi } aux prepare_dmeventd @@ -57,8 +66,6 @@ rm LOCAL_DMEVENTD debug.log* _restart_dmeventd -# wait longer as tries 5s to communicate with killed daemon -sleep 6 # now dmeventd should not be running not pgrep dmeventd rm LOCAL_DMEVENTD