[RFC][top-level] Add configure test-case
Tom de Vries
tdevries@suse.de
Thu Oct 20 15:10:28 GMT 2022
Hi,
As reported in reopened PR18632, recent commit 228cf97dd3c ("Merge configure.ac
from gcc project") dropped commit 69961a84c9b ("Don't build
readline/libreadline.a, when --with-system-readline is supplied"), due to the
patch only being applied to binutils-gdb repo, and not to gcc repo.
I wondered if I could write a test-case that would regress because of this,
such that we at least don't silently regress.
I came up with a test-case named toplevel.exp, that can be run like this:
...
$ cd src
$ runtest toplevel.exp
...
Running ./toplevel.exp ...
=== Summary ===
# of expected passes 1
...
and leaves files $src/testrun.{log,sum}.
Tested on x86_64-linux.
Any comments?
Thanks,
- Tom
[top-level] Add configure test-case
---
toplevel.exp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/toplevel.exp b/toplevel.exp
new file mode 100644
index 00000000000..db224b3f0b1
--- /dev/null
+++ b/toplevel.exp
@@ -0,0 +1,53 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# We're assuming this is run in the top-level source directory, like so:
+# $ cd src
+# $ runtest toplevel.exp
+set rootdir [pwd]
+set srcdir $rootdir
+
+# We're putting the build dir inside the source dir, that may need to be
+# changed at some point.
+set builddir $rootdir/build.tmp
+exec rm -Rf $builddir
+exec mkdir $builddir
+
+cd $builddir
+
+set test "configure --with-system-readline"
+set res [catch {exec $srcdir/configure --with-system-readline} output]
+
+set error_info_re \
+ [list \
+ "This configuration is not supported in the following subdirectories:" \
+ "(\[^\n\]+ )?readline( \[^\n\]+)?" \
+ ""]
+set error_info_re [join $error_info_re "\n"]
+
+# Note: $res == 1 and $errorCode == "NONE" means that configure succeeded but
+# wrote something to stderr, which is available in $errorInfo.
+if { $res == 1
+ && $errorCode == "NONE"
+ && [regexp $error_info_re $errorInfo] == 1 } {
+ pass $test
+} else {
+ verbose -log "configure output: $output"
+ fail $test
+}
+
+# Cleanup.
+exec rm -Rf $builddir
More information about the Binutils
mailing list