This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op_reg_common.h: Refactor variable for safety
[perl5.git] / runtests.SH
1 case $PERL_CONFIG_SH in
2 '')
3     if test ! -f config.sh; then
4         ln ../config.sh . || \
5         ln ../../config.sh . || \
6         ln ../../../config.sh . || \
7         (echo "Can't find config.sh."; exit 1)
8     fi 2>/dev/null
9     . ./config.sh
10     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
14 esac
15 echo "Extracting runtests (with variable substitutions)"
16 rm -f runtests
17 $spitshell >runtests <<!GROK!THIS!
18 $startsh -e
19 # runtests.SH
20
21
22 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
23
24 case \$# in
25     0)
26         echo "runtests tty_flag ..."
27         exit 1
28         ;;
29 esac
30
31 case \$1 in
32     tty)
33         tty=Y
34         ;;
35     no-tty)
36         tty=N
37         ;;
38     choose)
39         if (true </dev/tty) >/dev/null 2>&1; then
40             tty=Y
41         else
42             tty=N
43         fi
44         ;;
45     *)
46         echo "ttyflag should be one of tty, no-tty or choose"
47         exit 1
48         ;;
49 esac
50
51 if test X"\$TESTFILE" = X; then
52     TESTFILE=TEST
53 fi
54
55 if test X"\$PERL" = X; then
56     PERL=./perl$_exe
57     export PERL
58 fi
59
60 cd t
61
62 # The second branch is for testing without a tty or controlling terminal,
63 # see t/op/stat.t
64 if test \$tty = Y; then
65     \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
66 else
67     PERL_SKIP_TTY_TEST=1 \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES
68 fi
69
70 echo "Ran tests" > rantests
71 !GROK!THIS!
72 $eunicefix runtests
73 chmod +x runtests