public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC][top-level] Add configure test-case
@ 2022-10-20 15:10 Tom de Vries
  2022-10-31 15:03 ` Nick Clifton
  2022-11-07 11:34 ` Alan Modra
  0 siblings, 2 replies; 6+ messages in thread
From: Tom de Vries @ 2022-10-20 15:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-14  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 15:10 [RFC][top-level] Add configure test-case Tom de Vries
2022-10-31 15:03 ` Nick Clifton
2022-11-07 11:34 ` Alan Modra
2022-11-07 18:23   ` Joseph Myers
2022-11-08  7:12     ` Alan Modra
2023-01-14  8:51       ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).