xref: /openbsd-src/regress/usr.bin/diff/Makefile (revision babcc32b9d5053b7f9bfa9807d09add574e1d946)
1*babcc32bSbluhm# $OpenBSD: Makefile,v 1.8 2017/07/06 21:33:45 bluhm Exp $
2bad3ecd0Sotto
3*babcc32bSbluhmDIFF?=		diff
4*babcc32bSbluhmPATCH?=		patch
5*babcc32bSbluhmPATCHFLAGS=	-sb
6*babcc32bSbluhmCLEANFILES=	*.copy *.patch *.orig
7bad3ecd0Sotto
8*babcc32bSbluhmREGRESS_TARGETS=     t1  t2  t3  t4  t5  t6  t7  t8  t9 \
9*babcc32bSbluhm		t10 t11 t12 t13 t14 t15
10bad3ecd0Sotto
11e35ef852Sotto# Skip the cmp(1) part for ed(1) style diffs for these tests
12cd68dbecSottoEDSKIPCMP=t7 t10 t12
13e35ef852Sotto
14bad3ecd0Sotto# .1 and .2: 	input files
15bad3ecd0Sotto
16bad3ecd0Sotto# t1: two empty files
17bad3ecd0Sotto# t2: basic editing
18bad3ecd0Sotto# t3: one empty, other contains text
19bad3ecd0Sotto# t4: one contains text, other empty
20bad3ecd0Sotto# t5: files are the same
21bad3ecd0Sotto# t6: one file with no newline at end, other does contain newline
22bad3ecd0Sotto# t7: one file with newline at end, the other not
23f18483fbSray# t8: revision 1.1 and 1.54 of kern_malloc.c
24f18483fbSray# t9: revision 1.1 and 1.104 of vfs_syscalls.c
25bad3ecd0Sotto# t10: two files with no end of line at the end, line in second file is longer
26a5e94ad9Sotto# t11: rev 1.3 and 1.36 of usr.bin/ed/ed.1.
27cd68dbecSotto# t12: rev 1.1 and 1.2 of sbin/isakmpd/regress/hmac/Makefile.
28e35ef852Sotto# t13: a case to check the single dot on a line handling for ed(1) patches.
29887303feSkspillner# t14: a case to ensure unified diffs ignoring whitespace produce valid output
30887303feSkspillner#      when extra lines and no newline at end of file1
31887303feSkspillner# t15: a case to ensure unified diffs ignoring whitespace produce valid output
32887303feSkspillner#      when fewer lines and no newline at end of file1
33bad3ecd0Sotto
34bad3ecd0Sotto.SUFFIXES: .1 .2
35bad3ecd0Sotto
36bad3ecd0Sotto.1:
37bad3ecd0Sotto	@cp ${.CURDIR}/${*}.1 ${*}.copy
38bad3ecd0Sotto	@cp ${.CURDIR}/${*}.1 ${*}.c.copy
39bad3ecd0Sotto	@cp ${.CURDIR}/${*}.1 ${*}.u.copy
40e35ef852Sotto	@cp ${.CURDIR}/${*}.1 ${*}.e.copy
41bad3ecd0Sotto	@${DIFF}  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.patch || true
42bad3ecd0Sotto	@${DIFF} -c  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.c.patch || true
43bad3ecd0Sotto	@${DIFF} -u  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.u.patch || true
44e35ef852Sotto	@${DIFF} -e  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.e.patch || true
45*babcc32bSbluhm	@${PATCH} ${PATCHFLAGS} ${*}.copy ${*}.patch || true
46*babcc32bSbluhm	@${PATCH} ${PATCHFLAGS} ${*}.c.copy ${*}.c.patch || true
47*babcc32bSbluhm	@${PATCH} ${PATCHFLAGS} ${*}.u.copy ${*}.u.patch || true
48*babcc32bSbluhm	@${PATCH} ${PATCHFLAGS} ${*}.e.copy ${*}.e.patch || true
49e35ef852Sotto	@cmp -s ${.CURDIR}/${*}.2 ${*}.copy || \
50e35ef852Sotto		(echo "XXX ${*} standard diff failed" && false)
51e35ef852Sotto	@cmp -s ${.CURDIR}/${*}.2 ${*}.c.copy || \
52e35ef852Sotto		(echo "XXX ${*} context diff failed" && false)
53e35ef852Sotto	@cmp -s ${.CURDIR}/${*}.2 ${*}.u.copy || \
54e35ef852Sotto		(echo "XXX ${*} unified diff failed" && false)
55e35ef852Sotto	@( echo ${EDSKIPCMP} | grep -q '[[:<:]]${*}[[:>:]]' ) || \
56e35ef852Sotto		cmp -s ${.CURDIR}/${*}.2 ${*}.e.copy || \
57e35ef852Sotto		(echo "XXX ${*} ed diff failed" && false)
58bad3ecd0Sotto
59887303feSkspillnert14.1 t15.1:
60887303feSkspillner	@cp ${.CURDIR}/${*}.1 ${*}.uw.copy
61887303feSkspillner	@${DIFF} -uw  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.uw.patch || true
62*babcc32bSbluhm	@${PATCH} ${PATCHFLAGS} ${*}.uw.copy ${*}.uw.patch || true
63887303feSkspillner	@cmp -s ${.CURDIR}/${*}.2 ${*}.uw.copy || \
64887303feSkspillner		(echo "XXX ${*} unified diff ignoring whitespace failed" && false)
65887303feSkspillner
66bad3ecd0Sotto.include <bsd.regress.mk>
67