Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wang Nan and committed by
Arnaldo Carvalho de Melo
597bdeb4 bebd23a2

+13 -17
+1 -2
tools/perf/tests/attr.c
··· 171 171 !lstat(path_perf, &st)) 172 172 return run_dir(path_dir, path_perf); 173 173 174 - fprintf(stderr, " (omitted)"); 175 - return 0; 174 + return TEST_SKIP; 176 175 }
+4 -4
tools/perf/tests/code-reading.c
··· 613 613 case TEST_CODE_READING_OK: 614 614 return 0; 615 615 case TEST_CODE_READING_NO_VMLINUX: 616 - fprintf(stderr, " (no vmlinux)"); 616 + pr_debug("no vmlinux\n"); 617 617 return 0; 618 618 case TEST_CODE_READING_NO_KCORE: 619 - fprintf(stderr, " (no kcore)"); 619 + pr_debug("no kcore\n"); 620 620 return 0; 621 621 case TEST_CODE_READING_NO_ACCESS: 622 - fprintf(stderr, " (no access)"); 622 + pr_debug("no access\n"); 623 623 return 0; 624 624 case TEST_CODE_READING_NO_KERNEL_OBJ: 625 - fprintf(stderr, " (no kernel obj)"); 625 + pr_debug("no kernel obj\n"); 626 626 return 0; 627 627 default: 628 628 return -1;
+2 -2
tools/perf/tests/keep-tracking.c
··· 90 90 evsel->attr.enable_on_exec = 0; 91 91 92 92 if (perf_evlist__open(evlist) < 0) { 93 - fprintf(stderr, " (not supported)"); 94 - err = 0; 93 + pr_debug("Unable to open dummy and cycles event\n"); 94 + err = TEST_SKIP; 95 95 goto out_err; 96 96 } 97 97
+4 -7
tools/perf/tests/llvm.c
··· 36 36 static int test__bpf_parsing(void *obj_buf __maybe_unused, 37 37 size_t obj_buf_sz __maybe_unused) 38 38 { 39 - fprintf(stderr, " (skip bpf parsing)"); 39 + pr_debug("Skip bpf parsing\n"); 40 40 return 0; 41 41 } 42 42 #endif ··· 55 55 * and clang is not found in $PATH, and this is not perf test -v 56 56 */ 57 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 59 return TEST_SKIP; 60 60 } 61 61 ··· 86 86 err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz); 87 87 88 88 verbose = old_verbose; 89 - if (err) { 90 - if (!verbose) 91 - fprintf(stderr, " (use -v to see error message)"); 92 - return -1; 93 - } 89 + if (err) 90 + return TEST_FAIL; 94 91 95 92 err = test__bpf_parsing(obj_buf, obj_buf_sz); 96 93 free(obj_buf);
+2 -2
tools/perf/tests/switch-tracking.c
··· 366 366 367 367 /* Third event */ 368 368 if (!perf_evlist__can_select_event(evlist, sched_switch)) { 369 - fprintf(stderr, " (no sched_switch)"); 369 + pr_debug("No sched_switch\n"); 370 370 err = 0; 371 371 goto out; 372 372 } ··· 442 442 } 443 443 444 444 if (perf_evlist__open(evlist) < 0) { 445 - fprintf(stderr, " (not supported)"); 445 + pr_debug("Not supported\n"); 446 446 err = 0; 447 447 goto out; 448 448 }