Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp792293pxb; Mon, 25 Oct 2021 19:07:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFs4aBkQU6TTsSYSEwYLie6v9ZTOAFSE/EIq8hJFIK7hOxPTGMJQd458vdtabU4Ewp8XuM X-Received: by 2002:a05:6402:3588:: with SMTP id y8mr30987168edc.285.1635214035651; Mon, 25 Oct 2021 19:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635214035; cv=none; d=google.com; s=arc-20160816; b=OsJcKb3+dU2GI6BmYvKGIxe3HoRppZZ5C8N+qk+NYOV8XLPrTjbCrlLveYV85tTcrV uNVG45URCvLCbnC9UHlGAqOi4iGpCoac1FTOgcgrZFP/62+fqOPxg/at4PeBkiIsQGPC 78rz0KDE3hJlxbURiPNP9Wnx5rA9CFhbypJ8g1h52Qaw2ERPcpc3GL9Pjl+R60LGHF7M wZUVsORt9XaI3vnlw2R2QeB9TnA7ZdQTsPhffR98etO1MOtNCB0CVxQMj1UsjGn6geWx ilP/MpdGZ0zeNNf/UbLl2vLyNFiaHEfxNRkwIPaS9UgsckxNXebz/cIgi84Qx5PEMd2l wprw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=klXlN0zJqmk1eWnEu+/hXLI1dokmsVhjoAFEcoHuwqQ=; b=hFhD+8+9CAYptAdjGbZ8+yWZ2sYTCOlJtZCC+Cc65PY9mxt9pCct6Ce8mRBofbArzQ g+4ST4c6nfIwBToLH+jdTkxk0FLC6cyiTCtgDP+/HQu35Gdlvqrdj9WrGxvfY3aoPxlA +09hr1jYk3LLiqZsbqD7U4HfVmrUMpfzFIrC9r70d5wzChJ2zIB5uBZIA04IWOgN9Jvi GgL0eAlhGpX1FErbcm7FXk3CkGLK6jfJqiO60AhZakclkq+AJxBLv+AWMV78hd9s7whE n8Svy/zlP6ktucq9Q49QnHGZbP0XmLocPAzDekluIH+EossXiL8pfw7C85J0qHgZga8S 6raA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=aGRYtffq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q15si23298229edc.620.2021.10.25.19.06.50; Mon, 25 Oct 2021 19:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=aGRYtffq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232241AbhJYWh5 (ORCPT + 99 others); Mon, 25 Oct 2021 18:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbhJYWh4 (ORCPT ); Mon, 25 Oct 2021 18:37:56 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8E49C061767 for ; Mon, 25 Oct 2021 15:35:33 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id q6so13572104iod.7 for ; Mon, 25 Oct 2021 15:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=klXlN0zJqmk1eWnEu+/hXLI1dokmsVhjoAFEcoHuwqQ=; b=aGRYtffqOi9dXZ21RrjBjD+l82dN+ifp8T+Q11C1BXTSKNp87NEYH/sGros9Un1tIV ISYmYeKll86s2JbJqasIxVigulSD/WoVDZU2vCptei1vtpaT7i7H4Y/PYOK7A00JhWZ4 MFAZUlb/5ouNzs4+yNq35EminP3BzcGrnzFlCM8iRQP1DJgeebqvSk+4bVf5LmyXEC7J aS3nNwSL3X7nz48mF+9h3tASo9lBbNBMQHQIeSOLuWQfjkTISoac3sGqlJRWyuKZDuIx rhoUJ6YjOR7k6eibf6iBxDvOr82MVzlt6NPHX/yOqY8kE195MR+TEVQGuBEwDogVpGgA CRlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=klXlN0zJqmk1eWnEu+/hXLI1dokmsVhjoAFEcoHuwqQ=; b=uxG2BPm4jH3ZSJLt8yztdsfht6OL0OVkwCeOetVU2djNj4eDOp7TDOBoNrcH1GD1Id yDWYL8u50SY6CLmP1IV9NlgC4czTijz21s9IlWbIxR/wQF8A5p49JI3gFFobAg2vIfBb EbTev04Icy6pZa2Fy2RwaQJJCGupKNoKOHkkvzAFVpxcEU91PsRAxVvuYYP5c2MROkCN EOYpFYdPgQrULvaETs9ZE6Q/2Up7N/kVWGPJMSMk4b72yO0MiQPM/j3+Bi6ADId7gadl LHan+BiRQSRPUl7eMWry2LDG032ualAg7tniLYtsPcNunQZzgSTuHyU1K/70ONCTPCZd tg/A== X-Gm-Message-State: AOAM532Ui/Sceij5qXIwyeaLNa+aSKWfcw1M1jB5JiOMtGDryXW08SY7 o6tsjyAVC6FwqEVOzKVXwJg11ALWELeookUQArT2mQ== X-Received: by 2002:a05:6638:4115:: with SMTP id ay21mr12897670jab.90.1635201332884; Mon, 25 Oct 2021 15:35:32 -0700 (PDT) MIME-Version: 1.0 References: <20211013174604.747276-1-irogers@google.com> <20211013174604.747276-7-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Mon, 25 Oct 2021 15:35:20 -0700 Message-ID: Subject: Re: [PATCH v2 06/22] perf test: Add helper functions for abstraction. To: Jiri Olsa Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Jin Yao , John Garry , "Paul A . Clarke" , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Brendan Higgins , Daniel Latypov , David Gow , eranian@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 5:34 AM Jiri Olsa wrote: > > On Wed, Oct 13, 2021 at 10:45:48AM -0700, Ian Rogers wrote: > > SNIP > > > else > > pr_debug("%s subtest %d:", t->desc, subtest + 1); > > @@ -218,11 +257,10 @@ static int test_and_print(struct test_suite *t, bool force_skip, int subtest) > > pr_info(" Ok\n"); > > break; > > case TEST_SKIP: { > > - const char *skip_reason = NULL; > > - if (t->subtest.skip_reason) > > - skip_reason = t->subtest.skip_reason(subtest); > > - if (skip_reason) > > - color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", skip_reason); > > + const char *reason = skip_reason(t, subtest); > > + > > + if (reason) > > + color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", reason); > > else > > color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n"); > > } > > @@ -397,7 +435,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) > > int width = shell_tests__max_desc_width(); > > > > for_each_test(j, k, t) { > > - int len = strlen(t->desc); > > + int len = strlen(test_description(t, -1)); > > > > if (width < len) > > width = len; > > @@ -407,17 +445,15 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) > > int curr = i++, err; > > int subi; > > > > - if (!perf_test__matches(t->desc, curr, argc, argv)) { > > + if (!perf_test__matches(test_description(t, -1), curr, argc, argv)) { > > bool skip = true; > > int subn; > > > > - if (!t->subtest.get_nr) > > - continue; > > - > > - subn = t->subtest.get_nr(); > > + subn = num_subtests(t); > > should you call continue on !subn ? It's not necessary. When subn == 0 then the loop won't be taken and skip == true, so the immediately after "if (skip) continue;" will happen. Thanks, Ian > jirka > > > > > for (subi = 0; subi < subn; subi++) { > > - if (perf_test__matches(t->subtest.get_desc(subi), curr, argc, argv)) > > + if (perf_test__matches(test_description(t, subi), > > + curr, argc, argv)) > > skip = false; > > } > > > > @@ -425,22 +461,23 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) > > continue; > > } > > > > SNIP >