summaryrefslogtreecommitdiff
path: root/runtests.SH
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-20 21:46:58 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-20 21:46:58 +0100
commit9988b539d419b6c4e886f8919681acc06cd5d04a (patch)
tree4bab6e0f82bb63b9eade9e8a14e5bb85d3adb349 /runtests.SH
parent199863e7695677ad5c17a1011983f3a2354d23b1 (diff)
downloadperl-9988b539d419b6c4e886f8919681acc06cd5d04a.tar.gz
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.
Diffstat (limited to 'runtests.SH')
-rw-r--r--runtests.SH73
1 files changed, 73 insertions, 0 deletions
diff --git a/runtests.SH b/runtests.SH
new file mode 100644
index 0000000000..3b0f9b743b
--- /dev/null
+++ b/runtests.SH
@@ -0,0 +1,73 @@
+case $PERL_CONFIG_SH in
+'')
+ if test ! -f config.sh; then
+ ln ../config.sh . || \
+ ln ../../config.sh . || \
+ ln ../../../config.sh . || \
+ (echo "Can't find config.sh."; exit 1)
+ fi 2>/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 <<!GROK!THIS!
+$startsh -e
+# runtests.SH
+#
+
+export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
+
+case \$# in
+ 0)
+ echo "runtests tty_flag ..."
+ exit 1
+ ;;
+esac
+
+if test X"\$PERL" == X; then
+ echo "please supply PERL in the environment"
+ exit 1
+fi
+
+case \$1 in
+ tty)
+ tty=Y
+ ;;
+ no-tty)
+ tty=N
+ ;;
+ choose)
+ if (true </dev/tty) >/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 </dev/tty
+else
+ PERL_SKIP_TTY_TEST=1 \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES
+fi
+!GROK!THIS!
+$eunicefix runtests
+chmod +x runtests