gdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver

This test tests passing arguments made of exactly two single-quotes
('') or a single newline character through the --args argument of GDB.
For some reason, GDB adds some extra single quotes when transmitting the
arguments to GDBserver.  This produces some FAILs when testing with the
native-extended-gdbserver board:

    FAIL: gdb.base/args.exp: argv[2] for one empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[2] for two empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[3] for two empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[2] for one newline
    FAIL: gdb.base/args.exp: argv[2] for two newlines
    FAIL: gdb.base/args.exp: argv[3] for two newlines

This is documented as PR 27989.  Add some appropriate KFAILs.

gdb/testsuite/ChangeLog:

	* gdb.base/args.exp: Check target, KFAIL if remote.
	(args_test): Add parameter and use it.

Change-Id: I49225d1c7df7ebaba480ebdd596df80f8fbf62f0
This commit is contained in:
Simon Marchi
2021-06-17 09:41:59 -04:00
committed by Simon Marchi
parent d30e32637d
commit 18263be756
2 changed files with 23 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2021-06-17 Simon Marchi <simon.marchi@efficios.com>
* gdb.base/args.exp: Check target, KFAIL if remote.
(args_test): Add parameter and use it.
2021-06-17 Simon Marchi <simon.marchi@efficios.com>
* gdb.base/args.exp: Remove trailing parenthesis in test names.

View File

@ -34,7 +34,10 @@ if {[build_executable $testfile.exp $testfile \
return -1
}
proc args_test { name arglist } {
# If SINGLE_QUOTES_NEWLINE_KFAIL true, arguments made of exactly '' or a
# newline character will fail, so kfail those tests.
proc args_test { name arglist {single_quotes_newline_kfail false}} {
global srcdir
global subdir
global testfile
@ -52,6 +55,10 @@ proc args_test { name arglist } {
set i 1
foreach arg $arglist {
if { $single_quotes_newline_kfail
&& ($arg == {''} || $arg == {\\n}) } {
setup_kfail "gdb/27989" "*-*-*"
}
gdb_test "print argv\[$i\]" "\\\$$decimal = $hex \"$arg\"" \
"argv\[$i\] for $name"
set i [expr $i + 1]
@ -65,6 +72,12 @@ proc args_test { name arglist } {
save_vars { GDBFLAGS } {
set old_gdbflags $GDBFLAGS
# Single quotes and newlines are not well handled by the extended-remote
# target: https://sourceware.org/bugzilla/show_bug.cgi?id=27989
set single_quotes_newline_kfail \
[expr { [target_info exists gdb_protocol] \
&& [target_info gdb_protocol] == "extended-remote" }]
set GDBFLAGS "$old_gdbflags --args $binfile 1 3"
args_test basic {{1} {3}}
@ -85,16 +98,16 @@ save_vars { GDBFLAGS } {
# Try with arguments containing literal single quotes.
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' 3"
args_test "one empty with single quotes" {{1} {''} {3}}
args_test "one empty with single quotes" {{1} {''} {3}} $single_quotes_newline_kfail
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' '' 3"
args_test "two empty with single quotes" {{1} {''} {''} {3}}
args_test "two empty with single quotes" {{1} {''} {''} {3}} $single_quotes_newline_kfail
# try with arguments containing literal newlines.
set GDBFLAGS "$old_gdbflags --args $binfile 1 {\n} 3"
args_test "one newline" {{1} {\\n} {3}}
args_test "one newline" {{1} {\\n} {3}} $single_quotes_newline_kfail
set GDBFLAGS "$old_gdbflags --args $binfile 1 {\n} {\n} 3"
args_test "two newlines" {{1} {\\n} {\\n} {3}}
args_test "two newlines" {{1} {\\n} {\\n} {3}} $single_quotes_newline_kfail
}