From: millert Date: Wed, 15 Nov 2023 00:52:42 +0000 (+0000) Subject: Add regress test for "grep -m" behavior. From Crystal Kolipe. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1252c3676f7748817e3371b1b701b237645e601a;p=openbsd Add regress test for "grep -m" behavior. From Crystal Kolipe. --- diff --git a/regress/usr.bin/grep/Makefile b/regress/usr.bin/grep/Makefile index edb5a524817..8b227fff73a 100644 --- a/regress/usr.bin/grep/Makefile +++ b/regress/usr.bin/grep/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.18 2021/12/29 19:31:01 sdk Exp $ +# $OpenBSD: Makefile,v 1.19 2023/11/15 00:52:42 millert Exp $ REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 \ - t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 + t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28 t1: grep t.s ${.CURDIR}/in | diff - ${.CURDIR}/t1.out @@ -107,8 +107,27 @@ t27: grep -B1 'C' ${.CURDIR}/t27.in | diff - ${.CURDIR}/t27b.out grep -C1 'C' ${.CURDIR}/t27.in | diff - ${.CURDIR}/t27c.out +t28: + grep -m 0 -o x.y ${.CURDIR}/t28.in | diff - /dev/null + grep -m 1 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_1.out + grep -m 2 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_2.out + grep -m 3 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_3.out + grep -m 4 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out + grep -m 5 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out + grep -m 6 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out + grep -m 7 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out + grep -m 8 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out + grep -m 0 x.y ${.CURDIR}/t28.in | diff - /dev/null + grep -m 1 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_5.out + grep -m 2 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_6.out + grep -m 3 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_7.out + grep -m 4 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out + grep -m 5 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out + grep -m 6 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out + grep -m 7 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out + grep -m 8 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out .PHONY: t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 -.PHONY: t21 t22 t23 t24 t25 t26 t27 +.PHONY: t21 t22 t23 t24 t25 t26 t27 t28 .include diff --git a/regress/usr.bin/grep/t28.in b/regress/usr.bin/grep/t28.in new file mode 100644 index 00000000000..1a5a9915390 --- /dev/null +++ b/regress/usr.bin/grep/t28.in @@ -0,0 +1,7 @@ +regression test pattern should match nothing on this line +x1y x2y x3y x4y - four matches here +match nothing on this line +x5y x6y x7y - three here +x8y x9y - two here +x0y - one here +none here