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)
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 that the developer can extend the site.exp generated by the
18 # automake-generated Makefile.
25 echo "send_user \"$1: \$$1\\n\""
27 if { \$$1 == "/$1/" } {
35 cat >> configure.ac
<< 'END'
36 AC_CONFIG_FILES
([testsuite
/Makefile
])
40 cat > Makefile.am
<< 'END'
46 cat > testsuite
/Makefile.am
<< 'END'
47 AUTOMAKE_OPTIONS
= dejagnu
50 EXTRA_DIST
= tool.test
/tool.exp
52 EXTRA_DEJAGNU_SITE_CONFIG
= foo.exp
56 echo 'set foo "/foo/"' > testsuite
/foo.exp
58 mkdir testsuite
/tool.
test
59 write_check_for foo
> testsuite
/tool.test
/tool.exp
60 cat testsuite
/tool.test
/tool.exp
64 $AUTOMAKE --add-missing
70 cat testsuite
/site.exp
71 grep 'PASS: test_foo' testsuite
/tool.
sum
73 write_check_for bar
>> testsuite
/tool.test
/tool.exp
74 write_check_for baz
>> testsuite
/tool.test
/tool.exp
75 cat testsuite
/tool.test
/tool.exp
77 # Ensure that foo.exp will be newer than site.exp, which will
78 # thus have to be remade.
80 # With this, below we'll also check that settings in files coming later in
81 # $(EXTRA_DEJAGNU_SITE_CONFIG) override those in files coming earlier.
82 cat >> testsuite
/foo.exp
<<'END'
88 $MAKE check
&& { cat testsuite
/site.exp
; exit 1; }
89 grep 'PASS: test_foo' testsuite
/tool.
sum
90 grep 'FAIL: test_bar' testsuite
/tool.
sum
91 grep 'FAIL: test_baz' testsuite
/tool.
sum
93 cat >> testsuite
/Makefile.am
<< 'END'
94 EXTRA_DEJAGNU_SITE_CONFIG
+= bar bar.dir
/bar
96 DISTCLEANFILES
= bar.dir
/bar
98 test -d bar.dir || mkdir bar.dir
99 echo 'set baz "/baz/"' > $@
102 echo 'set bar "/bar/"' > testsuite
/bar
103 # This will allow us to check one more time that settings in files
104 # coming later in $(EXTRA_DEJAGNU_SITE_CONFIG) override those in
105 # files coming earlier.
106 echo 'set baz "/xyz/"' >> testsuite
/bar
108 # Ensure that the Makefile will be newer than site.exp, which will
109 # thus have to be remade.
111 $AUTOMAKE testsuite
/Makefile
112 .
/config.status testsuite
/Makefile
114 $MAKE check ||
{ cat testsuite
/site.exp
; exit 1; }
115 cat testsuite
/site.exp
116 cat testsuite
/bar.dir
/bar
117 $FGREP '/bar/' testsuite
/site.exp
118 $FGREP '/baz/' testsuite
/site.exp
119 grep 'PASS: test_foo' testsuite
/tool.
sum
120 grep 'PASS: test_bar' testsuite
/tool.
sum
121 grep 'PASS: test_baz' testsuite
/tool.
sum
123 # Check that the features we're testing behave well in VPATH builds.
126 # Check that the user can edit the site.exp file, and that his edits
128 write_check_for zardoz
>> testsuite
/tool.test
/tool.exp
129 cat testsuite
/tool.test
/tool.exp
130 echo 'set zardoz "/zardoz/"' >> testsuite
/site.exp
133 cat testsuite
/site.exp
134 grep 'PASS: test_zardoz' testsuite
/tool.
sum
136 cat >> testsuite
/Makefile.am
<< 'END'
137 EXTRA_DEJAGNU_SITE_CONFIG
+= quux.exp
139 echo 'set zardoz "/quux/"' > $@
142 # Ensure that the Makefile will be newer than on site.exp, which will
143 # thus have to be remade.
145 $AUTOMAKE testsuite
/Makefile
146 .
/config.status testsuite
/Makefile
147 grep 'zardoz.*/quux/' testsuite
/Makefile
149 (cd testsuite
/ && $MAKE site.exp
)
150 cat testsuite
/site.exp
151 cat testsuite
/quux.exp
152 grep 'zardoz.*/quux/' testsuite
/site.exp
155 grep 'PASS: test_zardoz' testsuite
/tool.
sum
156 grep 'zardoz: /zardoz/' testsuite
/tool.log
157 grep 'zardoz.*quux' testsuite
/tool.log
&& exit 1
159 # Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed
163 test ! -e $distdir/testsuite
/bar.dir
/bar
164 test ! -e $distdir/testsuite
/quux.exp