From patchwork Sat Dec 2 10:31:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 81181 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 238E03861811 for ; Sat, 2 Dec 2023 10:31:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8DDE8385840D for ; Sat, 2 Dec 2023 10:31:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8DDE8385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8DDE8385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701513075; cv=none; b=rk6xy9i8subtxpU5kkm4Zc0BeIGHYYzmRUGtwToEa9Nt8FhXXHYfifu48sWj7jFpRGfDj9Oizov5i7el62NTLYglh1P4okUGKYj2ja1jJubAzbCoCUTj2jHl2BXvZzsUGJ1hrRhZ1aEI+RYe0XmJXuyI6+Iaodi9X/nnA7HQ8+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701513075; c=relaxed/simple; bh=gbXP2LuVtIy0nnN0HBC3nGmO+K61YsbJXnrohDzSskE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Ufr7MJC+5TnP/UxiMNOzkEWhJAj8vjY8soZXAl2eAt8c+PdoH+5Ik7bV2ia1ehHLBFKy/svL/XNCp9o05NGqe1C8ZWaQO4Fu2J2I2A6BYXdLWARg6go/2sxi2Ubyr1nwL/krgW3eV3wDrp8zAccHF/RceZuqd0peDu7do0iL+84= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701513073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NMFosh4Z7ttUVRM7WqydWf12DMAhZVMwqsZXakFkU/I=; b=QJnW2MuywHholiVGkGZ4C7OrlIcIbfgPkZdKDhT+HuAU3r0zVpXeNg6hPBWFwfPdFnxmtg cZ/9sbn5WQK6ZDY57OGE6pD+gXx1cIh8gcHq4Q4h1o4Jgabcq5tRabqa20KMzdpAgeSQvE /TTltqvetQtfMbJyOsI6VEoNs1YLBaE= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-417-NfS1gfVkNJe9UFkdCtX06Q-1; Sat, 02 Dec 2023 05:31:11 -0500 X-MC-Unique: NfS1gfVkNJe9UFkdCtX06Q-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a1a4c416d49so159422566b.1 for ; Sat, 02 Dec 2023 02:31:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701513070; x=1702117870; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NMFosh4Z7ttUVRM7WqydWf12DMAhZVMwqsZXakFkU/I=; b=HCbzyxMhkF1EhGs9gIsnixqzwNGN1k9+r4j+ZHhelMyRRjCDH+NPXw28NOsNmsc6J/ 5/8VT/AhGz2iPotQHkBp5sdtmb0OkObh43aD1qIh7Jn4QHiS2VlomO+WbBxHvSJY8BNT 1o5NUDoBXotymwSWzb3wSYCcJjL1sXcg9fDqcSvE7592xC5WBtDU3lTkVyVH4Hee2k0a 8GFr7K+4Ewpusy3vs6U1NZBq9zYaiHrkmo7XdPWyq4T9khO1oIy3hPSI1JduWDfXtnWe H6CwyObL/2aJVcpXDcD7TTgeN1KERdbh+h0jZvah8IxvHP37vv06Z2zgNrWw/VbYPQ7g +1Zg== X-Gm-Message-State: AOJu0YxJotXI4eqdQJDiIm76TTJ/N4WvB1ZMzn0fyQJrXxIwSfqjt86L zDdBcdaNEt8S4mTli51j1StImVhPleEYjELCuRpk+utPS+t24H3ZgvaFkzf04zoXWX35l0ntG0K Ah2pf0l9ZVvRxuPgl1aCcvdDujfwxiZ0L7Z7gwj0rUca+WnMhxXqnKRUyWSFmiuj9J+7HsusAqK 3zRjx+mQ== X-Received: by 2002:a17:906:5193:b0:a1a:5cbf:4b5c with SMTP id y19-20020a170906519300b00a1a5cbf4b5cmr905514ejk.15.1701513070682; Sat, 02 Dec 2023 02:31:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4D9jBnfV7KOcsuJHChUr4Q1gN0RCVrhks1G2K2zZq8x9sv99OyEaYGQNEAB03xKajyvBUcA== X-Received: by 2002:a17:906:5193:b0:a1a:5cbf:4b5c with SMTP id y19-20020a170906519300b00a1a5cbf4b5cmr905508ejk.15.1701513070282; Sat, 02 Dec 2023 02:31:10 -0800 (PST) Received: from localhost (92.40.184.5.threembb.co.uk. [92.40.184.5]) by smtp.gmail.com with ESMTPSA id cy4-20020a0564021c8400b0054c838b8e37sm459162edb.40.2023.12.02.02.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 02:31:09 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/testsuite: another attempt to fix gdb.threads/thread-specific-bp.exp Date: Sat, 2 Dec 2023 10:31:04 +0000 Message-Id: <1576cabe99ace298caa833800f40781be8404682.1701513033.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HEXHASH_WORD, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org The gdb.threads/thread-specific-bp.exp test has been a little problematic, see commits: commit 89702edd933a5595557bcd9cc4a0dcc3262226d4 Date: Thu Mar 9 12:31:26 2023 +0100 [gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp on native-gdbserver and commit 2e5843d87c4050bf1109921481fb29e1c470827f Date: Fri Nov 19 14:33:39 2021 +0100 [gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp But I recently saw a test failure for that test, which looked like this: ... (gdb) PASS: gdb.threads/thread-specific-bp.exp: non_stop=on: thread 1 selected continue -a Continuing. Thread 1 "thread-specific" hit Breakpoint 4, end () at /tmp/binutils-gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.threads/thread-specific-bp.c:29 29 } (gdb) [Thread 0x7ffff7c5c700 (LWP 1552086) exited] Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list. FAIL: gdb.threads/thread-specific-bp.exp: non_stop=on: continue to end (timeout) ... This only crops up (for me) when running on a loaded machine, and still only occurs sometimes. I've had to leave the test running in a loop for 10+ minutes sometimes in order to see the failure. The problem is that we use gdb_test_multiple to try and match two patterns: (1) The 'Thread-specific breakpoint 3 deleted ....' message, and (2) The GDB prompt. As written in the test, we understand that these patterns can occur in any order, and we have a flag for each pattern. Once both patterns have been seen then we PASS the test. The problem is that once expect has matched a pattern, everything up to, and including the matched text is discarded from the input buffer. Thus, if the input buffer contains: Then expect will first try to match , which succeeds, and then expect discards the entire input buffer up to the end of the . As a result, we will never spot . Obviously we can't just reorder the patterns within the gdb_test_multiple, as the output can legitimately (and most often does) occur in the other order, in which case the test would mostly fail, and only occasionally pass! I think the easiest solution here is just to have the gdb_test_multiple contain two patterns, each pattern consists of the two parts, but in the alternative orders, thus, for a particular output configuration, only one regexp will match. With this change in place, I no longer see the intermittent failure. --- .../gdb.threads/thread-specific-bp.exp | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) base-commit: a393b155174d20d3d120b5012b87c5438ab9e3d4 diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp index 8929f194844..1f3b9441202 100644 --- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp +++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp @@ -87,31 +87,19 @@ proc check_thread_specific_breakpoint {non_stop} { } else { set cmd "continue" } - set test "continue to end" - set thread_exited 0 - set prompt 0 set msg_re \ [join \ [list \ "Thread-specific breakpoint 3 deleted" \ "-" \ "thread 2 no longer in the thread list\\."]] - gdb_test_multiple "$cmd" $test -lbl { - -re "(^|\r\n)${msg_re}(?=\r\n)" { - if { $prompt } { - pass $gdb_test_name - } else { - set thread_exited 1 - exp_continue - } + + gdb_test_multiple "$cmd" "continue to end" { + -re "$\r\n${gdb_prompt} .*${msg_re}\r\n" { + pass $gdb_test_name } - -re "\r\n$gdb_prompt " { - if { $thread_exited } { - pass $gdb_test_name - } else { - set prompt 1 - exp_continue - } + -re "\r\n${msg_re}\r\n.*$gdb_prompt " { + pass $gdb_test_name } }