public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Tom de Vries <tdevries@suse.de>
Cc: rupesh potharla <rupesh.potharla@amd.com>,
	Binutils <binutils@sourceware.org>
Subject: Re: ☠ Buildbot (GNU Toolchain): binutils-gdb - failed test (failure) (master)
Date: Wed, 19 Oct 2022 19:32:40 +1030	[thread overview]
Message-ID: <Y0+9MNoUR50//EzM@squeak.grove.modra.org> (raw)
In-Reply-To: <df6fcd5e-4e02-9502-bcd6-d49dfed85fd8@suse.de>

On Wed, Oct 19, 2022 at 09:55:59AM +0200, Tom de Vries via Binutils wrote:
> looks like this:
> ...
> regexp -line {^([0-9a-fA-F]+)?[ ]+T main} $output contents
> set list [regexp -inline -all -- {\S+} $contents]
> ...
> is causing:
> ...
> ERROR: tcl error sourcing /var/lib/buildbot/workers/wildebeest/binutils-debian-ppc64/binutils-gdb/binutils/testsuite/binutils-all/addr2line.exp.
> ERROR: tcl error code TCL LOOKUP VARNAME contents
> ERROR: can't read "contents": no such variable
>     while executing
> "regexp -inline -all -- {\S+} $contents"
>     (file "/var/lib/buildbot/workers/wildebeest/binutils-debian-ppc64/binutils-gdb/binutils/testsuite/binutils-all/addr2line.exp"
> line 31)
>     invoked from within
> ...
> 
> If the regexp doesn't match, contents is not set.

Right.  It doesn't match for PowerPC64 ELFv1 because function symbols
are defined on a descriptor and are flagged as "D" not "T".  The test
also fails on cygwin/mingw where the compiler output is testprog.exe.

I think the following will do the trick, I'll commit after a full
test run.

diff --git a/binutils/testsuite/binutils-all/addr2line.exp b/binutils/testsuite/binutils-all/addr2line.exp
index 15e60366ac2..c37b8b9cdc6 100644
--- a/binutils/testsuite/binutils-all/addr2line.exp
+++ b/binutils/testsuite/binutils-all/addr2line.exp
@@ -24,35 +24,43 @@ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug
     return
 }
 
+set exe [exeext]
+
 #testcase for default option.
 #Run nm command and input the main symbol address to addr2line.
-set output [binutils_run $NM "tmpdir/testprog"]
-regexp -line {^([0-9a-fA-F]+)?[ ]+T main} $output contents
-set list [regexp -inline -all -- {\S+} $contents]
-set got [binutils_run $ADDR2LINE "-e tmpdir/testprog  [lindex $list 0]"]
-set want "$srcdir/$subdir/testprog.c:\[0-9\]+"
-if ![regexp $want $got] then {
-    fail "$testname $got\n"
+set output [binutils_run $NM "tmpdir/testprog$exe"]
+if ![regexp -line {^([0-9a-fA-F]+)?[ ]+[TD] main} $output contents] then {
+    fail "$testname"
 } else {
-    pass "$testname"
+    set list [regexp -inline -all -- {\S+} $contents]
+    set got [binutils_run $ADDR2LINE "-e tmpdir/testprog$exe [lindex $list 0]"]
+    set want "$srcdir/$subdir/testprog.c:\[0-9\]+"
+    if ![regexp $want $got] then {
+	fail "$testname $got\n"
+    } else {
+	pass "$testname"
+    }
 }
 
 #testcase for -f option.
 #Run nm command and input the fn function symbol address to addr2line.
-regexp -line {^([0-9a-fA-F]+)?[ ]+T fn} $output contents
-pass "output is $output \n contents is $contents\n"
-set list [regexp -inline -all -- {\S+} $contents]
-set got [binutils_run $ADDR2LINE "-f -e tmpdir/testprog  [lindex $list 0]"]
-set want "fn\n$srcdir/$subdir/testprog.c:\[0-9\]+"
-if ![regexp $want $got] then {
-    fail "$testname -f option $got\n"
+if ![regexp -line {^([0-9a-fA-F]+)?[ ]+[TD] fn} $output contents] then {
+    fail "$testname -f option"
 } else {
-    pass "$testname -f option"
+    pass "output is $output \n contents is $contents\n"
+    set list [regexp -inline -all -- {\S+} $contents]
+    set got [binutils_run $ADDR2LINE "-f -e tmpdir/testprog$exe [lindex $list 0]"]
+    set want "fn\n$srcdir/$subdir/testprog.c:\[0-9\]+"
+    if ![regexp $want $got] then {
+	fail "$testname -f option $got\n"
+    } else {
+	pass "$testname -f option"
+    }
 }
 
 #testcase for -s option.
 #Using the same fn function address used in -f option.
-set got [binutils_run $ADDR2LINE "-s -e tmpdir/testprog  [lindex $list 0]"]
+set got [binutils_run $ADDR2LINE "-s -e tmpdir/testprog$exe [lindex $list 0]"]
 set want "testprog.c:\[0-9\]+"
 if ![regexp $want $got] then {
     fail "$testname -s option $got\n"

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2022-10-19  9:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221019073533.3F8543858D3C@sourceware.org>
2022-10-19  7:55 ` Tom de Vries
2022-10-19  9:02   ` Alan Modra [this message]
2022-10-19 11:53     ` Fix addr2line test for ppc64 elfv1 and mingw Alan Modra
2022-12-23 21:30 ☠ Buildbot (GNU Toolchain): binutils-gdb - failed test (failure) (master) builder
2022-12-23 22:10 ` Indu Bhagat
2022-12-24  1:46   ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2022-11-16  1:09 builder
2022-11-16  3:50 ` Indu Bhagat
2022-11-02  2:50 builder
2022-11-02  3:06 ` Jiang, Haochen
2022-10-19  7:35 builder
2022-10-11 12:35 builder
2022-09-28  1:23 builder
2022-09-28  0:20 builder
2022-09-27  3:09 builder
2022-09-26 15:57 builder
2022-09-22  7:49 builder
2022-09-19  0:37 builder
2022-09-07  0:32 builder
2022-07-25  0:24 builder
2022-07-19  1:32 builder
2022-07-03 16:54 builder
2022-07-03 17:30 ` Mark Wielaard
2022-05-25 15:27 builder
2022-05-25 19:11 ` Mark Wielaard

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=Y0+9MNoUR50//EzM@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=rupesh.potharla@amd.com \
    --cc=tdevries@suse.de \
    /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).