[PATCH] kill all threadapply processes at end of test

Carl Love via Gdb-patches
2021-05-12T16:37:04Z

GDB maintainers:

The threadapply test performs a number of tests to detatch and attach
threads. When the test is all done, some detatched threads are left
running. The following patch adds code to the end of the patch to kill
the processes that are still running.

Please let me know if this patch is acceptable. Thanks.

Carl Love

--------------------------------------

gdb/testsuite/ChangeLog:

2021-05-12 Carl Love <cel@us.ibm.com>

* gdb.threads/threadapply.exp: Add foreach loop to kill all remaining
threadapply processes.
---
gdb/testsuite/gdb.threads/threadapply.exp | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp
index ebc1cf15ad6..b3457121e76 100644
--- a/gdb/testsuite/gdb.threads/threadapply.exp
+++ b/gdb/testsuite/gdb.threads/threadapply.exp
@@ -229,3 +229,11 @@ proc kill_and_remove_inferior {thread_set} {
foreach_with_prefix thread_set {"all" "1.1"} {
kill_and_remove_inferior $thread_set
}
+
+# Make sure all of the threadapply processes are terminated
+set data [exec ps -e | grep threadapply]
+
+foreach line [split $data \n] {
+ scan $line {%d %s} threadid junk
+ exec kill -9 $threadid
+}
--
2.27.0