summaryrefslogtreecommitdiff
path: root/regress/usr.bin/diff/Makefile
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-07-17 21:04:05 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-07-17 21:04:05 +0000
commit9d6d3eb6b3892b849bcbf39950ec2281c02349c5 (patch)
treeb9aa73d9836d3db8ea46f142bb0296b853560875 /regress/usr.bin/diff/Makefile
parent449320db9c0abe4d21844929ad1c21605c66753d (diff)
A set of regressions to test diff(1).
Currently standard, context and unified diffs are tested by diffing two files and then applying the patch on a copy of the first file using patch(1). Next, the result is compared with the original first file using cmp(1). ok millert@ tedu@
Diffstat (limited to 'regress/usr.bin/diff/Makefile')
-rw-r--r--regress/usr.bin/diff/Makefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/regress/usr.bin/diff/Makefile b/regress/usr.bin/diff/Makefile
new file mode 100644
index 00000000000..43f39e80ee0
--- /dev/null
+++ b/regress/usr.bin/diff/Makefile
@@ -0,0 +1,42 @@
+# $OpenBSD: Makefile,v 1.1 2003/07/17 21:04:03 otto Exp $
+
+REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
+
+DIFF=diff
+
+# .1 and .2: input files
+
+# t1: two empty files
+# t2: basic editing
+# t3: one empty, other contains text
+# t4: one contains text, other empty
+# t5: files are the same
+# t6: one file with no newline at end, other does contain newline
+# t7: one file with newline at end, the other not
+# t8: revisison 1.1 and 1.54 of kern_malloc.c
+# t9: revisison 1.1 and 1.104 of vfs_syscalls.c
+# t10: two files with no end of line at the end, line in second file is longer
+
+.SUFFIXES: .1 .2
+
+all: clean ${REGRESS_TARGET}
+
+.1:
+ @cp ${.CURDIR}/${*}.1 ${*}.copy
+ @cp ${.CURDIR}/${*}.1 ${*}.c.copy
+ @cp ${.CURDIR}/${*}.1 ${*}.u.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
+ @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)
+
+# Clean all files generated
+clean:
+ rm -f *.copy *.patch *.orig
+
+.include <bsd.regress.mk>