Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: gdb-patches@sourceware.org
Cc: Jovan Dmitrovic <jovan.dmitrovic@htecgroup.com>,
	 Djordje Todorovic <Djordje.Todorovic@htecgroup.com>,
	 Milica Matic <milica.matic@htecgroup.com>,
	 "Maciej W. Rozycki" <macro@globalfoundries.com>
Subject: [PATCH 1/7] testsuite: Factor out target feature test template
Date: Thu, 23 Jul 2026 19:52:46 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2607222352260.14485@angie.orcam.me.uk> (raw)
In-Reply-To: <alpine.DEB.2.21.2607220148540.14485@angie.orcam.me.uk>

From: Maciej W. Rozycki <macro@globalfoundries.com>

Implement `allow_target_tests' generic target feature test procedure, 
factoring out duplicate code from tests such as `allow_altivec_tests', 
`allow_power_isa_3_1_tests', `allow_vsx_tests', etc.
---
 gdb/testsuite/lib/gdb.exp |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

gdb-test-target-allow.diff
Index: binutils-gdb/gdb/testsuite/lib/gdb.exp
===================================================================
--- binutils-gdb.orig/gdb/testsuite/lib/gdb.exp
+++ binutils-gdb/gdb/testsuite/lib/gdb.exp
@@ -4285,6 +4285,50 @@ gdb_caching_proc libc_has_debug_info {}
     }
 }
 
+# Using name ME for reporting, check for target feature FEATURE, the
+# absence of which is supposed to get message MESSAGE produced by GDB.
+# Use source SRC and optional list of additional compiler flags FLAGS
+# for the check.  Make sure the source provided builds and then that
+# target hardware runs it.
+proc allow_target_tests { me feature message src { flags {} } } {
+    global srcdir subdir gdb_prompt inferior_exited_re
+
+    set compile_flags {}
+    foreach flag $flags {
+	require {have_compile_flag $flag}
+	lappend compile_flags "additional_flags=$flag"
+    }
+
+    if {![gdb_simple_compile $me $src executable $compile_flags]} {
+	return 0
+    }
+
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir $srcdir/$subdir
+    gdb_load "$obj"
+    gdb_run_cmd
+    gdb_expect {
+	-re ".*${message}.*${gdb_prompt} $" {
+	    verbose -log "\n$me $feature not detected"
+	    set allow_target_tests 0
+	}
+	-re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
+	    verbose -log "\n$me: $feature detected"
+	    set allow_target_tests 1
+	}
+	default {
+	    warning "\n$me: default case taken"
+	    set allow_target_tests 0
+	}
+    }
+    gdb_exit
+    remote_file build delete $obj
+
+    verbose "$me: returning $allow_target_tests" 2
+    return $allow_target_tests
+}
+
 # Run a test on the target to see if it supports vmx hardware.  Return 1 if so,
 # 0 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
 

  reply	other threads:[~2026-07-23 18:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 18:52 [PATCH 0/7] MIPS+testsuite: BLEZL stepping fix and associated test infrastructure Maciej W. Rozycki
2026-07-23 18:52 ` Maciej W. Rozycki [this message]
2026-07-23 18:52 ` [PATCH 2/7] PowerPC/testsuite: Reduce feature tests in terms of `allow_target_tests' Maciej W. Rozycki
2026-07-23 18:52 ` [PATCH 3/7] MIPS/testsuite: Verify MIPS I CPU branch stepping Maciej W. Rozycki
2026-07-23 18:53 ` [PATCH 4/7] MIPS: Correct BLEZL single-stepping Maciej W. Rozycki
2026-07-23 18:53 ` [PATCH 5/7] MIPS/testsuite: Verify MIPS II CPU branch stepping Maciej W. Rozycki
2026-07-23 18:53 ` [PATCH 6/7] MIPS/testsuite: Verify MIPS16 " Maciej W. Rozycki
2026-07-23 18:53 ` [PATCH 7/7] MIPS: Reorder a reference to "BGTZ, BGTZL" in `mips32_next_pc' Maciej W. Rozycki

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=alpine.DEB.2.21.2607222352260.14485@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=Djordje.Todorovic@htecgroup.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jovan.dmitrovic@htecgroup.com \
    --cc=macro@globalfoundries.com \
    --cc=milica.matic@htecgroup.com \
    /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