On Fri, Jan 05, 2018 at 07:01:56PM +0300, Sergey Bronnikov wrote:
> I have updated patch for bin/ed and now the most part of tests are
> works.
I have converted your work into a single Makefile. It is easier
to have everything in one place. So mkscripts.sh and ckscripts.sh
are implemented as make rule. This gives more flexibility to create
the files in our obj directory.
> Tests i3.red, nl.red and s2.red still fails and require some attention.
I am reluctant to commit something to regress that fails.
Could you investigate why they are broken?
> - rename =.err to something else, for example eq.err,
> otherwise make will fail
Yes, that makes Makefile scripting easier.
Below is my Makefile, it works with and without obj directory.
bluhm
# $OpenBSD$
ED ?= /bin/ed
TESTDIR = ${.CURDIR}/../../../bin/ed/test
TS != cd ${TESTDIR} && ls *.t
ERRS != cd ${TESTDIR} && ls *.err
CLEANFILES = *.t *.d *.ed *.err *.red *.o !.z stamp-*
.for t in ${TS:R}
# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
$t.ed: ${TESTDIR}/$t.t ${TESTDIR}/$t.d Makefile
@echo '\n======== setup $t.ed ========'
cp ${TESTDIR}/$t.t ${TESTDIR}/$t.d .
( \
echo "#!/bin/sh -"; \
echo "${ED} - <<\EOT"; \
echo H; \
echo "r $t.d"; \
cat $t.t; \
echo "w $t.o"; \
echo EOT; \
) >$t.tmp
mv $t.tmp $t.ed
chmod +x $t.ed
REGRESS_TARGETS += run-regress-$t.ed
# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
run-regress-$t.ed: $t.ed
@echo '\n======== $t.ed ========'
./$t.ed
cmp -s $t.o ${TESTDIR}/$t.r
.endfor
.for t in ${ERRS:R}
# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
$t.red: ${TESTDIR}/$t.err Makefile
@echo '\n======== setup $t.red ========'
cp ${TESTDIR}/$t.err .
( \
echo "#!/bin/sh -"; \
echo "${ED} - <<\EOT"; \
echo H; \
echo "r $t.err"; \
cat $t.err; \
echo "w $t.o"; \
echo EOT; \
) >$t.tmp
mv $t.tmp $t.red
chmod +x $t.red
REGRESS_TARGETS += run-regress-$t.red
# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
run-regress-$t.red: $t.red
@echo '\n======== $t.red ========'
! ./$t.red
.endfor
# from /usr/src/bin/ed/test/README, known failing tests
REGRESS_SKIP_TARGETS+= run-regress-eq.red \
run-regress-a1.red \
run-regress-i1.red \
run-regress-k1.red \
run-regress-r1.red
.PHONY: ${REGRESS_TARGETS}
.include <bsd.regress.mk>