doc: update Vala documentation
[automake.git] / t / test-trs-recover2.sh
blob4038f9543eeab4d37f3aba463262e00396cf42d5
1 #! /bin/sh
2 # Copyright (C) 2011-2024 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 harness features:
18 # - recovery from unreadable '.trs' files, in various scenarios
20 . test-init.sh
22 cat >> configure.ac <<END
23 AC_OUTPUT
24 END
26 cat > Makefile.am << 'END'
27 TESTS = foo.test bar.test
28 TEST_LOG_COMPILER = true
29 END
31 : > foo.test
32 : > bar.test
34 TEST_STATUS=0; export TEST_STATUS
36 $ACLOCAL
37 $AUTOCONF
38 $AUTOMAKE -a
40 ./configure
42 : > t
43 chmod a-r t && test ! -r t || skip_ "you can still read unreadable files"
44 rm -f t
46 : Create the required log files.
47 $MAKE check
48 test -f foo.trs
49 test -f bar.trs
51 : Recreate with a sweeping "make check".
52 chmod a-r bar.trs
53 $MAKE check
54 test -f foo.trs
55 test -r foo.trs
56 test -f bar.trs
57 test -r bar.trs
59 : Again, this time with one .trs file missing and the other
60 : one unreadable.
61 rm -f foo.trs
62 chmod a-r bar.trs
63 $MAKE check
64 test -f foo.trs
65 test -r foo.trs
66 test -f bar.trs
67 test -r bar.trs
69 : Again, but using "make recheck" this time.
70 rm -f foo.trs
71 chmod a-r bar.trs
72 run_make -O recheck
73 test -f foo.trs
74 test -r foo.trs
75 test -f bar.trs
76 test -r bar.trs
77 grep '^PASS: foo\.test' stdout
78 grep '^PASS: bar\.test' stdout
80 : Recreate by remaking the global test log.
81 chmod a-r foo.trs
82 rm -f test-suite.log
83 run_make -O test-suite.log
84 test -f foo.trs
85 test -r foo.trs
86 grep '^PASS: foo\.test' stdout
87 grep 'bar\.test' stdout && exit 1
88 # Also test that have only run before should be counted in the final
89 # testsuite summary.
90 grep '^# TOTAL: *2$' stdout
92 : Setup for the next check.
93 : > baz.test
94 sed 's/^TESTS =.*/& baz.test/' Makefile > t
95 diff t Makefile && exit 99
96 mv -f t Makefile
97 $MAKE check
98 test -f foo.trs
99 test -f bar.trs
100 test -f baz.trs
102 : Interactions with lazy test reruns are OK.
103 chmod a-r foo.trs
104 $sleep
105 touch stamp
106 $sleep
107 touch bar.test
108 run_make -O RECHECK_LOGS= check
109 test -r foo.trs
110 is_newest bar.trs bar.test
111 grep '^PASS: foo\.test' stdout
112 grep '^PASS: bar\.test' stdout
113 grep 'baz\.test' stdout && exit 1
114 # Also test that have only run before should be counted in the final
115 # testsuite summary.
116 grep '^# TOTAL: *3$' stdout