[PATCH v3] binutils: testsuite: convert binary symbol tests to run_dump_test

Alan Modra amodra@gmail.com
Fri Nov 14 01:26:33 GMT 2025


On Wed, Nov 12, 2025 at 11:00:49AM +0200, Alon Bar-Lev wrote:
> On Tue, 11 Nov 2025 at 17:20, Maciej W. Rozycki <macro@orcam.me.uk> wrote:
> 
> > On Tue, 11 Nov 2025, Alan Modra wrote:
> >
> > Updating `run_dump_test' to bypass the
> > assembly step if requested could be another option long-term.
> >
> >   Maciej
> >
> 
> Hi,
> 
> I reviewed the code of run_dump_test, I do not think it is difficult to
> introduce a variable to disable the as.
> 
> Please let me know if this is acceptable and I will work on an
> implementation.

I don't think that is necessary or desirable for this particular test.
Maciej's original suggestion was justified mostly by better error
output from run_dump_test, but that has been fixed in commit
96b8a8a633a0.

It is not like you can write a single run_dump_test line in
objcopy.exp to handle this test.  You still need quite a lot of
surrounding tcl code.

I'm going to apply the following to further improve the symbol checks.
This exposes an error on alpha-linux-gnuecoff where the start and end
syms are given the wrong storage class.

	* testsuite/binutils-all/objcopy.exp (binary_symbol): Tighten
	symbol type checking.

diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 43814ac5a70..5f1f7c6b49e 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1631,8 +1631,11 @@ proc binary_symbol {name file args sym_prefix} {
 	return
     }
 
-    foreach sym [list "start" "end" "size"] {
-	set exp "^\[0-9a-fA-F\]+ +\[TtDdA\] +${sym_prefix}_${sym}$"
+    set syms [list {D start} {D end} {A size}]
+    foreach e $syms {
+	set typ [lindex $e 0]
+	set sym [lindex $e 1]
+	set exp "^\[0-9a-fA-F\]+ +${typ} +${sym_prefix}_${sym}$"
 	if ![regexp -line $exp $got] {
 	    send_log "failed to match: $exp\n"
 	    fail $test

-- 
Alan Modra


More information about the Binutils mailing list