Message ID | 563c1ceb201ad95221610ef3a4aaed48640b4e8d.1688750763.git.falcon@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3478372vqx; Fri, 7 Jul 2023 12:03:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlHn25R2xCgSJZlOAPaaO6XnZUnJRoEDj/oyCXQo8rakMwDRt7ghIbYj/O7NCzVH26SvIzD6 X-Received: by 2002:a05:6402:274c:b0:51b:d59f:8518 with SMTP id z12-20020a056402274c00b0051bd59f8518mr9993133edd.16.1688756604550; Fri, 07 Jul 2023 12:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688756604; cv=none; d=google.com; s=arc-20160816; b=YRoGhj5m4pKFdrDYC8CX2HAV5Oghd6pq+2nR44qRVfPWVCliroo81o5Z0Orvylw0tq HYbtL631bNCxK4TXGp3jRbh2EKRt7QWEFz3Gp/duZhGEnI4BEHNsM85ANQFvduBvylqR vqTJyOtddsI1L+0WE3KGNQsvXo3aG8jYcXzIB9C82sGTb6Dlzx5PwLPzs80U8MWiHHt0 1VXpMfsvtPtMFejTjLSpcnKqBQyr/7wcfrhlUUSpqUzgA14p50hdiEP9gvcNYo+blV9K nCExXFuIbXDtxxvF0/KQkh4USRaHNJIaialOXgBImcjyodNVbDbqjh/wvojltwGIzSCH 2JDg== 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=ZwZ7hWRCf5LDBLhAmLzjVTH9/Klk+BIO7SkHbUBqETg=; fh=+UJGAEU2Zd20Ffzlyw2DOtwfBiThnaWweXJeIpZW2cQ=; b=v+QnZbxTZEcio2aLzYCWv6AFI/YOQB1SGr7rPCcMH6+6s+AVYlhsh0SeA1JrWstsby f0pLyhEuEH2JgBK7tIK0IM4EcONhIJX+9JWfO0pBMhREtEMQmHW3t7Snx1glKuWp9y32 bmO1ZTV1JqXxxQ9ftx5Vg16DVzM/vbbTnjSw5PkxxmgQP35r4fey0GI4/RurJU6TuSd5 fLCMDgq866Z86Wz4NouP/r8y6voJ3Vv0fXosuXLo3xJ/4vJMBaJZdctuhzdKRFhXn8Zx Wcu8ivb+lf+/aY0iNr9pXwTMIw//F8phZDfWHH7++nmL4d5ptq5FTfBitktXIpqIHv7a 3pvw== 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 w14-20020a50fa8e000000b00516b291217fsi2679804edr.0.2023.07.07.12.03.00; Fri, 07 Jul 2023 12:03:24 -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 S232113AbjGGSiH (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Fri, 7 Jul 2023 14:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbjGGSiG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Jul 2023 14:38:06 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D896D2130; Fri, 7 Jul 2023 11:38:04 -0700 (PDT) X-QQ-mid: bizesmtp76t1688755075t7a4e2ih Received: from linux-lab-host.localdomain ( [116.30.131.119]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 08 Jul 2023 02:37:54 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: ShvZ91UTFj5yB/+Ev38CMV6CIpBprc4qrbbU2hYxpW1GkZvzMatwzYL4FyhsW 3PRijSlAFL9abUjBsl9bR0EMlSyhRsjaTrNV0VJIz9o2Lu3s/NxlwYtWnq5IZlpkP8qwLGZ byyUrdoh7A4uqCtoGF++2PSdPA/ghnEGO55qrfHpYNJR8v0kep7i2XxsZSuOzQpBbMK69ka PtjnVo06Ej+OrvisdUcKHfKsWkMhfgkIAsSMqnNV5Jh3OdURa4Ccfkun3cDNHID0Dd9gxM+ rO728L8eoQTBwez3nXhh7MOx4PQwCd1Yju0SaeD4mkq4bp/B1gSMysr++ZXflvaxUHsCV6A wcc8O2OMkrgxrhWjIV49plnXKA5wQaw5nCuXfaraIM5mKFGlDBUp2SaFKsJkw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8013575817692833523 From: Zhangjin Wu <falcon@tinylab.org> 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?= <linux@weissschuh.net> Subject: [PATCH v4 12/18] selftests/nolibc: fix up failures when CONFIG_PROC_FS=n Date: Sat, 8 Jul 2023 02:37:45 +0800 Message-Id: <563c1ceb201ad95221610ef3a4aaed48640b4e8d.1688750763.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1688750763.git.falcon@tinylab.org> References: <cover.1688750763.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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_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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770789645651082544?= X-GMAIL-MSGID: =?utf-8?q?1770789645651082544?= |
Series |
selftests/nolibc: allow run with minimal kernel config
|
|
Commit Message
Zhangjin Wu
July 7, 2023, 6:37 p.m. UTC
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. Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- 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 deff804e0753..5497ee86cf40 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1056,8 +1056,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;