Merge branch 'yacc-quote-fix'
[automake.git] / tests / test-driver-strip-vpath.test
blobf6b232b2cd97bb975e3ecd8254b1231491fef2ec
1 #! /bin/sh
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)
7 # any later version.
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 # Custom test drivers: check that the test name passed to the test
18 # driver has any VPATH prefix stripped.
20 am_parallel_tests=yes
21 . ./defs || Exit 1
23 ocwd=`pwd` || fatal_ "cannot get current working directory"
25 mkdir src build
26 mv install-sh missing configure.in src
27 rm -f depcomp
29 cd src
31 cat >> configure.in << 'END'
32 AC_OUTPUT
33 END
35 cat > Makefile.am << 'END'
36 # The directories of the `bar.test' and `baz.test' tests are deliberately
37 # called as the source directory, to verify that the VPATH-stripping code
38 # doesn't get too easily confused.
39 # The $(empty) are for eliciting VPATH rewrites on make implementations
40 # that support it (e.g., Solaris make), to improve coverage.
41 empty =
42 TESTS = $(empty) foo.test src/bar.test ./src/baz.test $(empty)
43 $(TESTS):
44 TEST_LOG_DRIVER = $(srcdir)/checkstrip-driver
45 EXTRA_DIST = checkstrip-driver
46 END
48 cat > checkstrip-driver <<'END'
49 #! /bin/sh
50 set -e
51 while test $# -gt 0; do
52 case $1 in
53 --log-file) log_file=$2; shift;;
54 --trs-file) trs_file=$2; shift;;
55 --test-name) test_name=$2; shift;;
56 --expect-failure|--color-tests|--enable-hard-errors) shift;;
57 --) shift; break;;
58 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
59 esac
60 shift
61 done
62 echo "test name: $test_name" # For debugging.
63 case $test_name in
64 foo.test|./foo.test|src/ba[rz].test|./src/ba[rz].test);;
65 *) exit 1;;
66 esac
67 echo dummy > "$log_file"
68 echo dummy > "$trs_file"
69 END
70 chmod a+x checkstrip-driver
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE
76 cd ..
78 mkdir build1
79 cd build1
80 ../src/configure
81 # "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
82 $MAKE -n check || :
83 $MAKE check
84 cd ..
86 mkdir build2
87 cd build2
88 "$ocwd"/src/configure
89 # "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
90 $MAKE -n check || :
91 $MAKE check
92 cd ..
94 cd src
95 ./configure
96 $MAKE distcheck