Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21478394rwd; Thu, 29 Jun 2023 17:10:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71Y7aKuqKu+X3SkZNp5S/aU7J7AoGfUdhDIY3NXFH/93v+9L0GzbSuPuLU2syKjWqH7lBO X-Received: by 2002:a05:6830:1d54:b0:6b8:9a3a:ea12 with SMTP id p20-20020a0568301d5400b006b89a3aea12mr1701675oth.12.1688083837251; Thu, 29 Jun 2023 17:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688083837; cv=none; d=google.com; s=arc-20160816; b=ADCqQPHGQaRbLTDqrIvLf7GQ3PrVVMRkNs5z3EkaF6EZom9yH9G7u7A9VSZ30Ws9DQ xaz7NYoroCruU55uIP3Y1FTtE3jC7TUazLpfNCUNoNgWl783/lXdaP+vZKgVASvyNyec hTRyRJgR2RxdDBI6qTwROpYDXOymTKtxBAr0A1HNzb2BWfKWIcbFLdUwdgYyKohNBs1O LXJwEsI1MLg7S6MVIiRQ/kJnNHRu0cViFfsZK7mBICfKUD2t3kOOfJV+ySetIjfXT5+a sOIVGwe8L1SWdz5PikV7JECiBkTNqZUMGf2tRo/5fG+ExyfdBZRgwpZhzTZcvXofIuCT g8zg== 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=upspyDq1/ll+yZphJ8mrEvzCmBaZDOBHIpgg402v3Z8=; fh=GzghTQzqgly4pZn8BwQ4U8bZ8zCadAK8Sl/utskeyEs=; b=wtyA7tDYHRs0VtzIQ86iFb463LFmbeThRYPLWuPi9DvHILoCTuOmYVxuiMATHTylxP Y8mRxSbhF5HviwljED9CMHel1fInKJlk+5aMaOYUZ0yW/sgLedUNsoyXGdyPlvACdEYp ANdsyTvM5u2Z4eMp3aPfgFrnsQJVoHRryeS9yfsIkXPN1hI8KsDbZJx7VMbWcM6VOWtt y5T8QLyFkqozC391WQaSa4ct5SLORZsTxEXDCzBDS1LXnq7+zoynznl5p8wjFtyjWsqG 7Sgw3pQvsEQ6SxRJJNqOCTisQkQ/7HEs5/48hiIYnc23i7pmQmJ/bF+N+DLQwROuS7kU UiDQ== 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 u189-20020a6385c6000000b00553a99dd783si11573605pgd.778.2023.06.29.17.10.22; Thu, 29 Jun 2023 17:10:37 -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 S231443AbjF2XvW (ORCPT + 99 others); Thu, 29 Jun 2023 19:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbjF2XvT (ORCPT ); Thu, 29 Jun 2023 19:51:19 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B3592D56; Thu, 29 Jun 2023 16:51:10 -0700 (PDT) X-QQ-mid: bizesmtp83t1688082660twu7a8ef Received: from linux-lab-host.localdomain ( [119.123.131.49]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 30 Jun 2023 07:50:58 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: D2GZf6M6C/i23X3okTEDyY7sY3qClIpPp5F6NuS/AEEIAEVpfzZOlfZdTUae/ 8CfRQul6j18UQzkvZt4EsG5DY7/jNUNQinzpFR6x/BTidUBNAu9H2aVgrxP7o2Q7pS7SCfg w5kxfiqw3cg2/Olv9TybUurx+SRkjOzWzeDs/NRYj3Q5/ToQPoACfSxqmES7ywPwYJabr2g 0g6EM//dSBgtZRsUVY5Bc4/1Vw1kaRxeEiQ7/prMFw7/U1s7lOJqskt9aYv3ariLgg5Q8t/ KW9cw0ditY8PZiICS5z9ENmLuWC56RUovXsksri2oZLW9rd07Bvtrx0qYtrw3KdX2junOQT +7T0Y8lW34Z+6nDzkXxM9rGwCchPB4d3xzAqiL5qMR17heqzC0iW53NX0FHnQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 18297835509952804073 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 10/15] selftests/nolibc: fix up failures when CONFIG_PROC_FS=n Date: Fri, 30 Jun 2023 07:49:42 +0800 Message-Id: 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: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: X-Mailing-List: linux-kernel@vger.kernel.org For CONFIG_PROC_FS=n, the /proc is not mountable, but the /proc directory has been created in the prepare() stage whenever /proc is there or not. so, the checking of /proc in the run_syscall() stage will be always true and at last it will fail all of the procfs dependent test cases, which deviates from the 'cond' check design of the EXPECT_xx macros, without procfs, these test cases should be skipped instead of failed. To solve this issue, one method is checking /proc/self instead of /proc, another method is removing the /proc directory completely for CONFIG_PROC_FS=n, we apply the second method to avoid misleading the users. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 2725d3dbfaf0..c0f5302ada5d 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1047,8 +1047,11 @@ int prepare(void) /* try to mount /proc if not mounted. Silently fail otherwise */ if (stat("/proc/.", &stat_buf) == 0 || mkdir("/proc", 0755) == 0) { - if (stat("/proc/self", &stat_buf) != 0) - mount("/proc", "/proc", "proc", 0, 0); + if (stat("/proc/self", &stat_buf) != 0) { + /* If not mountable, remove /proc completely to avoid misuse */ + if (mount("none", "/proc", "proc", 0, 0) != 0) + rmdir("/proc"); + } } return 0; -- 2.25.1