[PATCH 01/11] stalld: add readiness log marker for tests

Wander Lairson Costa <[email protected]> Fri, 10 Jul 2026 10:38:00 -0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
The test helper wait_for_stalld_ready() previously matched
implementation-detail messages like "checking cpu", "waiting
tasks", or "skipping" that appear during the first monitoring
cycle. These messages depend on system state and verbose-mode
internals that could change across refactors.

Add a "monitoring started" log_msg() call at the end of main()
initialization, after write_pidfile() and before entering the
main loop. Update wait_for_stalld_ready() to match this
deterministic marker instead of the old alternation pattern.

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 src/stalld.c                  | 2 ++
 tests/helpers/test_helpers.sh | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/stalld.c b/src/stalld.c
index ac9800d..34b0fd0 100644
--- a/src/stalld.c
+++ b/src/stalld.c
@@ -1239,6 +1239,8 @@ int main(int argc, char **argv)
 
 	write_pidfile();
 
+	log_msg("monitoring started\n");
+
 	/* The less likely first. */
 	if (config_aggressive)
 		aggressive_main(cpus, config_nr_cpus);
diff --git a/tests/helpers/test_helpers.sh b/tests/helpers/test_helpers.sh
index af341e0..53de276 100755
--- a/tests/helpers/test_helpers.sh
+++ b/tests/helpers/test_helpers.sh
@@ -696,7 +696,7 @@ wait_for_log_message() {
 wait_for_stalld_ready() {
 	local log_file=$1
 	local timeout=${2:-5}
-	wait_for_log_message "checking cpu\|waiting tasks\|skipping" "${timeout}" "${log_file}"
+	wait_for_log_message "monitoring started" "${timeout}" "${log_file}"
 }
 
 # Wait for stalld to detect a starving task.
-- 
2.55.0