Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp357434rdf; Fri, 3 Nov 2023 02:56:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYvW7xY2FvTqx/fumFCkgpfv9xOYQ0veuJGkeHpUuhWWcnrKgsvzHZacrn/HvYtZU5VPdo X-Received: by 2002:a17:907:3fa2:b0:9b2:bdbb:f145 with SMTP id hr34-20020a1709073fa200b009b2bdbbf145mr2445894ejc.34.1699005392065; Fri, 03 Nov 2023 02:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699005392; cv=none; d=google.com; s=arc-20160816; b=qjPlKKcUZ+NTqvzeE1xPbgfnhDR82zPnqwNGHmBzT+KjoCatss0Sg2RqW5pxLuffSo RhknpwiLt/uJc0v41zNHxiQDrPsV7WdjbPchqdlxxVwLJIOCGbUYonoe8TRjmCcse2bJ DeZtU+caYSHQ+CQbnVk4s9/jM0iBhDhEvRzx+FJRMrrkYcckylctvi6hUaBfme/Mm6xj cNv91FrYuWzP2Upltt9pVRVgxXucnamHO+dec/KFKcsDc+aHAvSQ7BftPGCWIJKDCnG7 aJmk80op05P5TD7OlIcV0KZ0XP8/FH6m52qA5ytWDqRN/jx1nDrRH5Z2bMtQyHQYFCZQ g9tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=0njPNc8sMLKtUok5+Ozsu1lDl7VeS/kBzUd6/9yysyI=; fh=XHJC3rNtFqy9NBdwfesynq0dG98cBzq8Qrv2Usg7GS0=; b=uxeqQXpFS0Lp4JEc9QPe74I4E3KyNXe2zGaiCdcPuY087JOwD7RVkBnMocAuGGH0LX mrshR+CWGkuoeBSTWMEpVfwLuQOmcKJHkQ35l8QPxwiIPfzA1lRqxaoTljnZ5k0CA2iF Hvg0APoLhOU04RUgQa4c37Xgp1NsAh8OMeZgpno0ZQ7E06GlHbjsg6lj7sCKacwt3HXj Xz7nU55LZakbkqaoTduOMgyyzcp3K/MD7/pIOm9ilAeXy6sqkTPRCMlL6dcbIWCxyy0T +gxURnvSGNek+KuEnCY/jOOafF46STrHbVRb1intxqStDgwIbdCIYK2G23UWKqP25EFv PqgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HuUl+btO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f8-20020a170906ef0800b009c45a6a86bcsi784570ejs.98.2023.11.03.02.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 02:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HuUl+btO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B9DD1805C146; Fri, 3 Nov 2023 02:55:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347536AbjKCJzN (ORCPT + 99 others); Fri, 3 Nov 2023 05:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347549AbjKCJzM (ORCPT ); Fri, 3 Nov 2023 05:55:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B035BD49; Fri, 3 Nov 2023 02:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699005304; x=1730541304; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=NSyd2tFqpwQi+DzpKhIJTBw3g3F0f78dLo/zLH6QgjA=; b=HuUl+btO67zZ4+uIqb5CLMI1MUe0jL5ybZKh9L8W+ArzQRHgHnekXvgi S2cK4ox+trYT/WELJPdH5+dR9CauNYrHCZaokwZ3pqjQe166eJUdcPf28 VXR+k9QgElm2zZScZEcQf2UsQNCwSp4LcsDKcETrbEjVzLIQzFNt2pjst qXnXoXrXnQzdxwW5GyhkNJoRstODl7K8d47EWyX7LRsLi7Qt/K3wbNbZP PiH/CAVSbo6zFPcdRc7AXeq0vIIRpl19AXWzPl4HZkV9jq/K4Tgpr3IpL zV6OGbx5PJl5/4rKaTnbbrrBTCLQ59f2mBbiYvc2fIzKmNpVVWBQ4uTvj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="10451100" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="10451100" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 02:55:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="9321815" Received: from pors-mobl3.ger.corp.intel.com ([10.252.35.38]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 02:55:01 -0700 Date: Fri, 3 Nov 2023 11:54:59 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Reinette Chatre cc: linux-kselftest@vger.kernel.org, Shuah Khan , Shaopeng Tan , =?ISO-8859-15?Q?Maciej_Wiecz=F3r-Retman?= , Fenghua Yu , LKML Subject: Re: [PATCH 18/24] selftests/resctrl: Introduce generalized test framework In-Reply-To: <56769c01-e21d-4775-94f0-ef9f863c1e92@intel.com> Message-ID: References: <20231024092634.7122-1-ilpo.jarvinen@linux.intel.com> <20231024092634.7122-19-ilpo.jarvinen@linux.intel.com> <56769c01-e21d-4775-94f0-ef9f863c1e92@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-2039173404-1699005303=:1725" X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 02:55:54 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-2039173404-1699005303=:1725 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Thu, 2 Nov 2023, Reinette Chatre wrote: > On 10/24/2023 2:26 AM, Ilpo Järvinen wrote: > ... > > diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h > > index ec6efd36f60a..e017adf1390d 100644 > > > @@ -233,25 +183,26 @@ int main(int argc, char **argv) > > case 't': > > token = strtok(optarg, ","); > > > > - mbm_test = false; > > - mba_test = false; > > - cmt_test = false; > > - cat_test = false; > > + if (!test_param_seen) { > > + for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) > > + resctrl_tests[i]->disabled = true; > > + tests = 0; > > + test_param_seen = true; > > + } > > while (token) { > > - if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) { > > - mbm_test = true; > > - tests++; > > - } else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) { > > - mba_test = true; > > - tests++; > > - } else if (!strncmp(token, CMT_STR, sizeof(CMT_STR))) { > > - cmt_test = true; > > - tests++; > > - } else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) { > > - cat_test = true; > > - tests++; > > - } else { > > - printf("invalid argument\n"); > > + bool found = false; > > + > > + for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) { > > + if (!strcasecmp(token, resctrl_tests[i]->name)) { > > + if (resctrl_tests[i]->disabled) > > + tests++; > > + resctrl_tests[i]->disabled = false; > > + found = true; > > + } > > + } > > Could providing multiple "-t" result in the test count not > matching the number of tests run? bool test_param_seen covers the case with more than one -t parameter. Because of it, the code above resets tests and ->disabled only when the first -t is encountered. tests++ is only done when ->disabled is set from true to false. I don't see how they could get out of sync but if you had a more specific case in mind, just let me know. -- i. --8323329-2039173404-1699005303=:1725--