Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp646143ybk; Fri, 15 May 2020 09:52:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR4XfmFE0Swp/DBfWN7IwNEOI6s25jC+fe8vNc+paMMASn8PMXMLTcdhnzgXDrF3bxvoOL X-Received: by 2002:a17:906:1199:: with SMTP id n25mr770956eja.14.1589561534799; Fri, 15 May 2020 09:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589561534; cv=none; d=google.com; s=arc-20160816; b=nmmxN7HZcZTsQoBZ3Fui9dwGGPxjCxnJWJU9ZQAKCoGMVyQinaeODIJwER4SA4Xssi Yt+C9/C0j8vg0e1RbGNOdGJIbFb8WKh6jGZoR4efPRJC6FWwKZEf2gOPvr7wZOHCUdJ+ 6vHwMG1k4vj+azPVaZPtduFpASzpmrdmNpm1S9dVe86eDI4MGp1kulAucGAO6RAvbLVZ E9wGcgx1Hvv3/NJtg2xYqc2b5Y0xPKBXdGvbwJAhu9vmNDae2VZmZ1H7IaxYMo7dP8jV oMeMZumZvucK7iCgBd158+tsbKymFhWwoQSZdWpIAv9DQIWJHDEw5ISzFNiBdyadJF/0 OVhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=HRcsgixZKIGHXE809MZwKkXe7/yWNFRQw3Pqfn6iPQ4=; b=Jkb8NzRpLYZQ0uiYrnf4H/o2au6gh/xwLV4tlyZDyKNXuMeEtDnGJB9ky9YNasxcdb +01BPlqfNdDZtJC/V9dFazhqII4DfNSqonTFS6p0GVfQybWphSLnWxo9aWRx7hf58ara SXovpH7pdjWfC8FafgX9IFH04l+RXJNCYxSBZEhzF8wVhjg9xKJPT89vd1pqpOFmfx4H 8fF480xtmjvc5iWNaMJ6gDRXDQ3gG2454qouldbeUfBYcpdsJfuHWicEyD1plBhO3S3l Ye5rTuYkpWA7Heis9/pr9cCCLe4Z2G65huJqFfVMFqU2QBdtBl4++6AYpQ1Zcl3Z/uv8 r27w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ty9ss6ZF; 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 p9si1670191ejg.108.2020.05.15.09.51.51; Fri, 15 May 2020 09:52:14 -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=20161025 header.b=Ty9ss6ZF; 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 S1726670AbgEOQuZ (ORCPT + 99 others); Fri, 15 May 2020 12:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726660AbgEOQuW (ORCPT ); Fri, 15 May 2020 12:50:22 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74982C05BD09 for ; Fri, 15 May 2020 09:50:22 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id g6so3215276qvn.3 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=EdcoWeHwTwhYOrePFDTw+gZyMeIue8ooPmi9cOaeiB1kIV6b8SYK1g9SBqpIhjE5P6 JRUVmrJvP/2ZlSj1rU2BI6vuKTu1WydiChg95nae26lkh4/VNN3RLKldo2NwdvCk/XPE GH4aowrKU31YLNVFGLtgWTGuERft+foOO+LWSYa7ofrRNIJADMUvIgcjEyAYryXzc4CZ hRb8Sowa1C+P8+Ap7+GRzUTHT9L9t113FnhR6HSvKfUcU8g/CTK/fTAmBieCTRvHIEcG nlAbW7r2v5Qgrq5tpYIrw0iyJkAe5TLNqr8+0MB+IPfFRx40nw0aD0iQSfHhiZl8IZmL /GCA== X-Gm-Message-State: AOAM532ZU9EKPvNTQJaFFaiMdYjI8M2cd1c7VLd1p6y9hydKepCtbUJY 2ik0U7ZU1AgDEMQuY9H5zp61eSpYbBTR 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.26.2.761.g0e0b3e54be-goog