From: Nicholas Clark Date: Sun, 20 Sep 2009 20:46:58 +0000 (+0100) Subject: Move the Makefile targets _test{,_prep,_tty,_notty} into a script runtests. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9988b539d419b6c4e886f8919681acc06cd5d04a;p=p5sagit%2Fp5-mst-13.2.git Move the Makefile targets _test{,_prep,_tty,_notty} into a script runtests. This avoids a recursive call to $(MAKE) in the top level directory, which feels over-complicated when all the targets invoked have no dependencies. --- diff --git a/MANIFEST b/MANIFEST index 47d70e0..ef563d7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4050,6 +4050,7 @@ regexec.c Regular expression evaluator regexp.h Public declarations for the above regnodes.h Description of nodes of RE engine run.c The interpreter loop +runtests.SH A script that generates runtests scope.c Scope entry and exit code scope.h Scope entry and exit header sv.c Scalar value code diff --git a/Makefile.SH b/Makefile.SH index f9f9984..4de1ae3 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -1297,8 +1297,8 @@ depend: makedepend makedepend: makedepend.SH config.sh sh ./makedepend.SH -.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \ - test_tty test-tty _test_tty test_notty test-notty _test_notty \ +.PHONY: test check test_prep test_prep_nodll test_prep_pre \ + test_tty test-tty test_notty test-notty \ utest ucheck test.utf8 check.utf8 test.torture torturetest \ test.utf16 check.utf16 utest.utf16 ucheck.utf16 \ test.third check.third utest.third ucheck.third test_notty.third \ @@ -1308,48 +1308,26 @@ makedepend: makedepend.SH config.sh # Cannot delegate rebuilding of t/perl to make # to allow interlaced test and minitest -TESTFILE=TEST - -_test_prep: - cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT)) - # Architecture-neutral stuff: test_prep_pre: preplibrary utilities $(nonxs_ext) test_prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL) - PERL=./perl $(MAKE) _test_prep - -_test_tty: - cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES) /dev/null 2>&1; then \ - $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_tty ; \ - else \ - $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_notty ; \ - fi - @echo "Ran tests" > t/rantests test check: test_prep - PERL=./perl $(MAKE) _test + PERL=./perl ./runtests choose test_tty: test_prep - PERL=./perl $(MAKE) _test_tty + PERL=./perl ./runtests tty test_notty: test_prep - PERL=./perl $(MAKE) _test_notty + PERL=./perl ./runtests no-tty utest ucheck test.utf8 check.utf8: test_prep - PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test + PERL=./perl TEST_ARGS=-utf8 ./runtests choose coretest: test_prep - PERL=./perl TEST_ARGS=-core $(MAKE) _test + PERL=./perl TEST_ARGS=-core ./runtests choose test-prep: test_prep @@ -1360,7 +1338,7 @@ test-notty: test_notty # Torture testing test.torture torturetest: test_prep - PERL=./perl TEST_ARGS=-torture $(MAKE) _test + PERL=./perl TEST_ARGS=-torture ./runtests choose # Targets for UTF16 testing: @@ -1369,51 +1347,49 @@ minitest.utf16: minitest.prep && $(LDLIBPTH) $(RUN) ./perl TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t /dev/null + . ./config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting runtests (with variable substitutions)" +rm -f runtests +$spitshell >runtests </dev/null 2>&1; then + tty=Y + else + tty=N + fi + ;; + *) + echo "ttyflag should be one of tty, no-tty or choose" + exit 1 + ;; +esac + +if test X"\$TESTFILE" == X; then + TESTFILE=TEST +fi + +cd t +rm -f \$PERL +$lns ../\$PERL \$PERL + +# The second branch is for testing without a tty or controlling terminal, +# see t/op/stat.t +if test \$tty == Y; then + \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES