From patchwork Thu Mar 9 14:57:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Newman X-Patchwork-Id: 66934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp351159wrd; Thu, 9 Mar 2023 07:24:42 -0800 (PST) X-Google-Smtp-Source: AK7set+uWDzWF5BsOGauCqYQ7O8cZwyNXXOaBthhSgiiec0AflVcibNDEdKMQ6HhmNTf9tmxWu63 X-Received: by 2002:a17:903:32ca:b0:19c:e937:6d04 with SMTP id i10-20020a17090332ca00b0019ce9376d04mr28706940plr.0.1678375482395; Thu, 09 Mar 2023 07:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678375482; cv=none; d=google.com; s=arc-20160816; b=jruVTrXvJ4nbSQtiMPi7FWsYEAyTXIInfSaLCphwJvZx/j1gNf6VsglWDIiYO9bLGx ddl1Nb5yPXxkzcd38PbOchZfE26PwHCzjzVjelMAgFUubT+SXgshPEUp9odk57CSSh3Y zF9p30oDwCdhb1+Qq+UPoWYsT3GiO8EBNi9l0vXOEXM/q8wQYrAFYQXXab05to2n3m1Q DV+ERWOvf9SmY0kYA/URsZr0xpdZjAacC3N+/525k8GoxB9808XSH8qj9vp+JYUAbVpd uumRjcUSHKhQH3SWRP9zRyZwSBUmeNZ73HIun9d64xC1h1wacJ0SxI2GD3cSRuGw10uj H8jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=bEFeJ9xyxhy0W7bJZiAq/kKy1WMrrLIg7OiI+XOB/AI=; b=r44Bg4/wcufJqBY+VVFJIsczzWPB9ehooj0UfR7CcK8I82tic2C5Kt7CWq3P6MAAOp l0AwskKjeuR944NrEKTiWp27crUEKG+ZNmpkx+OQsM6/tLVujm4r0jv4/GX6opfUlkqP SSOFPGr56jqMiKMVYMSz91Llb3yNCkFWiOs+P9Ywq2dMjc40t1AgArD3KZgU5E0bKRGm MVr74LK4cuxrvWjRMkYdtHiSoW0xJkhUvs9wAIyh+dft3BxyImAG94l9ysHlkPN77P0X vQ8IyJih5z5w/Vh118oHKfwnj26rP12G3iuL2kU9M8vYzh7FN2CXlcpozQx6mcckJXyJ apzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AECFctgy; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt4-20020a170903088400b00194bcc88b52si16638675plb.363.2023.03.09.07.24.25; Thu, 09 Mar 2023 07:24:42 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20210112 header.b=AECFctgy; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbjCIPCe (ORCPT + 99 others); Thu, 9 Mar 2023 10:02:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbjCIPBq (ORCPT ); Thu, 9 Mar 2023 10:01:46 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E904BE41C7 for ; Thu, 9 Mar 2023 06:58:39 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-536cb268ab8so22173107b3.17 for ; Thu, 09 Mar 2023 06:58:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678373919; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=bEFeJ9xyxhy0W7bJZiAq/kKy1WMrrLIg7OiI+XOB/AI=; b=AECFctgy1Pb6vzSBgJ5svnQmNInplL1FiLFI2a2aQW8hYY0ThUh2VXXfsjbvTYbuxp 8bYTu6CJ5iozTv5Q1hZT/09unkP8ISm2HYkFp8SM9xTFypTEUXFmzIS+yWoNWdtpiBRQ f20CjjG1vOvbxVh1dWew0Z11D4PAp1XilSYSNoSSJSrRs19Mi8uqELGYfgXwZCjfswiB nc+ASgKzk7rzNu8E3BELtDZggkPQ2Mp7dcaGHHoUAeZaxn+HtSuyeFKjFTJCEbOJT2w6 R6C96lohFpiGLEfxtvwzPM6D2Ox5o45l6dH/w8a/m+X9qtAbR7tlPegUZcOvFr8sj3XO G90A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678373919; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bEFeJ9xyxhy0W7bJZiAq/kKy1WMrrLIg7OiI+XOB/AI=; b=746b3Nqfql/p2IqsnIcq6SpJmfqiMdKzcvPnsmt7cpWTa2DITdI6idYQaU1unuu5F1 1hA2AB/uLiUoGKF7eapGxxcR/fTK4AhUawVaCkf3N+kEcd4nJHM68wxNwJPCkb06VDs9 oE1lduwrkLsm1GogqcA6InSm4v0RDKam7f4rS3hQV7mfoBdfxTZkvnq+41RXbDhYDg/d sgJ2tyo9VLX0s7vSX+qR/evrp1aPlL9TNES+zQ2ga6c+gPdAX7/sydHO1gPSWj9NpgZ7 sHMZVhHwrTyEbkxEv7/f3QAtvpIADekeJCANbwyZ2vbHdVKN64W3od/+no0MiXdMYKuy TjBw== X-Gm-Message-State: AO0yUKWd36uiYGftc3HdjR6xA42pK40p/WGQ4op7d33d+P+cNuYjPA5C uQlyW998z2KuCqXXS3xhIuZURrx7fuHMe0YB9A== X-Received: from peternewman0.zrh.corp.google.com ([2a00:79e0:9d:6:9c2a:d34f:579c:b74e]) (user=peternewman job=sendgmr) by 2002:a25:9f84:0:b0:8ac:72e3:c743 with SMTP id u4-20020a259f84000000b008ac72e3c743mr3566181ybq.9.1678373918808; Thu, 09 Mar 2023 06:58:38 -0800 (PST) Date: Thu, 9 Mar 2023 15:57:57 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog Message-ID: <20230309145757.2280518-1-peternewman@google.com> Subject: [PATCH] selftests/resctrl: Use correct exit code when tests fail From: Peter Newman To: Fenghua Yu , Reinette Chatre Cc: Shuah Khan , Shaopeng Tan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, eranian@google.com, Peter Newman X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759904249807760305?= X-GMAIL-MSGID: =?utf-8?q?1759904249807760305?= Use ksft_finished() after running tests so that resctrl_tests doesn't return exit code 0 when tests fail. Consequently, report the MBA and MBM tests as skipped when running on non-Intel hardware, otherwise resctrl_tests will exit with a failure code. Signed-off-by: Peter Newman Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre --- tools/testing/selftests/resctrl/resctrl_tests.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) base-commit: c9c3395d5e3dcc6daee66c6908354d47bf98cb0c diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index df0d8d8526fc..69ebb0d7fff6 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -77,7 +77,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, ksft_print_msg("Starting MBM BW change ...\n"); - if (!validate_resctrl_feature_request(MBM_STR)) { + if (!validate_resctrl_feature_request(MBM_STR) || (get_vendor() != ARCH_INTEL)) { ksft_test_result_skip("Hardware does not support MBM or MBM is disabled\n"); return; } @@ -98,7 +98,7 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, int span, ksft_print_msg("Starting MBA Schemata change ...\n"); - if (!validate_resctrl_feature_request(MBA_STR)) { + if (!validate_resctrl_feature_request(MBA_STR) || (get_vendor() != ARCH_INTEL)) { ksft_test_result_skip("Hardware does not support MBA or MBA is disabled\n"); return; } @@ -258,10 +258,10 @@ int main(int argc, char **argv) ksft_set_plan(tests ? : 4); - if ((get_vendor() == ARCH_INTEL) && mbm_test) + if (mbm_test) run_mbm_test(has_ben, benchmark_cmd, span, cpu_no, bw_report); - if ((get_vendor() == ARCH_INTEL) && mba_test) + if (mba_test) run_mba_test(has_ben, benchmark_cmd, span, cpu_no, bw_report); if (cmt_test) @@ -272,5 +272,5 @@ int main(int argc, char **argv) umount_resctrlfs(); - return ksft_exit_pass(); + ksft_finished(); }