[PATCH stalld 29/52] tests: Drop redundant sleeps in test_pidfile

Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:31:39 -0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Remove redundant sleep calls following start_stalld in the pidfile
tests. The start_stalld helper already polls for readiness internally
before returning. It waits for the pidfile to appear when --pidfile
is passed, and uses pgrep retries otherwise. The additional sleeps
were dead wait time and unnecessarily slowed down test execution.

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 tests/functional/test_pidfile.sh | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/tests/functional/test_pidfile.sh b/tests/functional/test_pidfile.sh
index a2e5eb0..b5e1159 100755
--- a/tests/functional/test_pidfile.sh
+++ b/tests/functional/test_pidfile.sh
@@ -22,9 +22,6 @@ test_section "Test 1: Default behavior (no -P specified)"
 
 start_stalld -l -t 5
 
-# Give stalld time to create pidfile
-sleep 2
-
 # Check common default pidfile locations
 default_found=0
 for pidfile in /var/run/stalld.pid /run/stalld.pid; do
@@ -58,7 +55,6 @@ rm -f "${custom_pidfile}"
 
 log "Starting stalld with custom pidfile: ${custom_pidfile}"
 start_stalld -l -t 5 --pidfile "${custom_pidfile}"
-sleep 2
 
 assert_file_exists "${custom_pidfile}" "Custom pidfile created at ${custom_pidfile}"
 
@@ -87,7 +83,6 @@ rm -f "${tmp_pidfile}"
 
 log "Starting stalld with /tmp pidfile: ${tmp_pidfile}"
 start_stalld -l -t 5 --pidfile "${tmp_pidfile}"
-sleep 2
 
 assert_file_exists "${tmp_pidfile}" "Pidfile created in /tmp directory"
 
@@ -107,7 +102,6 @@ rm -f "${fg_pidfile}"
 
 log "Starting stalld in foreground mode with pidfile: ${fg_pidfile}"
 start_stalld -f -v -l -t 5 --pidfile "${fg_pidfile}"
-sleep 2
 
 if [ -f "${fg_pidfile}" ]; then
     pass "Pidfile created in foreground mode"
@@ -139,7 +133,6 @@ rm -f "${readable_pidfile}"
 
 log "Starting stalld with readable pidfile: ${readable_pidfile}"
 start_stalld -l -t 5 --pidfile "${readable_pidfile}"
-sleep 2
 
 assert_file_exists "${readable_pidfile}" "Pidfile created"
 assert_success "Pidfile is readable" cat "${readable_pidfile}"
-- 
2.54.0