aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff/tests
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-02-05 14:39:57 +0000
committerColin Percival <cperciva@FreeBSD.org>2026-02-11 06:14:30 +0000
commitb4139147bbb7e368316bee86ffac0fdb79319839 (patch)
tree98556b259204f42f02d4a32312cc61cd4ac8f5df /usr.bin/diff/tests
parent6761e555376e375f89fe36c72f2813f5e64a7f63 (diff)
Diffstat (limited to 'usr.bin/diff/tests')
-rwxr-xr-xusr.bin/diff/tests/diff_test.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
index b499bb709cdd..d28eeba9604d 100755
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -423,6 +423,24 @@ prleak_body()
atf_check diff -rul a b
}
+same_head()
+{
+ atf_set "descr" "Don't diff a file or directory with itself"
+}
+same_body()
+{
+ local n=256
+ mkdir a
+ for hi in $(jot -w%02x $n 0) ; do
+ mkdir a/$hi
+ for lo in $(jot -w%02x $n 0) ; do
+ echo "$hi$lo" >a/$hi/$lo
+ done
+ done
+ ln -s a b
+ atf_check timeout 1s diff -rqs a b
+}
+
atf_init_test_cases()
{
atf_add_test_case simple
@@ -453,4 +471,5 @@ atf_init_test_cases()
atf_add_test_case bigc
atf_add_test_case bigu
atf_add_test_case prleak
+ atf_add_test_case same
}