Thread (30 messages) 30 messages, 2 authors, 2021-11-10
STALE1782d

[PATCH 05/11] selftests: net/fcnal: kill_procs via spin instead of sleep

From: Leonard Crestez <hidden>
Date: 2021-10-06 11:48:11
Also in: linux-kselftest, lkml
Subsystem: kernel selftest framework, networking [general], the rest · Maintainers: Shuah Khan, Shuah Khan, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Sleeping for one second after a kill is not necessary and adds up quite
quickly. Replace with a fast loop spinning until pidof returns nothing.

Signed-off-by: Leonard Crestez <redacted>
---
 tools/testing/selftests/net/fcnal-test.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 0bd60cd3bc06..b7fda51deb3f 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -176,12 +176,19 @@ show_hint()
 	fi
 }
 
 kill_procs()
 {
-	killall nettest ping ping6 >/dev/null 2>&1
-	sleep 1
+	local pids
+	while true; do
+		pids=$(pidof nettest ping ping6)
+		if [[ -z $pids ]]; then
+			break
+		fi
+		kill $pids
+		sleep 0.01
+	done
 }
 
 do_run_cmd()
 {
 	local cmd="$*"
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help