git: 1c793e7cbe2e - main - stat: Nits in readlink tests

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Wed, 08 Apr 2026 11:26:31 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=1c793e7cbe2ecded388fd51fb20274891620a6f4

commit 1c793e7cbe2ecded388fd51fb20274891620a6f4
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-08 11:26:23 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-08 11:26:23 +0000

    stat: Nits in readlink tests
    
    * The f_flag test may fail if a component of the full path to the
      temporary directory is a symbolic link.
    
    * The n_flag test had an empty head; give it a description.
    
    * Use consistent quoting.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    kevans
    Differential Revision:  https://reviews.freebsd.org/D56293
---
 usr.bin/stat/tests/readlink_test.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/usr.bin/stat/tests/readlink_test.sh b/usr.bin/stat/tests/readlink_test.sh
index d0107e0d655e..8eff21fa7a16 100755
--- a/usr.bin/stat/tests/readlink_test.sh
+++ b/usr.bin/stat/tests/readlink_test.sh
@@ -33,7 +33,7 @@ basic_head()
 basic_body()
 {
 	atf_check ln -s foo bar
-	atf_check -o inline:'foo\n' readlink bar
+	atf_check -o inline:"foo\n" readlink bar
 }
 
 atf_test_case f_flag
@@ -44,6 +44,7 @@ f_flag_head()
 }
 f_flag_body()
 {
+	cd "$(realpath "$PWD")"
 	atf_check touch A.file
 	atf_check ln -s nonexistent A.link
 	atf_check -o inline:"nonexistent\n" \
@@ -55,13 +56,15 @@ f_flag_body()
 atf_test_case n_flag
 n_flag_head()
 {
+	atf_set "descr" "Verify that calling readlink with -n will not emit " \
+			"a newline character."
 }
 n_flag_body()
 {
 	atf_check ln -s nonexistent.A A
 	atf_check ln -s nonexistent.B B
-	atf_check -o 'inline:nonexistent.A\nnonexistent.B\n' readlink A B
-	atf_check -o 'inline:nonexistent.Anonexistent.B' readlink -n A B
+	atf_check -o inline:"nonexistent.A\nnonexistent.B\n" readlink A B
+	atf_check -o inline:"nonexistent.Anonexistent.B" readlink -n A B
 }
 
 atf_init_test_cases()