| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Copyright (C) 2011-2025 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 <https://www.gnu.org/licenses/>. |
| 16 | |
| 17 | # Check that the developer can extend the site.exp generated by the |
| 18 | # automake-generated Makefile. |
| 19 | |
| 20 | required=runtest |
| 21 | . test-init.shscip-shell source . . `test-init.sh`. |
| 22 | |
| 23 | write_check_forscip-shell shell automake 1:1.18.1-4 write_check_for(). () |
| 24 | { |
| 25 | echoscip-shell system . . echo. "send_user \"$1: \$$1\\n\"" |
| 26 | unindent << END |
| 27 | if { \$$1 == "/$1/" } { |
| 28 | pass "test_$1" |
| 29 | } else { |
| 30 | fail "test_$1" |
| 31 | } |
| 32 | END |
| 33 | } |
| 34 | |
| 35 | catscip-shell system . . cat. >> configure.ac << 'END' |
| 36 | AC_CONFIG_FILES([testsuite/Makefile]) |
| 37 | AC_OUTPUT |
| 38 | END |
| 39 | |
| 40 | catscip-shell system . . cat. > Makefile.am << 'END' |
| 41 | SUBDIRS = testsuite |
| 42 | END |
| 43 | |
| 44 | mkdirscip-shell system . . mkdir. testsuite |
| 45 | |
| 46 | catscip-shell system . . cat. > testsuite/Makefile.am << 'END' |
| 47 | AUTOMAKE_OPTIONS = dejagnu |
| 48 | DEJATOOL = tool |
| 49 | |
| 50 | EXTRA_DIST = tool.test/tool.exp |
| 51 | |
| 52 | EXTRA_DEJAGNU_SITE_CONFIG = foo.exp |
| 53 | EXTRA_DIST += foo.exp |
| 54 | END |
| 55 | |
| 56 | echoscip-shell system . . echo. 'set foo "/foo/"' > testsuite/foo.exp |
| 57 | |
| 58 | mkdirscip-shell system . . mkdir. testsuite/tool.test |
| 59 | write_check_forscip-shell shell automake 1:1.18.1-4 write_check_for(). foo > testsuite/tool.test/tool.exp |
| 60 | catscip-shell system . . cat. testsuite/tool.test/tool.exp |
| 61 | |
| 62 | $ACLOCAL |
| 63 | $AUTOCONF |
| 64 | $AUTOMAKE --add-missing |
| 65 | |
| 66 | ./configure |
| 67 | |
| 68 | $MAKE check |
| 69 | catscip-shell system . . cat. testsuite/foo.exp |
| 70 | catscip-shell system . . cat. testsuite/site.exp |
| 71 | grepscip-shell system . . grep. 'PASS: test_foo' testsuite/tool.sum |
| 72 | |
| 73 | write_check_forscip-shell shell automake 1:1.18.1-4 write_check_for(). bar >> testsuite/tool.test/tool.exp |
| 74 | write_check_forscip-shell shell automake 1:1.18.1-4 write_check_for(). baz >> testsuite/tool.test/tool.exp |
| 75 | catscip-shell system . . cat. testsuite/tool.test/tool.exp |
| 76 | |
| 77 | # Ensure that foo.exp will be newer than site.exp, which will |
| 78 | # thus have to be remade. |
| 79 | $sleep |
| 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 | catscip-shell system . . cat. >> testsuite/foo.exp <<'END' |
| 83 | set bar "/foo/" |
| 84 | set baz "/foo/" |
| 85 | set qux "/foo/" |
| 86 | END |
| 87 | |
| 88 | $MAKE check && { catscip-shell system . . cat. testsuite/site.exp; exit 1; } |
| 89 | grepscip-shell system . . grep. 'PASS: test_foo' testsuite/tool.sum |
| 90 | grepscip-shell system . . grep. 'FAIL: test_bar' testsuite/tool.sum |
| 91 | grepscip-shell system . . grep. 'FAIL: test_baz' testsuite/tool.sum |
| 92 | |
| 93 | catscip-shell system . . cat. >> testsuite/Makefile.am << 'END' |
| 94 | EXTRA_DEJAGNU_SITE_CONFIG += bar bar.dir/bar |
| 95 | EXTRA_DIST += bar |
| 96 | DISTCLEANFILES = bar.dir/bar |
| 97 | bar.dir/bar: |
| 98 | test -d bar.dir || mkdir bar.dir |
| 99 | echo 'set baz "/baz/"' > $@ |
| 100 | END |
| 101 | |
| 102 | echoscip-shell system . . 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 | echoscip-shell system . . echo. 'set baz "/xyz/"' >> testsuite/bar |
| 107 | |
| 108 | # Ensure that the Makefile will be newer than site.exp, which will |
| 109 | # thus have to be remade. |
| 110 | $sleep |
| 111 | $AUTOMAKE testsuite/Makefile |
| 112 | ./config.status testsuite/Makefile |
| 113 | |
| 114 | $MAKE check || { catscip-shell system . . cat. testsuite/site.exp; exit 1; } |
| 115 | catscip-shell system . . cat. testsuite/site.exp |
| 116 | catscip-shell system . . cat. testsuite/bar.dir/bar |
| 117 | $FGREP '/bar/scip-shell filesystem . . `/bar/`.' testsuite/site.exp |
| 118 | $FGREP '/baz/scip-shell filesystem . . `/baz/`.' testsuite/site.exp |
| 119 | grepscip-shell system . . grep. 'PASS: test_foo' testsuite/tool.sum |
| 120 | grepscip-shell system . . grep. 'PASS: test_bar' testsuite/tool.sum |
| 121 | grepscip-shell system . . grep. 'PASS: test_baz' testsuite/tool.sum |
| 122 | |
| 123 | # Check that the features we're testing behave well in VPATH builds. |
| 124 | $MAKE distcheck |
| 125 | |
| 126 | # Check that the user can edit the site.exp file, and that his edits |
| 127 | # are retained. |
| 128 | write_check_forscip-shell shell automake 1:1.18.1-4 write_check_for(). zardoz >> testsuite/tool.test/tool.exp |
| 129 | catscip-shell system . . cat. testsuite/tool.test/tool.exp |
| 130 | echoscip-shell system . . echo. 'set zardoz "/zardoz/"' >> testsuite/site.exp |
| 131 | |
| 132 | $MAKE check |
| 133 | catscip-shell system . . cat. testsuite/site.exp |
| 134 | grepscip-shell system . . grep. 'PASS: test_zardoz' testsuite/tool.sum |
| 135 | |
| 136 | catscip-shell system . . cat. >> testsuite/Makefile.am << 'END' |
| 137 | EXTRA_DEJAGNU_SITE_CONFIG += quux.exp |
| 138 | quux.exp: |
| 139 | echo 'set zardoz "/quux/"' > $@ |
| 140 | END |
| 141 | |
| 142 | # Ensure that the Makefile will be newer than on site.exp, which will |
| 143 | # thus have to be remade. |
| 144 | $sleep |
| 145 | $AUTOMAKE testsuite/Makefile |
| 146 | ./config.status testsuite/Makefile |
| 147 | grepscip-shell system . . grep. 'zardoz.*/quux/' testsuite/Makefile |
| 148 | |
| 149 | (cd testsuite/ && $MAKE site.exp) |
| 150 | catscip-shell system . . cat. testsuite/site.exp |
| 151 | catscip-shell system . . cat. testsuite/quux.exp |
| 152 | grepscip-shell system . . grep. 'zardoz.*/quux/' testsuite/site.exp |
| 153 | |
| 154 | $MAKE check |
| 155 | grepscip-shell system . . grep. 'PASS: test_zardoz' testsuite/tool.sum |
| 156 | grepscip-shell system . . grep. 'zardoz: /zardoz/' testsuite/tool.log |
| 157 | grepscip-shell system . . grep. 'zardoz.*quux' testsuite/tool.log && exit 1 |
| 158 | |
| 159 | # Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed |
| 160 | # by default. |
| 161 | $MAKE distdir |
| 162 | lsscip-shell system . . ls. -l $distdir |
| 163 | testscip-shell system . . test. ! -e $distdir/testsuite/bar.dir/bar |
| 164 | testscip-shell system . . test. ! -e $distdir/testsuite/quux.exp |
| 165 | |
| 166 | : |