All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: acme@kernel.org, linux-perf-users@vger.kernel.org
Cc: James Clark <james.clark@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: [PATCH 2/3] perf tools: Fix LLVM test failure when running in verbose mode
Date: Tue, 31 Aug 2021 15:55:00 +0100	[thread overview]
Message-ID: <20210831145501.2135754-2-james.clark@arm.com> (raw)
In-Reply-To: <20210831145501.2135754-1-james.clark@arm.com>

A CI system might want to run all tests in verbose mode so that there is
enough information to diagnose issues. This LLVM test is the only test
that uses "-v" to signify to not skip the test if the preconditions
aren't met (LLVM isn't installed). This means that running the test in
verbose mode without LLVM installed causes a test failure.

For consistency with the other tests, remove this verbose/skip check. An
alternate solution would be to make _all_ tests not skip when run in
verbose mode, but I don't think that would be intuitive.

Also change the search_program() call to search_program_and_warn().
Previously the hint about installing LLVM was only printed by the actual
test because this check was skipped in verbose mode. To maintain the old
behaviour, the precondition check must also print the full warning.

Previous output:

  $ ./perf test llvm
  40: LLVM search and compile                                     :
  40.1: Basic BPF llvm compile                                    : Skip

  $ ./perf test -v llvm
  40: LLVM search and compile                                     :
  40.1: Basic BPF llvm compile                                    :
  --- start ---
  test child forked, pid 2085835
  ERROR:	unable to find clang.
  Hint:	Try to install latest clang/llvm to support BPF. Check your $PATH
  ...
  test child finished with -1
  ---- end ----
  LLVM search and compile subtest 1: FAILED!

New output (non verbose mode is identical, verbose changes from fail to
skip):

  $ ./perf test llvm
  40: LLVM search and compile                                     :
  40.1: Basic BPF llvm compile                                    : Skip

  $ ./perf test -v llvm
  40: LLVM search and compile                                     :
  40.1: Basic BPF llvm compile                                    :
  --- start ---
  test child forked, pid 2087680
  ERROR:	unable to find clang.
  Hint:	Try to install latest clang/llvm to support BPF. Check your $PATH
  ...
  No clang, skip this test
  test child finished with -2
  ---- end ----
  LLVM search and compile subtest 1: Skip

Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/tests/llvm.c      | 7 +++----
 tools/perf/util/llvm-utils.c | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 98da8a8757ab..33e43cce9064 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -67,12 +67,11 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,
 
 	/*
 	 * Skip this test if user's .perfconfig doesn't set [llvm] section
-	 * and clang is not found in $PATH, and this is not perf test -v
+	 * and clang is not found in $PATH
 	 */
-	if (!force && (verbose <= 0 &&
-		       !llvm_param.user_set_param &&
+	if (!force && (!llvm_param.user_set_param &&
 		       llvm__search_clang())) {
-		pr_debug("No clang and no verbosive, skip this test\n");
+		pr_debug("No clang, skip this test\n");
 		return TEST_SKIP;
 	}
 
diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c
index cec9c16efb17..d95c56d175bc 100644
--- a/tools/perf/util/llvm-utils.c
+++ b/tools/perf/util/llvm-utils.c
@@ -585,5 +585,5 @@ int llvm__search_clang(void)
 {
 	char clang_path[PATH_MAX];
 
-	return search_program(llvm_param.clang_path, "clang", clang_path);
+	return search_program_and_warn(llvm_param.clang_path, "clang", clang_path);
 }
-- 
2.28.0


  reply	other threads:[~2021-08-31 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 14:54 [PATCH 1/3] perf tools: Refactor LLVM test warning for missing binary James Clark
2021-08-31 14:55 ` James Clark [this message]
2021-08-31 14:55 ` [PATCH 3/3] perf tools: Fix LLVM download hint link James Clark
2021-08-31 18:18 ` [PATCH 1/3] perf tools: Refactor LLVM test warning for missing binary Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831145501.2135754-2-james.clark@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.