Commit | Line | Data |
---|---|---|
1f00b0d6 S |
1 | #!/bin/sh |
2 | ||
9988b539 NC |
3 | case $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 | ;; | |
13 | esac | |
14 | case "$0" in | |
15 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; | |
16 | esac | |
17 | echo "Extracting runtests (with variable substitutions)" | |
18 | rm -f runtests | |
f1397316 | 19 | |
9988b539 NC |
20 | $spitshell >runtests <<!GROK!THIS! |
21 | $startsh -e | |
22 | # runtests.SH | |
23 | # | |
f1397316 | 24 | !GROK!THIS! |
9988b539 | 25 | |
f1397316 AD |
26 | ## In the following, dollars and backticks do not need the extra backslash. |
27 | $spitshell >>runtests <<'!NO!SUBS!' | |
9988b539 | 28 | |
f1397316 AD |
29 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) |
30 | ||
8b51b1ff DM |
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 | ||
53de846c MF |
43 | if [ "x$MAKEFLAGS" != "x" ]; then |
44 | unset MAKEFLAGS | |
45 | fi | |
8b51b1ff | 46 | |
f1397316 | 47 | case $# in |
9988b539 NC |
48 | 0) |
49 | echo "runtests tty_flag ..." | |
50 | exit 1 | |
51 | ;; | |
52 | esac | |
53 | ||
f1397316 | 54 | case $1 in |
9988b539 NC |
55 | tty) |
56 | tty=Y | |
57 | ;; | |
58 | no-tty) | |
59 | tty=N | |
60 | ;; | |
61 | choose) | |
62 | if (true </dev/tty) >/dev/null 2>&1; then | |
63 | tty=Y | |
64 | else | |
65 | tty=N | |
66 | fi | |
67 | ;; | |
68 | *) | |
69 | echo "ttyflag should be one of tty, no-tty or choose" | |
70 | exit 1 | |
71 | ;; | |
72 | esac | |
73 | ||
f1397316 | 74 | if test X"$TESTFILE" = X; then |
9988b539 NC |
75 | TESTFILE=TEST |
76 | fi | |
77 | ||
78 | cd t | |
9988b539 | 79 | |
7d18793f AD |
80 | # If this is run under an old shell that doesn't automatically |
81 | # update PWD, then we must update it. Otherwise, t/io/fs.t gets | |
82 | # mixed up about what directory we are in. | |
83 | case "$PWD" in | |
84 | '') ;; # Do nothing if it isn't set at all. | |
85 | */t) ;; # Leave it alone if it's properly updated. | |
86 | *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it. | |
87 | esac | |
88 | ||
f1397316 AD |
89 | !NO!SUBS! |
90 | ||
91 | ## In the following, dollars and backticks do need the extra backslash. | |
92 | $spitshell >>runtests <<!GROK!THIS! | |
9988b539 NC |
93 | # The second branch is for testing without a tty or controlling terminal, |
94 | # see t/op/stat.t | |
12a67024 | 95 | if test \$tty = Y; then |
463c96de | 96 | ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty |
9988b539 | 97 | else |
463c96de | 98 | PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES |
9988b539 | 99 | fi |
6fa4dacc NC |
100 | |
101 | echo "Ran tests" > rantests | |
9988b539 NC |
102 | !GROK!THIS! |
103 | $eunicefix runtests | |
104 | chmod +x runtests |