From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DB0333858D35 for ; Fri, 21 Jul 2023 09:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB0333858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689931998; 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=+a2i8K9xDzB6U/Clx7VQ7pWTyPtuqoHWz6k/kaxPyt4=; b=QlLboyjCMxvAAf2Av+AyodW1SJrc+WxZL83PPoOTXgnfwMAxS95Me3Wdh0DLE3V2dBXn1a Rp7JudpKzNwIarAViD43dSAMyne1G4e2RYAIq5N3/QrLdmzi2yHunjmSwcIZs0jqj5y2T9 ht+BMy04u+Ds2LRiiT6GFisc2a6fW3Q= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-90-mMWTpL5JMHu9bVM5J_BEiQ-1; Fri, 21 Jul 2023 05:33:17 -0400 X-MC-Unique: mMWTpL5JMHu9bVM5J_BEiQ-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-403cddf284bso24214651cf.0 for ; Fri, 21 Jul 2023 02:33:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689931997; x=1690536797; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+a2i8K9xDzB6U/Clx7VQ7pWTyPtuqoHWz6k/kaxPyt4=; b=ifY3TQtxvx8QHlJisEUtqygQ+udrB1FEu8fcBGcfgDF1wzo+bQXU6Vn37gDd9M1L8r KTemWQA7EzlNX7qy5cbxZFDx4u/0QgZaNiOPMU2aakcWvTPZBdmZ72p3bh1aZwjBdzZr ju6sLoAYI+pC/jl+GjunV28LBITRp1nsEHI1w25wqh7nCXbwcLaun++GseEAc6jnSA3w upVcWQ3eYrIDTuUP90PX0701l+OQ6mfjn7IMcxtVwXTWJk2UbtsUdifXk87tzvhVKkQq 908qmI0bNyC69pcFmCHTfuk465D4FgvPWr9Ep82aNNjH4S3LtdIbC3nAqqjSzrwwFBw3 wEog== X-Gm-Message-State: ABy/qLZXPeMSFNTSMjrDm5EQtAgMEqYcbG8iLHPGFweSdt3ycahulJjJ 3DM8WO9/DR+mvIK1P0rAYfHJBo8ivzYx2Q97s1myhntf9ebGCMzf1XeyVbjW0o8rTNYF+ghZpXY P3EWa3qB2ESF+xrbio3087UAlNgieqQ== X-Received: by 2002:ac8:5f14:0:b0:3f6:c0f7:a5d7 with SMTP id x20-20020ac85f14000000b003f6c0f7a5d7mr1470433qta.35.1689931996937; Fri, 21 Jul 2023 02:33:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlFj5X7xUZcJ7dpunWqFudAhlK8/xSjv4sAq/Mwl27Uq++I7v3ZG3XnT6R4UjU7jnoQ675ULVA== X-Received: by 2002:ac8:5f14:0:b0:3f6:c0f7:a5d7 with SMTP id x20-20020ac85f14000000b003f6c0f7a5d7mr1470425qta.35.1689931996684; Fri, 21 Jul 2023 02:33:16 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id o9-20020ac872c9000000b00403c1a19a2bsm1071505qtp.92.2023.07.21.02.33.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Jul 2023 02:33:16 -0700 (PDT) Message-ID: Date: Fri, 21 Jul 2023 11:33:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] gdb/testsuite: dont test dprintf to stderr in gdb.mi/mi-dprintf.exp To: Andrew Burgess , Bruno Larsen via Gdb-patches References: <20230719134015.2331400-1-blarsen@redhat.com> <871qh1hbmn.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <871qh1hbmn.fsf@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,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 List-Id: On 21/07/2023 11:12, Andrew Burgess wrote: > Bruno Larsen via Gdb-patches writes: > >> As mentioned in commit 3f5bbc3e2075ef5061a815c73fdc277218489f22, some >> compilers such as clang don't add debug information about stderr by >> default, leaving it to external debug packages. However, different to >> that commit, there seems to be no simple way to test if stderr is present >> without introducing a failure, > I don't understand what you mean here. In the previous commit, you just > print stderr and check GDB's reply. Why no adopt the same approach for > this test? > > I revised this test to use this proc: > > # Check for stderr. > proc mi_gdb_is_stderr_available {} { > set has_stderr_symbol false > gdb_test_multiple "-data-evaluate-expression stderr" "stderr symbol check" { > -re "\\^error,msg=\"'stderr' has unknown type; cast it to its declared type\"\r\n$::mi_gdb_prompt$" { > # Default value of false is fine. > } > -re "$::mi_gdb_prompt$" { > set has_stderr_symbol true > } > } > return $has_stderr_symbol > } > > set has_stderr_symbol [mi_gdb_is_stderr_available] > > And then replaced your: > > if ![test_compiler_info clang*] > > with: > > if {$::has_stderr_symbol} > > And (when testing with Clang) I don't see any failures. > > I think, in general, we should avoid as much as possible placing > specific compiler checks into test scripts unless we can make a _really_ > strong argument that a special behaviour will _only_ happen for this one > compiler. > > In this case, if a compiler check really was the _only_ way to solve > this problem we would still be better off placing the check into a new > proc in lib/*.exp somewhere -- but in this case I don't think that's > necessary, we should be able to check for stderr. > > Also, I think the new stderr checking proc should be placed into > lib/mi-support.exp. Oh this makes sense. I looked into lib/mi-support.exp and couldn't see anything that used the gdb_test_multiple machinery, so I assumed it wouldn't work. I agree with everything you said, it makes a lot of sense. I'll incorporate the changes and send a v2 soon, thanks for the review! -- Cheers, Bruno > > Thanks, > Andrew > > >> so instead this commit just disables >> tests that rely on stderr when clang is detected > >> --- >> gdb/testsuite/gdb.mi/mi-dprintf.exp | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp >> index e40fa6121fa..735f7fc234e 100644 >> --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp >> +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp >> @@ -127,7 +127,6 @@ proc mi_continue_dprintf {args} { >> mi_continue_dprintf "gdb" >> >> # The "call" style depends on having I/O functions available, so test. >> - >> if ![target_info exists gdb,noinferiorio] { >> >> # Now switch styles and rerun; in the absence of redirection the >> @@ -136,9 +135,12 @@ if ![target_info exists gdb,noinferiorio] { >> mi_gdb_test "set dprintf-style call" ".*" "mi set dprintf style to call" >> mi_continue_dprintf "call" >> >> - mi_gdb_test "set dprintf-function fprintf" ".*" "mi set dprintf-channel stderr" >> - mi_gdb_test "set dprintf-channel stderr" ".*" "mi set dprintf channel" >> - mi_continue_dprintf "fprintf" >> + # Clang does not add information about stderr, so skip these tests if needed. >> + if ![test_compiler_info clang*] { >> + mi_gdb_test "set dprintf-function fprintf" ".*" "mi set dprintf-channel stderr" >> + mi_gdb_test "set dprintf-channel stderr" ".*" "mi set dprintf channel" >> + mi_continue_dprintf "fprintf" >> + } >> } >> >> set target_can_dprintf 0 >> -- >> 2.41.0