96701885470744fb93a63d4222703fd74c175f04
[platform/upstream/automake.git] / t / test-driver-strip-vpath.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 # Custom test drivers: check that the test name passed to the test
18 # driver has any VPATH prefix stripped.
19
20 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 ocwd=`pwd` || fatal_ "cannot get current working directory"
24
25 mkdir src build
26 mv install-sh missing configure.ac src
27 rm -f depcomp
28
29 cd src
30
31 cat >> configure.ac << 'END'
32 AC_OUTPUT
33 END
34
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
47
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
71
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE
75
76 cd ..
77
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 ..
85
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 ..
93
94 cd src
95 ./configure
96 $MAKE distcheck
97
98 :