xref: /openbsd/regress/usr.bin/sed/Makefile (revision eaf3b488)
1#	$OpenBSD: Makefile,v 1.8 2022/01/12 15:32:15 martijn Exp $
2#	$NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $
3
4SED?=	/usr/bin/sed
5
6REGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \
7	inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1
8
9commandc1:
10	# New tests, currently failing, need fixes in sed.
11	@echo DISABLED
12
13sedtest:
14	sh ${.CURDIR}/$@.sh ${SED} $@.out
15	diff ${.CURDIR}/$@.expected $@.out
16
17substitute:
18	sh ${.CURDIR}/$@.sh
19
20hanoi:
21	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
22	diff ${.CURDIR}/$@.expected $@.out
23
24math:
25	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
26	diff ${.CURDIR}/$@.expected $@.out
27
28sierpinski:
29	${SED} -nf ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
30	diff ${.CURDIR}/$@.expected $@.out
31
32negation:
33	echo foo | ${SED} "1!!s/foo/bar/" > $@.out
34	diff ${.CURDIR}/$@.expected $@.out
35
36inplace:
37	cp -f ${.CURDIR}/$@.in $@.txt
38	${SED} -i -f ${.CURDIR}/sierpinski.sed $@.txt
39	diff ${.CURDIR}/sierpinski.expected $@.txt
40
41inplace2:
42	cp -f ${.CURDIR}/$@.in $@.txt
43	${SED} -i 's/PROG/GROP/g' $@.txt
44	diff ${.CURDIR}/$@.expected $@.txt
45
46inplace3:
47	cp -f ${.CURDIR}/$@.in $@.txt
48	${SED} -i 's/#PermitRootLogin no/PermitRootLogin yes/g' $@.txt
49	diff ${.CURDIR}/$@.expected $@.txt
50
51commandl1:
52	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
53	diff ${.CURDIR}/$@.expected $@.out
54
55commandl2:
56	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
57	diff ${.CURDIR}/$@.expected $@.out
58
59commandc1:
60	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
61	diff ${.CURDIR}/$@.expected $@.out
62
63commandD1:
64	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
65	diff ${.CURDIR}/$@.expected $@.out
66
67CLEANFILES+=*.out lines* script* *.txt
68
69.include <bsd.regress.mk>
70