From patchwork Fri Jul 7 18:43:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13305181 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 1F5C7EB64D9 for ; Fri, 7 Jul 2023 18:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232723AbjGGSoS (ORCPT ); Fri, 7 Jul 2023 14:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232718AbjGGSoR (ORCPT ); Fri, 7 Jul 2023 14:44:17 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A0722684; Fri, 7 Jul 2023 11:44:15 -0700 (PDT) X-QQ-mid: bizesmtp63t1688755446tq21jiw8 Received: from linux-lab-host.localdomain ( [116.30.131.119]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 08 Jul 2023 02:44:05 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: uGhnJwy6xZK2nzJD+cc5kZhLnCKCdne1Sfn1JdSmLb7re57uLtOqm35U5ddys GFLzxnlh1Sxv6m4JRyUpmAa4AIbblGLl2nbv0I7OsuFuxSujLPifjVJnU2WipHjHY77aTAn XMCJ3xtv5jkAvnSMwtWG48/N8VTl2MX/ViF1B1zJqPghy6LXYvGq4ZNjVJtY/XuxjwlNHqp oJkZJPtS5NCXhYajJbNwoVS4uq2RRHjszfLxMJc0FCnvZcmkwuyLfu59mf2cJ+BThUvUqmP 3JtWYClB+QxvgFQG6MUHTGZ7ZCatDTbHkalQcS7xZx003ILw4PMM7fmfXkJ88fEadcnCqw1 0THSH3uA2CMbwSauyKirykkIZd/0j2iyLyqeWk2j2HNDc8hI6S8Mj9qqR6sU48rRqf1YyvU X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6129854655699815004 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, thomas@t-8ch.de, =?utf-8?q?Thomas_Wei?= =?utf-8?q?=C3=9Fschuh?= Subject: [PATCH v4 16/18] selftests/nolibc: stat_timestamps: remove procfs dependency Date: Sat, 8 Jul 2023 02:43:44 +0800 Message-Id: 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 '/proc/self/' is a good path which doesn't have stale time info but it is only available for CONFIG_PROC_FS=y. When CONFIG_PROC_FS=n, use argv0 instead of '/proc/self', use '/' for the worst case. Reviewed-by: Thomas Weißschuh Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 0ed207495ea6..2065b5b0d171 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -584,7 +584,7 @@ static int test_stat_timestamps(void) if (sizeof(st.st_atim.tv_sec) != sizeof(st.st_atime)) return 1; - if (stat("/proc/self/", &st)) + if (stat("/proc/self/", &st) && stat(argv0, &st) && stat("/", &st)) return 1; if (st.st_atim.tv_sec != st.st_atime || st.st_atim.tv_nsec > 1000000000)