From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11160C433FE for ; Fri, 13 May 2022 15:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382036AbiEMP3T (ORCPT ); Fri, 13 May 2022 11:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382012AbiEMP3N (ORCPT ); Fri, 13 May 2022 11:29:13 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E03C76A009; Fri, 13 May 2022 08:29:10 -0700 (PDT) Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4L0C9V3WMHz6H6vZ; Fri, 13 May 2022 23:24:14 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 13 May 2022 17:29:07 +0200 Received: from [10.47.25.226] (10.47.25.226) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 13 May 2022 16:29:06 +0100 Message-ID: <6341384c-b3e6-fbe5-f29f-e0db114bd439@huawei.com> Date: Fri, 13 May 2022 16:29:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 1/7] perf test: Skip reason for suites with 1 test To: Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , "Namhyung Kim" , Riccardo Mancini , "Sohaib Mohamed" , Carsten Haitzler , Marco Elver , Michael Petlan , , CC: Stephane Eranian References: <20220513040519.1499333-1-irogers@google.com> <20220513040519.1499333-2-irogers@google.com> From: John Garry In-Reply-To: <20220513040519.1499333-2-irogers@google.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.25.226] X-ClientProxiedBy: lhreml748-chm.china.huawei.com (10.201.108.198) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On 13/05/2022 05:05, Ian Rogers wrote: > When a suite has just 1 subtest, the subtest number is given as -1 to > avoid indented printing. When this subtest number is seen for the skip > reason, use the reason of the first test. > > Signed-off-by: Ian Rogers > --- > tools/perf/tests/builtin-test.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c > index fac3717d9ba1..33fcafa0fa79 100644 > --- a/tools/perf/tests/builtin-test.c > +++ b/tools/perf/tests/builtin-test.c > @@ -137,10 +137,10 @@ static bool has_subtests(const struct test_suite *t) > > static const char *skip_reason(const struct test_suite *t, int subtest) > { > - if (t->test_cases && subtest >= 0) > - return t->test_cases[subtest].skip_reason; > + if (!t->test_cases) > + return NULL; > > - return NULL; > + return t->test_cases[subtest >= 0 ? subtest : 0].skip_reason; > } I was not sure which suite has a single tastcase, so I experimented for libpfm4 by deleting a testcase so it has only 1x remaining, I get: before your change: john@localhost:~/acme/tools/perf> sudo ./perf test 63 63: Test libpfm4 support : Skip after: john@localhost:~/acme/tools/perf> sudo ./perf test 63 63: Test libpfm4 support : Skip (not compiled in) Although it is odd to have a single sub-test, is there a reason for which we don't print its name? We print the name when there are multiple sub-tests. Thanks, John