From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id crglK1PC92drWC4AWB0awg (envelope-from ) for ; Thu, 10 Apr 2025 09:06:27 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QlZvNBkg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9B7B31E0C3; Thu, 10 Apr 2025 09:06:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BCAF71E05C for ; Thu, 10 Apr 2025 09:06:24 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3FA76383906E for ; Thu, 10 Apr 2025 13:06:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FA76383906E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QlZvNBkg Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 6ECCF3858C56 for ; Thu, 10 Apr 2025 13:01:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ECCF3858C56 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 6ECCF3858C56 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=1744290118; cv=none; b=xScMbQHwNOhWJBWF1IHbcCGemMQ7UiVP4RVwdpe1tfOKmBQdn/3o1yQqbd9Q2Sn/ybRXpp5ijGo99tB6pbMOz33OJuCWBKHV7eWJAR9r8+D8g7ra/E8IG4JDxetiXcJY2MzEsDxVxu68mSrHqTzqJ6PpMuqj7pAgijUxK1ACQ8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744290118; c=relaxed/simple; bh=tkjh05mwDhE9QDBGCliTeTnelsA/yTapRk685FIt26U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Jz0tJxb9JaHeeBlvt4XD2neTGx1OBeWs4VLzEr2bodlg+AkjuZ0I3dG4g2jdyLMlEz54pYH7pfM5iaLwRrDPEeIAkiOmIlJ/j02u8OK9gNcF8WFrj38YFvVgFUKepg1+/MrYh5R6tFHFM8m0ZtUhsAHfZUk/A0CwXXsOSCz2RiI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ECCF3858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744290117; 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=yHPQtUez0FQ+eDMT2rM+Ww+RZ7cKU/WXyhvyEQsJnSw=; b=QlZvNBkghAHJbUDaeBixtM7MrU1zsNtGmuNbJB0QDH5DTD9S2NZSiHTPo3cOqeELvFJK9B jfqDVX+hez5W7WbGJ7sPonq3Ner9pwrvBkUHZUE5kYNshwb6BP4a7qavErgH5snxL+gQjq wWDqSZ927SYIWVqllm2FJGqR5YHtNVY= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-2xg_t0IZO_mRwoem6ngR4A-1; Thu, 10 Apr 2025 09:01:56 -0400 X-MC-Unique: 2xg_t0IZO_mRwoem6ngR4A-1 X-Mimecast-MFC-AGG-ID: 2xg_t0IZO_mRwoem6ngR4A_1744290115 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6A56F19560BB; Thu, 10 Apr 2025 13:01:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B79883003746; Thu, 10 Apr 2025 13:01:53 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , tdevries@suse.de Subject: [PATCH v2] gdb/testsuite: fix gdb.base/dlmopen-ns-ids.exp racy test Date: Thu, 10 Apr 2025 10:01:48 -0300 Message-ID: <20250410130148.1880139-1-guinevere@redhat.com> In-Reply-To: <20250409182510.1629742-1-guinevere@redhat.com> References: <20250409182510.1629742-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lbNXwECFMteR7lsexOw4om7IlBaDcw2VuoTN9h7KrHA_1744290115 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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~public-inbox=simark.ca@sourceware.org The recently included gdb.base/dlmopen-ns-ids.exp test can sometimes fail the call to get_integer_valueof when trying to check the namespace ID of the fourth dlopened SO, for apparently no reason. What's happening is that the call to get_first_so_ns doesn't necessarily consume the GDB prompt, and so get_integer_valueof will see the prompt immediately and not find the value the test is looking for. To fix this, the test was changed so that we consume all of the output of the command "info sharedlibrary", but only set the namespace ID for the first occurence of the SO we're looking for. The command now also gets the solib name as a parameter, to reduce the amount of output. Co-Authored-By: tdevries@suse.de --- gdb/testsuite/gdb.base/dlmopen-ns-ids.exp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp index 03b7a527af5..3ddc07e7773 100644 --- a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp +++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp @@ -24,7 +24,8 @@ require allow_dlmopen_tests standard_testfile -main.c -lib.c set srcfile_lib $srcfile2 -set binfile_lib [standard_output_file dlmopen-lib.so] +set so_name dlmopen-lib.so +set binfile_lib [standard_output_file $so_name] if { [build_executable "build shlib" $binfile_lib $srcfile_lib \ [list debug shlib]] == -1 } { @@ -41,18 +42,19 @@ if { [build_executable "failed to build" $testfile $srcfile \ # for the so proc get_first_so_ns {} { set ns -1 - gdb_test_multiple "info sharedlibrary" "get SO namespace" -lbl { - -re "From\\s+To\\s+\(NS\\s+\)?Syms\\s+Read\\s+Shared Object Library\r\n" { + set lib_regexp [string_to_regexp ${::binfile_lib}] + gdb_test_multiple "info sharedlibrary $::so_name" "get SO namespace" -lbl { + -re "\r\nFrom\\s+To\\s+\(NS\\s+\)?Syms\\s+Read\\s+Shared Object Library(?=\r\n)" { exp_continue } - -re "^$::hex\\s+$::hex\\s+\\\[\\\[($::decimal)\\\]\\\]\\s+\[^\r\n]+$::binfile_lib.*" { - set ns $expect_out(1,string) - } - -re "^$::gdb_prompt $" { - } - -re "^\[^\r\n\]+\r\n" { + -re "\r\n$::hex\\s+$::hex\\s+\\\[\\\[($::decimal)\\\]\\\]\\s+\[^\r\n]+${lib_regexp}(?=\r\n)" { + if {$ns == -1} { + set ns $expect_out(1,string) + } exp_continue } + -re -wrap "" { + } } return $ns } base-commit: d1458933830456e54223d9fc61f0d9b3a19256f5 -- 2.49.0