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