tests: expose automake bug#14560
[platform/upstream/automake.git] / t / parallel-am2.sh
1 #! /bin/sh
2 # Copyright (C) 2008-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 # Test parallel automake execution.
18
19 # This tests:
20 # 4) warning and normal error output should be identical, in that duplicate
21 #    warnings should be omitted in the same way as without threads.
22
23 required=perl-threads
24 . test-init.sh
25
26 mkdir sub
27
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = subdir-objects
30 bin_PROGRAMS = main
31 main_SOURCES = sub/main.c
32 SUBDIRS =
33 END
34
35 list='1 2 3'
36 for i in $list; do
37   echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.ac
38   echo "SUBDIRS += sub$i" >> Makefile.am
39   mkdir sub$i sub$i/sub
40   unindent > sub$i/Makefile.am << END
41     AUTOMAKE_OPTIONS = subdir-objects
42     bin_PROGRAMS = sub$i
43     sub${i}_SOURCES = sub/main$i.c
44 END
45 done
46
47 mkdir build-aux
48
49 $ACLOCAL
50
51 # Independently of the number of worker threads, automake output
52 # should be
53 # - stable (multiple runs should produce the same output),
54 # - properly uniquified,
55 # - complete (output from worker threads should not be lost).
56 #
57 # The parts output by --add-missing are unstable not only wrt. order
58 # but also wrt. content: any of the Makefile.am files may cause the
59 # depcomp script to be installed (or several of them).
60 # Thus we install the auxiliary files in a prior step.
61
62 # Generate expected output using non-threaded code.
63 unset AUTOMAKE_JOBS
64 rm -f install-sh missing depcomp
65 AUTOMAKE_fails --add-missing
66 mv stderr expected
67
68 AUTOMAKE_JOBS=5
69 export AUTOMAKE_JOBS
70
71 for i in 1 2 3 4 5 6 7 8; do
72   rm -f install-sh missing depcomp
73   AUTOMAKE_fails --add-missing
74   diff expected stderr
75 done
76
77 :