This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX math: s = "0" is not happy with -Wwrite-strings.
[perl5.git] / runtests.SH
CommitLineData
1f00b0d6
S
1#!/bin/sh
2
9988b539
NC
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
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
29export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
30
31case $# in
9988b539
NC
32 0)
33 echo "runtests tty_flag ..."
34 exit 1
35 ;;
36esac
37
f1397316 38case $1 in
9988b539
NC
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 ;;
56esac
57
f1397316 58if test X"$TESTFILE" = X; then
9988b539
NC
59 TESTFILE=TEST
60fi
61
62cd t
9988b539 63
7d18793f
AD
64# If this is run under an old shell that doesn't automatically
65# update PWD, then we must update it. Otherwise, t/io/fs.t gets
66# mixed up about what directory we are in.
67case "$PWD" in
68 '') ;; # Do nothing if it isn't set at all.
69 */t) ;; # Leave it alone if it's properly updated.
70 *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it.
71esac
72
f1397316
AD
73!NO!SUBS!
74
75## In the following, dollars and backticks do need the extra backslash.
76$spitshell >>runtests <<!GROK!THIS!
9988b539
NC
77# The second branch is for testing without a tty or controlling terminal,
78# see t/op/stat.t
12a67024 79if test \$tty = Y; then
463c96de 80 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
9988b539 81else
463c96de 82 PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES
9988b539 83fi
6fa4dacc
NC
84
85echo "Ran tests" > rantests
9988b539
NC
86!GROK!THIS!
87$eunicefix runtests
88chmod +x runtests