From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id EF82C3858D20 for ; Mon, 12 Jun 2023 16:57:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF82C3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.00,236,1681200000"; d="scan'208";a="9591794" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 12 Jun 2023 08:57:45 -0800 IronPort-SDR: vXPuoPGym4HqiT2U5XvYg0iSPKO9lYUIe9RdJNZLGT3ZGu23EXs1SpoD0YKmpHj4YyGQjEDDLB ao0RzX230+2yZ+ZiZrDi8Wjs67othg0GLCZBuir2N1n4F1H/fVh0Acy4VV7rLbST8VmIQFk0r5 Ve95cB30trJoQyuNu4SMZxyWY9tLuaeuDkK5Nz655yews5hvfbEgq7id+F3It6vKoaBCQNvwrm SVDfqrNJDg73RQ8jlBnKh1hD0gTkTRVr+6Yg8kvF2Fyz5j56/yzggHsKpVCEJl6jbe3YhsZRok dPI= Date: Mon, 12 Jun 2023 16:57:41 +0000 From: Joseph Myers To: =?ISO-8859-15?Q?Fr=E9d=E9ric_B=E9rat?= CC: , Subject: Re: [PATCH v7 1/4] tests: replace read by xread In-Reply-To: <20230612151821.199003-2-fberat@redhat.com> Message-ID: References: <20230612151821.199003-1-fberat@redhat.com> <20230612151821.199003-2-fberat@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1152306461-470640328-1686589061=:344113" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3106.1 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: ---1152306461-470640328-1686589061=:344113 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 8BIT On Mon, 12 Jun 2023, Frédéric Bérat via Libc-alpha wrote: > @@ -56,7 +58,7 @@ tf (void *arg) > > /* This call should block and be cancelable. */ > char buf[20]; > - read (fd[0], buf, sizeof (buf)); > + xread (fd[0], buf, sizeof (buf)); Since the comment suggests this code is actually testing a property of the read function, it seems doubtful whether it's appropriate to change it to call xread - which would impose an API requirement on xread that it calls read in exactly the way under test. Calling x* functions is fine in testcases when the function in question is not under test - for example, when the point of calling xread is just to read some data, with the details of how that's done being irrelevant - but questionable when the test is a test of read itself. > @@ -32,7 +34,7 @@ tf (void *arg) > } > > char buf[10]; > - read (fds[0], buf, sizeof (buf)); > + xread (fds[0], buf, sizeof (buf)); > > puts ("read returned"); The same might apply here. -- Joseph S. Myers joseph@codesourcery.com ---1152306461-470640328-1686589061=:344113--