File gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch of Package gdb

[gdb/testsuite] Add KFAIL in gdb.threads/fork-plus-threads.exp

When running test-case gdb.threads/fork-and-threads.exp on a VM with openSUSE
Tumbleweed, with the VM bound to 1 cpu with 75% execution cap, I get:
...
(gdb) info inferiors^M
  Num  Description       Connection           Executable        ^M
* 1    <null>                                 fork-plus-threads ^M
  11   <null>                                 fork-plus-threads ^M
(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
  only inferior 1 left
...

The test checks that all removable inferiors are indeed removed from the
inferior list after exit, and evidently this didn't happen for inferior 11
(which is added by fork rather than a user command, and therefore removable).

I've investigated why that is that case, and it's because its refcount didn't
drop to 0.

This seems like a bug to me, so add a KFAIL for this.

Tested on x86_64-linux.

---
 gdb/testsuite/gdb.threads/fork-plus-threads.exp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
index c8e179938c6..5b2b0909a65 100644
--- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
@@ -119,9 +119,21 @@ proc do_test { detach-on-fork } {
     gdb_test "info threads" "No threads\." \
 	"no threads left"
 
-    gdb_test "info inferiors" \
-	"Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+\r\n\\* 1 \[^\r\n\]+" \
-	"only inferior 1 left"
+    set re \
+	[multi_line \
+	     "Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+" \
+	     "\\* 1 \[^\r\n\]+"]
+    gdb_test_multiple "info inferiors" "only inferior 1 left" {
+	-re -wrap $re {
+	    pass $gdb_test_name
+	}
+	-re -wrap $re.* {
+	    if { ${detach-on-fork} == "off" } {
+		setup_kfail "threads/26272" *-*-*
+	    }
+	    fail $gdb_test_name
+	}
+    }
 }
 
 foreach_with_prefix detach-on-fork {"on" "off"} {
openSUSE Build Service is sponsored by