Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / gen-parallel-tests
1 #! /bin/sh
2 # Generate parallel-tests.am.
3 #
4 # Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 # For each automake test case that checks features of the TESTS automake
20 # interface, generate a sibling test that does likewise, but with the
21 # option `parallel-tests' enabled.  Individual tests can prevent the
22 # creation of such a sibling by explicitly setting the `$parallel_tests'
23 # variable to either "yes" or "no".  The rationale for this is that if
24 # the variable is set to "yes", the test already uses the `parallel-tests'
25 # option, so that a sibling would be just a duplicate; while if the
26 # variable is set to "no", the test doesn't support, or is not meant to
27 # run with, the `parallel-tests' option, and forcing it to do so in the
28 # sibling would likely cause a spurious failure.
29
30 set -e
31
32 tests=`sed -n '/^handwritten_TESTS *=/,$p' <list-of-tests.mk \
33          | sed -n 's/\(.*\.test\).*/\1/p'`
34 {
35   grep -l '^TESTS ' $tests
36   grep -l ' TESTS ' $tests
37 } |
38 grep -v '.-p\.test' |
39 LC_ALL=C sort -u |
40 while read tst; do
41   if grep '^[^#]*parallel-tests' $tst >/dev/null \
42      || grep "parallel_tests=" $tst >/dev/null
43   then :; else echo $tst; fi;
44 done |
45 {
46   echo "## Generated by gen-parallel-tests.  Edit Makefile.am instead of this."
47   echo "parallel_tests = \\"
48   sed 's,\.test$,-p.test,; $!s,$, \\,'
49 }