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