Fix races in mi2-basics.exp.
authorMarek Polacek <mpolacek@sourceware.org>
Thu, 23 Jun 2011 09:38:14 +0000 (09:38 +0000)
committerMarek Polacek <mpolacek@sourceware.org>
Thu, 23 Jun 2011 09:38:14 +0000 (09:38 +0000)
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi2-basics.exp

index 9f5ed90c0b51df677718a8594d6c817e4b11b083..1aabd7c9e883c7f140d6b24734bf7d40a119b6d8 100644 (file)
@@ -1,3 +1,12 @@
+2011-06-23  Marek Polacek  <mpolacek@redhat.com>
+
+        * gdb.mi/mi2-basics.exp: Fix races.  Honour the
+        `test_exec_and_symbol_mi_operatons' return value.
+        (test_mi_interpreter_selection): Use mi_gdb_test instead of
+        gdb_test_multiple.
+        (test_exec_and_symbol_mi_operatons): Likewise.
+        (test_path_specification): Likewise.
+
 2011-06-23  Yao Qi  <yao@codesourcery.com>
 
        * gdb.base/moribund-step.exp: Skip test if displaced stepping is not
index f52a1207d784cbf9893ba6509f158ed371737a46..155b9dc6d5f6c2e5f6c1f0649037ba2afce6e2b9 100644 (file)
@@ -60,18 +60,10 @@ proc test_mi_interpreter_selection {} {
 
     # All this test expects is to get the prompt back
     # with no syntax error message
-    gdb_test_multiple "-gdb-version" "acceptance of MI operations" {
-       -re "GNU gdb .*\r\n$mi_gdb_prompt$" {
-           pass "acceptance of MI operations" 
-           return 1
-       }
-       -re ".*\r\n$mi_gdb_prompt$" {
-           fail "acceptance of MI operations"
-       }
-       -re "Undefined command.*$gdb_prompt $" {
-           fail "acceptance of MI operations"
-       }
-    }
+    if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] {
+       return 1
+    } 
+    
     note "Skipping all other MI tests."
     return 0
 }
@@ -84,19 +76,11 @@ proc test_exec_and_symbol_mi_operatons {} {
     # Tests:
     # -file-exec-and-symbols
 
-    # Can't use mi_gdb_test as if this doesn't work,
-    #  we must give up on the whole test file
-    gdb_test_multiple "-file-exec-and-symbols ${binfile}" \
-       "file-exec-and-symbols operation" {
-           -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" {
-               pass "file-exec-and-symbols operation"
-           }
-           timeout {
-               fail "file-exec-and-symbols operation (timeout)"
-               note "Skipping all other MI tests."
-               return 0
-           }
-       }
+    if [mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\\^done" \
+       "file-exec-and-symbols operation"] {
+       note "Skipping all other MI tests."
+       return 0
+    }
 
     # The following is not used by mi-support.exp, but we test here so
     # we get done with loading a program basics.
@@ -121,7 +105,8 @@ proc test_exec_and_symbol_mi_operatons {} {
              "\\\^done" \
              "file-symbol-file operation"
 
-    # FIXME: if we cannot load we have to skip all other tests.
+    # We need to return != 0.
+    return 1
 }
 
 proc test_breakpoints_deletion {} {
@@ -201,6 +186,7 @@ proc test_path_specification {} {
     global subdir
     global escapedobjdir
     global envirodir
+    global expect_out
 
     # Add to the path, display, then reset 
     # Tests:
@@ -209,15 +195,8 @@ proc test_path_specification {} {
     # -environment-path -r dir
     # -environment-path -r
 
-    gdb_test_multiple "-environment-path" "-environment-path" {
-       -re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" { 
-           set orig_path $expect_out(1,string); 
-       }
-       timeout { 
-           perror "-environment-path (timeout)" ; 
-           return 
-       }
-    }
+    mi_gdb_test "-environment-path" "\\\^done,path=\"(.*)\"" "-environment-path"
+    set orig_path $expect_out(3,string)
 
     set orig_path [string_to_regexp ${orig_path}]
     set pathdir [string_to_regexp ${objdir}/${subdir}]
@@ -240,8 +219,8 @@ proc test_path_specification {} {
 
 } 
 
-if [test_mi_interpreter_selection] {
-  test_exec_and_symbol_mi_operatons
+if { [test_mi_interpreter_selection]
+      && [test_exec_and_symbol_mi_operatons] } {
   test_breakpoints_deletion
   test_dir_specification
   test_cwd_specification