xref: /openbsd/regress/usr.bin/patch/Makefile (revision 4cfece93)
1# $OpenBSD: Makefile,v 1.13 2017/07/06 21:33:45 bluhm Exp $
2
3PATCH?=		patch
4PATCHFLAGS=	-sN
5CLEANFILES=	*.copy *.orig *.rej t5 d19/*
6
7REGRESS_TARGETS=     t1  t2  t3  t4  t5  t6  t7  t8  t9 \
8		t10 t11 t12 t13 t14 t15 t16 t17 t18 t19
9
10t3:
11	@echo ${*} currently fails
12	@echo DISABLED
13
14# .in: input file
15# .diff: patch
16# .out: desired result after patching
17
18# t1: diff contains invalid line number 0.
19# t2: diff contains invalid line numbers beyond end of input file.
20# t3: a case where patch should detect a previously applied patch.
21#     Diff transform an empty file into a single line one. Currently fails.
22# t4: a case where patch has to detect a previously applied patch.
23#     Diff transform a file with a single line with an eol into a single
24#     line without eol.
25# t5: both files in diff do not exist. t5.in should be missing.
26# t6-t12: various cases of no eol at end of file handling.
27# t13: a case where patch has to detect a previously applied patch.
28#     Diff transform a file ending with no eol into a file ending with eol.
29# t14: diff in normal diff format.
30# t15: diff in context diff format.
31# t16: diff in ed format.
32# t17: diff in ed format that inserts a dot-line.
33# t18: diff in ed format that fully replaces input content.
34
35.SUFFIXES: .in
36
37.in:
38	@echo ${*}
39	@cp ${.CURDIR}/${*}.in ${*}.copy
40	@${PATCH} ${PATCHFLAGS} ${*}.copy ${.CURDIR}/${*}.diff
41	@cmp -s ${*}.copy ${.CURDIR}/${*}.out || \
42		(echo "XXX ${*} failed" && false)
43
44t3:
45	@echo ${*}
46	@cp ${.CURDIR}/${*}.in ${*}.copy
47	@(! ${PATCH} ${PATCHFLAGS} ${*}.copy ${.CURDIR}/${*}.diff)
48	@cmp -s ${*}.copy ${.CURDIR}/${*}.out || \
49		(echo "XXX ${*} failed" && false)
50t4:
51	@echo ${*}
52	@cp ${.CURDIR}/${*}.in ${*}.copy
53	@(! ${PATCH} ${PATCHFLAGS} ${*}.copy ${.CURDIR}/${*}.diff)
54	@cmp -s ${*}.copy ${.CURDIR}/${*}.out || \
55		(echo "XXX ${*} failed" && false)
56
57t5:
58	@echo ${*}
59	@rm -f ${*}
60	@${PATCH} ${PATCHFLAGS} < ${.CURDIR}/${*}.diff
61	@cmp -s ${*} ${.CURDIR}/${*}.out || (echo "XXX ${*} failed" && false)
62
63t13:
64	@echo ${*}
65	@cp ${.CURDIR}/${*}.in ${*}.copy
66	@(! ${PATCH} ${PATCHFLAGS} ${*}.copy ${.CURDIR}/${*}.diff)
67	@cmp -s ${*}.copy ${.CURDIR}/${*}.out || \
68		(echo "XXX ${*} failed" && false)
69
70t19:
71	@echo t19
72	@mkdir -p d19
73	@cp ${.CURDIR}/t19.in d19/file
74	@${PATCH} -t ${PATCHFLAGS} < ${.CURDIR}/t19.diff
75	@cmp -s ${.CURDIR}/t19.out d19/file || (echo "XXX t19 failed" && false)
76
77.PHONY: t5
78
79.include <bsd.regress.mk>
80