From 8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 04:42:50 +0200 Subject: Adding upstream version 2.33.1. Signed-off-by: Daniel Baumann --- tests/ts/kill/kill_functions.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/ts/kill/kill_functions.sh (limited to 'tests/ts/kill/kill_functions.sh') diff --git a/tests/ts/kill/kill_functions.sh b/tests/ts/kill/kill_functions.sh new file mode 100644 index 0000000..cc0a440 --- /dev/null +++ b/tests/ts/kill/kill_functions.sh @@ -0,0 +1,29 @@ +# kill tests, or command, will not when /proc is missing. +test -d /proc || ts_skip "/proc not available" + +# The test_sigreceive is ready when signal process mask contains SIGHUP +function check_test_sigreceive { + local rc=0 + local pid=$1 + + for i in 0.01 0.1 1 1 1 1; do + if [ ! -f /proc/$pid/status ]; then + # The /proc exists, but not status file. Because the + # process already started it is unlikely the file would + # appear after any amount of waiting. Try to sleep for + # moment and hopefully test_sigreceive is ready to be + # killed. + echo "kill_functions.sh: /proc/$pid/status: No such file or directory" + sleep 2 + rc=1 + break + fi + sigmask=$((16#$( awk '/SigCgt/ { print $2}' /proc/$pid/status) )) + if [ $(( $sigmask & 1 )) == 1 ]; then + rc=1 + break + fi + sleep $i + done + return $rc +} -- cgit v1.2.3