Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4828447rwb; Mon, 31 Jul 2023 12:58:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHvURQWiKRDaNOAlbbp1axjVWA4ARlzKYbmwHh0eIwLDEWjyKyn3P/PCdkE0XMbEFrsg/R5 X-Received: by 2002:a17:902:da83:b0:1b9:d2fc:ba9f with SMTP id j3-20020a170902da8300b001b9d2fcba9fmr10585682plx.11.1690833516387; Mon, 31 Jul 2023 12:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690833516; cv=none; d=google.com; s=arc-20160816; b=tXtfkFFkpPEtl/0Yb9evzgfvQqlmeMfo5V8NsXrN1nrlSlEWIql/YJqEGqLFSe7NfD t6foad+C3ZFdDeENQW+D5UlkV3SeviZtTcUttOGFuDoKIWnTutk8b4tby+WV5+z3EAv9 ZVzP86YTOL4h3RraSy4MNavGlrsNl9HMTEheesxP/auCpb10kH1Gf3vFtW62znxvFCJf Vmf0GyA3URSUao77+d7Wk7MrJaCxvZon+r87UVe4BYzxvVKkvyGhl+cDvje4lJmivFLp 7HClssQLF1csTl+X28UZHLRqHx+FHgZ0T0N1BniXoYggyJeCf2yDWCfO0bcb5Ga5EVCI MBog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9YjAFcAF31FT2UZhEN2EWL3WBzJJN50SYLMY9Gli8ug=; fh=l33mWavnHGYJ2XDeKtGto0RLtWj7njx9xyMvDkqmpRA=; b=EbUkDcCaSA7SvAjfZhPKQo41+KhYi6TE0HuOvchIiQksONQxHnxAHplTuRP8NaRBNG QYfNsvbYYpMIRRKbzfnN9/If96cm4vPnzJz7Te+ZdF1Ib7AgWoXrJvCNByWlgWjRVW9Q VTZkJT9rtGhner9SNgaNEA/GpIFOXd6LlwY8S69KFbCqBPGB7mOjOWNw/P02LcOD2Ud8 Oo4kzEuFo3LC45UKoydafiK9pR9+1zLUlwE1OYe/XObBctImLk4Wzjcyc2PwbFB8/VTk WBBlU5xakv+QEClGEPB78/XcRp9oQjeV3k+48wApx/qudK5guxZSa0dEN2zNT0/bWRPc EX3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=WbV3E8IW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902e80900b001b3eeaad177si7946855plg.99.2023.07.31.12.58.23; Mon, 31 Jul 2023 12:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=WbV3E8IW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230388AbjGaS3H (ORCPT + 99 others); Mon, 31 Jul 2023 14:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbjGaS3A (ORCPT ); Mon, 31 Jul 2023 14:29:00 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDE51FC6; Mon, 31 Jul 2023 11:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1690828125; bh=7NrEnQxXICxhw0/8TiGcDTN7V2/dgz44Rd+KTW46XH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WbV3E8IWxUYOWeDUuQprLuCoGp3MIH2ALt16eJfJgVko1lMHMfHWC1jmiYvSjN0O4 b1V5XB2JI+/jDUhYUmKEBd3dyrEygjp2OCzKOJp/6sVEIWMGYYquL4W5BivSXmzQas alFvO0/zWI/cx29RXEiZDfLEUYGTluJQM/cAzzyY= Date: Mon, 31 Jul 2023 20:28:44 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Yuan Tan Cc: w@1wt.eu, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 2/2] selftests/nolibc: add testcase for pipe Message-ID: <51b39ee9-7645-4759-9cc0-3cfe721a2757@t-8ch.de> References: <9221753abe0509ef5cbb474a31873012e0e40706.1690733545.git.tanyuan@tinylab.org> <2ba88bae-2986-4e70-9828-824d7b140277@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-08-01 02:01:36+0800, Yuan Tan wrote: > Hi Thomas, > On Mon, 2023-07-31 at 17:41 +0200, Thomas Weißschuh wrote: > > On 2023-07-31 20:35:28+0800, Yuan Tan wrote: > > > On Mon, 2023-07-31 at 08:10 +0200, Thomas Weißschuh wrote: > > > > On 2023-07-31 13:51:00+0800, Yuan Tan wrote: > > > > > Add a testcase of pipe that child process sends message to > > > > > parent > > > > > process. > > > > > > > > Thinking about it some more: > > > > > > > > What's the advantage of going via a child process? > > > > The pipe should work the same within the same process. > > > > > > > > > > The pipe is commonly used for process communication, and I think as > > > a > > > test case it is supposed to cover the most common scenarios. > > > > The testcase is supposed to cover the code of nolibc. > > It should be the *minimal* amount of code to be reasonable sure that > > the > > code in nolibc does the correct thing. > > If pipe() returns a value that behaves like a pipe I see no reason to > > doubt it will also survive fork(). > > > > Validating that would mean testing the kernel and not nolibc. > > For the kernel there are different testsuites. > > > > Less code means less work for everyone involved, now and in the > > future. > > > > It's a good point and I never thought about this aspect. > > I wonder whether the code below is enough? > > static int test_pipe(void) > { > int pipefd[2]; > > if (pipe(pipefd) == -1) > return 1; > > close(pipefd[0]); > close(pipefd[1]); > > return 0; > } That is very barebones. If accidentally a wrong syscall number was used and the used syscall would not take any arguments this test would still succeed. Keeping the write-read-cycle from the previous revision would test that nicely. Essentially the same code as before but without the fork(). > > And I forgot to add this line: > > CASE_TEST(pipe); EXPECT_SYSZR(1, test_pipe()); break; > > I will add it in next patch. >