tests: expose automake bug#14560
[platform/upstream/automake.git] / t / serial-tests.sh
1 #! /bin/sh
2 # Copyright (C) 2012-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 # Option 'serial-tests'.
18
19 am_create_testdir=empty
20 . test-init.sh
21
22 hasnt_parallel_tests ()
23 {
24   $EGREP 'TEST_SUITE_LOG|TEST_LOGS|\.log.*:' $1 && exit 1
25   grep 'recheck.*:' $1 && exit 1
26   grep '^check-TESTS: \$(TESTS)$' $1
27 }
28
29 has_parallel_tests ()
30 {
31   $EGREP '(^| )check-TESTS.*:' $1
32   $EGREP '(^| )recheck.*:' $1
33   grep '^\$(TEST_SUITE_LOG): \$(TEST_LOGS)$' $1
34   grep '^\.test\.log:$' $1
35 }
36
37 mkdir one two
38
39 cat > one/configure.ac <<END
40 AC_INIT([$me], [1.0])
41 AM_INIT_AUTOMAKE([serial-tests])
42 AC_CONFIG_FILES([Makefile])
43 END
44
45 echo 'TESTS = foo.test bar.test' > one/Makefile.am
46
47 cat > two/configure.ac <<END
48 AC_INIT([$me], [2.0])
49 AC_CONFIG_AUX_DIR([config])
50 AM_INIT_AUTOMAKE([parallel-tests])
51 AC_CONFIG_FILES([aMakefile bMakefile])
52 END
53
54 cp one/Makefile.am two/aMakefile.am
55 cat - one/Makefile.am > two/bMakefile.am <<END
56 AUTOMAKE_OPTIONS = serial-tests
57 END
58
59 cd one
60 touch missing install-sh
61 $ACLOCAL
62 $AUTOMAKE
63 grep TEST Makefile.in # For debugging.
64 hasnt_parallel_tests Makefile.in
65 test ! -e test-driver
66 cd ..
67
68 cd two
69 mkdir config
70 $ACLOCAL
71 $AUTOMAKE --add-missing
72 grep TEST [ab]Makefile.in # For debugging.
73 has_parallel_tests aMakefile.in
74 hasnt_parallel_tests bMakefile.in
75 mv aMakefile.in aMakefile.sav
76 mv bMakefile.in bMakefile.sav
77 test ! -e test-driver
78 test -f config/test-driver
79 $AUTOMAKE
80 diff aMakefile.sav aMakefile.in
81 diff bMakefile.sav bMakefile.in
82 cd ..
83
84 :