gdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 17 Jun 2021 13:41:59 +0000 (09:41 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 17 Jun 2021 13:41:59 +0000 (09:41 -0400)
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

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/args.exp

index 1eb42e7b6bb72e650865e4d0c7e0edea2cca107c..16a86b6df9f984e89f42e7633a8b89ed891776d3 100644 (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.
index e76368f544e750cde80e4d666c7980382a2581e3..36dd19e64df785c51e340507991153afab5e55e1 100644 (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
 }
This page took 0.033544 seconds and 4 git commands to generate.