From patchwork Thu Feb 1 13:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 85130 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 B788F385772D for ; Thu, 1 Feb 2024 13:04:58 +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.133.124]) by sourceware.org (Postfix) with ESMTPS id DBA893858033 for ; Thu, 1 Feb 2024 13:04:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBA893858033 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 DBA893858033 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706792658; cv=none; b=DTWn6bgqMcpej00+4Cfn1i6m4zPTAOS3xdRHfZPuRhoSSVSI+rBDZRVhpbciGUyqS7JKIdSRPaj9pve/jmp8e3doCzTxeF1brcPmMQVsteW2rZ1+9GdMIsh1Aown4mPFrXTRDJz3q+wVFfZn4SCuNv1uBDAqSJa9dmZ6swy4sQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706792658; c=relaxed/simple; bh=cLIieJCG5S+2XUQUnLGsjB1K7JULiHtjzt7orBIRm7g=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=t2aPQmuRFy0dVHHfPltsx4M42VEoVIvOaoGMzaGhKdvovKY3CFMgf5L4Bt8SSsZ8j7bpQLdGKrT66JH6C9dq+FGhW6WU1tDfUUvOiTm9gspfv6YvoS6Kqbq8umTDv78+ydD1Z28/82PYrcJ9q1fLvZe3VIYENS+Cdd9EeV0rH9I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706792656; 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=7cq2U0lrystrmsvRca5MoZxw84b7/LAJM+0RACBs8XA=; b=eAQT5Y1cSKjZZiPKG3wXTSy758EtGKHCmyKHuAQW6BJpywZAor/ys/2/J95KZZtZRJsdzO kbB6pkVXGNgcEgZ5n2Jkqa11zPWfUQYNjlVe3ppcCzGIrninTUdjSDe9+sp9f+tlTyXt7k crwP8u84PDKjaJWUa08SVubXTfNE2kc= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-474-HsNtPLe-M9yNVgbqxINZ8A-1; Thu, 01 Feb 2024 08:04:15 -0500 X-MC-Unique: HsNtPLe-M9yNVgbqxINZ8A-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2d07b30ba0cso4873571fa.0 for ; Thu, 01 Feb 2024 05:04:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706792653; x=1707397453; 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=7cq2U0lrystrmsvRca5MoZxw84b7/LAJM+0RACBs8XA=; b=sFs+mPy5DGs1BXK5vW+8ESpkZ6p69aQEQp+UjIovoPmHI0G9L2u02ugPtxzG12sGkm tmZc0uRkVH1JwkzIl2B6ApUU0vbWnfj4DhK+DGCIoq1OX9uvPWWxeklPe58qLjMpcNzd zUXTcURxgcknEvCLFBtWGOA5zbqAD6M6d4e6Bx3Z9wN4n4yXg/YJS2gUwiG9kTA2M3Sy k/VXabo37YT2hKncXddjDST5NvJrD8J1veGDG+Q/R1P5puz2nWD3cPphDSkfASTjphTd Xo0zB6dMXuZPy9+ZuLnrnU+va9OdvXhG258H4fycjpaZAypl2T/U1iCd6CkwJDInnCm8 p/fg== X-Gm-Message-State: AOJu0YyTvMR1AnxFNWZURezJHctFjC7G6sReBxNIdWk89hdJzF0nt0Gx 0d3IVd/+DCyVFwAUJpI9X02sHTg7Mtr78md+HgWjuDxHkN+IEXSv9GN+yiO3J5Vmo947C7O0Bto JWVOS/X7V4jKW57gAoNdCAP7yoDRvNO2852pCnCdGQsRIt4I+8/AatX6G8Vl6pyqngO5EDSPAL9 NMNYgpd/xeaT+5NMKHlzSnSlliLQob+q1WfLT6IIW13Ko= X-Received: by 2002:a2e:7812:0:b0:2d0:7d59:8cd8 with SMTP id t18-20020a2e7812000000b002d07d598cd8mr583719ljc.26.1706792653201; Thu, 01 Feb 2024 05:04:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJVi/YTLvFsZyhdiNcQaiuexkAqAPdX4VJmzsSvoDxyY7c+m/56Zr4BrXj4g6FbfvCod3ZTg== X-Received: by 2002:a2e:7812:0:b0:2d0:7d59:8cd8 with SMTP id t18-20020a2e7812000000b002d07d598cd8mr583701ljc.26.1706792652700; Thu, 01 Feb 2024 05:04:12 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id az28-20020adfe19c000000b0033afcf8925asm6590975wrb.24.2024.02.01.05.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 05:04:12 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/2] gdb/testsuite: fix some more duplicate test names in gdb.trace/ Date: Thu, 1 Feb 2024 13:04:05 +0000 Message-Id: <823ce91e119bd57b3b1320e2aef39abba9991678.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_H5, RCVD_IN_MSPIKE_WL, 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 commit fixes some duplicate test names in the gdb.trace/ directory when run with the native-gdbserver and native-extended-gdbserver boards. In this case the duplicates relate to the calls to gdb_compile_pthreads which emits a fixed PASS message, as there are two calls to gdb_compile_pthreads we get a duplicate PASS message. In both cases the problem is fixed by adding a with_test_prefix around one of the compilations, however, I've made additional changes to clean up the tests a little while I was working on them: 1. Switch to use prepare_for_testing instead of gdb_compile_pthreads. By passing the 'pthreads' option this does call gdb_compile_pthreads under the hood, but using the standard compile function is cleaner, 2. Using prepare_for_testing removes the need to call clean_restart immediately afterwards, so those calls are removed, 3. I removed the unneeded $executable and $expfile globals, where the $executable global was used I've replaced this with $binfile, 4. When we compile two executables I've now given these different names so that both exist at the end of the test run, 5. Removed a gdb_reinitialize_dir call, this is covered by clean_restart, 6. Use gdb_test_no_output where it makes sense. I now see no duplicate test names when running these test scripts. There should be no change in what is being tested after this commit. --- gdb/testsuite/gdb.trace/ftrace-lock.exp | 45 ++++++++++---------- gdb/testsuite/gdb.trace/trace-mt.exp | 56 +++++++++++-------------- 2 files changed, 46 insertions(+), 55 deletions(-) diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp index eb0d0f02933..ce2b890229a 100644 --- a/gdb/testsuite/gdb.trace/ftrace-lock.exp +++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp @@ -16,9 +16,10 @@ load_lib "trace-support.exp" require allow_shlib_tests +# Check that the target supports trace. +require gdb_trace_common_supports_arch + standard_testfile -set executable $testfile -set expfile $testfile.exp # make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2' if ![info exists NUM_THREADS] { @@ -27,25 +28,23 @@ if ![info exists NUM_THREADS] { # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -set options [list debug [gdb_target_symbol_prefix_flags] \ +set options [list debug pthreads [gdb_target_symbol_prefix_flags] \ additional_flags=-DNUM_THREADS=$NUM_THREADS] -# Check that the target supports trace. -require gdb_trace_common_supports_arch -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - untested "failed to compile" - return -1 -} - -clean_restart ${testfile} +with_test_prefix "runtime trace support check" { + if { [prepare_for_testing "prepare for testing" ${binfile}-check \ + $srcfile $options] } { + return + } -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } -if ![gdb_target_supports_trace] { - unsupported "target does not support trace" - return -1 + if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 + } } # Compile the test case with the in-process agent library. @@ -54,13 +53,11 @@ set remote_libipa [gdb_load_shlib $libipa] lappend options shlib=$libipa -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - untested "failed to compile with in-process agent library" - return -1 +if { [prepare_for_testing "prepare for testing with libipa" \ + $binfile $srcfile $options] } { + return } -clean_restart ${executable} - if ![runto_main] { return -1 } @@ -76,7 +73,7 @@ gdb_breakpoint "fail" qualified gdb_test "ftrace set_point" "Fast tracepoint .*" \ "fast tracepoint at a long insn" -gdb_test "tstart" "" +gdb_test_no_output "tstart" # If NUM_THREADS is high then this test case may timeout. Increase the # timeout temporarily. @@ -86,4 +83,4 @@ with_timeout_factor $NUM_THREADS { "do not hit the fail function" } -gdb_test "tstop" "" +gdb_test_no_output "tstop" diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp index bfa66dd88ee..e56064bbe8b 100644 --- a/gdb/testsuite/gdb.trace/trace-mt.exp +++ b/gdb/testsuite/gdb.trace/trace-mt.exp @@ -15,39 +15,36 @@ load_lib "trace-support.exp" standard_testfile -set executable $testfile -set expfile $testfile.exp # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] require gdb_trace_common_supports_arch -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags] ] != "" } { - # gdb_compile_pthreads provides an appropriate unsupported message. - return -1 -} - -clean_restart ${testfile} +with_test_prefix "runtime trace support check" { + if { [prepare_for_testing "prepare for testing" ${binfile} $srcfile \ + [list debug pthreads $additional_flags]] } { + return + } -if ![runto_main] { - return -1 -} + if ![runto_main] { + return -1 + } -if ![gdb_target_supports_trace] { - unsupported "target does not support trace" - return -1 + if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 + } } -proc step_over_tracepoint { trace_type } \ +proc step_over_tracepoint { binfile trace_type } \ {with_test_prefix "step over $trace_type" \ { - global executable global hex # Start with a fresh gdb. - clean_restart ${executable} + clean_restart $binfile + # Make sure inferior is running in all-stop mode. gdb_test_no_output "set non-stop 0" if ![runto_main] { @@ -66,14 +63,13 @@ proc step_over_tracepoint { trace_type } \ # Set breakpoint and tracepoint at the same address. -proc break_trace_same_addr { trace_type option } \ +proc break_trace_same_addr { binfile trace_type option } \ {with_test_prefix "$trace_type $option" \ { - global executable global hex # Start with a fresh gdb. - clean_restart ${executable} + clean_restart $binfile if ![runto_main] { return -1 } @@ -100,10 +96,10 @@ proc break_trace_same_addr { trace_type option } \ }} foreach break_always_inserted { "on" "off" } { - break_trace_same_addr "trace" ${break_always_inserted} + break_trace_same_addr $binfile "trace" ${break_always_inserted} } -step_over_tracepoint "trace" +step_over_tracepoint $binfile "trace" require allow_shlib_tests @@ -111,24 +107,22 @@ set libipa [get_in_proc_agent] set remote_libipa [gdb_load_shlib $libipa] # Compile test case again with IPA. -if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ - executable [list debug $additional_flags shlib=$libipa] ] != "" } { - untested "failed to compile with in-process agent library" - return -1 +set binfile_ipa ${binfile}-ipa +if { [prepare_for_testing "prepare for testing" $binfile_ipa $srcfile \ + [list debug pthreads $additional_flags shlib=$libipa]] } { + return } -clean_restart ${executable} if ![runto_main] { return 0 } -gdb_reinitialize_dir $srcdir/$subdir if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } { untested "could not find IPA lib loaded" } else { foreach break_always_inserted { "on" "off" } { - break_trace_same_addr "ftrace" ${break_always_inserted} + break_trace_same_addr $binfile_ipa "ftrace" ${break_always_inserted} } - step_over_tracepoint "ftrace" + step_over_tracepoint $binfile_ipa "ftrace" } 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" \