Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108394806
D10112.id26582.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D10112.id26582.diff
View Options
Index: contrib/netbsd-tests/usr.bin/grep/d_color_a.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_color_a.in
@@ -0,0 +1 @@
+abcd*
Index: contrib/netbsd-tests/usr.bin/grep/d_color_a.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_color_a.out
@@ -0,0 +1 @@
+abcd*
Index: contrib/netbsd-tests/usr.bin/grep/d_color_b.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_color_b.in
@@ -0,0 +1,5 @@
+fojeiwuroiuwet
+ljfajsljkfabcdddjlfkajlkj
+abcaaa
+zzzabc
+
Index: contrib/netbsd-tests/usr.bin/grep/d_color_b.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_color_b.out
@@ -0,0 +1,3 @@
+ljfajsljkfabcdddjlfkajlkj
+abcaaa
+zzzabc
Index: contrib/netbsd-tests/usr.bin/grep/d_color_c.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_color_c.out
@@ -0,0 +1,3 @@
+ljfajsljkf[01;31m[Kabcddd[m[Kjlfkajlkj
+[01;31m[Kabc[m[Kaaa
+zzz[01;31m[Kabc[m[K
Index: contrib/netbsd-tests/usr.bin/grep/d_escmap.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_escmap.in
@@ -0,0 +1 @@
+f.oo
Index: contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in
@@ -0,0 +1,2 @@
+Fish zebra monkey suits
+
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in
@@ -0,0 +1 @@
+01:1:01
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out
@@ -0,0 +1,3 @@
+0
+:
+:0
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in
@@ -0,0 +1 @@
+1:1:01
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out
@@ -0,0 +1,2 @@
+:
+:0
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in
@@ -0,0 +1 @@
+bla bla
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out
@@ -0,0 +1,2 @@
+bla
+bla
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in
@@ -0,0 +1,3 @@
+bla
+bla
+
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in
@@ -0,0 +1 @@
+abcdef
Index: contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out
===================================================================
--- /dev/null
+++ contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out
@@ -0,0 +1 @@
+ab
Index: contrib/netbsd-tests/usr.bin/grep/t_grep.sh
===================================================================
--- contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+++ contrib/netbsd-tests/usr.bin/grep/t_grep.sh
@@ -227,9 +227,85 @@
grep -z -C1 cod test1 test2
}
+atf_test_case oflag_zerolen
+oflag_zerolen_head()
+{
+ atf_set "descr" "Checks behavior of zero-length matches with -o flag"
+}
+oflag_zerolen_body()
+{
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_a.out" \
+ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_a.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_b.out" \
+ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_b.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_c.out" \
+ grep -Eo '[[:alnum:]]*' "$(atf_get_srcdir)/d_oflag_zerolen_c.in"
+
+ atf_check -o empty grep -Eo '' "$(atf_get_srcdir)/d_oflag_zerolen_d.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \
+ grep -o -e 'ab' -e 'bc' "$(atf_get_srcdir)/d_oflag_zerolen_e.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \
+ grep -o -e 'bc' -e 'ab' "$(atf_get_srcdir)/d_oflag_zerolen_e.in"
+}
+
+atf_test_case xflag
+xflag_head()
+{
+ atf_set "descr" "Check that we actually get a match with -x flag"
+}
+xflag_body()
+{
+ echo 128 > match_file
+ seq 1 128 > pattern_file
+ grep -xf pattern_file match_file
+}
+
+atf_test_case color
+color_head()
+{
+ atf_set "descr" "Checks behavior using --color"
+}
+color_body()
+{
+ echo 'abcd*' > grepfile
+ echo 'abc$' >> grepfile
+ echo '^abc' >> grepfile
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_a.out" \
+ grep --color=auto -e '.*' -e 'a' "$(atf_get_srcdir)/d_color_a.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_b.out" \
+ grep --color=auto -f grepfile "$(atf_get_srcdir)/d_color_b.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_c.out" \
+ grep --color=always -f grepfile "$(atf_get_srcdir)/d_color_b.in"
+}
+
+atf_test_case f_file_empty
+f_file_empty_body()
+{
+ printf "\0\n" > nulpat
+
+ atf_check -s exit:1 grep -f nulpat "$(atf_get_srcdir)/d_f_file_empty.in"
+}
+
+atf_test_case escmap
+escmap_body()
+{
+ atf_check -s exit:1 env -i MALLOC_CONF=junk:true grep -o 'f.o\.' "$(atf_get_srcdir)/d_escmap.in"
+ atf_check -s exit:1 env -i MALLOC_CONF=junk:false grep -o 'f.o\.' "$(atf_get_srcdir)/d_escmap.in"
+
+ atf_check -o not-empty env -i MALLOC_CONF=junk:true grep -o 'f.o.' "$(atf_get_srcdir)/d_escmap.in"
+ atf_check -o not-empty env -i MALLOC_CONF=junk:false grep -o 'f.o.' "$(atf_get_srcdir)/d_escmap.in"
+}
+
atf_init_test_cases()
{
- atf_add_test_case basic
+ atf_add_test_case basic
atf_add_test_case binary
atf_add_test_case recurse
atf_add_test_case recurse_symlink
@@ -245,4 +321,9 @@
atf_add_test_case zgrep
atf_add_test_case nonexistent
atf_add_test_case context2
+ atf_add_test_case oflag_zerolen
+ atf_add_test_case xflag
+ atf_add_test_case color
+ atf_add_test_case f_file_empty
+ atf_add_test_case escmap
}
Index: usr.bin/grep/tests/Makefile
===================================================================
--- usr.bin/grep/tests/Makefile
+++ usr.bin/grep/tests/Makefile
@@ -8,6 +8,11 @@
${PACKAGE}FILES+= d_begin_end_a.out
${PACKAGE}FILES+= d_begin_end_b.out
${PACKAGE}FILES+= d_binary.out
+${PACKAGE}FILES+= d_color_a.in
+${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_context2_a.out
${PACKAGE}FILES+= d_context2_b.out
${PACKAGE}FILES+= d_context2_c.out
@@ -18,12 +23,23 @@
${PACKAGE}FILES+= d_context_c.out
${PACKAGE}FILES+= d_context_d.out
${PACKAGE}FILES+= d_egrep.out
+${PACKAGE}FILES+= d_escmap.in
+${PACKAGE}FILES+= d_f_file_empty.in
${PACKAGE}FILES+= d_file_exp.in
${PACKAGE}FILES+= d_file_exp.out
${PACKAGE}FILES+= d_ignore_case.out
${PACKAGE}FILES+= d_input
${PACKAGE}FILES+= d_invert.in
${PACKAGE}FILES+= d_invert.out
+${PACKAGE}FILES+= d_oflag_zerolen_a.in
+${PACKAGE}FILES+= d_oflag_zerolen_a.out
+${PACKAGE}FILES+= d_oflag_zerolen_b.in
+${PACKAGE}FILES+= d_oflag_zerolen_b.out
+${PACKAGE}FILES+= d_oflag_zerolen_c.in
+${PACKAGE}FILES+= d_oflag_zerolen_c.out
+${PACKAGE}FILES+= d_oflag_zerolen_d.in
+${PACKAGE}FILES+= d_oflag_zerolen_e.in
+${PACKAGE}FILES+= d_oflag_zerolen_e.out
${PACKAGE}FILES+= d_recurse.out
${PACKAGE}FILES+= d_recurse_symlink.err
${PACKAGE}FILES+= d_recurse_symlink.out
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 10:53 AM (15 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16138721
Default Alt Text
D10112.id26582.diff (7 KB)
Attached To
Mode
D10112: bsdgrep(1): Create additional tests to expand coverage into areas that we're currently lacking
Attached
Detach File
Event Timeline
Log In to Comment