From b3abfea626241afd979400d9b19e86492b7af9d4 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 7 Aug 2003 21:01:30 +0000 Subject: Two new regressions concerning detection of already applied patches. ok millert@ --- regress/usr.bin/patch/Makefile | 23 +++++++++++++++++++---- regress/usr.bin/patch/t3.diff | 4 ++++ regress/usr.bin/patch/t3.in | 1 + regress/usr.bin/patch/t3.out | 2 ++ regress/usr.bin/patch/t4.diff | 6 ++++++ regress/usr.bin/patch/t4.in | 1 + regress/usr.bin/patch/t4.out | 1 + 7 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 regress/usr.bin/patch/t3.diff create mode 100644 regress/usr.bin/patch/t3.in create mode 100644 regress/usr.bin/patch/t3.out create mode 100644 regress/usr.bin/patch/t4.diff create mode 100644 regress/usr.bin/patch/t4.in create mode 100644 regress/usr.bin/patch/t4.out diff --git a/regress/usr.bin/patch/Makefile b/regress/usr.bin/patch/Makefile index 8b268e262a6..7478261e421 100644 --- a/regress/usr.bin/patch/Makefile +++ b/regress/usr.bin/patch/Makefile @@ -1,25 +1,40 @@ -# $OpenBSD: Makefile,v 1.1 2003/07/22 19:31:51 otto Exp $ +# $OpenBSD: Makefile,v 1.2 2003/08/07 21:01:29 otto Exp $ PATCH=patch +PATCHOPTIONS=-sN -REGRESS_TARGETS=t1 t2 +REGRESS_TARGETS=t1 t2 t3 t4 # .in: input file # .diff: patch # .out: desired result after patching -# t1: diff contains invalid line number 0. Fails. +# t1: diff contains invalid line number 0. # t2: diff contains invalid line numbers beyond end of input file. +# t3: a case where it patch should detect a previously applied patch. +# Diff transform an empty file into a single line one. Patch cannot +# detect this because it has an empty context. +# t4: a case where patch has to detect a previously applied patch. +# Diff transform an file with a single line without eol into a single +# line with eol. Fails because patch does not detect the previously +# applied diff. all: clean ${REGRESS_TARGET} .SUFFIXES: .in .in: + @echo ${*} @cp ${.CURDIR}/${*}.in ${*}.copy - @${PATCH} -s ${*}.copy ${.CURDIR}/${*}.diff + @${PATCH} ${PATCHOPTIONS} ${*}.copy ${.CURDIR}/${*}.diff @cmp -s ${*}.copy ${.CURDIR}/${*}.out || (echo "XXX ${*} failed" && false) +t4: + @echo ${*} + @cp ${.CURDIR}/${*}.in ${*}.copy + @(! ${PATCH} ${PATCHOPTIONS} ${*}.copy ${.CURDIR}/${*}.diff) + @cmp -s ${*}.copy ${.CURDIR}/${*}.out || (echo "XXX ${*} failed" && false) + # Clean all files generated clean: rm -f *.copy *.orig *.rej diff --git a/regress/usr.bin/patch/t3.diff b/regress/usr.bin/patch/t3.diff new file mode 100644 index 00000000000..b3b005d9c6c --- /dev/null +++ b/regress/usr.bin/patch/t3.diff @@ -0,0 +1,4 @@ +--- t3.in Mon Aug 4 10:04:58 2003 ++++ t3.out Mon Aug 4 10:05:11 2003 +@@ -0,0 +1 @@ ++A line of text diff --git a/regress/usr.bin/patch/t3.in b/regress/usr.bin/patch/t3.in new file mode 100644 index 00000000000..0f24bc045a8 --- /dev/null +++ b/regress/usr.bin/patch/t3.in @@ -0,0 +1 @@ +A line of text diff --git a/regress/usr.bin/patch/t3.out b/regress/usr.bin/patch/t3.out new file mode 100644 index 00000000000..c9ffc909a19 --- /dev/null +++ b/regress/usr.bin/patch/t3.out @@ -0,0 +1,2 @@ +A line of text +A line of text diff --git a/regress/usr.bin/patch/t4.diff b/regress/usr.bin/patch/t4.diff new file mode 100644 index 00000000000..83d480eece1 --- /dev/null +++ b/regress/usr.bin/patch/t4.diff @@ -0,0 +1,6 @@ +--- t4.in Thu Aug 7 16:05:20 2003 ++++ t4.out Thu Aug 7 16:05:37 2003 +@@ -1 +1 @@ +-A line of text ++A line of text +\ No newline at end of file diff --git a/regress/usr.bin/patch/t4.in b/regress/usr.bin/patch/t4.in new file mode 100644 index 00000000000..c585375388e --- /dev/null +++ b/regress/usr.bin/patch/t4.in @@ -0,0 +1 @@ +A line of text \ No newline at end of file diff --git a/regress/usr.bin/patch/t4.out b/regress/usr.bin/patch/t4.out new file mode 100644 index 00000000000..c585375388e --- /dev/null +++ b/regress/usr.bin/patch/t4.out @@ -0,0 +1 @@ +A line of text \ No newline at end of file -- cgit v1.2.3