[PATCH 04/11] tests: drop journal logging from test framework

Wander Lairson Costa <[email protected]> Fri, 10 Jul 2026 10:38:03 -0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
The test helper's log() function wrote every message to the system
journal via logger -t stalld, tagging entries with [TEST] to
distinguish them from real stalld output.  start_test() and
end_test() also called logger directly alongside echo.

These journal entries interfered with test_logging_destinations.sh,
which inspects journalctl for stalld's own syslog messages.  The
[TEST] entries appeared under the same stalld identifier and had
to be filtered out, making the assertions fragile and causing
spurious failures from journal flush races.

Remove the logger calls and the ANSI-stripping sed from log().
Replace the separate echo/logger pairs in start_test() and
end_test() with a single log() call each.  The test framework
now writes only to stdout, leaving the journal free of test
noise.

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 tests/helpers/test_helpers.sh | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/tests/helpers/test_helpers.sh b/tests/helpers/test_helpers.sh
index 12b548e..1e3d736 100755
--- a/tests/helpers/test_helpers.sh
+++ b/tests/helpers/test_helpers.sh
@@ -38,19 +38,13 @@ else
 	NC=''
 fi
 
-# Logging function that writes to both stdout and journal
-# This allows correlating test activities with stalld behavior in journalctl
+# Logging function that writes to stdout with a timestamp
 log() {
 	local timestamp="[$(date +'%H:%M:%S')]"
 	local message="$*"
 
 	# Echo to stdout with timestamp
 	echo -e "${timestamp} ${message}"
-
-	# Also send to journal with stalld tag for easy correlation
-	# Strip ANSI color codes before sending to journal
-	local clean_message=$(echo "${message}" | sed 's/\x1b\[[0-9;]*m//g')
-	logger -t stalld "[TEST] ${clean_message}"
 }
 
 # Parse common test options
@@ -87,20 +81,16 @@ parse_test_options() {
 # Start a test
 start_test() {
 	TEST_NAME=$1
-	echo -e "${BLUE}=== Starting test: ${TEST_NAME} ===${NC}"
-	# Log test start to journal for correlation
-	logger -t stalld "[TEST] === Starting test: ${TEST_NAME} ==="
+	log "${BLUE}=== Starting test: ${TEST_NAME} ===${NC}"
 }
 
 # End a test
 end_test() {
 	if [ ${TEST_FAILED} -eq 0 ]; then
-		echo -e "${GREEN}=== Test ${TEST_NAME}: PASSED ===${NC}"
-		logger -t stalld "[TEST] === Test ${TEST_NAME}: PASSED ==="
+		log "${GREEN}=== Test ${TEST_NAME}: PASSED ===${NC}"
 		return 0
 	else
-		echo -e "${RED}=== Test ${TEST_NAME}: FAILED ===${NC}"
-		logger -t stalld "[TEST] === Test ${TEST_NAME}: FAILED ==="
+		log "${RED}=== Test ${TEST_NAME}: FAILED ===${NC}"
 		return 1
 	fi
 }
-- 
2.55.0