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