Page MenuHomeFreeBSD

D10827.id28592.diff
No OneTemporary

D10827.id28592.diff

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
@@ -574,6 +574,48 @@
atf_check -o inline:"A\000B\000C\n" grep --binary-files=text 'B' test1
atf_check -s exit:1 grep --binary-files=without-match 'B' test2
}
+
+atf_test_case mmap
+mmap_head()
+{
+ atf_set "descr" "Check basic matching with --mmap flag"
+}
+mmap_body()
+{
+ grep_type
+ if [ $? -eq $GREP_TYPE_GNU ]; then
+ atf_expect_fail "this test doesn't pass with gnu grep from ports"
+ fi
+
+ printf "A\nB\nC\n" > test1
+
+ atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1
+ atf_check -s exit:1 grep --mmap -e "Z" test1
+}
+
+atf_test_case mmap_eof_not_eol
+mmap_eof_not_eol_head()
+{
+ atf_set "descr" "Check --mmap flag handling of encountering EOF without EOL (PR 165471, 219402)"
+}
+mmap_eof_not_eol_body()
+{
+ grep_type
+ if [ $? -eq $GREP_TYPE_GNU ]; then
+ atf_expect_fail "this test doesn't pass with gnu grep from ports"
+ fi
+
+ printf "ABC" > test1
+ for i in $(jot 4096); do
+ printf " " >> test2
+ done
+
+ atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1
+ # Dependency on jemalloc(3) to detect buffer overflow, otherwise this
+ # unreliably produces a SIGSEGV or SIGBUS
+ atf_check -s exit:0 -o not-empty -x \
+ 'env MALLOC_CONF="redzone:true" grep --mmap -e " " /tmp/test1'
+}
# End FreeBSD
atf_init_test_cases()
@@ -610,5 +652,7 @@
atf_add_test_case grep_nomatch_flags
atf_add_test_case binary_flags
atf_add_test_case badcontext
+ atf_add_test_case mmap
+ atf_add_test_case mmap_eof_not_eol
# End FreeBSD
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 12:23 PM (18 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27649990
Default Alt Text
D10827.id28592.diff (1 KB)

Event Timeline