From patchwork Fri May 15 16:50:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 219165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B52DC433E2 for ; Fri, 15 May 2020 16:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 289322078C for ; Fri, 15 May 2020 16:50:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ty9ss6ZF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbgEOQuk (ORCPT ); Fri, 15 May 2020 12:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726663AbgEOQuY (ORCPT ); Fri, 15 May 2020 12:50:24 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C825C05BD0A for ; Fri, 15 May 2020 09:50:22 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id h15so3220681qvk.0 for ; Fri, 15 May 2020 09:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=HRcsgixZKIGHXE809MZwKkXe7/yWNFRQw3Pqfn6iPQ4=; b=Ty9ss6ZF+Dkg8BzgAfgIZxpJLKi/+7c1ULD69kwV8E8EzgDH4EswWfAA+fgnXMwCrA eyqL2F2Zgvu0ZzQ0OHiLdtwnya1oLp2+h700/6dAhHL0g7eT474c754k1iEv3gNRr3wU 5GvMzg5ACPAkm5+Hg1AUq6s3T8cu9nprggCKzr9cBV3MqhT6IP1l6pKLdlLw60PF9h7P YgPZLPCCLaPY0TJhIyyo3MzXoKjGgf1OmmcjF7ubhdw5xNFFaYW7szurgXJSZsnA0Xmn XeYp3DI75axN+Bl7dnGgyF5ZzuYoEcFQGBs6ILM1iv3dAAfmnjeEs+Wxv3joxghkTL/0 3W6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=HRcsgixZKIGHXE809MZwKkXe7/yWNFRQw3Pqfn6iPQ4=; b=CBAesjx2M4rQMS48V0hGUm1SFL5GxoNVhf7ufD9r1svHMo46a/c4gHSYjKc8TrUKTt Wj7UC14CpuCi/dR9mIZFKuxKA4OA4CP0xmvVAkjXXepUVTYhNOp1PmKwSJXyPocJJipG vGG0jdeuBFud9Dnim829iHrBMI224cYiWTxBp5qkWjsksTsJUU0tZnyXWHxKLxDhvhGg pPPY3CoDp50/FAHpymGIWnECgrlBFaVwUSZwqm2chZF/HbUZTqJCHypSgnAB54TV4jk/ jgXLatw40/aqUXJhCVhOvdTSfmSMuj3jjYQrn8RP47FUYBt81Je860CJNjo6R4zZZ8+0 v86Q== X-Gm-Message-State: AOAM533Guv2Cvphf7n5I5CH82ysJ6Aqr3fKdTdjrcSJfnHh+riKFKK9j yvY58ig+U7/pRhIpj4OMo7joDssItpB1 X-Google-Smtp-Source: ABdhPJzdkZmiAD7+WG9HYDPYJtwE9sP5O4jfN3LNO0DqKa5LmIg6bGj172k+mPgkkH80yUyWNr6lczkXSpaW X-Received: by 2002:a0c:f407:: with SMTP id h7mr4274894qvl.116.1589561421592; Fri, 15 May 2020 09:50:21 -0700 (PDT) Date: Fri, 15 May 2020 09:50:05 -0700 In-Reply-To: <20200515165007.217120-1-irogers@google.com> Message-Id: <20200515165007.217120-6-irogers@google.com> Mime-Version: 1.0 References: <20200515165007.217120-1-irogers@google.com> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH v2 5/7] perf test: Provide a subtest callback to ask for the reason for skipping a subtest From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Kajol Jain , Andi Kleen , John Garry , Jin Yao , Kan Liang , Cong Wang , Kim Phillips , Adrian Hunter , Leo Yan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Stephane Eranian , Ian Rogers , Paul Clarke , Arnaldo Carvalho de Melo Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now subtests can inform why a test was skipped. The upcoming patch improvint PMU event metric testing will use it. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jin Yao Cc: Jiri Olsa Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Paul Clarke Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20200513212933.41273-1-irogers@google.com [ split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/builtin-test.c | 11 +++++++++-- tools/perf/tests/tests.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 3471ec52ea11..baee735e6aa5 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -429,8 +429,15 @@ static int test_and_print(struct test *t, bool force_skip, int subtest) case TEST_OK: pr_info(" Ok\n"); break; - case TEST_SKIP: - color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n"); + 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); + else + color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n"); + } break; case TEST_FAIL: default: diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index d6d4ac34eeb7..88e45aeab94f 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -34,6 +34,7 @@ struct test { bool skip_if_fail; int (*get_nr)(void); const char *(*get_desc)(int subtest); + const char *(*skip_reason)(int subtest); } subtest; bool (*is_supported)(void); void *priv;