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