Commit 597bdeb4 authored by Wang Nan's avatar Wang Nan Committed by Arnaldo Carvalho de Melo

perf test: Keep test result clean if '-v' not set

According to [1], 'perf test' should avoid output too much information
if '-v' is not set, only 'Ok', 'FAIL' or 'Skip' need to be printed.

This patch removes several messages sent directly to stderr to make
the output clean.

Before this patch:

  # perf test dummy
  23: Test using a dummy software event to keep tracking       : (not supported) Ok

After this patch:

  # perf test dummy
  23: Test using a dummy software event to keep tracking       : Skip

[1] http://lkml.kernel.org/r/20151020134155.GE4400@redhat.comSigned-off-by: default avatarWang Nan <wangnan0@huawei.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1446547486-229499-2-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent bebd23a2
...@@ -171,6 +171,5 @@ int test__attr(void) ...@@ -171,6 +171,5 @@ int test__attr(void)
!lstat(path_perf, &st)) !lstat(path_perf, &st))
return run_dir(path_dir, path_perf); return run_dir(path_dir, path_perf);
fprintf(stderr, " (omitted)"); return TEST_SKIP;
return 0;
} }
...@@ -613,16 +613,16 @@ int test__code_reading(void) ...@@ -613,16 +613,16 @@ int test__code_reading(void)
case TEST_CODE_READING_OK: case TEST_CODE_READING_OK:
return 0; return 0;
case TEST_CODE_READING_NO_VMLINUX: case TEST_CODE_READING_NO_VMLINUX:
fprintf(stderr, " (no vmlinux)"); pr_debug("no vmlinux\n");
return 0; return 0;
case TEST_CODE_READING_NO_KCORE: case TEST_CODE_READING_NO_KCORE:
fprintf(stderr, " (no kcore)"); pr_debug("no kcore\n");
return 0; return 0;
case TEST_CODE_READING_NO_ACCESS: case TEST_CODE_READING_NO_ACCESS:
fprintf(stderr, " (no access)"); pr_debug("no access\n");
return 0; return 0;
case TEST_CODE_READING_NO_KERNEL_OBJ: case TEST_CODE_READING_NO_KERNEL_OBJ:
fprintf(stderr, " (no kernel obj)"); pr_debug("no kernel obj\n");
return 0; return 0;
default: default:
return -1; return -1;
......
...@@ -90,8 +90,8 @@ int test__keep_tracking(void) ...@@ -90,8 +90,8 @@ int test__keep_tracking(void)
evsel->attr.enable_on_exec = 0; evsel->attr.enable_on_exec = 0;
if (perf_evlist__open(evlist) < 0) { if (perf_evlist__open(evlist) < 0) {
fprintf(stderr, " (not supported)"); pr_debug("Unable to open dummy and cycles event\n");
err = 0; err = TEST_SKIP;
goto out_err; goto out_err;
} }
......
...@@ -36,7 +36,7 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz) ...@@ -36,7 +36,7 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
static int test__bpf_parsing(void *obj_buf __maybe_unused, static int test__bpf_parsing(void *obj_buf __maybe_unused,
size_t obj_buf_sz __maybe_unused) size_t obj_buf_sz __maybe_unused)
{ {
fprintf(stderr, " (skip bpf parsing)"); pr_debug("Skip bpf parsing\n");
return 0; return 0;
} }
#endif #endif
...@@ -55,7 +55,7 @@ int test__llvm(void) ...@@ -55,7 +55,7 @@ int test__llvm(void)
* and clang is not found in $PATH, and this is not perf test -v * and clang is not found in $PATH, and this is not perf test -v
*/ */
if (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang()) { if (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang()) {
fprintf(stderr, " (no clang, try 'perf test -v LLVM')"); pr_debug("No clang and no verbosive, skip this test\n");
return TEST_SKIP; return TEST_SKIP;
} }
...@@ -86,11 +86,8 @@ int test__llvm(void) ...@@ -86,11 +86,8 @@ int test__llvm(void)
err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz); err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz);
verbose = old_verbose; verbose = old_verbose;
if (err) { if (err)
if (!verbose) return TEST_FAIL;
fprintf(stderr, " (use -v to see error message)");
return -1;
}
err = test__bpf_parsing(obj_buf, obj_buf_sz); err = test__bpf_parsing(obj_buf, obj_buf_sz);
free(obj_buf); free(obj_buf);
......
...@@ -366,7 +366,7 @@ int test__switch_tracking(void) ...@@ -366,7 +366,7 @@ int test__switch_tracking(void)
/* Third event */ /* Third event */
if (!perf_evlist__can_select_event(evlist, sched_switch)) { if (!perf_evlist__can_select_event(evlist, sched_switch)) {
fprintf(stderr, " (no sched_switch)"); pr_debug("No sched_switch\n");
err = 0; err = 0;
goto out; goto out;
} }
...@@ -442,7 +442,7 @@ int test__switch_tracking(void) ...@@ -442,7 +442,7 @@ int test__switch_tracking(void)
} }
if (perf_evlist__open(evlist) < 0) { if (perf_evlist__open(evlist) < 0) {
fprintf(stderr, " (not supported)"); pr_debug("Not supported\n");
err = 0; err = 0;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment