xref: /openbsd/gnu/usr.bin/perl/runtests.SH (revision 8932bfb7)
1case $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    ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15echo "Extracting runtests (with variable substitutions)"
16rm -f runtests
17$spitshell >runtests <<!GROK!THIS!
18$startsh -e
19# runtests.SH
20#
21
22export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
23
24case \$# in
25    0)
26	echo "runtests tty_flag ..."
27	exit 1
28	;;
29esac
30
31case \$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	;;
49esac
50
51if test X"\$TESTFILE" = X; then
52    TESTFILE=TEST
53fi
54
55if test X"\$PERL" = X; then
56    PERL=./perl$_exe
57    export PERL
58fi
59
60cd t
61
62# The second branch is for testing without a tty or controlling terminal,
63# see t/op/stat.t
64if test \$tty = Y; then
65    \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
66else
67    PERL_SKIP_TTY_TEST=1 \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES
68fi
69
70echo "Ran tests" > rantests
71!GROK!THIS!
72$eunicefix runtests
73chmod +x runtests
74