summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-08-07 21:01:30 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-08-07 21:01:30 +0000
commitb3abfea626241afd979400d9b19e86492b7af9d4 (patch)
tree9c251934fd9049574ae7aca2fe657776d9aea332
parente6e87dd6f6ed6af5fb7684889f1383464ceb3983 (diff)
Two new regressions concerning detection of already applied patches.
ok millert@
-rw-r--r--regress/usr.bin/patch/Makefile23
-rw-r--r--regress/usr.bin/patch/t3.diff4
-rw-r--r--regress/usr.bin/patch/t3.in1
-rw-r--r--regress/usr.bin/patch/t3.out2
-rw-r--r--regress/usr.bin/patch/t4.diff6
-rw-r--r--regress/usr.bin/patch/t4.in1
-rw-r--r--regress/usr.bin/patch/t4.out1
7 files changed, 34 insertions, 4 deletions
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