Message ID | 9dc032064dde254a03e2111da1e58344deca6522.1688078605.git.falcon@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10004602vqr; Thu, 29 Jun 2023 17:26:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlHKvcpt1A1u423Cl9SeuzMUfrPtavy2UxXqJUMWkxhcnv5BCDGXbIcr4RPDCk1VRTFUKGlD X-Received: by 2002:a17:902:ec88:b0:1a6:6bdb:b548 with SMTP id x8-20020a170902ec8800b001a66bdbb548mr792012plg.1.1688084795344; Thu, 29 Jun 2023 17:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688084795; cv=none; d=google.com; s=arc-20160816; b=cNXftu73TLdBllJkRo9weKknyQKJwL/e+kOoiJMA6UFRnFnRfq1tdoskJ277QWBeyp UKcALOasvRTxKDlfg1FeVZE9tAf+zINpQ7o+AgLJlmcStMhTfMTm+feNdEcYsG21Lhr3 eH9VaAp5sqRoCLrEjKCGAoMsJgBh0KF+NN4M7IsNXu4kHcmXBnucNq4plrsSl1+4qiQo lPmeE76cBpwPJPNGDGIfUTbQRrXFeNMNnyok/og6T1bDt6szn1fioBmGzB8hbJ5HMHPT NjcANiWoyF73tv1ExNIhlKSAZDHXHs3i/DJfmOLbUvtvy+AiIsi+xF0G2eZkzcS70WUm HI/g== 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=sorbPGL5wCAbm6CukBd2LmFBGr8sFCmv3UnH7gB3weI=; fh=GzghTQzqgly4pZn8BwQ4U8bZ8zCadAK8Sl/utskeyEs=; b=qsNTN0Ae/Y3ciB3atSh/o+9CUYWI5EV2BhIfLASyYTWVbcsCRRpsfBr79469pNZaGx uLrvjjGCtKo+ts4rrqSt9FFAnI84rhds92RE6sXqpEAv9aILHcPXKTk+u+WMbLo8Ee+5 0WU8HDPYj51UIPUM9Nh24S5iUdffOLwkiVaMNr/MzakKuvrF5IKxTC1wSTe4vv1HD0// UmtJpLuT/VwhKxJdsLzoZpMnH3BGK78qSTRWXBhWs++yXC1PHca90LSunDD8zmbAznyz dX42PX2eN4HQoDlQe0CdGOuNX5JtMjgAFDpjhVZXTrSVXMkulYK/TuBjh3UeX8V6qoty 9Czg== 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 i12-20020a17090332cc00b0019ca7d69673si12572096plr.196.2023.06.29.17.26.21; Thu, 29 Jun 2023 17:26:35 -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 S230488AbjF2Xxq (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Thu, 29 Jun 2023 19:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbjF2Xxo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 29 Jun 2023 19:53:44 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85236C3; Thu, 29 Jun 2023 16:53:42 -0700 (PDT) X-QQ-mid: bizesmtp62t1688082813tkl23r8i Received: from linux-lab-host.localdomain ( [119.123.131.49]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 30 Jun 2023 07:53:32 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: SdugMSrl+IPAzXWq+rfJBOyleIPNwAJP1BnWuXjvrOgozUJpjkblZ040nbM0V 4nYGY8mJHgC1InPwQxd66pwy39Ncw2l3U1VAq3Exy6G8vo5XDg/2ht6XP8d2wYbESG8lrA6 uSJqxqrWSrWxsAY9JcffJxCcyO/dpYdQlb2N693wOs2t5z86w3JMJ8vj+nz0kd9q//1DQ8J hb5IppBq9Qot4Koo5KkS9x/7oaCb7FcZSgJWBZgfggO/5UtJe4z7N1DEwSHWJRlQH3Pnp66 xuXtRV+1rRqBOREkItMdGFJck4pnjXpgCWm16Kf4OnQKi4lWcuXEFWuZCnvYnlrKCI2nEwz rOVbx8w+ne0rx0ByPHIAwpoVVvs5XdhaNvbMK5Phj+Itt1nE1g1sv9pbnY75g== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11952200826971950609 From: Zhangjin Wu <falcon@tinylab.org> To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 11/15] selftests/nolibc: prepare /tmp for tmpfs or ramfs Date: Fri, 30 Jun 2023 07:52:03 +0800 Message-Id: <9dc032064dde254a03e2111da1e58344deca6522.1688078605.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1688078604.git.falcon@tinylab.org> References: <cover.1688078604.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_DNSWL_NONE, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770085202213232078?= X-GMAIL-MSGID: =?utf-8?q?1770085202213232078?= |
Series |
allow run with minimal kernel config
|
|
Commit Message
Zhangjin Wu
June 29, 2023, 11:52 p.m. UTC
Let's create a /tmp directory and mount tmpfs there, if tmpfs is not
mountable, use ramfs as tmpfs.
tmpfs will be used instead of procfs for some tests.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On 2023-06-30 07:52:03+0800, Zhangjin Wu wrote: > Let's create a /tmp directory and mount tmpfs there, if tmpfs is not > mountable, use ramfs as tmpfs. > > tmpfs will be used instead of procfs for some tests. > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > index c0f5302ada5d..8e3e2792f5e3 100644 > --- a/tools/testing/selftests/nolibc/nolibc-test.c > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > @@ -1054,6 +1054,10 @@ int prepare(void) > } > } > > + /* try to mount /tmp if not mounted, if not mountable, use ramfs as tmpfs */ > + if (stat("/tmp/.", &stat_buf) == 0 || mkdir("/tmp", 0755) == 0) > + mount("none", "/tmp", "tmpfs", 0, 0); > + mkdir() mount() without any error checking should do the same and be easier to read. > return 0; > } > > -- > 2.25.1 >
Hi, Thomas > On 2023-06-30 07:52:03+0800, Zhangjin Wu wrote: > > Let's create a /tmp directory and mount tmpfs there, if tmpfs is not > > mountable, use ramfs as tmpfs. > > > > tmpfs will be used instead of procfs for some tests. > > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > --- > > tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > index c0f5302ada5d..8e3e2792f5e3 100644 > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > @@ -1054,6 +1054,10 @@ int prepare(void) > > } > > } > > > > + /* try to mount /tmp if not mounted, if not mountable, use ramfs as tmpfs */ > > + if (stat("/tmp/.", &stat_buf) == 0 || mkdir("/tmp", 0755) == 0) > > + mount("none", "/tmp", "tmpfs", 0, 0); > > + > > mkdir() > mount() > > without any error checking should do the same and be easier to read. > Yeah, will apply it, it saves a call for us. Perhaps the other codes in prepare() can be cleaned up with the same method in the future too. Thanks, Zhangjin > > return 0; > > } > > > > -- > > 2.25.1 > >
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index c0f5302ada5d..8e3e2792f5e3 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1054,6 +1054,10 @@ int prepare(void) } } + /* try to mount /tmp if not mounted, if not mountable, use ramfs as tmpfs */ + if (stat("/tmp/.", &stat_buf) == 0 || mkdir("/tmp", 0755) == 0) + mount("none", "/tmp", "tmpfs", 0, 0); + return 0; }