git: 0a5535d1c520 - main - grep: add testcase to test color when matches is greater than MAX_MATCHES
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Jan 2026 23:23:12 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=0a5535d1c5209e73c6b2f3fd6118f9ffcb7e296e
commit 0a5535d1c5209e73c6b2f3fd6118f9ffcb7e296e
Author: Viacheslav Chimishuk <vchimishuk@yandex.ru>
AuthorDate: 2024-10-06 22:18:17 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-01-09 23:22:48 +0000
grep: add testcase to test color when matches is greater than MAX_MATCHES
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/1442
---
contrib/netbsd-tests/usr.bin/grep/d_color_d.out | 1 +
contrib/netbsd-tests/usr.bin/grep/t_grep.sh | 6 ++++++
usr.bin/grep/tests/Makefile | 1 +
3 files changed, 8 insertions(+)
diff --git a/contrib/netbsd-tests/usr.bin/grep/d_color_d.out b/contrib/netbsd-tests/usr.bin/grep/d_color_d.out
new file mode 100644
index 000000000000..a9ce473965ea
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/grep/d_color_d.out
@@ -0,0 +1 @@
+[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar[01;31m[Kfoo[m[Kbar
diff --git a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
index c4ba9a9657db..9f92160bc372 100755
--- a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+++ b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
@@ -422,6 +422,12 @@ color_body()
atf_check -o file:"$(atf_get_srcdir)/d_color_c.out" \
grep --color=always -f grepfile "$(atf_get_srcdir)/d_color_b.in"
+ # Begin FreeBSD
+ MAX_MATCHES=32
+ for _ in $(seq $((MAX_MATCHES + 1))); do printf "foobar"; done > grepfile
+ atf_check -o file:"$(atf_get_srcdir)/d_color_d.out" \
+ grep --color=always foo grepfile
+ # End FreeBSD
}
atf_test_case f_file_empty
diff --git a/usr.bin/grep/tests/Makefile b/usr.bin/grep/tests/Makefile
index b3c79657e53c..1db5ebea5c62 100644
--- a/usr.bin/grep/tests/Makefile
+++ b/usr.bin/grep/tests/Makefile
@@ -12,6 +12,7 @@ ${PACKAGE}FILES+= d_color_a.out
${PACKAGE}FILES+= d_color_b.in
${PACKAGE}FILES+= d_color_b.out
${PACKAGE}FILES+= d_color_c.out
+${PACKAGE}FILES+= d_color_d.out
${PACKAGE}FILES+= d_context2_a.out
${PACKAGE}FILES+= d_context2_b.out
${PACKAGE}FILES+= d_context2_c.out