From patchwork Fri Jul 7 15:02:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 117174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3336617vqx; Fri, 7 Jul 2023 08:09:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEAqjbafqouGJIg+RP7XHh9iwD7HSwf0VFoQ0usW6nuxKc1XIU7SAlymy2pHmQ8BpEz9M6S X-Received: by 2002:a17:90a:ba95:b0:263:70d5:6d60 with SMTP id t21-20020a17090aba9500b0026370d56d60mr2806803pjr.30.1688742571701; Fri, 07 Jul 2023 08:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688742571; cv=none; d=google.com; s=arc-20160816; b=BnvLwNr3vLnmDfmcjiECbX/b7udpd7Knor3yx3Ic4V+54fvO7OcXn71wyIwWkiZlz0 ti34shuOh+p9ednplMmpKVhjFaYpGkfytPSoUZ339lQU08/wI8fFNlZDlj7/Q3/qcBX8 6n4BODhVpytAvzDoJT7DhWNGrHwCGGVtUrRFNGN3dVijMT6lMTLVaELPyMuxS1sumDc+ HRHSMh2B97AqsgQDVdfDIywIWOXQY1//mGmD22/0wQ92SW245rWgasDcyqt2ZwyGx0UW XHe/sI57s9QwQZ/91++OnYJ91BANDZi6Ja/U+3M4MfaII6K2Yl/r+fBgdEBzBvxRCoUi Qa7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=P04lXBU07fd1rS6dEe5QbnnTl7H9nvA+0KiO2Ty7D9U=; fh=pYBoK8NKvGZirLsyIjvjlYHPy/fM5+u4iD3mF5vegBA=; b=UWuF9iaTOum53Jbr1YkgQFbEK3aP6m6QR+22K929khpGusMFfi2qknlO1ML1/A4Eb4 q/5YHlwyxhhIkkIbU8EiJbdA6MiGd6NfLJAWnzN6HtLqazvS1dPWgRE21GqcFJ+oyYgC rExZc7aT3YPYGKfInKxWgRgsOkCq+4LxlJBBkDFMZJon/dr1vR3Q6ge/z31D57BxCtTC osQ0DbCEJswJkvTercsHYCwmI3ny+55aZLvFP5brjDctYkblK7oCcdsMcXmvihEPO0v3 PGbyWpFYKW5TO1+U/RdNDPqQaEvVKtCMJjYr9xxpnemVI2HsQauhVG77bZMOue+ajgJN TsYQ== ARC-Authentication-Results: i=1; mx.google.com; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv9-20020a632e09000000b0055acc92299esi3856769pgb.240.2023.07.07.08.09.18; Fri, 07 Jul 2023 08:09:31 -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; 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 S233277AbjGGPCu (ORCPT + 99 others); Fri, 7 Jul 2023 11:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233252AbjGGPCs (ORCPT ); Fri, 7 Jul 2023 11:02:48 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F5F210A; Fri, 7 Jul 2023 08:02:37 -0700 (PDT) X-QQ-mid: bizesmtp63t1688742143tn8jl0ih Received: from linux-lab-host.localdomain ( [116.30.131.119]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 07 Jul 2023 23:02:22 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: hoArX50alxFmsJ0atZjqbzHeVuse8MtD4x3pgHfFnxe1hIjs3zsPJJljILwPP cZOCtJq2GFFmaWMlBnT7xIijoHajHOWxCVCyUgsrmQJI4aJwBx1j1G0/nT9v816H4crLevD b2wqhPOTx2jJXGPA0XEf1e4cXnpNe+Ho6HRdAYwOKiwGrv3+FsrXaYQXFnirspceOYnrj5d 2gD2Mwc5hrF7Tk82JzkwT9vRE8qLrIbfJAFlgLQxBAVjmuqj1HFPF+meU0LnlvFzYUHVQsU ALHr5zeDk8O8oofQT+qDeXFlCZuVx8tWjuBG0NsEHzSMmIGDxTHm1aGJR5nGRksKAQw62x2 856wxltVV+JT2VWIZNTh1T+Ecuwb/jyN6hRoodt577DibVw0p0ypooL8P7v34K9lg6uY0Ni X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7535638931028319636 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, david.laight@aculab.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, thomas@t-8ch.de Subject: [PATCH v6 10/15] selftests/nolibc: prepare: create /dev/zero Date: Fri, 7 Jul 2023 23:02:16 +0800 Message-Id: <589b6a374e604b6289eb00890cd63e2b7d2ce86f.1688739492.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770774930678907366?= X-GMAIL-MSGID: =?utf-8?q?1770774930678907366?= /dev/zero is commonly used to allocate anonymous memory, it is a very good file for tests, let's prepare it. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230702193306.GK16233@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 88b840f86f52..b759fb25d375 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -894,11 +894,13 @@ int prepare(void) */ if (stat("/dev/.", &stat_buf) == 0 || mkdir("/dev", 0755) == 0) { if (stat("/dev/console", &stat_buf) != 0 || - stat("/dev/null", &stat_buf) != 0) { + stat("/dev/null", &stat_buf) != 0 || + stat("/dev/zero", &stat_buf) != 0) { /* try devtmpfs first, otherwise fall back to manual creation */ if (mount("/dev", "/dev", "devtmpfs", 0, 0) != 0) { mknod("/dev/console", 0600 | S_IFCHR, makedev(5, 1)); mknod("/dev/null", 0666 | S_IFCHR, makedev(1, 3)); + mknod("/dev/zero", 0666 | S_IFCHR, makedev(1, 5)); } } }