testsuite: one more use of TAP in our own tests
[platform/upstream/automake.git] / tests / parallel-tests7.test
1 #! /bin/sh
2 # Copyright (C) 2009, 2010, 2011 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 # Check parallel-tests features:
18 # - per-extension test drivers
19
20 parallel_tests=yes
21 . ./defs || Exit 1
22 cat >> configure.in << 'END'
23 AC_PROG_CC
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 ## Note that automake should not match the '/test' part
29 ## of 'sub/test' as '.test' suffix.
30 TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
31 check_PROGRAMS = baz bla.test bli.suff
32 TEST_EXTENSIONS = .chk .test
33 CHK_LOG_COMPILER = ./chk-compiler
34 TEST_LOG_COMPILER = ./test-compiler
35 LOG_COMPILER = ./noext-compiler
36 AM_CHK_LOG_FLAGS = 1
37 CHK_LOG_FLAGS = 2
38 AM_TEST_LOG_FLAGS = 3
39 TEST_LOG_FLAGS = 4
40 AM_LOG_FLAGS = 5
41 LOG_FLAGS = 6
42 END
43
44 mkdir sub
45
46 cat >chk-compiler <<'END'
47 #! /bin/sh
48 echo $0 "$@"
49 shift
50 shift
51 exec "$@"
52 exit 127
53 END
54 chmod a+x chk-compiler
55 cp chk-compiler test-compiler
56 cp chk-compiler noext-compiler
57
58 cat >foo.chk << 'END'
59 #! /bin/sh
60 exit 0
61 END
62 chmod a+x foo.chk
63 cp foo.chk bar.test
64 cp foo.chk sub/test
65
66 cat >baz.c << 'END'
67 int main (void)
68 {
69   return 0;
70 }
71 END
72 cp baz.c bla.c
73 cp baz.c bli.c
74
75 $ACLOCAL
76 $AUTOCONF
77 $AUTOMAKE -a
78
79 ./configure
80 $MAKE
81 $MAKE check
82 grep 'chk-compiler  *1  *2' foo.log
83 grep 'test-compiler  *3  *4' bar.log
84 grep 'noext-compiler  *5  *6' baz.log
85 grep 'test-compiler  *3  *4' bla.log
86 grep 'noext-compiler  *5  *6' bli.suff.log
87 grep 'noext-compiler  *5  *6' sub/test.log
88 :