tests: prune some weed in a non-POSIX test
[platform/upstream/automake.git] / t / dejagnu-relative-srcdir.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Check that DejaGnu testsuites have 'srcdir' defined to a relative path
18 # (both as TCL variable and as environment variable).
19
20 required=runtest
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 AUTOMAKE_OPTIONS = dejagnu
29 DEJATOOL = tcl env
30 EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
31 END
32
33 mkdir env.test tcl.test lib
34
35 # DejaGnu can change $srcdir behind our backs, so we have to
36 # save its original value.  Thanks to Ian Lance Taylor for the
37 # suggestion.
38 cat > lib/tcl.exp << 'END'
39 send_user "tcl_lib_srcdir: $srcdir\n"
40 set orig_srcdir $srcdir
41 END
42
43 cat > env.test/env.exp << 'END'
44 set env_srcdir $env(srcdir)
45 send_user "env_srcdir: $env_srcdir\n"
46 if { [ regexp "^\.\.?$" $env_srcdir ] } {
47     pass "test_env_src"
48 } else {
49     fail "test_env_src"
50 }
51 END
52
53 cat > tcl.test/tcl.exp << 'END'
54 send_user "tcl_srcdir: $srcdir\n"
55 if { [ regexp "^\.\.?$" $srcdir ] } {
56     pass "test_tcl_src"
57 } else {
58     fail "test_tcl_src"
59 }
60 send_user "tcl_orig_srcdir: $orig_srcdir\n"
61 if { [ regexp "^\.\.?$" $orig_srcdir ] } {
62     pass "test_tcl_orig_src"
63 } else {
64     fail "test_tcl_orig_src"
65 }
66 END
67
68 $ACLOCAL
69 $AUTOCONF
70 $AUTOMAKE --add-missing
71
72 ./configure --srcdir=.
73
74 $MAKE check
75
76 # Sanity check: all tests have run.
77 test -f env.log
78 test -f env.sum
79 test -f tcl.log
80 test -f tcl.sum
81
82 $MAKE distcheck
83
84 :