This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Split file into parts with and without substitutions.
[perl5.git] / runtests.SH
1 #!/bin/sh
2
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
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
29 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
30
31 case $# in
32     0)
33         echo "runtests tty_flag ..."
34         exit 1
35         ;;
36 esac
37
38 case $1 in
39     tty)
40         tty=Y
41         ;;
42     no-tty)
43         tty=N
44         ;;
45     choose)
46         if (true </dev/tty) >/dev/null 2>&1; then
47             tty=Y
48         else
49             tty=N
50         fi
51         ;;
52     *)
53         echo "ttyflag should be one of tty, no-tty or choose"
54         exit 1
55         ;;
56 esac
57
58 if test X"$TESTFILE" = X; then
59     TESTFILE=TEST
60 fi
61
62 cd t
63
64 !NO!SUBS!
65
66 ## In the following, dollars and backticks do need the extra backslash.
67 $spitshell >>runtests <<!GROK!THIS!
68 # The second branch is for testing without a tty or controlling terminal,
69 # see t/op/stat.t
70 if test \$tty = Y; then
71     ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
72 else
73     PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES
74 fi
75
76 echo "Ran tests" > rantests
77 !GROK!THIS!
78 $eunicefix runtests
79 chmod +x runtests