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

Simon Marchi simark@sourceware.org
Thu Jun 17 13:42:43 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18263be7565782a9c07045a7a72d80c507a5be09

commit 18263be7565782a9c07045a7a72d80c507a5be09
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Thu Jun 17 09:41:59 2021 -0400

    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

Diff:
---
 gdb/testsuite/ChangeLog         |  5 +++++
 gdb/testsuite/gdb.base/args.exp | 23 ++++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1eb42e7b6bb..16a86b6df9f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -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.
diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp
index e76368f544e..36dd19e64df 100644
--- a/gdb/testsuite/gdb.base/args.exp
+++ b/gdb/testsuite/gdb.base/args.exp
@@ -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
 }


More information about the Gdb-cvs mailing list