This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move the Makefile targets _test{,_prep,_tty,_notty} into a script runtests.
[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 if test X"\$PERL" == X; then
32     echo "please supply PERL in the environment"
33     exit 1
34 fi
35
36 case \$1 in
37     tty)
38         tty=Y
39         ;;
40     no-tty)
41         tty=N
42         ;;
43     choose)
44         if (true </dev/tty) >/dev/null 2>&1; then
45             tty=Y
46         else
47             tty=N
48         fi
49         ;;
50     *)
51         echo "ttyflag should be one of tty, no-tty or choose"
52         exit 1
53         ;;
54 esac
55
56 if test X"\$TESTFILE" == X; then
57     TESTFILE=TEST
58 fi
59
60 cd t
61 rm -f \$PERL
62 $lns ../\$PERL \$PERL
63
64 # The second branch is for testing without a tty or controlling terminal,
65 # see t/op/stat.t
66 if test \$tty == Y; then
67     \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
68 else
69     PERL_SKIP_TTY_TEST=1 \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES
70 fi
71 !GROK!THIS!
72 $eunicefix runtests
73 chmod +x runtests