0e9d6e737c777fac5052ae895087908de743fe48
[platform/upstream/automake.git] / t / tests-environment-and-log-compiler.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 # parallel-tests: check that we can use variables and functions set
18 # by TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT in LOG_COMPILER and
19 # LOG_FLAGS (for tests both with and without registered extensions).
20
21 am_parallel_tests=yes
22 . ./defs || Exit 1
23
24 cat >> configure.ac << 'END'
25 AC_OUTPUT
26 END
27
28 unset v0 v1 v2 v3 v4 || :
29
30 cat > Makefile.am << 'END'
31 TESTS_ENVIRONMENT = am__f3 () { echo 3; }; v0='$(srcdir)' v1=1; :;
32 AM_TESTS_ENVIRONMENT = v2=2; v4=4 && am__f5 () { echo 5; }; :;
33
34 LOG_COMPILER = $$v0/log-compiler $$v1
35 AM_LOG_FLAGS = $$v2 `am__f3`
36 LOG_FLAGS = $$v4 `am__f5`
37
38 TEST_LOG_COMPILER = $$v0/test-log-compiler $$v2
39 AM_TEST_LOG_FLAGS = `am__f5` $$v1
40 TEST_LOG_FLAGS = $$v4 `am__f3`
41
42 EXTRA_DIST = log-compiler test-log-compiler
43
44 TESTS = a b.test
45 $(TESTS):
46 END
47
48 cat > log-compiler << 'END'
49 #! /bin/sh
50 echo "$0: $*"
51 test x"$1$2$3$4$5" = x"12345"
52 END
53
54 cat > test-log-compiler << 'END'
55 #! /bin/sh
56 echo "$0: $*"
57 test x"$1$2$3$4$5" = x"25143"
58 END
59
60 chmod a+x test-log-compiler log-compiler
61
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE -a
65
66 ./configure
67
68 $MAKE -n check || : # For debugging.
69 VERBOSE=yes $MAKE check
70 cat a.log
71 cat b.log
72
73 VERBOSE=yes $MAKE distcheck
74
75 :