191f110e0Safresh1#!/bin/sh 291f110e0Safresh1 3b39c5158Smillertcase $PERL_CONFIG_SH in 4b39c5158Smillert'') 5b39c5158Smillert if test ! -f config.sh; then 6b39c5158Smillert ln ../config.sh . || \ 7b39c5158Smillert ln ../../config.sh . || \ 8b39c5158Smillert ln ../../../config.sh . || \ 9b39c5158Smillert (echo "Can't find config.sh."; exit 1) 10b39c5158Smillert fi 2>/dev/null 11b39c5158Smillert . ./config.sh 12b39c5158Smillert ;; 13b39c5158Smillertesac 14b39c5158Smillertcase "$0" in 15b39c5158Smillert*/*) cd `expr X$0 : 'X\(.*\)/'` ;; 16b39c5158Smillertesac 17b39c5158Smillertecho "Extracting runtests (with variable substitutions)" 18b39c5158Smillertrm -f runtests 196fb12b70Safresh1 20b39c5158Smillert$spitshell >runtests <<!GROK!THIS! 21b39c5158Smillert$startsh -e 22b39c5158Smillert# runtests.SH 23b39c5158Smillert# 246fb12b70Safresh1!GROK!THIS! 25b39c5158Smillert 266fb12b70Safresh1## In the following, dollars and backticks do not need the extra backslash. 276fb12b70Safresh1$spitshell >>runtests <<'!NO!SUBS!' 28b39c5158Smillert 296fb12b70Safresh1export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) 306fb12b70Safresh1 31b8851fccSafresh1# Avoid "warning: jobserver unavailable: using -j1." warnings under GNU make. 32b8851fccSafresh1# When gmake -j N spawns a child, it passes 33b8851fccSafresh1# MAKEFLAGS=" --jobserver-fds=3,4 -j". 34b8851fccSafresh1# in the environment. Also, if make recognises that the child is another 35b8851fccSafresh1# make (e.g. it's invoked as $(MAKE) or +command), it keeps open fd's 3 36b8851fccSafresh1# and 4 to allow the child process to access the job server. Otherwise, 37b8851fccSafresh1# those fd's aren't kept open. 38b8851fccSafresh1# In the case where one does 'make -j 16 test_harness', this script is 39b8851fccSafresh1# called with MAKEFLAGS set, but fd's 3 and 4 closed. Later when 40b8851fccSafresh1# descendents of this script run cpan/ExtUtils-Constant/t/Constant.t 41b8851fccSafresh1# which itelf invokes make, the warnings ensue. 42b8851fccSafresh1 43*eac174f2Safresh1if [ "x$MAKEFLAGS" != "x" ]; then 44b8851fccSafresh1 unset MAKEFLAGS 45*eac174f2Safresh1fi 46b8851fccSafresh1 476fb12b70Safresh1case $# in 48b39c5158Smillert 0) 49b39c5158Smillert echo "runtests tty_flag ..." 50b39c5158Smillert exit 1 51b39c5158Smillert ;; 52b39c5158Smillertesac 53b39c5158Smillert 546fb12b70Safresh1case $1 in 55b39c5158Smillert tty) 56b39c5158Smillert tty=Y 57b39c5158Smillert ;; 58b39c5158Smillert no-tty) 59b39c5158Smillert tty=N 60b39c5158Smillert ;; 61b39c5158Smillert choose) 62b39c5158Smillert if (true </dev/tty) >/dev/null 2>&1; then 63b39c5158Smillert tty=Y 64b39c5158Smillert else 65b39c5158Smillert tty=N 66b39c5158Smillert fi 67b39c5158Smillert ;; 68b39c5158Smillert *) 69b39c5158Smillert echo "ttyflag should be one of tty, no-tty or choose" 70b39c5158Smillert exit 1 71b39c5158Smillert ;; 72b39c5158Smillertesac 73b39c5158Smillert 746fb12b70Safresh1if test X"$TESTFILE" = X; then 75b39c5158Smillert TESTFILE=TEST 76b39c5158Smillertfi 77b39c5158Smillert 78b39c5158Smillertcd t 79b39c5158Smillert 806fb12b70Safresh1# If this is run under an old shell that doesn't automatically 816fb12b70Safresh1# update PWD, then we must update it. Otherwise, t/io/fs.t gets 826fb12b70Safresh1# mixed up about what directory we are in. 836fb12b70Safresh1case "$PWD" in 846fb12b70Safresh1 '') ;; # Do nothing if it isn't set at all. 856fb12b70Safresh1 */t) ;; # Leave it alone if it's properly updated. 866fb12b70Safresh1 *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it. 876fb12b70Safresh1esac 886fb12b70Safresh1 896fb12b70Safresh1!NO!SUBS! 906fb12b70Safresh1 916fb12b70Safresh1## In the following, dollars and backticks do need the extra backslash. 926fb12b70Safresh1$spitshell >>runtests <<!GROK!THIS! 93b39c5158Smillert# The second branch is for testing without a tty or controlling terminal, 94b39c5158Smillert# see t/op/stat.t 95b39c5158Smillertif test \$tty = Y; then 966fb12b70Safresh1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty 97b39c5158Smillertelse 986fb12b70Safresh1 PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES 99b39c5158Smillertfi 100b39c5158Smillert 101b39c5158Smillertecho "Ran tests" > rantests 102b39c5158Smillert!GROK!THIS! 103b39c5158Smillert$eunicefix runtests 104b39c5158Smillertchmod +x runtests 105