gdb/testsuite: use unresolved in mi_run_cmd_full
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 18 Nov 2020 19:58:42 +0000 (14:58 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 18 Nov 2020 19:58:42 +0000 (14:58 -0500)
Running:

    make check TESTS="gdb.mi/mi-nonstop-exit.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"

We get:

    Running /home/simark/src/binutils-gdb/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
    ERROR: Unable to start target

                    === gdb Summary ===

    # of expected passes            2

The root cause of the problem is the typical "we try to enable non-stop
after having connected to gdbserver".  This is because with the
native-extended-gdbserver board, GDB connects to GDBserver as soon as
it's started.  It's too late then to do "set non-stop 1" or "-gdb-set
non-stop 1".  This is fixed by the following patch.

More worrying is that the error is not reported (except for the
printout).  From the testsuite point of view, everything went fine.
runtest exits with status 0.

This is because mi_run_cmd_full uses perror.  perror just prints that
ERROR and makes it so the next test becomes UNRESOLVED.  However,
there's no next test, because we just return early, seeing that we
couldn't run.

Change mi_run_cmd_full to call unresolved directly instead.  This
ensures that the failure is recorded.

This is the results diff when running the gdb.mi/*.exp tests:

     # of unexpected failures       34
     # of expected failures         8
     # of known failures            13
    -# of unresolved testcases      4
    +# of unresolved testcases      10
     # of unsupported tests         1
     # of duplicate test names      34

gdb/testsuite/ChangeLog:

* lib/mi-support.exp (mi_run_cmd_full): Use unresovled instead
of perror.

Change-Id: Ib0f214c0127fbe73f2033c6c29d678e025690220

gdb/testsuite/ChangeLog
gdb/testsuite/lib/mi-support.exp

index 3aa06fa72c939f95c0172446f18e7dd3dbfee1d8..4722846c75e140cd387c49141d41bbabf9711404 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * lib/mi-support.exp (mi_run_cmd_full): Use unresovled instead
+       of perror.
+
 2020-11-18  Joseph Myers  <joseph@codesourcery.com>
 
        * lib/mi-support.exp (mi_gdb_file_cmd): Check for case where
index bfc8edcd8d3d6bba670712f93f36de76b762435c..1c95ddee941a4444007066732e0e633feb686a65 100644 (file)
@@ -961,7 +961,7 @@ proc mi_run_cmd_full {use_mi_command args} {
        gdb_expect 30 {
            -re "$mi_gdb_prompt$" { }
            default {
-               perror "gdb_init_command for target failed"
+               unresolved "gdb_init_command for target failed"
                return -1
            }
        }
@@ -995,7 +995,7 @@ proc mi_run_cmd_full {use_mi_command args} {
        gdb_expect {
            -re "&\"jump \\*${start}\\\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\.\\\\n\"\[\r\n\]+\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\[\r\n\]+${mi_gdb_prompt}" {}
            timeout {
-               perror "Unable to start target"
+               unresolved "unable to start target"
                return -1
            }
        }
@@ -1011,7 +1011,7 @@ proc mi_run_cmd_full {use_mi_command args} {
            return -1
        }
        timeout {
-           perror "Unable to start target"
+           unresolved "unable to start target"
            return -1
        }
     }