Merge branch 'msvc'
[platform/upstream/automake.git] / tests / gen-parallel-tests
1 #! /bin/sh
2 # Generate parallel-tests.am.
3 #
4 # Copyright (C) 2009, 2010  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 test in the TESTS list in this Makefile.am file, that itself
20 # tests features of the TESTS automake interface, generate a sibling
21 # test that does likewise, but with the option `parallel-tests' enabled.
22
23 set -e
24
25 tests=`sed -n '/^TESTS =/,/^$/s/\(.*\.test\).*/\1/p' Makefile.am`
26 {
27   grep -l '^TESTS ' $tests
28   grep -l ' TESTS ' $tests
29 } |
30 grep -v '.-p\.test' |
31 LC_ALL=C sort -u |
32 while read tst; do
33   if grep '^[^#]*parallel-tests' $tst >/dev/null \
34      || grep "parallel_tests=yes" $tst >/dev/null \
35      || grep "parallel_tests=['\"]yes" $tst >/dev/null
36   then :; else echo $tst; fi;
37 done |
38 sed -e 's/\.test$//' |
39 {
40   echo "## Generated by gen-parallel-tests.  Edit Makefile.am instead of this."
41   echo "parallel_tests ="
42   # Since `foo-p.test' sources `foo.test', `foo-p.log' also depends on
43   # `foo.test'.
44   sed -e '
45     h
46     s/^/parallel_tests += /
47     s/$/-p.test/
48     p
49     x
50     s/.*/&-p.log: &.test/
51   '
52 }