From patchwork Thu Feb 1 13:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 85131 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 CAC4B3857B94 for ; Thu, 1 Feb 2024 13:05:04 +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 822883858009 for ; Thu, 1 Feb 2024 13:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 822883858009 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 822883858009 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=1706792660; cv=none; b=B5YigyisVlQNGpNbtwSM6vg0OhurIOHE7GST1IP9zeHYhDwuxeco1px7Re0CH/sAVjRfeIw+/nZajD63o71HBpRAwnYcoFzcaPnGq2JMAmHzaeXIAWRyMKg3Q/dgPuNxKSbMt0KizLx6r6NkJwy7EEp1TDkaN8QW/nPuCPUq3mM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706792660; c=relaxed/simple; bh=Gebh0lb4dXfKEy0AjJbpGZ5Bx3nvIgVYgUsTdpk9NXI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=VYrppkJ+cBQWNMNlTeEgVOqZ5MZWz9lMLfYyZuLeHzEbzN4oIX5juNDUgoYmhzNGrcc/R0YrBOOkteO/fmH9aaCk3vpHX6Yy1B0EObOSWNvPnu5wPuoMaMoGvfL/Ks8UDjOxgyMfBDZoLrV8F1NXfiPKsvzAESAYZgfhT+NRrjE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706792658; 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: in-reply-to:in-reply-to:references:references; bh=pvcfnWAv8I7EinMdWejkrYzmGyGHsv7Rnr9asLjwDk0=; b=Jt+5C71FQZF6SXHi8LZNTh2ZhBlQTKcvcrXj/ey3P8nBwVJ+7q4AX6jXTx0h2MN4Kiig17 x32bwQXHBgnwgiQIc+YNkqNh7QcCDD8gkPhAhexLGXKwbEx9y+bIPlr2mpPCEDRCEZU5f4 w3K0bpdDKCXmims+eK0kFZ6Pegfg5L8= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-Tfud41aZNeWUmLuLsCWx8A-1; Thu, 01 Feb 2024 08:04:17 -0500 X-MC-Unique: Tfud41aZNeWUmLuLsCWx8A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-51117158dd8so737022e87.3 for ; Thu, 01 Feb 2024 05:04:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706792655; x=1707397455; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pvcfnWAv8I7EinMdWejkrYzmGyGHsv7Rnr9asLjwDk0=; b=BcUP6esSTY32qqVQtcG6GFmc2+bRr+SaVFFobxRNyZSKYGe6n5DYeHm7YSBOn55WLK JqYgwrZ2NUcTGoGWDjap4oDMZaVHfBRzbgxSEyxKf117ZhLzZkgoILAdEHaGczeH8NpN 7QzqPWHjSQ6nPj1JeKdDyAM8X4bZHZBQ5/P/+zIBnbocRUy0R4QYGLLE+HR1XmYs00ej BmLapb4Fs2U766QsXg95zvOsvkq5VANVxSIpTcPOXAEUnswq0YUa+C5HsqQxjDKf6kpv wx85hUJ1A5eab/nSZhflK4ER1UY+KE+gELKkkLZWZPfUTxc45v9eUMNfxX40bqdJwx4b rx2A== X-Gm-Message-State: AOJu0YzXUHDO8WGL2dL/rtUewc2dyOusuDtWxHqxjNNA6wAbsXnOykFw Lv+LdoZW2VapQ9yJDoitk0dS+kZn+GOK8SXALvAKOFKn+Mj0e/7kRpOIOaE3g6HJW/gIZtq8pNn bpHuzicBDf4poQeIKD0cYGcKtSXK4nOnhCQXBsYR/tkeoHU0F4ZfGn6UIR24B3cxg/X3IO/Jy83 YEna57f3L72KvnybmzruPHfuZZIcK39G0ashLIvyLrxv0= X-Received: by 2002:ac2:41c8:0:b0:510:40a:4cb2 with SMTP id d8-20020ac241c8000000b00510040a4cb2mr1557495lfi.38.1706792654841; Thu, 01 Feb 2024 05:04:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPTq5LF2FHzTT0EeVZnc/7xqn/rvgHq9nNth8ikdDpY+OKcCTxzZ7VEMCWJyfL9s3F81d9Dw== X-Received: by 2002:ac2:41c8:0:b0:510:40a:4cb2 with SMTP id d8-20020ac241c8000000b00510040a4cb2mr1557484lfi.38.1706792654552; Thu, 01 Feb 2024 05:04:14 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id l18-20020a05600c1d1200b0040e89ade84bsm4464495wms.4.2024.02.01.05.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 05:04:13 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/2] gdb/testsuite: fix duplicate test names in gdb.trace/circ.exp Date: Thu, 1 Feb 2024 13:04:06 +0000 Message-Id: <3a05c395ca3cc92ff4388539623b9d58eb0dfc3f.1706792515.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 This fixes some duplicate test names in gdb.trace/circ.exp when using native-gdbserver and native-extended-gdbserver boards. In this test we set the trace buffer size twice. The same test name was used each time the size was adjusted. I've fixed this issue by: 1. Creating a new proc, set_trace_buffer_size, which factors out the code to change the buffer size, and uses test names based on the size we're setting the buffer too, 2. Calling the new proc each time we want to adjust the buffer size. After this the duplicate test names are resolved. There should be no change in what is tested after this commit. --- gdb/testsuite/gdb.trace/circ.exp | 76 +++++++++++++++++++------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp index 66bb64852fd..d123a1e7686 100644 --- a/gdb/testsuite/gdb.trace/circ.exp +++ b/gdb/testsuite/gdb.trace/circ.exp @@ -115,45 +115,59 @@ gdb_test "show circular-trace-buffer" \ "Target's use of circular trace buffer is on." \ "show circular-trace-buffer (on)" -# Check if changing the trace buffer size is supported. This step is -# repeated twice. This helps in case the trace buffer size is 100. -set test_size 100 -set test "change buffer size to $test_size" -gdb_test_multiple "set trace-buffer-size $test_size" $test { - -re ".*Target does not support this command.*$gdb_prompt $" { - unsupported "target does not support changing trace buffer size" - return 1 +# Use 'set trace-buffer-size' to change the trace buffer size to +# REQUIRED_SIZE. Return -1 if the current target doesn't support +# adjusting the trace buffer size. Return 0 if the adjustment failed +# for some other reason. Return 1 if the trace buffer size was +# correctly adjusted. +# +# If this proc returns -1 then a suitable call to the unsupported proc +# will have already been made. +proc set_trace_buffer_size { required_size } { + set test_passed false + gdb_test_multiple "set trace-buffer-size $required_size" "" { + -re -wrap ".*Target does not support this command.*" { + unsupported "target does not support changing trace buffer size" + return -1 + } + -re -wrap "" { + pass $gdb_test_name + set test_passed true + } } - -re "$gdb_prompt $" { - pass $test + + if { !$test_passed } { + return 0 } -} -set test "check whether setting trace buffer size is supported" -gdb_test_multiple "tstatus" $test { - -re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gdb_prompt $" { - set total_size $expect_out(2,string) - if { $test_size != $total_size } { - unsupported "target does not support changing trace buffer size" - return 1 + set test_passed false + gdb_test_multiple "tstatus" "check trace-buffer-size is $required_size" { + -re -wrap ".*Trace buffer has ($::decimal) bytes of ($::decimal) bytes free.*" { + set total_size $expect_out(2,string) + if { $required_size != $total_size } { + unsupported "target does not support changing trace buffer size" + return -1 + } + pass $gdb_test_name + set test_passed true } - pass $test } + + if { !$test_passed } { + return 0 + } + + return 1 } -set test_size 400 -gdb_test_no_output "set trace-buffer-size $test_size" \ - "change buffer size to $test_size" +# Check if changing the trace buffer size is supported. This step is +# repeated twice. This helps in case the trace buffer size is 100. +if {[set_trace_buffer_size 100] < 0} { + return +} -gdb_test_multiple "tstatus" $test { - -re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gdb_prompt $" { - set total_size $expect_out(2,string) - if { $test_size != $total_size } { - unsupported "target does not support changing trace buffer size" - return 1 - } - pass $test - } +if {[set_trace_buffer_size 400] < 0} { + return } gdb_test_no_output "set circular-trace-buffer off" \