From 9499bb88348ed4469f97f197bd2e10053ceda9bf Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 22 Jul 2003 19:34:17 +0000 Subject: Also test ed(1) style patches. ok millert@ --- regress/usr.bin/diff/Makefile | 23 ++++++++++++++++++----- regress/usr.bin/diff/t13.1 | 11 +++++++++++ regress/usr.bin/diff/t13.2 | 9 +++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 regress/usr.bin/diff/t13.1 create mode 100644 regress/usr.bin/diff/t13.2 (limited to 'regress/usr.bin') diff --git a/regress/usr.bin/diff/Makefile b/regress/usr.bin/diff/Makefile index 4b8b33b4bae..a55b2ce5dae 100644 --- a/regress/usr.bin/diff/Makefile +++ b/regress/usr.bin/diff/Makefile @@ -1,9 +1,12 @@ -# $OpenBSD: Makefile,v 1.2 2003/07/21 20:16:21 otto Exp $ +# $OpenBSD: Makefile,v 1.3 2003/07/22 19:34:16 otto Exp $ -REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 +REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 DIFF=diff +# Skip the cmp(1) part for ed(1) style diffs for these tests +EDSKIPCMP=t7 t10 + # .1 and .2: input files # t1: two empty files @@ -18,6 +21,7 @@ DIFF=diff # t10: two files with no end of line at the end, line in second file is longer # t11: rev 1.3 and 1.36 of usr.bin/ed/ed.1. # t12: rev 1.1 and 1.2 of sbin/isakmpd/regress/hmac/Makefile. Fails. +# t13: a case to check the single dot on a line handling for ed(1) patches. .SUFFIXES: .1 .2 @@ -27,15 +31,24 @@ all: clean ${REGRESS_TARGET} @cp ${.CURDIR}/${*}.1 ${*}.copy @cp ${.CURDIR}/${*}.1 ${*}.c.copy @cp ${.CURDIR}/${*}.1 ${*}.u.copy + @cp ${.CURDIR}/${*}.1 ${*}.e.copy @${DIFF} ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.patch || true @${DIFF} -c ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.c.patch || true @${DIFF} -u ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.u.patch || true + @${DIFF} -e ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.e.patch || true @patch -s ${*}.copy ${*}.patch || true @patch -s ${*}.c.copy ${*}.c.patch || true @patch -s ${*}.u.copy ${*}.u.patch || true - @cmp -s ${.CURDIR}/${*}.2 ${*}.copy || (echo "XXX ${*} standard diff failed" && false) - @cmp -s ${.CURDIR}/${*}.2 ${*}.c.copy || (echo "XXX ${*} context diff failed" && false) - @cmp -s ${.CURDIR}/${*}.2 ${*}.u.copy || (echo "XXX ${*} unified diff failed" && false) + @patch -s ${*}.e.copy ${*}.e.patch || true + @cmp -s ${.CURDIR}/${*}.2 ${*}.copy || \ + (echo "XXX ${*} standard diff failed" && false) + @cmp -s ${.CURDIR}/${*}.2 ${*}.c.copy || \ + (echo "XXX ${*} context diff failed" && false) + @cmp -s ${.CURDIR}/${*}.2 ${*}.u.copy || \ + (echo "XXX ${*} unified diff failed" && false) + @( echo ${EDSKIPCMP} | grep -q '[[:<:]]${*}[[:>:]]' ) || \ + cmp -s ${.CURDIR}/${*}.2 ${*}.e.copy || \ + (echo "XXX ${*} ed diff failed" && false) # Clean all files generated clean: diff --git a/regress/usr.bin/diff/t13.1 b/regress/usr.bin/diff/t13.1 new file mode 100644 index 00000000000..bedd72eee7f --- /dev/null +++ b/regress/usr.bin/diff/t13.1 @@ -0,0 +1,11 @@ +A line of text +. +Another line of text +.. +A third line +... +A fourth line +. +We keep counting +. +. diff --git a/regress/usr.bin/diff/t13.2 b/regress/usr.bin/diff/t13.2 new file mode 100644 index 00000000000..3e00acf6ec1 --- /dev/null +++ b/regress/usr.bin/diff/t13.2 @@ -0,0 +1,9 @@ +A line of text +Another line of text +.. +. +A third line +... +.. +We keep counting +. -- cgit v1.2.3