From 6dee77f7ca11af954e3f5552c3d217565c57eaf2 Mon Sep 17 00:00:00 2001 From: op Date: Wed, 3 Aug 2022 07:35:04 +0000 Subject: [PATCH] some love for patch regress * t3 doesn't was fixed anymore * add a comment describing t19 * add t20 (reversal application of a diff that creates a one-line file) ok stsp@ --- regress/usr.bin/patch/Makefile | 20 +++++++++++++------- regress/usr.bin/patch/t20.diff | 4 ++++ regress/usr.bin/patch/t20.in | 0 regress/usr.bin/patch/t20.out | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 regress/usr.bin/patch/t20.diff create mode 100644 regress/usr.bin/patch/t20.in create mode 100644 regress/usr.bin/patch/t20.out diff --git a/regress/usr.bin/patch/Makefile b/regress/usr.bin/patch/Makefile index 73781e33724..45b228aaf7c 100644 --- a/regress/usr.bin/patch/Makefile +++ b/regress/usr.bin/patch/Makefile @@ -1,15 +1,11 @@ -# $OpenBSD: Makefile,v 1.13 2017/07/06 21:33:45 bluhm Exp $ +# $OpenBSD: Makefile,v 1.14 2022/08/03 07:35:04 op Exp $ PATCH?= patch PATCHFLAGS= -sN CLEANFILES= *.copy *.orig *.rej t5 d19/* REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 \ - t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 - -t3: - @echo ${*} currently fails - @echo DISABLED + t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 # .in: input file # .diff: patch @@ -18,7 +14,7 @@ t3: # t1: diff contains invalid line number 0. # t2: diff contains invalid line numbers beyond end of input file. # t3: a case where patch should detect a previously applied patch. -# Diff transform an empty file into a single line one. Currently fails. +# Diff transform an empty file into a single line one. # t4: a case where patch has to detect a previously applied patch. # Diff transform a file with a single line with an eol into a single # line without eol. @@ -31,6 +27,8 @@ t3: # t16: diff in ed format. # t17: diff in ed format that inserts a dot-line. # t18: diff in ed format that fully replaces input content. +# t19: git-produced unified diff. +# t20: reversal application of a patch to create a file with a single line. .SUFFIXES: .in @@ -47,6 +45,7 @@ t3: @(! ${PATCH} ${PATCHFLAGS} ${*}.copy ${.CURDIR}/${*}.diff) @cmp -s ${*}.copy ${.CURDIR}/${*}.out || \ (echo "XXX ${*} failed" && false) + t4: @echo ${*} @cp ${.CURDIR}/${*}.in ${*}.copy @@ -74,6 +73,13 @@ t19: @${PATCH} -t ${PATCHFLAGS} < ${.CURDIR}/t19.diff @cmp -s ${.CURDIR}/t19.out d19/file || (echo "XXX t19 failed" && false) +t20: + @echo ${*} + @cp ${.CURDIR}/${*}.in ${*}.copy + @${PATCH} ${PATCHFLAGS} -Rf ${*}.copy ${.CURDIR}/${*}.diff + @cmp -s ${*}.copy ${.CURDIR}/${*}.out || \ + (echo "XXX ${*} failed" && false) + .PHONY: t5 .include diff --git a/regress/usr.bin/patch/t20.diff b/regress/usr.bin/patch/t20.diff new file mode 100644 index 00000000000..e64ddc9faf1 --- /dev/null +++ b/regress/usr.bin/patch/t20.diff @@ -0,0 +1,4 @@ +--- full ++++ empty +@@ -1 +0,0 @@ +-A diff --git a/regress/usr.bin/patch/t20.in b/regress/usr.bin/patch/t20.in new file mode 100644 index 00000000000..e69de29bb2d diff --git a/regress/usr.bin/patch/t20.out b/regress/usr.bin/patch/t20.out new file mode 100644 index 00000000000..f70f10e4db1 --- /dev/null +++ b/regress/usr.bin/patch/t20.out @@ -0,0 +1 @@ +A -- 2.20.1