From patchwork Wed Jun 21 13:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 111032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4376869vqr; Wed, 21 Jun 2023 06:47:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6VEuXXNy8UNOrtjSn8OVJGc53LxwiSrRzNkzPbOM3N9TQqIwRCLwmpDqFWw8NR/ijTof2T X-Received: by 2002:a05:6a21:3a85:b0:11d:3c0c:e632 with SMTP id zv5-20020a056a213a8500b0011d3c0ce632mr13879545pzb.23.1687355248583; Wed, 21 Jun 2023 06:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687355248; cv=none; d=google.com; s=arc-20160816; b=w9tHx5GgoM8V5S47r8a/+AiAZOQMklFtwEWjeCUV5CxsGAGqiYozdzcYYIPBtEMKDE bRlia/Frw1dVu7odr5BxCDIQw9uDba+s9mT16Ea9YTY7KduMHxaWJ1ZyGkLFfDZ6ZPhS BRCGr0CW/y2KFJEqec1fPOJe3ydfg6ZJmluXq1fAv7/SGmJTk349CNPJXTFxHM6TsAzO dXUpNgcWryOldfAtKu0mQcrVNi2JK2c81fAu/9sdkhyPhJJuVDDIKayJT7Iye86FVyM5 vcUBoZ1QezcrZXaZRvVOfEx53WU6yt+o4oOZ+KeztpK0WBpYVRHSeTRu2NKS+uQ18ozO R63Q== 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=hQLV/yzcZmo2O2PQ/1Hlsdc1+12YXrLn8aScDyIS/jI=; b=MEmiI7HVtyn3cxdbag26t9ez38DLxYr7Wm7yMfCqL07cM5ndQ1ohOHw+Yt9MLzV+or aR4b7jWi40hiHND5tP2+/3+UQl3GvF3I3Q1l26wYmOhcc6wSQoxwjf2itb5vpHHVazGk HL+8MAWXPhJJLe7p7b1Xa57HJAgMTOuBD0J0y2pTcnlXBGsy3Uz+zw+geNiAgqRHgLLk M1uxFs6wdrE6PK0F3GKv9hnm95IiYsLcsI1g32+eKPT9QgwVYoZbK01jE3JvuAtnrA1r XevOZyoN3WaxLRpNrYj+rsMj0RbgymrwNxbaT3JJXQF9OTQWRHKJRkf1qp3jilwRXcIZ wcXg== 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 a202-20020a621ad3000000b0065d56d5e7a9si4108492pfa.123.2023.06.21.06.47.16; Wed, 21 Jun 2023 06:47:28 -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 S232478AbjFUNU0 (ORCPT + 99 others); Wed, 21 Jun 2023 09:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbjFUNUW (ORCPT ); Wed, 21 Jun 2023 09:20:22 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBAE71994; Wed, 21 Jun 2023 06:20:18 -0700 (PDT) X-QQ-mid: bizesmtp78t1687353609twv2x5yr Received: from linux-lab-host.localdomain ( [116.30.126.60]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 21 Jun 2023 21:20:07 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: LE7C6P2vL8QaLL7JPV1s2XMq3xaIhLPj7Fcy7ZasiRCLssjSUm9F+DbEx0p4g 0gPy5kD2TqEixqQZRzFnulPS2AtCpo9yKg2a53LxzOZDf426H2hSW7q9zCjMScUmvL+Gc96 wv3NqZLpC0DEYO20NTyPnywckAS2JgJxhTLDwxla2AKv3sOWObrXEz+Anb8OCHv0wvNFSH9 7zk5zv2vqy36LnH1ewGptn5XZsPVIbcdMlgh4vFMn9w7sIKp+1dkXXbUd75tS/Epfv1rx7x stmMDbj9VDf/181dzxopn0yu4htPyqic7qpxpWmxC4MeYq6/yhx946EDrciP0a1aNvmVlK6 YdFyPLWkPAsOpp9lPx9Jbw3ghg8k90cjaPuFvuU002KpY1c0D0= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11267784333303017325 From: Zhangjin Wu To: w@1wt.eu Cc: thomas@t-8ch.de, arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v1 16/17] selftests/nolibc: vfprintf: skip if neither tmpfs nor hugetlbfs Date: Wed, 21 Jun 2023 21:18:53 +0800 Message-Id: <55a01001987f2795a982755ed2ca8e27efe49249.1687344643.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:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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?1769320217175916011?= X-GMAIL-MSGID: =?utf-8?q?1769320217175916011?= As fs/Kconfig shows, MEMFD_CREATE depends on TMPFS or HUGETLBFS: config MEMFD_CREATE def_bool TMPFS || HUGETLBFS Let's skip vfprintf test if they are not there. The /tmp and /hugetlb directories have been created to mount tmpfs and hugetlbfs respectively, if they are not enabled in kernel configuration, neither /tmp nor /hugetlb will be created. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 8b1ce9911c5c..85fa64746cde 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -769,11 +769,22 @@ int run_stdlib(int min, int max) static int expect_vfprintf(int llen, size_t c, const char *expected, const char *fmt, ...) { + struct stat stat_buf; int ret, fd, w, r; + int tmpfs = 0, hugetlbfs = 0; char buf[100]; FILE *memfile; va_list args; + /* memfd_create depends on tmpfs or hugetlbfs */ + tmpfs = stat("/tmp/.", &stat_buf) == 0; + hugetlbfs = stat("/hugetlb/.", &stat_buf) == 0; + + if (!tmpfs && !hugetlbfs) { + pad_spc(llen, 64, "[SKIPPED]\n"); + return 0; + } + /* silence warning for kernel >= v6.2: * * "memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid="