maint: Update HACKING
[automake.git] / t / parallel-tests-recheck.sh
blob2ea07d1a82fd487e5afe4faf133258f6e6f91f38
1 #! /bin/sh
2 # Copyright (C) 2009-2017 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 <https://www.gnu.org/licenses/>.
17 # Check parallel-tests features:
18 # - recheck
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
26 cat > Makefile.am << 'END'
27 TEST_SUITE_LOG = mylog.log
28 TESTS = foo.test bar.test baz.test
29 check_SCRIPTS = bla
30 CLEANFILES = bla
31 bla:
32 echo bla > $@
33 END
35 cat > foo.test <<'END'
36 #! /bin/sh
37 echo "this is $0"
38 test -f bla || exit 1
39 exit 0
40 END
41 cat > bar.test <<'END'
42 #! /bin/sh
43 echo "this is $0"
44 exit 99
45 END
46 cat > baz.test <<'END'
47 #! /bin/sh
48 echo "this is $0"
49 exit 1
50 END
51 chmod a+x foo.test bar.test baz.test
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
57 ./configure
58 run_make -O -e FAIL check
59 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
61 # Running this two times in a row should produce the same results the
62 # second time.
63 for i in 1 2; do
64 using_gmake || $sleep # Required by BSD make.
65 run_make -O -e FAIL recheck
66 count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
67 grep 'foo\.test' stdout && exit 1
68 grep '^ERROR: bar\.test$' stdout
69 grep '^FAIL: baz\.test$' stdout
70 done
72 # Ensure that recheck builds check_SCRIPTS, and that
73 # recheck reruns nothing if check has not been run.
74 $MAKE clean
75 $MAKE recheck
76 test -f bla
77 test ! -e foo.log
78 test ! -e bar.log
79 test ! -e baz.log
80 test -f mylog.log