2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Sanity check for the automake testsuite.
18 # Test the sanity checks performed by the 'defs' script. Also check
19 # that we can use 'defs' elsewhere, when we duplicate some of the
20 # infrastructure from the automake/tests subdirectory.
22 am_create_testdir=empty
25 # Avoid to confuse traces from child processed with our own traces.
28 sed 's/^/ | /' stderr >&2
31 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
33 source_defs=". '$am_top_builddir/defs'"
35 if $SHELL -c "$source_defs" dummy.test 2>stderr; then
40 grep 'defs-static: not found in current directory' stderr
43 sed 's|^am_top_srcdir=.*|am_top_srcdir=foo|' \
44 "$am_top_builddir"/defs-static > defs-static
45 if $SHELL -c "$source_defs" t/dummy.test 2>stderr; then
50 grep 'foo/defs-static\.in not found.*check \$am_top_srcdir' stderr
53 sed 's|^am_top_builddir=.*|am_top_builddir=foo|' \
54 "$am_top_builddir"/defs-static > defs-static
55 if $SHELL -c "$source_defs" t/dummy.test 2>stderr; then
60 grep 'foo/defs-static not found.*check \$am_top_builddir' stderr
63 # We still need a little hack to make ./defs work outside automake's
64 # tree 'tests' subdirectory. Not a big deal.
65 sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \
66 "$am_top_builddir"/defs-static > defs-static
67 # Redefining *srcdir and *builddir variables in the environment shouldn't
70 builddir=bad-dir srcdir=bad-dir \
71 top_builddir=bad-dir top_srcdir=bad-dir \
72 abs_builddir=bad-dir abs_srcdir=bad-dir \
73 abs_top_builddir=bad-dir abs_top_srcdir=bad-dir \
74 $SHELL -c "$source_defs && echo '!OK!' > ../foo" t/dummy.test