[PATCH stalld 35/36] tests/functional: Fix invalid pidfile test in test_pidfile

Wander Lairson Costa <[email protected]> Mon, 30 Mar 2026 16:43:58 -0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
The test created a directory with no write permission and expected
stalld to fail writing the pidfile. Since the tests run as root,
the permission restriction has no effect and stalld succeeds. Use
a non-existent parent directory instead so fopen() fails regardless
of privileges.

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

diff --git a/tests/functional/test_pidfile.sh b/tests/functional/test_pidfile.sh
index 0e4c623..76be14a 100755
--- a/tests/functional/test_pidfile.sh
+++ b/tests/functional/test_pidfile.sh
@@ -192,12 +192,8 @@ log "=========================================="
 log "Test 6: Invalid pidfile path (permission denied)"
 log "=========================================="
 
-# Create a directory with no write permissions
-test_dir="/tmp/stalld_test_no_write_$$"
-mkdir -p "${test_dir}"
-chmod 555 "${test_dir}"
-invalid_pidfile="${test_dir}/stalld.pid"
-CLEANUP_FILES+=("${test_dir}")
+# Use a non-existent parent directory so fopen() fails even as root
+invalid_pidfile="/nonexistent_${$}/stalld.pid"
 
 INVALID_LOG="/tmp/stalld_test_pidfile_invalid_$$.log"
 CLEANUP_FILES+=("${INVALID_LOG}")
-- 
2.53.0