[gdb/testsuite] Handle runto fail in gdb.mi/mi-var-cp.exp
authorTom de Vries <tdevries@suse.de>
Fri, 19 Nov 2021 14:55:16 +0000 (15:55 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 19 Nov 2021 14:55:16 +0000 (15:55 +0100)
On OBS I ran into:
...
PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:81 (set breakpoint)
UNRESOLVED: gdb.mi/mi-var-cp.exp: unable to start target
...
followed by 81 FAILs and two more UNRESOLVEDs.

I didn't manage to reproduce this, but I did notice that the initial
problem causing the UNRESOLVED caused all subsequent UNRESOLVEDs and FAILs.

I emulated the problem by commenting out the send_gdb "run\n" in
mi_run_cmd_full.

Fix this by:
- handling mi_run_cmd failure in mi_get_inline_test
- handling mi_run_inline_test failure in gdb.mi/mi-var-cp.exp, and
  other test-cases using mi_get_inline_test

Tested on x86_64-linux.

gdb/testsuite/gdb.mi/mi-var-child.exp
gdb/testsuite/gdb.mi/mi-var-cmd.exp
gdb/testsuite/gdb.mi/mi-var-cp.exp
gdb/testsuite/gdb.mi/mi-var-rtti.exp
gdb/testsuite/lib/mi-support.exp

index 8632fe26cf86765af1960247cca8157bd0e0d326..63cea065c3f0aa837a02a53f9d245dbcf0a7d0ab 100644 (file)
@@ -1205,7 +1205,9 @@ mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \
 
 mi_prepare_inline_tests $srcfile
 
-mi_run_inline_test child_deletion
+if { [mi_run_inline_test child_deletion] < 0 } {
+    return -1
+}
 
 
 mi_gdb_exit
index fe0826d480d3a4f67de22d236a76ca683a9c610b..fbf57aa25acbbf82affaa33879a1f0ce2f88f721 100644 (file)
@@ -587,14 +587,24 @@ proc set_frozen {varobjs flag} {
 }
 
 mi_prepare_inline_tests $srcfile
-mi_run_inline_test frozen
 
-mi_run_inline_test bitfield
+set inline_tests {
+    frozen
+    bitfield
+}
+
+# Needs to be last, following tests rely on this.
+lappend inline_tests floating
+
+foreach inline_test $inline_tests {
+    if { [mi_run_inline_test $inline_test] < 0 } {
+       return -1
+    }
+}
 
 # Since the inline test framework does not really work with
-# function calls, first to inline tests and then do the reminder
+# function calls, first to inline tests and then do the remainder
 # manually.
-mi_run_inline_test floating
 set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"]
 mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \
     "inside breakpoint inside callee"
index 4e8abe8d961b1ac61011f4a5a2552d0d7b1567c3..8fdd0f863a788ee294002f261e985ef60e587a0a 100644 (file)
@@ -38,11 +38,19 @@ mi_gdb_load ${binfile}
 
 mi_prepare_inline_tests $srcfile
 
-mi_run_inline_test reference_update
-mi_run_inline_test base_in_reference
-mi_run_inline_test reference_to_pointer
-mi_run_inline_test reference_to_struct
-mi_run_inline_test path_expression
+set inline_tests {
+    reference_update
+    base_in_reference
+    reference_to_pointer
+    reference_to_struct
+    path_expression
+}
+
+foreach inline_test $inline_tests {
+    if { [mi_run_inline_test $inline_test] < 0 } {
+       return -1
+    }
+}
 
 set lineno [gdb_get_line_number "/* anonymous_structs_and_unions */"]
 mi_create_breakpoint "$srcfile:$lineno" \
index b574e5c4edbc2f7488b031487d22fb695313670a..a0a2e132aafd3d90aa5a0d3caf4326a5c4550ee6 100644 (file)
@@ -109,13 +109,21 @@ proc check_new_derived_with_rtti {var_name var_type testname} {
         "delete varobj for ${var_name} (with RTTI) in $testname"
 }
 
-mi_run_inline_test use_rtti_for_ptr
-mi_run_inline_test use_rtti_for_ref
-mi_run_inline_test use_rtti_for_ptr_child
-mi_run_inline_test use_rtti_for_ref_child
-mi_run_inline_test use_rtti_with_multiple_inheritence
-mi_run_inline_test type_update_when_use_rtti
-mi_run_inline_test skip_type_update_when_not_use_rtti
+set inline_tests {
+    use_rtti_for_ptr
+    use_rtti_for_ref
+    use_rtti_for_ptr_child
+    use_rtti_for_ref_child
+    use_rtti_with_multiple_inheritence
+    type_update_when_use_rtti
+    skip_type_update_when_not_use_rtti
+}
+
+foreach inline_test $inline_tests {
+    if { [mi_run_inline_test $inline_test] < 0 } {
+       return -1
+    }
+}
 
 mi_gdb_exit
 return 0
index f6ee352b67eb4da64e7f2ad909cfde87fe742bbb..7e02badd9675caefdfd597fb4ed1645c29011224 100644 (file)
@@ -1955,7 +1955,9 @@ proc mi_run_inline_test { testcase } {
        if {$first==1} {
            # Start the program afresh.
            mi_tbreak "$mi_autotest_source:$line"
-           mi_run_cmd
+           if { [mi_run_cmd] < 0 } {
+               return -1
+           }
            set line_now [mi_get_stop_line "$testcase: step to $line"]
            set first 0
        } elseif {$line_now!=$line} {
@@ -1982,6 +1984,8 @@ proc mi_run_inline_test { testcase } {
        # will need more experience to be sure.
        eval $statements
     }
+
+    return 0
 }
 
 proc get_mi_thread_list {name} {