2 # Copyright (C) 2011 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)
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 that the developer can extend the site.exp generated by the
18 # automake-generated Makefile.
27 echo "send_user \"$1: \$$1\\n\""
29 if { \$$1 == "/$1/" } {
37 cat >> configure.in << 'END'
41 cat > Makefile.am << 'END'
42 AUTOMAKE_OPTIONS = dejagnu
45 EXTRA_DIST = tool.test/tool.exp
47 EXTRA_DEJAGNU_SITE_CONFIG = foo.exp
51 echo 'set foo "/foo/"' > foo.exp
54 write_check_for foo > tool.test/tool.exp
55 cat tool.test/tool.exp
59 $AUTOMAKE --add-missing
66 grep 'PASS: test_foo' tool.sum
68 write_check_for bar >> tool.test/tool.exp
69 write_check_for baz >> tool.test/tool.exp
70 cat tool.test/tool.exp
72 # Ensure that foo.exp will be newer than site.exp, which will
73 # thus have to be remade.
75 # With this, below we'll also check that settings in files coming later in
76 # $(EXTRA_DEJAGNU_SITE_CONFIG) override those in files coming earlier.
77 cat >> foo.exp <<'END'
83 $MAKE check && { cat site.exp; Exit 1; }
84 grep 'PASS: test_foo' tool.sum
85 grep 'FAIL: test_bar' tool.sum
86 grep 'FAIL: test_baz' tool.sum
88 cat >> Makefile.am << 'END'
89 EXTRA_DEJAGNU_SITE_CONFIG += bar bar.dir/bar
91 DISTCLEANFILES = bar.dir/bar
93 test -d bar.dir || mkdir bar.dir
94 echo 'set baz "/baz/"' > $@
97 echo 'set bar "/bar/"' > bar
98 # This will allow us to check one more time that settings in files
99 # coming later in $(EXTRA_DEJAGNU_SITE_CONFIG) override those in
100 # files coming earlier.
101 echo 'set baz "/xyz/"' >> bar
103 # Ensure that the Makefile will be newer than site.exp, which will
104 # thus have to be remade.
107 ./config.status Makefile
109 $MAKE check || { cat site.exp; Exit 1; }
112 $FGREP '/bar/' site.exp
113 $FGREP '/baz/' site.exp
114 grep 'PASS: test_foo' tool.sum
115 grep 'PASS: test_bar' tool.sum
116 grep 'PASS: test_baz' tool.sum
118 # Check that the features we're testing behave well in VPATH builds.
121 # Check that the user can edit the site.exp file, and that his edits
123 write_check_for zardoz >> tool.test/tool.exp
124 cat tool.test/tool.exp
125 echo 'set zardoz "/zardoz/"' >> site.exp
129 grep 'PASS: test_zardoz' tool.sum
131 cat >> Makefile.am << 'END'
132 EXTRA_DEJAGNU_SITE_CONFIG += quux.exp
134 echo 'set zardoz "/quux/"' > $@
137 # Ensure that the Makefile will be newer than on site.exp, which will
138 # thus have to be remade.
141 ./config.status Makefile
142 grep 'zardoz.*/quux/' Makefile
147 grep 'zardoz.*/quux/' site.exp
150 grep 'PASS: test_zardoz' tool.sum
151 grep 'zardoz: /zardoz/' tool.log
152 grep 'zardoz.*quux' tool.log && Exit 1
154 # Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed
158 test ! -r $me-1.0/bar.dir/bar
159 test ! -r $me-1.0/quux.exp