public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/1] Skip attach-many-short-lived-threads.exp on known-broken DejaGnu versions
Date: Wed, 25 May 2016 14:07:00 -0000	[thread overview]
Message-ID: <1464185260-9133-2-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1464185260-9133-1-git-send-email-palves@redhat.com>

If the testsuite is run with a DejaGnu version that predates the fix
from last year:

  [PATCH] DejaGnu kills the wrong process due to PID-reuse races
  http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00005.html

... gdb.threads/attach-many-short-lived-threads.exp fails randomly,
often.  Other tests randomly fail due to that issue too, but this one
is _much_ more exposed.

DejaGnu 1.6 was released meanwhile, which includes that DejaGnu fix,
and also some distros backported the fix too.

So skip the test when run with older/broken DejaGnus.

gdb/testsuite/ChangeLog:
2016-05-25  Pedro Alves  <palves@redhat.com>

	* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
	New procedure.
	(top level): Call it, and bail out of DejaGnu is known to be bad.
---
 .../attach-many-short-lived-threads.exp            | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index ccb5e9b..eba5136 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -21,6 +21,40 @@
 # end up leaving stale state behind that confuse the following
 # attach).
 
+# Return true if the running version of DejaGnu is known to not be
+# able to run this test.
+proc bad_dejagnu {} {
+    global frame_version
+
+    verbose -log "DejaGnu version: $frame_version"
+    verbose -log "Expect version: [exp_version]"
+    verbose -log "Tcl version: [info tclversion]"
+
+    set dj_ver [split $frame_version .]
+    set dj_ver_major [lindex $dj_ver 0]
+    set dj_ver_minor [lindex $dj_ver 1]
+
+    # DejaGnu versions prior to 1.6 manage to kill the wrong process
+    # due to PID-reuse races.  Since this test spawns many threads, it
+    # wides the race window a whole lot, enough the inferior is often
+    # killed, and thus the test randomly fails.  See:
+    # http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00005.html
+    # The fix added a close_wait_program procedure.  If that procedure
+    # is defined, and DejaGnu is older than 1.6, assume that means the
+    # fix was backported.
+    if {$dj_ver_major == 1
+	&& ($dj_ver_minor < 6 && [info procs close_wait_program] == "")} {
+	return 1
+    }
+
+    return 0
+}
+
+if {[bad_dejagnu]} {
+    unsupported "broken DejaGnu"
+    return 0
+}
+
 if {![can_spawn_for_attach]} {
     return 0
 }
-- 
2.5.5

  reply	other threads:[~2016-05-25 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 14:07 [PATCH 0/1] " Pedro Alves
2016-05-25 14:07 ` Pedro Alves [this message]
2016-05-27 15:21 ` Pedro Alves

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=1464185260-9133-2-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --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).