Merge branch master into maint after 1.12 release
[platform/upstream/automake.git] / t / parallel-tests-console-output.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 # parallel-tests: some checks on console output about testsuite
18 # progress.
19
20 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 XFAIL_TESTS = sub/xpass.test xfail.test error.test
29 TESTS = $(XFAIL_TESTS) fail.test pass.test a/b/skip.test sub/error2.test
30 pass.log: fail.log
31 error.log: pass.log
32 sub/xpass.log: error.log
33 sub/error2.log: xfail.log
34 a/b/skip.log: sub/error2.log
35 END
36
37 cat > exp <<'END'
38 FAIL: fail.test
39 PASS: pass.test
40 ERROR: error.test
41 XPASS: sub/xpass.test
42 XFAIL: xfail.test
43 ERROR: sub/error2.test
44 SKIP: a/b/skip.test
45 END
46
47 mkdir sub a a/b
48
49 cat > pass.test << 'END'
50 #!/bin/sh
51 exit 0
52 END
53 cp pass.test sub/xpass.test
54
55 cat > fail.test << 'END'
56 #!/bin/sh
57 exit 1
58 END
59
60 cat > xfail.test << 'END'
61 #!/bin/sh
62 # The sleep should ensure expected execution order of tests
63 # even when make is run in parallel mode.
64 # Creative quoting below to plase maintainer-check.
65 sleep '10'
66 exit 1
67 END
68
69 cat > error.test << 'END'
70 #!/bin/sh
71 exit 99
72 END
73 cp error.test sub/error2.test
74
75 cat > a/b/skip.test << 'END'
76 #!/bin/sh
77 exit 77
78 END
79
80 chmod a+x pass.test fail.test xfail.test sub/xpass.test \
81           a/b/skip.test error.test sub/error2.test
82
83 $ACLOCAL
84 $AUTOCONF
85 $AUTOMAKE -a
86
87 for vpath in : false; do
88   if $vpath; then
89     mkdir build
90     cd build
91     srcdir=..
92   else
93     srcdir=.
94   fi
95   $srcdir/configure
96   $MAKE check >stdout && { cat stdout; Exit 1; }
97   cat stdout
98   LC_ALL=C grep '^[A-Z][A-Z]*:' stdout > got
99   cat got
100   diff $srcdir/exp got
101   cd $srcdir
102 done
103
104 :