]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog
[gdb/testsuite] Fix hello.go xpass
authorTom de Vries <tdevries@suse.de>
Thu, 20 Feb 2020 16:46:17 +0000 (17:46 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 20 Feb 2020 16:46:17 +0000 (17:46 +0100)
commita9c798035de33ccc3bc3e494449bbe931e900372
tree282bd4d976cf45a29095bfb65be48091c58e20ad
parent52405d85ec748e4566b7893fa3cb9ff21c8a1bc4
[gdb/testsuite] Fix hello.go xpass

With gdb.go/hello.go, we run into an xpass:
...
Thread 1 "hello" hit Breakpoint 1, main.main () at hello.go:7^M
7       func main () {^M
(gdb) print st^M
$1 = 0x0 ""^M
(gdb) XPASS: gdb.go/hello.exp: starting string check
...

The xfail is setup as follows:
...
\# This used to print "", i.e., the local "st" initialized as "".
setup_xfail "*-*-*"

gdb_test "print st" \
    ".* = $hex \"\"" \
    "starting string check"
...

It's not clear what gccgo/gc PR this xfail refers to.

It's also not clear why the empty string is both:
- listed as reason for xfail, and
- used in the pass pattern.

Furthermore, there's a comment in the hello.go testcase:
...
  st := "Hello, world!" // this intentionally shadows the global "st"
...
while there's no global st variable present, only a variable myst:
...
var myst = "Shall we?"
...

Fix this by splitting up the test-case in two test-cases, hello.{go,exp} and
global-local-var-shadow.{go,exp}.

In hello.exp we no longer attempt to print st before its declaration.  In
hello.go we remove the myst variable as well the comment related to shadowing.

In global-local-var-shadow.go, we rename myst to st, such that the comment
related to shadowing is correct.  In global-local-var-shadow.exp we attempt to
print the value of st before the local definition, which should print the
value of the global definition, and xfail this with reference to GCC PR93844.

Tested on x86_64-linux, with gccgo 10.

gdb/testsuite/ChangeLog:

2020-02-20  Tom de Vries  <tdevries@suse.de>

PR go/17018
* gdb.go/hello.exp: Copy ...
* gdb.go/global-local-var-shadow.exp: ... here.  New file.  Expect
print of st to print value of global definition. Add xfail for GCC
PR93844.
* gdb.go/hello.exp: Remove printing of st before definition.
* gdb.go/hello.go: Copy ...
* gdb.go/global-local-var-shadow.go: ... here. New test.  Rename myst
to st.
* gdb.go/hello.go: Remove myst.  Remove comment about shadowing.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.go/global-local-var-shadow.exp [new file with mode: 0644]
gdb/testsuite/gdb.go/global-local-var-shadow.go [new file with mode: 0644]
gdb/testsuite/gdb.go/hello.exp
gdb/testsuite/gdb.go/hello.go