Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / parallel-tests-log-override-1.test
1 #! /bin/sh
2 # Copyright (C) 2011 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: runtime redefinition of $(TEST_SUITE_LOG).
18
19 parallel_tests=yes
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in <<'END'
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am <<'END'
29 TESTS = pass.test skip.test xfail.test
30 XFAIL_TESTS = xfail.test
31 EXTRA_DIST = $(TESTS)
32 END
33
34 cat > pass.test <<'END'
35 #! /bin/sh
36 exit 0
37 END
38
39 cat > skip.test <<'END'
40 #! /bin/sh
41 echo "% test skipped %"
42 exit 77
43 END
44
45 cat > xfail.test <<'END'
46 #! /bin/sh
47 echo "# expected failure #"
48 exit 1
49 END
50
51 chmod a+x *.test
52
53 test_log_edit ()
54 {
55   sed -e "s|^  *$me 1\.0:.*$|  $me 1.0: ???|" \
56       -e "s|^=====*|=======================|" $*
57 }
58
59 test_log_expected ()
60 {
61   test_log_edit orig > exp
62   test_log_edit $1   > got
63   diff exp got || Exit 1
64   rm -f exp got
65 }
66
67 $ACLOCAL
68 $AUTOCONF
69 $AUTOMAKE -a
70
71 ./configure
72
73 $MAKE check
74 ls -l
75 cat test-suite.log
76 cp test-suite.log orig
77
78 $MAKE clean
79 test -f test-suite.log && Exit 99 # Sanity check.
80
81 # Check that we can override the testsuite log file at runtime.
82 TEST_SUITE_LOG=zardoz.log $MAKE -e check
83 ls -l
84 test ! -f test-suite.log
85 cat zardoz.log
86 test_log_expected zardoz.log
87 # Sanity check the distribution too (this also does minimal checks on
88 # VPATH support).
89 TEST_SUITE_LOG=zardoz.log $MAKE -e distcheck
90
91 # Check that cleanup rules remove the correct file even when
92 # user overrides are in place.
93 cp orig test-suite.log
94 TEST_SUITE_LOG=zardoz.log $MAKE -e clean
95 ls -l
96 test ! -f zardoz.log
97 diff orig test-suite.log
98
99 # Check that the default testsuite log doesn't get unduly modified.
100 # Also check that the testsuite log file doesn't need to be named
101 # accordingly to the `*.log' pattern.
102 chmod a-w test-suite.log
103 TEST_SUITE_LOG=TheLogFile $MAKE -e check
104 ls -l
105 diff orig test-suite.log
106 test_log_expected TheLogFile
107 TEST_SUITE_LOG=TheLogFile $MAKE -e clean
108 ls -l
109 test ! -f TheLogFile
110 diff orig test-suite.log
111
112 :