[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with readnow
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / fork-plus-threads.exp
index 81eeda3f565b57991bd43dd7b6790fdae1251591..7fe3c603bcde2e8057b1a554ed4567674d425038 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Free Software Foundation, Inc.
+# Copyright (C) 2015-2021 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [target_info exists gdb_protocol]
 
 standard_testfile
 
-proc do_test { detach_on_fork } {
+proc do_test { detach-on-fork } {
     global GDBFLAGS
     global srcfile testfile
     global gdb_prompt
@@ -50,7 +50,7 @@ proc do_test { detach_on_fork } {
        return 0
     }
 
-    gdb_test_no_output "set detach-on-fork $detach_on_fork"
+    gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
     set test "continue &"
     gdb_test_multiple $test $test {
        -re "$gdb_prompt " {
@@ -87,6 +87,14 @@ proc do_test { detach_on_fork } {
            set saw_thread_stopped 1
            exp_continue
        }
+       -re "(Thread|LWP) \[^\r\n\]+ exited" {
+           # Avoid timeout with check-read1
+           exp_continue
+       }
+       -re "New (Thread|LWP) \[^\r\n\]+" {
+           # Avoid timeout with check-read1
+           exp_continue
+       }
        -re "Inferior 1 \(\[^\r\n\]+\) exited normally" {
            pass $test
        }
@@ -101,12 +109,10 @@ proc do_test { detach_on_fork } {
        "no threads left"
 
     gdb_test "info inferiors" \
-       "Num\[ \t\]+Description\[ \t\]+Executable\[ \t\]+\r\n\\* 1 \[^\r\n\]+" \
+       "Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+\r\n\\* 1 \[^\r\n\]+" \
        "only inferior 1 left"
 }
 
-foreach detach_on_fork {"on" "off"} {
-    with_test_prefix "detach-on-fork=$detach_on_fork" {
-       do_test $detach_on_fork
-    }
+foreach_with_prefix detach-on-fork {"on" "off"} {
+    do_test ${detach-on-fork}
 }
This page took 0.025974 seconds and 4 git commands to generate.