diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-10-01 21:48:22 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-10-01 21:48:22 +0000 |
commit | 63c8336d4de15085d50c9d8c855cdc97ee018a04 (patch) | |
tree | 3d5efee44aa41a41cebb8a303dc2ab96abfff9eb /contrib | |
parent | 36972ee3e0fe8474e85646d0a2f1de9247a1e66a (diff) | |
download | src-test2-63c8336d4de15085d50c9d8c855cdc97ee018a04.tar.gz src-test2-63c8336d4de15085d50c9d8c855cdc97ee018a04.zip |
zgrep: fix exit status with multiple files
zgrep should exit with success when given multiple files and the
pattern is found in at least one file. Prior to this change,
it would exit with success only if the pattern was found in _every_ file.
Reviewed by: dab ngie
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26616
Notes
Notes:
svn path=/head/; revision=366345
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/netbsd-tests/usr.bin/grep/t_grep.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh index 75ee254cc79b..e094b15c6d67 100755 --- a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh +++ b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh @@ -891,6 +891,24 @@ mflag_body() atf_check -o inline:"test1:2\n" grep -m 2 -EHc "a|b|e|f" test1 } + +atf_test_case zgrep_multiple_files +zgrep_multiple_files_head() +{ + atf_set "descr" "Ensures that zgrep functions properly with multiple files" +} +zgrep_multiple_files_body() +{ + echo foo > test1 + echo foo > test2 + atf_check -o inline:"test1:foo\ntest2:foo\n" zgrep foo test1 test2 + + echo bar > test1 + atf_check -o inline:"test2:foo\n" zgrep foo test1 test2 + + echo bar > test2 + atf_check -s exit:1 zgrep foo test1 test2 +} # End FreeBSD atf_init_test_cases() @@ -944,5 +962,6 @@ atf_init_test_cases() atf_add_test_case fgrep_oflag atf_add_test_case cflag atf_add_test_case mflag + atf_add_test_case zgrep_multiple_files # End FreeBSD } |