From patchwork Thu Jun 29 23:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13297443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6839EB64D9 for ; Thu, 29 Jun 2023 23:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231587AbjF2Xxo (ORCPT ); Thu, 29 Jun 2023 19:53:44 -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 ); 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 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: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 --- 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); + return 0; }