Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp578895pxb; Tue, 15 Feb 2022 22:42:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaMvqwCv/XdXt5Fy5goON/HjioTH9xiT/yr+2ChfTc32rfe3SEQbOKHOOouJKNQKXUnaM2 X-Received: by 2002:a17:902:d502:b0:14b:4520:9380 with SMTP id b2-20020a170902d50200b0014b45209380mr1150848plg.53.1644993771857; Tue, 15 Feb 2022 22:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644993771; cv=none; d=google.com; s=arc-20160816; b=Xq2zjT338uZ+9RqYlS9PC8rnaRyJM49Qolh50qEd6BMyexfI5Lff0rTAZZPoTk+/Nl AqLmTH37pIPf7+RAT/wWtj0BvFW2+O3MrdphKWin4FeM5T1cAM78193UzVPVtYf9jmCY Y+k6M1B3qbMdwB3H6pug1c88WFbFHio/Gfh+rOIqMAiAkPoZ8eU19z7X96O5wbwYHHzP Q7HhgPxmMuUy5c1f+1U/5fKEf4AodE45DVtbh1h1MiP9OEfOO75+0iNYXZqiZsHPuo32 OTkVqRyCZn95dN2aisenRfKATmjziiqLwbcbQSnhJjvgEXmrysGMRCUkqyS91iTjuJlI vgUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr; bh=OgZA6PYf7jQ6WYppyVDfV5wGD/5iX3OpIUcP/DDpDmY=; b=ZPnOxEZ5GWneLq7VzIzW7F5hIw098zUQqmltAJLJh4ZmLETP3LMZjOcF4CF1utX/sv H62FJVihxl+MeeJs2g/4juvX0Af5sEmissP459OSjCJfwHmVvobTOIOj2yK8Y4qb9edy 3awvufjpk9zeMwgTqARXGqFELw0Cc8NYIvIku1VDisPu1ul7dhA5h1vlpRmY21vBfACu D7Kfrb3r9S3+kFlcLE3TBoHngssnZ4RJukNX3PIA+ngM+trXWjk5cg79l4nD8XXdT0l4 ioIJVJlVP7/w8tQSV/lnNJGRVKfX2xeVNnTOUCsZWLTtTqcT346oRmrx4X3EiY4LH8dk usXw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q8si203743pfk.281.2022.02.15.22.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:42:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2890A1E5F1C; Tue, 15 Feb 2022 22:31:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343693AbiBPC3R (ORCPT + 99 others); Tue, 15 Feb 2022 21:29:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbiBPC3O (ORCPT ); Tue, 15 Feb 2022 21:29:14 -0500 X-Greylist: delayed 63 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Feb 2022 18:29:02 PST Received: from esa6.hc1455-7.c3s2.iphmx.com (esa6.hc1455-7.c3s2.iphmx.com [68.232.139.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D32F4D30; Tue, 15 Feb 2022 18:29:02 -0800 (PST) IronPort-SDR: O71LzE2HZ2rK+V6H6KRTZDKR9c+9VzwtLs5r4eBl/lqnFWnyp/dJaNtvVF8zOMlsbHYoWfaup2 gn2IZiHkPQJU7ArbXDb3JJJMm9+blEVR5Vd23o7jqAcxn44cs6zih0w/9pxbDfeX8BFqsmpVqL bDKG9qNO5FXf4nD4VJkJwF0MCS4IvUelKOSzqkCS5T6rWeaPeu8DdYWuwJ4T87Ro3CcPN404Fu vkFoTx1fKGJHuqhYabIsXfPDX0Fe7EEOa5OWNOwD7CrnClPh35BbHluF4qQs3uI6o8HT4E8G1D C6DO5/RhVwW2r9vJiKPfErcl X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="63437440" X-IronPort-AV: E=Sophos;i="5.88,371,1635174000"; d="scan'208";a="63437440" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa6.hc1455-7.c3s2.iphmx.com with ESMTP; 16 Feb 2022 11:29:00 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id BDADE97F0C; Wed, 16 Feb 2022 11:28:58 +0900 (JST) Received: from yto-om4.fujitsu.com (yto-om4.o.css.fujitsu.com [10.128.89.165]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 0431FD9973; Wed, 16 Feb 2022 11:28:58 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by yto-om4.fujitsu.com (Postfix) with ESMTP id C42B94007E8D1; Wed, 16 Feb 2022 11:28:57 +0900 (JST) From: Shaopeng Tan To: Fenghua Yu , Reinette Chatre , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tan.shaopeng@jp.fujitsu.com Subject: [PATCH v3 5/5] selftests/resctrl: Fix resctrl_tests' return code to work with selftest framework Date: Wed, 16 Feb 2022 11:26:41 +0900 Message-Id: <20220216022641.2998318-6-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220216022641.2998318-1-tan.shaopeng@jp.fujitsu.com> References: <20220216022641.2998318-1-tan.shaopeng@jp.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 In kselftest framework, if a sub test can not run by some reasons, the test result should be marked as SKIP rather than FAIL. Return KSFT_SKIP(4) instead of KSFT_FAIL(1) if resctrl_tests is not run as root or it is run on a test environment which does not support resctrl. - ksft_exit_fail_msg(): returns KSFT_FAIL(1) - ksft_exit_skip(): returns KSFT_SKIP(4) Signed-off-by: Shaopeng Tan --- Some important feedbacks from v1&v2 are addressed as follows: - It is important to highlight that a skipped test is marked as successful to not unnecessarily report a feature failure when there actually is a failure in the test environment. => I highligted this content in changelog as follows. "In kselftest framework, if a test is not run by some reason, the test result is marked as SKIP rather than FAIL." - The subject line can be made more succinct while the details are moved to the commit message. => I made subject line succinct and moved the details to changelog. - How changing ksft_exit_fail_msg() to ksft_exit_skip() accomplishes the goal of unifying the return code. => In changelog, I explained why return code KSFT_SKIP(4) is needed in kselftest framework and the return code of each function. tools/testing/selftests/resctrl/resctrl_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 973f09a66e1e..3be0895c492b 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -205,7 +205,7 @@ int main(int argc, char **argv) * 2. We execute perf commands */ if (geteuid() != 0) - return ksft_exit_fail_msg("Not running as root, abort testing.\n"); + return ksft_exit_skip("Not running as root, abort testing.\n"); /* Detect AMD vendor */ detect_amd(); @@ -235,7 +235,7 @@ int main(int argc, char **argv) sprintf(bm_type, "fill_buf"); if (!check_resctrlfs_support()) - return ksft_exit_fail_msg("resctrl FS does not exist\n"); + return ksft_exit_skip("resctrl FS does not exist\n"); filter_dmesg(); -- 2.27.0