From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kElCLC4M+We3ty8AWB0awg (envelope-from ) for ; Fri, 11 Apr 2025 08:33:50 -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=V4S2l//H; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A698B1E0C3; Fri, 11 Apr 2025 08:33:50 -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 D2EEB1E05C for ; Fri, 11 Apr 2025 08:33:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 288593831396 for ; Fri, 11 Apr 2025 12:33:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 288593831396 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=V4S2l//H 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 0217438316E6 for ; Fri, 11 Apr 2025 12:32:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0217438316E6 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 0217438316E6 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=1744374771; cv=none; b=SPLsuU5cO7DDc5f31f2WvGESUn9kVij8i8g37XtP5g1apruC2t+ir0cE0SjbJ48I/c0Ef57KN8PyATkYeCh+6TaapeDOd33IhouKE++lmLrAyV6mh+gxehPc8c19yLo74E3aHQJVrJON3R8pkpUbZAZpsmsImXzExnKSCaZ+mAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744374771; c=relaxed/simple; bh=bswG3L1O6TI+ftO6l5sOxvFwxz63lUbVJZl9bV/H9Ok=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=bt6NwZ0/EKDQFPQsML7SZQS5QccOAsm+Te+H1IaplNhd0DhP0n0pEnDeqa/4Bi5lU0o9hxRZ6ABPHD4adLpSEeHe7+mlR2xlcKPZ4K06+MLbtifTnx+LUGOpIgMwurMfjJjOGsxwHRIWGl0MgdVx3N7JGUv8gv8rgXeXC1A0bfY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0217438316E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744374770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xvdyX7zpCPHPT7TXKP+kCO9I/nhvdLEkTQ+DAQP9kHs=; b=V4S2l//H5GwTclDO6iQnaXLSkgl41kVu3v+9hjQaCiy8/nQ1EPOGz+Ld8A1P2yQyDNcUDS vFq9fZVrCSFdlrUWvcFj8NdC0dVt97Bemm9mcUpzTvX7W/f6lTsljF3Q72bG1HRDfQS7Uc /R3Uzp6hU5nOH6A4ozi3tCBY95ZEBUo= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-lVdc06yuM6SunsXqQGnEUQ-1; Fri, 11 Apr 2025 08:32:47 -0400 X-MC-Unique: lVdc06yuM6SunsXqQGnEUQ-1 X-Mimecast-MFC-AGG-ID: lVdc06yuM6SunsXqQGnEUQ_1744374766 Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2241e7e3addso17996615ad.1 for ; Fri, 11 Apr 2025 05:32:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744374766; x=1744979566; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xvdyX7zpCPHPT7TXKP+kCO9I/nhvdLEkTQ+DAQP9kHs=; b=Kdx+JmyCzhK9yMkwftUlH/HUxqCtzeHV+BQtBFhT0IYjEWDcEtEdJ0TDNT197pfKEL B9qFxrxyF3wYPQouIyUhXzOO7WBfLOkrDUaGxcLIv0qto6bZb4I616iP0tiCydnbhleJ RtJnIA1PouiAeX3JiwqdL8owdTUzA3xgkD7/exINHpOsDTyljrXtEY3t8TlEWr1phDuS 3LkoDUwey2CRlz1CAl0pDkfyKzCGssyefK7dbHoMOVXgZszced3JZa7A0HCXgWvme1zZ jlCkwejiZqfoLhJsNnPlyh9tyFtllzPB11pHgfBT1e+goteCrOPdRwzL7zoXwcfV0gaz ImYw== X-Forwarded-Encrypted: i=1; AJvYcCU6VhfyX8Exoi6JUHMCefjX1hOw2r+msj62l0KDQmFrda03GbZEO8TU4idNmK8+yv6E45+3q4Ae2pkmWw==@sourceware.org X-Gm-Message-State: AOJu0Yzz9mqrqusCU3X9Cs5wD4ZoMC7Qhjn1oGrvs6S/8bV6liOWA6EP 0FMImTzEIgyHhgaIQcdD3NBDLnGO2TMa2G18Ww6U/Wb7QJ2GDPWSAlFRxi7Pd+F6MeB1wgnqlkq LNbrcvBGzM0o7+97HBbdRwlVcUYm5lho0jtN94FgxTZvJDqPJX4Tdyo2Fl1TKUCbRJ4g= X-Gm-Gg: ASbGncv6ymd0ULZ3r6HaFrutVod6Yg899pJA2jdEuwaUUbKPeIti94ffFxIyyezYfNy koycuYSGK7PIVJU2ZGlDXMkC0xVcAY8BwYTxiKqNG1iMhYWvMa64jrOTi2C9UoYNHdq/Jf0W15b ox363hrwNsjbwbOyhcGpEYJaBe0ga/GG5sHqQW/rm0ZTR2T7oa93uCYEyiDOjbsTmuZsq7vVbpi q1erhIvBFA0HFRDHKm1e5r+7hx8SwpThBdabJUm4C9RBjEputtSoZGVQ4NKmksGSU3gJR3T+9Wp ebCp3ZumTlopv9QPGSIkQmg= X-Received: by 2002:a17:903:2452:b0:221:7eae:163b with SMTP id d9443c01a7336-22bea4fcfc9mr35311865ad.46.1744374765898; Fri, 11 Apr 2025 05:32:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGn7fEWPTkqSyraVXXOSTou72XO/m7SXo/guPk4IGCEhtxGZhVlIo50+LcJI8q98Vb+lDQOUg== X-Received: by 2002:a17:903:2452:b0:221:7eae:163b with SMTP id d9443c01a7336-22bea4fcfc9mr35311565ad.46.1744374765502; Fri, 11 Apr 2025 05:32:45 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1001? ([2804:14d:8084:9a69::1001]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22ac7ccab77sm47551405ad.214.2025.04.11.05.32.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Apr 2025 05:32:44 -0700 (PDT) Message-ID: <46ac9fa3-8fc5-4939-9d5f-18da414f6355@redhat.com> Date: Fri, 11 Apr 2025 09:32:41 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] gdb/testsuite: fix gdb.base/dlmopen-ns-ids.exp racy test To: Tom de Vries , gdb-patches@sourceware.org References: <20250409182510.1629742-1-guinevere@redhat.com> <20250410130148.1880139-1-guinevere@redhat.com> From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: v0VLRDLkaQAU7Vt7ipKUvMzsKxGC1cyZa1A7zdcfjf4_1744374766 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 4/11/25 7:26 AM, Tom de Vries wrote: > On 4/10/25 15:01, Guinevere Larsen wrote: >> 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. >> > > Hi Gwen, > > LGTM. > > I've also ran it through make-check-all.sh, and found no issues. > > I did notice a typo, and indeed, the proposed codespell-log check > confirmed it ( > https://sourceware.org/pipermail/gdb-patches/2025-April/217118.html ): > ... > codespell-log............................................................Passed > > - hook id: codespell-log > - duration: 0.19s > > codespell-log-internal...................................................Failed > > - hook id: codespell > - exit code: 65 > > .git/COMMIT_EDITMSG:13: occurence ==> occurrence > > ... > > OK with that fixed. > > Approved-By: Tom de Vries Thanks, I pushed this (while also fixing the Co-Authored-By tag) > > FWIW, I don't much like the style of regexp used, I find it hard to > parse. This makes sense. I'm also not a fan of the final regexp either, i just didn't know how to make it better. Considering I'm going to propose further changes to the test, I will try to remember to make this change as well -- Cheers, Guinevere Larsen She/Her/Hers > > I prefer something more spaced out and less escape-heavy, like: > ... >     set re1 [list "From" "To" "(NS" ")?Syms" "Read" "Shared Object > Library"] >     set re1 [join $re1 {\s+}] > >     set re_ns [list {\[\[} ($::decimal) {\]\]}] >     set re_ns [join $re_ns ""] >     set re2 [list "$::hex" "$::hex" $re_ns "\[^\r\n]+${lib_regexp}"] >     set re2 [join $re2 {\s+}] > ... > > But that's a pre-exising style issue, so I suppose it's better to not > address this in this bug-fix commit. > > Thanks, > - Tom > >> 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 >