Merge branch 'python-fix-pr10227' into maint
[automake.git] / t / parallel-tests2.sh
blobae9bd38b69c3f39aaac63f88b63ed30cb5ded8f0
1 #! /bin/sh
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)
7 # any later version.
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 # - check-html
19 # - recheck-html
20 # FIXME: the features tested by this script has been moved in contrib.
21 # FIXME: We should move this script accordingly.
23 . ./defs || exit 1
25 # Try the variants that are tried in check-html.am.
26 while :; do
27 for r2h in $RST2HTML rst2html rst2html.py; do
28 echo "$me: running $r2h --version"
29 $r2h --version && break 2
30 : For shells with busted 'set -e'.
31 done
32 skip_all_ "no proper rst2html program found"
33 done
34 unset r2h
36 cp "$am_top_srcdir"/contrib/check-html.am . \
37 || fatal_ "cannot fetch 'check-html.am' from contrib"
39 cat >> configure.ac << 'END'
40 AC_OUTPUT
41 END
43 cat > Makefile.am << 'END'
44 TEST_SUITE_LOG = mylog.log
45 TESTS = foo.test bar.test baz.test
46 check_SCRIPTS = bla
47 bla:
48 echo bla > $@
49 CLEANFILES = bla
50 include $(srcdir)/check-html.am
51 END
53 cat > foo.test <<'END'
54 #! /bin/sh
55 echo "this is $0"
56 test -f bla || exit 1
57 exit 0
58 END
60 cat > bar.test <<'END'
61 #! /bin/sh
62 echo "this is $0"
63 exit 99
64 END
66 cat > baz.test <<'END'
67 #! /bin/sh
68 echo "this is $0"
69 exit 1
70 END
72 chmod a+x foo.test bar.test baz.test
74 $ACLOCAL
75 $AUTOCONF
76 $AUTOMAKE -a
78 ./configure
80 $MAKE check-html && exit 1
81 test -f mylog.html
82 # check-html should cause check_SCRIPTS to be created.
83 test -f bla
85 # "make clean" should remove HTML files.
86 $MAKE clean
87 test ! -e mylog.html
88 test ! -e bla
90 # Always create the HTML output, even if there were no failures.
91 rm -f mylog.html
92 env TESTS=foo.test $MAKE -e check-html
93 test -f mylog.html
95 # Create summarizing HTML output also with recheck-html.
96 rm -f mylog.html
97 env TESTS=foo.test $MAKE -e recheck-html
98 test -f mylog.html
100 # Create HTML output for an individual test.
101 $MAKE foo.html
102 grep 'this is .*foo\.test' foo.html
103 test ! -e bar.html
104 test ! -e baz.html
106 # Create HTML output for individual tests. Since the pre-existing log
107 # files are expected to be used for the HTML conversion, this should
108 # go smoothly even for failed tests.
109 $MAKE bar.html baz.html
110 grep 'this is .*bar\.test' bar.html
111 grep 'this is .*baz\.test' baz.html
113 # HTML output removed by mostlyclean.
114 $MAKE mostlyclean
115 test ! -e foo.html
116 test ! -e bar.html
117 test ! -e baz.html
118 test ! -e mylog.html
120 # check-html and recheck-html should cause check_SCRIPTS to be created,
121 # and recheck-html should rerun no tests if check has not been run.
123 $MAKE clean
124 test ! -e mylog.html
125 env TEST_LOGS=foo.log $MAKE -e check-html
126 test -f bla
127 test -f foo.log
128 test ! -e bar.log
129 test ! -e baz.log
130 test -f mylog.html
132 $MAKE clean
133 env TESTS=foo.test $MAKE -e recheck-html
134 test -f bla
135 test ! -e foo.log
136 test -f mylog.html
138 $MAKE clean
139 $MAKE recheck-html
140 test -f bla
141 test ! -e foo.log
142 test ! -e bar.log
143 test ! -e baz.log
144 test -f mylog.html