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 307B53858D20 for ; Thu, 14 Sep 2023 13:12:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 307B53858D20 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=1694697171; 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=1UWFajiLr+ONNv8DTwNHTc9nJN73tANXu7Cz1qQpODg=; b=Lwihk9Tupw1OJDZRl71ROW1uBFpngxrkJ6DFiMyYJVkPbGhdq8qWoKSqKUP9QmywVq33DQ 58FX9PKH6Q3DUAMckXCaUD2bIJieArVOraVxD08UhWGVzuYLQdf0ORMO7b2EgWa9y71/2J sjEkOht5H4J0cZacniGRVrmSZhmYK0k= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-zxaOev-hOEqNmF0BDOSV_Q-1; Thu, 14 Sep 2023 09:12:48 -0400 X-MC-Unique: zxaOev-hOEqNmF0BDOSV_Q-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9a9f282713fso71267666b.3 for ; Thu, 14 Sep 2023 06:12:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694697162; x=1695301962; h=content-transfer-encoding:in-reply-to:from:references:cc: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=1UWFajiLr+ONNv8DTwNHTc9nJN73tANXu7Cz1qQpODg=; b=g0Xtp5WpirZjns+21LE8BrFOjtWYT21Zb4I10uSaAqhZhEwFEyHUxA5f6/dp1BcHu2 AOtspF3XFnioDCW6cE83sndLfoJctjbPHnZMY0i4J1YiGL68t3HiUspsp3LUGHJAA4+o pUwPHjqNbfhQ8e+OTkiuRoMB14J/na/1GdSbyxpSGBfPwTMeVhmqNx5eNKtcnGgYJ6Dk A0TzvxFzXNmY/uoarx/5ihe/z7hrXwVoIvbEKvF3RxetKZpanlvSrqs31yyrzxK/pRqT kaTtjSDDhIti8LvpYiU05g9sUlqSfdTMzSVoHyqIRN8FdJZ3IX9PceSQOU55lv875VTT 2ziA== X-Gm-Message-State: AOJu0YynLKeCC9VXOGxrkTHUv4U7Z7cRIaTcbjIaNOEWtk5DX4p/eQL2 nZ17j3py4atXfglgqKKsaxlfu6ywvqNaXRjAsKmKuDwVEZtDOMlv/YJFnSb4MGXLe2fRqAjlWpO YFD4t7cZKgTIaIZfugjZiRTQ4Q9DDhl8LOFAqbM3pK+9T0WLQZLQTCD/IIkXjF8qUujBRvxjM5N 832Z+T X-Received: by 2002:a17:906:1db2:b0:9a9:e3be:1310 with SMTP id u18-20020a1709061db200b009a9e3be1310mr4443419ejh.53.1694697162285; Thu, 14 Sep 2023 06:12:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOp8SXW4gZsFSvsdCj0PtiiISHQk3sXtmXh4vL4ov2kCLpN6mBIYuqZ/9SJnNwhvQ88B91BA== X-Received: by 2002:a17:906:1db2:b0:9a9:e3be:1310 with SMTP id u18-20020a1709061db200b009a9e3be1310mr4443403ejh.53.1694697161951; Thu, 14 Sep 2023 06:12:41 -0700 (PDT) Received: from [10.43.2.16] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id gg23-20020a170906e29700b0099364d9f0e6sm989767ejb.117.2023.09.14.06.12.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Sep 2023 06:12:41 -0700 (PDT) Message-ID: <9b9c85d6-8507-4b49-0b07-2a3acc9b8496@redhat.com> Date: Thu, 14 Sep 2023 15:12:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PING][PATCH v2] gdb/testsuite: XFAIL some gdb.base/fileio.exp To: gdb-patches@sourceware.org, Guinevere Larsen Cc: lsix@lancelotsix.com References: <20230811102134.2796842-1-blarsen@redhat.com> <20230814102449.203616-2-blarsen@redhat.com> From: Guinevere Larsen In-Reply-To: <20230814102449.203616-2-blarsen@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=-11.9 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: Ping! -- Cheers, Guinevere Larsen She/Her/Hers On 14/08/2023 12:24, Guinevere Larsen wrote: > Some gdb.base/fileio.exp tests expect the inferior to not have write > access to some files. If the test is being run as root, this is never > possible. This commit adds a way to identify if the user is root and > xfails the tests that expect no write access. > --- > > Changes for v2: > * root_user now uses remote_exec instead of exec to see the uid of the > inferior > > --- > gdb/testsuite/gdb.base/fileio.exp | 9 ++++++++- > gdb/testsuite/lib/gdb.exp | 11 +++++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp > index 33c88d064c4..e1c7a7f955e 100644 > --- a/gdb/testsuite/gdb.base/fileio.exp > +++ b/gdb/testsuite/gdb.base/fileio.exp > @@ -17,7 +17,6 @@ > > require {!target_info exists gdb,nofileio} > > - > standard_testfile > > if {[is_remote host]} { > @@ -75,6 +74,10 @@ gdb_test "continue" ".*" "" > > catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\"" > > +# If the user is root, we will always have write permission > +if { [root_user] } { > + setup_xfail *-* > +} > gdb_test continue \ > "Continuing\\..*open 5:.*EACCES$stop_msg" \ > "Open for write but no write permission returns EACCES" > @@ -240,6 +243,10 @@ gdb_test continue \ > if [ishost *cygwin*] { > setup_xfail "*-*-*" > } > +# If the user is root, we will always have write permission > +if { [root_user] } { > + setup_xfail *-* > +} > gdb_test continue \ > "Continuing\\..*unlink 2:.*EACCES$stop_msg" \ > "Unlinking a file in a directory w/o write access returns EACCES" > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 36bf738c667..d7947e0dcf4 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -9952,5 +9952,16 @@ proc have_host_locale { locale } { > return [expr $idx != -1] > } > > +# Return 1 if the test is being run as root, 0 otherwise > + > +gdb_caching_proc root_user {} { > + # ID outputs to stdout, we have to use exec to capture it here > + set user [remote_exec id] > + > + regexp -all ".*uid=(\[0-9\]+).*" $user user uid > + > + return [expr $uid == 0] > +} > + > # Always load compatibility stuff. > load_lib future.exp