Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9360722rwd; Wed, 21 Jun 2023 06:33:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CYo8BvlBIBaE9lvL8Oq/uJ5+/L3XfyFwgxshYwE0wijf6/PW8tqFlR1pt+65Xa7vbkjBD X-Received: by 2002:a17:902:f551:b0:1b5:4f50:f1e0 with SMTP id h17-20020a170902f55100b001b54f50f1e0mr10006894plf.29.1687354434348; Wed, 21 Jun 2023 06:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687354434; cv=none; d=google.com; s=arc-20160816; b=Der6qCanQo/oyC2wT6tLKWaAkH+fTPPWHFhVNCkEgd1bE8HJEsyPQQTkkajA5JzdD9 b0rUbviRmeXrFbg6cYPVc6oOWbtpruPXC0ymcwxN5tGlpqcAHqv78/7Bsvz7C2xEGv2h hqlCj/03tVT2pnH7Hl1HobLBlIuQAE2ItwYwik542HTtN3tCg91oq3QL5aYhUERYZdzK kmVQFS9BgLMLKyA+uBJxEixHqUnb8IYIIIdR+CsccOOybEeuwkIKeugc4l18q4q1lPqX bgcJz5zfB0PldBaU1HZ+6958oSm9/OwZfin3thzoKyN00iDnWVefjPlclX9OMxzqshdH AE6Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020a170902d19200b001a52db202c7si875872plb.382.2023.06.21.06.33.32; Wed, 21 Jun 2023 06:33:54 -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 S232484AbjFUNUZ (ORCPT + 99 others); Wed, 21 Jun 2023 09:20:25 -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 Content-Transfer-Encoding: 8bit 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 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=" -- 2.25.1