From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E68643858017 for ; Fri, 4 Aug 2023 13:06:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E68643858017 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A981A1F8B2; Fri, 4 Aug 2023 13:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691154400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDvCI7KPrAPaL5HrDpFrzX+XI2B5T/K+r4tec4YA208=; b=MaRyyoM81wm4NJwbPgyv4qfn/NwF0ZgZ9eAX2cL/A9cGTi5HQcz4pGuQR8oGpdgg0lRHLf 8Hbvkf2gW4nxejHbJ3qHb7hW12MRjs9gvPi9AjwCw5cLzDIVGLD8HKdbJshIXrmIAHgEx7 VRQTBD6gA0PuZGU7IKIlC8y1HitD/ig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691154400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDvCI7KPrAPaL5HrDpFrzX+XI2B5T/K+r4tec4YA208=; b=kdQIsxrowPZp+rftEwtpJbZPITbWkwrY1VdPIIraE/Yo20zGZU1vhKLKpJ1QP2cEKnMQGR 7O29gJohWgauSbCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 92177139C4; Fri, 4 Aug 2023 13:06:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +PyIIuD3zGT+CgAAMHmgww (envelope-from ); Fri, 04 Aug 2023 13:06:40 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed 3/4] [gdb/testsuite] Move "maint wait-for-index-cache" ALAP in gdb.base/index-cache.exp Date: Fri, 4 Aug 2023 15:06:20 +0200 Message-Id: <20230804130621.15883-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230804130621.15883-1-tdevries@suse.de> References: <20230804130621.15883-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: In test-case gdb.base/index-cache.exp proc run_test_with_flags contains: ... clean_restart ${testfile} # The tests generally want to check the cache, so make sure it # has completed its work. gdb_test_no_output "maintenance wait-for-index-cache" ... This however hides data races between: - index-cache writing (due to file $exec), and - symbol lookups (due to subsequent ptype commands). Fix this by: - moving the "maintenance wait-for-index-cache" to proc check_cache_stats, and - moving all calls to proc check_cache_stats ALAP. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/index-cache.exp | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp index c26c4f94e65..1379a040445 100644 --- a/gdb/testsuite/gdb.base/index-cache.exp +++ b/gdb/testsuite/gdb.base/index-cache.exp @@ -65,6 +65,10 @@ proc ls_host { dir } { # values. proc check_cache_stats { expected_hits expected_misses } { + # This test wants to check the cache, so make sure it has completed + # its work. + gdb_test_no_output "maintenance wait-for-index-cache" + set re [multi_line \ " Cache hits .this session.: $expected_hits" \ "Cache misses .this session.: $expected_misses" \ @@ -84,10 +88,6 @@ proc run_test_with_flags { cache_dir cache_enabled code } { clean_restart ${testfile} - # The tests generally want to check the cache, so make sure it - # has completed its work. - gdb_test_no_output "maintenance wait-for-index-cache" - uplevel 1 $code } } @@ -146,13 +146,13 @@ proc_with_prefix test_cache_disabled { cache_dir test_prefix } { set nfiles_created [expr [llength $files_after] - [llength $files_before]] gdb_assert "$nfiles_created == 0" "no files were created" - check_cache_stats 0 0 - # Trigger expansion of symtab containing main, if not already done. gdb_test "ptype main" "^type = int \\(void\\)" # Trigger expansion of symtab not containing main. gdb_test "ptype foo" "^type = int \\(void\\)" + + check_cache_stats 0 0 } } } @@ -193,17 +193,17 @@ proc_with_prefix test_cache_enabled_miss { cache_dir } { remote_exec host rm "-f $cache_dir/$expected_created_file" - if { $expecting_index_cache_use } { - check_cache_stats 0 1 - } else { - check_cache_stats 0 0 - } - # Trigger expansion of symtab containing main, if not already done. gdb_test "ptype main" "^type = int \\(void\\)" # Trigger expansion of symtab not containing main. gdb_test "ptype foo" "^type = int \\(void\\)" + + if { $expecting_index_cache_use } { + check_cache_stats 0 1 + } else { + check_cache_stats 0 0 + } } } @@ -228,17 +228,17 @@ proc_with_prefix test_cache_enabled_hit { cache_dir } { set nfiles_created [expr [llength $files_after] - [llength $files_before]] gdb_assert "$nfiles_created == 0" "no files were created" - if { $expecting_index_cache_use } { - check_cache_stats 1 0 - } else { - check_cache_stats 0 0 - } - # Trigger expansion of symtab containing main, if not already done. gdb_test "ptype main" "^type = int \\(void\\)" # Trigger expansion of symtab not containing main. gdb_test "ptype foo" "^type = int \\(void\\)" + + if { $expecting_index_cache_use } { + check_cache_stats 1 0 + } else { + check_cache_stats 0 0 + } } } -- 2.35.3