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" }