2 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Check parallel-tests features:
18 # - concurrent parallel execution
23 *\
-j*) skip_
"\$MAKE contains '-j'";;
29 unindent
> Makefile
<<END
36 for j
in "-j" "-j " NONE
; do
37 if test x
"$j" = xNONE
; then
38 skip_
"can't run make in parallel mode"
40 $MAKE ${j}2 all
>output
2>&1 ||
continue
41 $EGREP -i "(warning|error):|-j[\"\'\` ]" output
&& continue
44 rm -f one output Makefile
47 cat >> configure.ac
<< 'END'
51 cat > Makefile.am
<< 'END'
58 # Creative quoting below to please maintainer-check.
66 echo "TESTS += foo$i.test" >> Makefile.am
68 echo "TESTS += zap$i" >> Makefile.am
70 echo "TESTS += sub/bar$i.test" >> Makefile.am
72 echo "TESTS += sub/mu$i" >> Makefile.am
80 for build
in serial parallel
; do
92 # Use append mode here to avoid dropping output. See automake bug#11413.
94 $MAKE ${j}4 check
>> stdout
96 # Ensure the tests are really being run in parallel mode: if this is
97 # the case, the serial run of the dummy testsuite started above should
98 # still be ongoing when the parallel one has terminated.
101 test $
(grep -c '^PASS:' parallel
/stdout
) -eq 12
103 # Wait long enough so that there are no open files any more when the
104 # post-test cleanup runs. But exit after we've waited for two minutes
105 # or more, to avoid testsuite hangs in unusual situations (this has
108 while test ! -f serial
/test-suite.log
&& test $i -le 120; do
110 sleep '1' # Extra quoting to please maintainer-check.