public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 3/4] [gdb/testsuite] Fix gdb.multi/multi-arch.exp on powerpc64le
Date: Mon, 24 Apr 2023 14:48:45 +0200	[thread overview]
Message-ID: <20230424124846.29580-3-tdevries@suse.de> (raw)
In-Reply-To: <20230424124846.29580-1-tdevries@suse.de>

When running test-case gdb.multi/multi-arch.exp on powerpc64le-linux, I run into:
...
Running gdb/testsuite/gdb.multi/multi-arch.exp ...
gdb compile failed, In file included from /usr/include/features.h:399:0,
                 from /usr/include/stdio.h:27,
                 from gdb/testsuite/gdb.multi/hangout.c:18:
/usr/include/gnu/stubs.h:8:27: fatal error: gnu/stubs-32.h: \
  No such file or directory
 # include <gnu/stubs-32.h>
                           ^
compilation terminated.
...

The problem is that the test-case attempts to use gcc -m32 to produce an
executable while that's not available.

Fix this by:
- introduce a new caching proc have_compile_and_link_flag, and
- using have_compile_and_link_flag in test-case gdb.multi/multi-arch.exp.

Tested on:
- x86_64-linux (openSUSE Leap 15.4), and
- powerpc64le-linux (CentOS-7).
---
 gdb/testsuite/gdb.multi/multi-arch.exp | 8 ++++++++
 gdb/testsuite/lib/gdb.exp              | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index f2c8a282a61..e1fbe1bcab1 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -50,6 +50,14 @@ if [istarget "s390*-*-*"] {
     set march2 "-m32"
 }
 
+if { $march1 != "" } {
+    require "have_compile_and_link_flag $march1"
+}
+
+if { $march2 != "" } {
+    require "have_compile_and_link_flag $march2"
+}
+
 if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
 	  [list debug additional_flags=${march1}]] } {
     return -1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 9d711e8aa66..45588d85aea 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9668,6 +9668,14 @@ gdb_caching_proc have_compile_flag { flag } {
 		additional_flags=$flag]
 }
 
+# Return 1 if we can create an executable using compile and link flag FLAG.
+
+gdb_caching_proc have_compile_and_link_flag { flag } {
+    set src { int main () { return 0; } }
+    return [gdb_can_simple_compile have_compile_and_link_flag_$flag $src executable \
+		additional_flags=$flag]
+}
+
 # Handle include file $srcdir/$subdir/FILE.
 
 proc include_file { file } {
-- 
2.35.3


  parent reply	other threads:[~2023-04-24 12:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 12:48 [pushed 1/4] [gdb/testsuite] Don't use string cat in gdb.dwarf2/dw2-abs-hi-pc.exp Tom de Vries
2023-04-24 12:48 ` [pushed 2/4] [gdb/testsuite] Add basic lmap for tcl < 8.6 Tom de Vries
2023-04-24 12:48 ` Tom de Vries [this message]
2023-04-24 12:48 ` [pushed 4/4] [gdb/testsuite] Require GCC >= 5.x.x in gdb.base/utf8-identifiers.exp Tom de Vries
2023-04-24 16:48 ` [pushed 1/4] [gdb/testsuite] Don't use string cat in gdb.dwarf2/dw2-abs-hi-pc.exp Tom Tromey
2023-04-24 20:22   ` Tom de Vries
2023-04-25 18:38     ` Tom Tromey
2023-04-26  6:34       ` Tom de Vries
2023-04-26  7:08         ` Andreas Schwab
2023-05-02 15:38           ` Tom de Vries
2023-04-27 13:39         ` Tom Tromey
2023-05-02 15:40           ` Tom de Vries

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20230424124846.29580-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).