public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/5] Adjust gdb.thread/pthreads.exp for Cygwin
Date: Wed, 20 Sep 2023 18:59:59 +0100	[thread overview]
Message-ID: <20230920175959.2305271-6-pedro@palves.net> (raw)
In-Reply-To: <20230920175959.2305271-1-pedro@palves.net>

The Cygwin runtime spawns a few extra threads, so using hardcoded
thread numbers in tests rarely works correctly.  Thankfully, this
testcase already records the ids of the important threads in globals.
It just so happens that they are not used in a few tests.  This commit
fixes that.

With this, the test passes cleanly on Cygwin.  Still passes cleanly on
x86-64 GNU/Linux.

Change-Id: I01bf71fcb44ceddea8bd16b933b10b964749a6af
---
 gdb/testsuite/gdb.threads/pthreads.exp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index 41a7cb3800f..122172a052b 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -274,21 +274,21 @@ proc check_qcs {} {
     set number "\[0-9]\+"
 
     # Check -c (continue) and -s (silently continue) flags.
-    gdb_test "thread apply 2-3 p notfound" \
+    gdb_test "thread apply $::thread1_id $::thread2_id p notfound" \
 	[multi_line \
 	     "" \
-	     "Thread 2 ${any}" \
+	     "Thread $::thread1_id ${any}" \
 	     "No symbol \\\"notfound\\\" in current context." \
 	    ] \
 	"run a failing command that aborts thread apply"
 
-    gdb_test "thread apply 2-3 -c p notfound" \
+    gdb_test "thread apply $::thread1_id $::thread2_id -c p notfound" \
 	[multi_line \
 	     "" \
-	     "Thread 2 ${any}" \
+	     "Thread $::thread1_id ${any}" \
 	     "No symbol \\\"notfound\\\" in current context." \
 	     "" \
-	     "Thread 3 ${any}" \
+	     "Thread $::thread2_id ${any}" \
 	     "No symbol \\\"notfound\\\" in current context." \
 	    ] \
 	"run a failing command, -c to continue"
@@ -302,11 +302,11 @@ proc check_qcs {} {
 		gdb_test $cmd \
 		    [multi_line \
 			 "" \
-			 "Thread 3 ${any}" \
+			 "Thread $::thread2_id ${any}" \
 			 "#${number}${ws}${any} in thread2 ${any}" \
 			 "\\\$\[0-9]+ = ${number}${any}" \
 			 "" \
-			 "Thread 2 ${any}" \
+			 "Thread $::thread1_id ${any}" \
 			 "#${number}${ws}${any} in thread1 ${any}" \
 			 "\\\$\[0-9]+ = ${number}${any}" \
 			] \
-- 
2.34.1


  parent reply	other threads:[~2023-09-20 18:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 17:59 [PATCH 0/5] Adjust/fix " Pedro Alves
2023-09-20 17:59 ` [PATCH 1/5] gdb.threads/pthreads.c, K&R -> ANSI function style Pedro Alves
2023-09-20 17:59 ` [PATCH 2/5] Fix gdb.threads/pthreads.c formatting Pedro Alves
2023-09-20 17:59 ` [PATCH 3/5] Fix gdb.threads/pthreads.exp error handling/printing Pedro Alves
2023-09-20 17:59 ` [PATCH 4/5] In gdb.threads/pthreads.c, handle pthread_attr_setscope ENOTSUP Pedro Alves
2023-09-20 17:59 ` Pedro Alves [this message]
2023-09-21 19:21 ` [PATCH 0/5] Adjust/fix gdb.thread/pthreads.exp for Cygwin Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230920175959.2305271-6-pedro@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).