git: b9a6888b37cc - stable/13 - diff: Tweak recursion tests

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Wed, 18 Feb 2026 00:26:03 UTC
The branch stable/13 has been updated by des:

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

commit b9a6888b37cce03a5a04f376a1d782498f4352af
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-02-13 20:18:30 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-02-18 00:21:16 +0000

    diff: Tweak recursion tests
    
    The -r flag is not required to compare two directories; it is only
    required to compare them recursively, i.e. descend into their common
    subdirectories.  Adjust tests that use -r needlessly, and adjust the
    dirloop test to verify that these two cases remain distinct.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    kevans
    Differential Revision:  https://reviews.freebsd.org/D55262
    
    (cherry picked from commit b2532432971fbd9339a9a49eca1b532978bb6d48)
---
 usr.bin/diff/tests/diff_test.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
index 9914cdcf84c7..0fcd5b02c29c 100755
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -1,4 +1,3 @@
-
 atf_test_case simple
 atf_test_case unified
 atf_test_case header
@@ -170,19 +169,19 @@ brief_format_body()
 	atf_check \
 	    -s exit:1 \
 	    -o inline:"Files A/test-file and B/test-file differ\n" \
-	    diff -rq A B
+	    diff -q A B
 
 	atf_check diff -rq A C
 
 	atf_check \
 	    -s exit:1 \
 	    -o inline:"Only in D: another-test-file\n" \
-	    diff -rq A D
+	    diff -q A D
 
 	atf_check \
 	    -s exit:1 \
 	    -o inline:"Files A/another-test-file and D/another-test-file differ\n" \
-	    diff -Nrq A D
+	    diff -Nq A D
 }
 
 Bflag_body()
@@ -204,9 +203,9 @@ Nflag_body()
 {
 	atf_check -x 'printf "foo" > A'
 
-	atf_check -s exit:1 -o ignore -e ignore diff -N A NOFILE 
-	atf_check -s exit:1 -o ignore -e ignore diff -N NOFILE A 
-	atf_check -s exit:2 -o ignore -e ignore diff -N NOFILE1 NOFILE2 
+	atf_check -s exit:1 -o ignore -e ignore diff -N A NOFILE
+	atf_check -s exit:1 -o ignore -e ignore diff -N NOFILE A
+	atf_check -s exit:2 -o ignore -e ignore diff -N NOFILE1 NOFILE2
 }
 
 tabsize_body()
@@ -298,6 +297,9 @@ dirloop_body()
 	atf_check mkdir -p a/foo/bar
 	atf_check ln -s .. a/foo/bar/up
 	atf_check cp -a a b
+	atf_check \
+	    -o inline:"Common subdirectories: a/foo and b/foo\n" \
+	    diff a b
 	atf_check \
 	    -e match:"a/foo/bar/up: Directory loop detected" \
 	    -e match:"b/foo/bar/up: Directory loop detected" \