~ubuntu-branches/ubuntu/precise/automake1.11/precise-proposed

« back to all changes in this revision

Viewing changes to tests/parallel-tests.test

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-08-12 02:36:44 UTC
  • Revision ID: james.westby@ubuntu.com-20090812023644-f40we9eqbmx1dpbj
Tags: upstream-1.11
ImportĀ upstreamĀ versionĀ 1.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# Copyright (C) 2009  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
# Check parallel-tests features:
 
18
# - VERBOSE
 
19
# - clean
 
20
# - TEST_SUITE_LOG
 
21
# - dependencies between tests
 
22
# - DISABLE_HARD_ERRORS
 
23
# - TESTS
 
24
# - TEST_LOGS
 
25
# - RECHECK_LOGS
 
26
 
 
27
. ./defs-p || Exit 1
 
28
 
 
29
set -e
 
30
 
 
31
cat >> configure.in << 'END'
 
32
AC_OUTPUT
 
33
END
 
34
 
 
35
cat > Makefile.am << 'END'
 
36
TEST_SUITE_LOG = mylog.log
 
37
TESTS = foo.test bar.test baz.test
 
38
XFAIL_TESTS = bar.test
 
39
foo.log: bar.log
 
40
bar.log: baz.log
 
41
END
 
42
 
 
43
cat >>foo.test <<'END'
 
44
#! /bin/sh
 
45
echo "this is $0"
 
46
exit 0
 
47
END
 
48
cat >>bar.test <<'END'
 
49
#! /bin/sh
 
50
echo "this is $0"
 
51
exit 99
 
52
END
 
53
cat >>baz.test <<'END'
 
54
#! /bin/sh
 
55
echo "this is $0"
 
56
exit 1
 
57
END
 
58
chmod a+x foo.test bar.test baz.test
 
59
 
 
60
$ACLOCAL
 
61
$AUTOCONF
 
62
$AUTOMAKE -a
 
63
 
 
64
unset TESTS || :
 
65
 
 
66
./configure
 
67
# No hard errors: all tests should be run, there should be one failure.
 
68
env DISABLE_HARD_ERRORS=yes $MAKE -e check >stdout && { cat stdout; Exit 1; }
 
69
cat stdout
 
70
test `grep -c '^FAIL' stdout` -eq 1
 
71
test -f mylog.log
 
72
test `grep -c '^FAIL' mylog.log` -eq 1
 
73
test -f baz.log
 
74
test -f bar.log
 
75
test -f foo.log
 
76
# The summary should be formatted correctly.
 
77
grep 'failedn' stdout && Exit 1
 
78
 
 
79
# clean should remove all log files (but not more).
 
80
: > unrelated.log
 
81
$MAKE clean
 
82
test ! -f baz.log
 
83
test ! -f bar.log
 
84
test ! -f foo.log
 
85
test ! -f mylog.log
 
86
test -f unrelated.log
 
87
 
 
88
$MAKE clean
 
89
$MAKE check >stdout && { cat stdout; Exit 1; }
 
90
cat stdout
 
91
# Now, there should be two errors: bar.test is a hard error.
 
92
test `grep -c '^FAIL' stdout` -eq 2
 
93
test `grep -c '^FAIL' mylog.log` -eq 2
 
94
 
 
95
# Check dependencies: baz.test needs to run before bar.test,
 
96
# but foo.test is not needed.
 
97
# Note that this usage has a problem: the summary will only
 
98
# take bar.log into account, because the $(TEST_SUITE_LOG) rule
 
99
# does not "see" baz.log.  Hmm.
 
100
$MAKE clean
 
101
env TESTS='bar.test' $MAKE -e check && Exit 1
 
102
test -f baz.log
 
103
test -f bar.log
 
104
test ! -f foo.log
 
105
test -f mylog.log
 
106
 
 
107
# Upon a lazy rerun, foo.test should be run, but the others shouldn't.
 
108
# Note that the lazy rerun still exits with a failure, due to the previous
 
109
# test failures.
 
110
# Note that the previous test and this one taken together expose the timing
 
111
# issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
 
112
# before running the tests lazily.
 
113
env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
114
cat stdout
 
115
test -f foo.log
 
116
grep foo.test stdout
 
117
grep bar.test stdout && Exit 1
 
118
grep baz.test stdout && Exit 1
 
119
grep '2.*tests.*failed' stdout
 
120
 
 
121
# Now, explicitly retry with all test logs already updated, and ensure
 
122
# that the summary is still displayed.
 
123
env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
124
cat stdout
 
125
grep foo.test stdout && Exit 1
 
126
grep bar.test stdout && Exit 1
 
127
grep baz.test stdout && Exit 1
 
128
grep '2.*tests.*failed' stdout
 
129
 
 
130
# Lazily rerunning only foo should only rerun this one test.
 
131
env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
132
cat stdout
 
133
grep foo.test stdout
 
134
grep bar.test stdout && Exit 1
 
135
grep baz.test stdout && Exit 1
 
136
grep '2.*tests.*failed' stdout
 
137
 
 
138
# Test VERBOSE.
 
139
env VERBOSE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
140
cat stdout
 
141
grep 'this is.*bar.test' stdout
 
142
grep 'this is.*baz.test' stdout
 
143
 
 
144
$MAKE clean
 
145
env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
146
cat stdout
 
147
grep foo.test stdout && Exit 1
 
148
grep bar.test stdout && Exit 1
 
149
grep baz.test stdout
 
150
 
 
151
$MAKE clean
 
152
env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; Exit 1; }
 
153
cat stdout
 
154
grep foo.test stdout && Exit 1
 
155
grep bar.test stdout && Exit 1
 
156
grep baz.test stdout
 
157
 
 
158
: