aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-11-03 05:44:42 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-03 09:45:40 -0500
commit597bdeb4ab7396c43935eded15f82e3e100b3ff3 (patch)
tree289c61adebac5e14fde781cb31764409a514d6bf
parentbebd23a2ed31d47e7dd746d3b125068aa2c42d85 (diff)
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.com Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo 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.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/tests/attr.c3
-rw-r--r--tools/perf/tests/code-reading.c8
-rw-r--r--tools/perf/tests/keep-tracking.c4
-rw-r--r--tools/perf/tests/llvm.c11
-rw-r--r--tools/perf/tests/switch-tracking.c4
5 files changed, 13 insertions, 17 deletions
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 2dfc9ad0e6f2..638875a0960a 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -171,6 +171,5 @@ int test__attr(void)
171 !lstat(path_perf, &st)) 171 !lstat(path_perf, &st))
172 return run_dir(path_dir, path_perf); 172 return run_dir(path_dir, path_perf);
173 173
174 fprintf(stderr, " (omitted)"); 174 return TEST_SKIP;
175 return 0;
176} 175}
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 49b1959dda41..a767a6400c5c 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -613,16 +613,16 @@ int test__code_reading(void)
613 case TEST_CODE_READING_OK: 613 case TEST_CODE_READING_OK:
614 return 0; 614 return 0;
615 case TEST_CODE_READING_NO_VMLINUX: 615 case TEST_CODE_READING_NO_VMLINUX:
616 fprintf(stderr, " (no vmlinux)"); 616 pr_debug("no vmlinux\n");
617 return 0; 617 return 0;
618 case TEST_CODE_READING_NO_KCORE: 618 case TEST_CODE_READING_NO_KCORE:
619 fprintf(stderr, " (no kcore)"); 619 pr_debug("no kcore\n");
620 return 0; 620 return 0;
621 case TEST_CODE_READING_NO_ACCESS: 621 case TEST_CODE_READING_NO_ACCESS:
622 fprintf(stderr, " (no access)"); 622 pr_debug("no access\n");
623 return 0; 623 return 0;
624 case TEST_CODE_READING_NO_KERNEL_OBJ: 624 case TEST_CODE_READING_NO_KERNEL_OBJ:
625 fprintf(stderr, " (no kernel obj)"); 625 pr_debug("no kernel obj\n");
626 return 0; 626 return 0;
627 default: 627 default:
628 return -1; 628 return -1;
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 4d4b9837b630..a2e2269aa093 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -90,8 +90,8 @@ int test__keep_tracking(void)
90 evsel->attr.enable_on_exec = 0; 90 evsel->attr.enable_on_exec = 0;
91 91
92 if (perf_evlist__open(evlist) < 0) { 92 if (perf_evlist__open(evlist) < 0) {
93 fprintf(stderr, " (not supported)"); 93 pr_debug("Unable to open dummy and cycles event\n");
94 err = 0; 94 err = TEST_SKIP;
95 goto out_err; 95 goto out_err;
96 } 96 }
97 97
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 52d55971f66f..512d3620e9f9 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -36,7 +36,7 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
36static int test__bpf_parsing(void *obj_buf __maybe_unused, 36static int test__bpf_parsing(void *obj_buf __maybe_unused,
37 size_t obj_buf_sz __maybe_unused) 37 size_t obj_buf_sz __maybe_unused)
38{ 38{
39 fprintf(stderr, " (skip bpf parsing)"); 39 pr_debug("Skip bpf parsing\n");
40 return 0; 40 return 0;
41} 41}
42#endif 42#endif
@@ -55,7 +55,7 @@ int test__llvm(void)
55 * and clang is not found in $PATH, and this is not perf test -v 55 * and clang is not found in $PATH, and this is not perf test -v
56 */ 56 */
57 if (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang()) { 57 if (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang()) {
58 fprintf(stderr, " (no clang, try 'perf test -v LLVM')"); 58 pr_debug("No clang and no verbosive, skip this test\n");
59 return TEST_SKIP; 59 return TEST_SKIP;
60 } 60 }
61 61
@@ -86,11 +86,8 @@ int test__llvm(void)
86 err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz); 86 err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz);
87 87
88 verbose = old_verbose; 88 verbose = old_verbose;
89 if (err) { 89 if (err)
90 if (!verbose) 90 return TEST_FAIL;
91 fprintf(stderr, " (use -v to see error message)");
92 return -1;
93 }
94 91
95 err = test__bpf_parsing(obj_buf, obj_buf_sz); 92 err = test__bpf_parsing(obj_buf, obj_buf_sz);
96 free(obj_buf); 93 free(obj_buf);
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index e698742d4fec..a02af503100c 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -366,7 +366,7 @@ int test__switch_tracking(void)
366 366
367 /* Third event */ 367 /* Third event */
368 if (!perf_evlist__can_select_event(evlist, sched_switch)) { 368 if (!perf_evlist__can_select_event(evlist, sched_switch)) {
369 fprintf(stderr, " (no sched_switch)"); 369 pr_debug("No sched_switch\n");
370 err = 0; 370 err = 0;
371 goto out; 371 goto out;
372 } 372 }
@@ -442,7 +442,7 @@ int test__switch_tracking(void)
442 } 442 }
443 443
444 if (perf_evlist__open(evlist) < 0) { 444 if (perf_evlist__open(evlist) < 0) {
445 fprintf(stderr, " (not supported)"); 445 pr_debug("Not supported\n");
446 err = 0; 446 err = 0;
447 goto out; 447 goto out;
448 } 448 }