public inbox for
 help / color / mirror / Atom feed
From: Tom de Vries <>
Subject: [RFC][top-level] Add configure test-case
Date: Thu, 20 Oct 2022 17:10:28 +0200	[thread overview]
Message-ID: <20221020151027.GA1300@delia.home> (raw)


As reported in reopened PR18632, recent commit 228cf97dd3c ("Merge
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?

- 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
+# 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
+# <>.
+# 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

             reply	other threads:[~2022-10-20 15:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 15:10 Tom de Vries [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221020151027.GA1300@delia.home \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).