git: 498b3b494b8b - main - lockf tests: Fix a race

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 14 Jul 2024 18:30:17 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=498b3b494b8b3e500e555a9653d950b9e25a2f1a

commit 498b3b494b8b3e500e555a9653d950b9e25a2f1a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-07-14 16:13:13 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-07-14 18:29:14 +0000

    lockf tests: Fix a race
    
    The test launches lockf(1) in the background and races with it, so it
    shouldn't be using atf_check to check that lockf won the race.
    
    MFC after:      1 week
---
 usr.bin/lockf/tests/lockf_test.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/usr.bin/lockf/tests/lockf_test.sh b/usr.bin/lockf/tests/lockf_test.sh
index cc6938d2306e..d73c7590653d 100644
--- a/usr.bin/lockf/tests/lockf_test.sh
+++ b/usr.bin/lockf/tests/lockf_test.sh
@@ -47,7 +47,9 @@ basic_body()
 	lpid=$!
 
 	# Make sure that the lock exists...
-	atf_check test -e "testlock"
+	while ! test -e "testlock"; do
+		sleep 0.1
+	done
 
 	# Attempt both verbose and silent re-lock
 	atf_check -s exit:${EX_TEMPFAIL} -e not-empty \