Merge branch 'maint'
[platform/upstream/automake.git] / t / parallel-tests-log-compiler-example.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 # Test the example of usage of generic and extension-specific
18 # LOG_COMPILER and LOG_FLAGS given in the manual.
19
20 am_parallel_tests=yes
21 required=python
22 . ./defs || Exit 1
23
24 cat >> configure.ac <<END
25 AC_SUBST([PERL], ['$PERL'])
26 AM_PATH_PYTHON
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 TESTS = foo.pl bar.py baz
32 TEST_EXTENSIONS = .pl .py
33 PL_LOG_COMPILER = $(PERL)
34 AM_PL_LOG_FLAGS = -w
35 PY_LOG_COMPILER = $(PYTHON)
36 AM_PY_LOG_FLAGS = -v
37 LOG_COMPILER = ./wrapper-script
38 AM_LOG_FLAGS = -d
39 END
40
41 echo 'my $a =+ 2; exit (0);' > foo.pl
42 echo 'import sys; sys.exit(0);' > bar.py
43 : > baz
44
45 cat > wrapper-script <<'END'
46 #!/bin/sh
47 echo "wrapper args: $*"
48 END
49 chmod a+x wrapper-script
50
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE -a
54
55 ./configure
56
57 st=0
58 $MAKE check || st=$?
59 cat foo.log
60 cat bar.log
61 cat baz.log
62 test $st -eq 0 || Exit $st
63
64 # Check that the wrappers have been run with the expected flags.
65 grep '[rR]eversed.*+=.*operator.*foo\.pl' foo.log
66 grep '^# *[cC]lear.*sys\.argv' bar.log
67 grep '^wrapper args:.* -d .*baz' baz.log
68
69 :