This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove dquote_inline.h
[perl5.git] / runtests.SH
... / ...
CommitLineData
1#!/bin/sh
2
3case $PERL_CONFIG_SH in
4'')
5 if test ! -f config.sh; then
6 ln ../config.sh . || \
7 ln ../../config.sh . || \
8 ln ../../../config.sh . || \
9 (echo "Can't find config.sh."; exit 1)
10 fi 2>/dev/null
11 . ./config.sh
12 ;;
13esac
14case "$0" in
15*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
16esac
17echo "Extracting runtests (with variable substitutions)"
18rm -f runtests
19
20$spitshell >runtests <<!GROK!THIS!
21$startsh -e
22# runtests.SH
23#
24!GROK!THIS!
25
26## In the following, dollars and backticks do not need the extra backslash.
27$spitshell >>runtests <<'!NO!SUBS!'
28
29export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
30
31# Avoid "warning: jobserver unavailable: using -j1." warnings under GNU make.
32# When gmake -j N spawns a child, it passes
33# MAKEFLAGS=" --jobserver-fds=3,4 -j".
34# in the environment. Also, if make recognises that the child is another
35# make (e.g. it's invoked as $(MAKE) or +command), it keeps open fd's 3
36# and 4 to allow the child process to access the job server. Otherwise,
37# those fd's aren't kept open.
38# In the case where one does 'make -j 16 test_harness', this script is
39# called with MAKEFLAGS set, but fd's 3 and 4 closed. Later when
40# descendents of this script run cpan/ExtUtils-Constant/t/Constant.t
41# which itelf invokes make, the warnings ensue.
42
43unset MAKEFLAGS
44
45
46case $# in
47 0)
48 echo "runtests tty_flag ..."
49 exit 1
50 ;;
51esac
52
53case $1 in
54 tty)
55 tty=Y
56 ;;
57 no-tty)
58 tty=N
59 ;;
60 choose)
61 if (true </dev/tty) >/dev/null 2>&1; then
62 tty=Y
63 else
64 tty=N
65 fi
66 ;;
67 *)
68 echo "ttyflag should be one of tty, no-tty or choose"
69 exit 1
70 ;;
71esac
72
73if test X"$TESTFILE" = X; then
74 TESTFILE=TEST
75fi
76
77cd t
78
79# If this is run under an old shell that doesn't automatically
80# update PWD, then we must update it. Otherwise, t/io/fs.t gets
81# mixed up about what directory we are in.
82case "$PWD" in
83 '') ;; # Do nothing if it isn't set at all.
84 */t) ;; # Leave it alone if it's properly updated.
85 *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it.
86esac
87
88!NO!SUBS!
89
90## In the following, dollars and backticks do need the extra backslash.
91$spitshell >>runtests <<!GROK!THIS!
92# The second branch is for testing without a tty or controlling terminal,
93# see t/op/stat.t
94if test \$tty = Y; then
95 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
96else
97 PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES
98fi
99
100echo "Ran tests" > rantests
101!GROK!THIS!
102$eunicefix runtests
103chmod +x runtests