public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Set sysroot earlier in local-board.exp
@ 2021-09-12  9:31 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-09-12  9:31 UTC (permalink / raw)
  To: gdb-patches

Hi,

When running test-case gdb.base/batch-exit-status.exp for native, it passes.
But with target board cc-with-debug-names, we run into (added missing double
quotes for clarity):
...
builtin_spawn $build/gdb/testsuite/../../gdb/gdb -nw -nx \
  -data-directory $build/gdb/testsuite/../data-directory \
  -iex "set height 0" -iex "set width 0" -ex "set sysroot" -batch ""^M
: No such file or directory.^M
PASS: gdb.base/batch-exit-status.exp: \
  : No such file or directory\.: [lindex $result 2] == 0
FAIL: gdb.base/batch-exit-status.exp: \
  : No such file or directory\.: [lindex $result 3] == $expect_status
...

The difference between the passing and failing case is that with native we
have (leaving out set height/width for brevity):
...
$ gdb -batch ""; echo $?
: No such file or directory.
1
...
and with target board cc-with-debug-names:
...
$ gdb -ex "set sysroot" -batch ""; echo $?
: No such file or directory.
0
...

The difference is expected.  GDB returns the exit status of the last executed
command.  In the former case that's 'file ""', which fails.  In the latter case,
that's 'set sysroot', which succeeds.

Fix this by setting sysroot using -iex instead of -ex in local-board.exp, such
that we have the expected:
...
$ gdb -iex "set sysroot" -batch ""; echo $?
: No such file or directory.
1
...

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Set sysroot earlier in local-board.exp

---
 gdb/testsuite/boards/local-board.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/boards/local-board.exp b/gdb/testsuite/boards/local-board.exp
index 6d78fa666eb..6523312b0cd 100644
--- a/gdb/testsuite/boards/local-board.exp
+++ b/gdb/testsuite/boards/local-board.exp
@@ -24,4 +24,4 @@ set baseboard [lindex [split $board "/"] 0]
 set board_info($baseboard,isremote) 0
 
 # Set sysroot to avoid sending files via the remote protocol.
-set GDBFLAGS "${GDBFLAGS} -ex \"set sysroot\""
+set GDBFLAGS "${GDBFLAGS} -iex \"set sysroot\""

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-12  9:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12  9:31 [committed][gdb/testsuite] Set sysroot earlier in local-board.exp Tom de Vries

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