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