xref: /openbsd/regress/bin/ed/Makefile (revision 4bdff4be)
1# $OpenBSD: Makefile,v 1.3 2020/12/17 00:51:11 bluhm Exp $
2
3ED ?=		/bin/ed
4TESTDIR =	${.CURDIR}/../../../bin/ed/test
5
6TS !=		cd ${TESTDIR} && ls *.t
7ERRS !=		cd ${TESTDIR} && ls *.err
8CLEANFILES =	*.t *.d *.ed *.err *.red *.o *.z
9
10# from /usr/src/bin/ed/test/README, known failing tests
11REGRESS_EXPECTED_FAILURES =	run-eq.red \
12				run-a1.red \
13				run-i1.red \
14				run-k1.red \
15				run-r1.red
16
17REGRESS_TARGETS =
18
19.for t in ${TS:R}
20# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
21$t.ed: ${TESTDIR}/$t.t ${TESTDIR}/$t.d Makefile
22	cp ${TESTDIR}/$t.t ${TESTDIR}/$t.d .
23	( \
24	    echo "#!/bin/sh -"; \
25	    echo "rm -f -- $t.o"; \
26	    echo "${ED} - <<\EOT"; \
27	    echo H; \
28	    echo "r $t.d"; \
29	    cat $t.t; \
30	    echo "w $t.o"; \
31	    echo EOT; \
32	) >$t.tmp
33	mv $t.tmp $t.ed
34	chmod +x $t.ed
35
36REGRESS_TARGETS +=	run-$t.ed
37# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
38run-$t.ed: $t.ed
39	./$t.ed
40	diff -u ${TESTDIR}/$t.r $t.o
41.endfor
42
43.for t in ${ERRS:R}
44# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
45$t.red: ${TESTDIR}/$t.err Makefile
46	cp ${TESTDIR}/$t.err .
47	( \
48	    echo "#!/bin/sh -"; \
49	    echo "rm -f -- $t.o"; \
50	    echo "${ED} - <<\EOT"; \
51	    echo H; \
52	    echo "r $t.err"; \
53	    cat $t.err; \
54	    echo "w $t.o"; \
55	    echo EOT; \
56	) >$t.tmp
57	mv $t.tmp $t.red
58	chmod +x $t.red
59
60REGRESS_TARGETS +=	run-$t.red
61# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
62run-$t.red: $t.red
63	! ./$t.red
64.endfor
65
66.include <bsd.regress.mk>
67