Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261391 > unrolled thread

[PATCH 1/5] perf test: Keep test result clean if '-v' not set

Started byWang Nan <wangnan0@huawei.com>
First post2015-11-03 12:10 +0100
Last post2015-11-08 08:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/5] perf test: Keep test result clean if '-v' not set Wang Nan <wangnan0@huawei.com> - 2015-11-03 12:10 +0100
    Re: [PATCH 1/5] perf test: Keep test result clean if '-v' not set Namhyung Kim <namhyung@kernel.org> - 2015-11-03 12:20 +0100
    [tip:perf/urgent] perf test: Keep test result clean if '-v'   not set tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-08 08:30 +0100

#1261391 — [PATCH 1/5] perf test: Keep test result clean if '-v' not set

FromWang Nan <wangnan0@huawei.com>
Date2015-11-03 12:10 +0100
Subject[PATCH 1/5] perf test: Keep test result clean if '-v' not set
Message-ID<qqHDr-1VD-9@gated-at.bofh.it>
According to [1], 'perf state' should avoid output too much information
if '-v' not set, only 'Ok', 'FAIL' or 'Skip' need to be printed.

This patch removes sereval stderr output to make 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>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-446450727-218554-1-git-send-email-wangnan0@huawei.com
---
 tools/perf/tests/attr.c            |  3 +--
 tools/perf/tests/code-reading.c    |  8 ++++----
 tools/perf/tests/keep-tracking.c   |  4 ++--
 tools/perf/tests/llvm.c            | 11 ++++-------
 tools/perf/tests/switch-tracking.c |  4 ++--
 5 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 2dfc9ad..638875a 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -171,6 +171,5 @@ int test__attr(void)
 	    !lstat(path_perf, &st))
 		return run_dir(path_dir, path_perf);
 
-	fprintf(stderr, " (omitted)");
-	return 0;
+	return TEST_SKIP;
 }
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 49b1959..a767a64 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -613,16 +613,16 @@ int test__code_reading(void)
 	case TEST_CODE_READING_OK:
 		return 0;
 	case TEST_CODE_READING_NO_VMLINUX:
-		fprintf(stderr, " (no vmlinux)");
+		pr_debug("no vmlinux\n");
 		return 0;
 	case TEST_CODE_READING_NO_KCORE:
-		fprintf(stderr, " (no kcore)");
+		pr_debug("no kcore\n");
 		return 0;
 	case TEST_CODE_READING_NO_ACCESS:
-		fprintf(stderr, " (no access)");
+		pr_debug("no access\n");
 		return 0;
 	case TEST_CODE_READING_NO_KERNEL_OBJ:
-		fprintf(stderr, " (no kernel obj)");
+		pr_debug("no kernel obj\n");
 		return 0;
 	default:
 		return -1;
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 4d4b983..a2e2269 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -90,8 +90,8 @@ int test__keep_tracking(void)
 	evsel->attr.enable_on_exec = 0;
 
 	if (perf_evlist__open(evlist) < 0) {
-		fprintf(stderr, " (not supported)");
-		err = 0;
+		pr_debug("Unable to open dummy and cycles event\n");
+		err = TEST_SKIP;
 		goto out_err;
 	}
 
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 52d5597..512d362 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)
 static int test__bpf_parsing(void *obj_buf __maybe_unused,
 			     size_t obj_buf_sz __maybe_unused)
 {
-	fprintf(stderr, " (skip bpf parsing)");
+	pr_debug("Skip bpf parsing\n");
 	return 0;
 }
 #endif
@@ -55,7 +55,7 @@ int test__llvm(void)
 	 * 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()) {
-		fprintf(stderr, " (no clang, try 'perf test -v LLVM')");
+		pr_debug("No clang and no verbosive, skip this test\n");
 		return TEST_SKIP;
 	}
 
@@ -86,11 +86,8 @@ int test__llvm(void)
 	err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz);
 
 	verbose = old_verbose;
-	if (err) {
-		if (!verbose)
-			fprintf(stderr, " (use -v to see error message)");
-		return -1;
-	}
+	if (err)
+		return TEST_FAIL;
 
 	err = test__bpf_parsing(obj_buf, obj_buf_sz);
 	free(obj_buf);
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index e698742..a02af50 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -366,7 +366,7 @@ int test__switch_tracking(void)
 
 	/* Third event */
 	if (!perf_evlist__can_select_event(evlist, sched_switch)) {
-		fprintf(stderr, " (no sched_switch)");
+		pr_debug("No sched_switch\n");
 		err = 0;
 		goto out;
 	}
@@ -442,7 +442,7 @@ int test__switch_tracking(void)
 	}
 
 	if (perf_evlist__open(evlist) < 0) {
-		fprintf(stderr, " (not supported)");
+		pr_debug("Not supported\n");
 		err = 0;
 		goto out;
 	}
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1261401

FromNamhyung Kim <namhyung@kernel.org>
Date2015-11-03 12:20 +0100
Message-ID<qqHN7-1ZB-3@gated-at.bofh.it>
In reply to#1261391
On Tue, Nov 03, 2015 at 10:44:42AM +0000, Wang Nan wrote:
> According to [1], 'perf state' should avoid output too much information
> if '-v' not set, only 'Ok', 'FAIL' or 'Skip' need to be printed.
> 
> This patch removes sereval stderr output to make 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>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Link: http://lkml.kernel.org/n/tip-446450727-218554-1-git-send-email-wangnan0@huawei.com

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  tools/perf/tests/attr.c            |  3 +--
>  tools/perf/tests/code-reading.c    |  8 ++++----
>  tools/perf/tests/keep-tracking.c   |  4 ++--
>  tools/perf/tests/llvm.c            | 11 ++++-------
>  tools/perf/tests/switch-tracking.c |  4 ++--
>  5 files changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
> index 2dfc9ad..638875a 100644
> --- a/tools/perf/tests/attr.c
> +++ b/tools/perf/tests/attr.c
> @@ -171,6 +171,5 @@ int test__attr(void)
>  	    !lstat(path_perf, &st))
>  		return run_dir(path_dir, path_perf);
>  
> -	fprintf(stderr, " (omitted)");
> -	return 0;
> +	return TEST_SKIP;
>  }
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 49b1959..a767a64 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -613,16 +613,16 @@ int test__code_reading(void)
>  	case TEST_CODE_READING_OK:
>  		return 0;
>  	case TEST_CODE_READING_NO_VMLINUX:
> -		fprintf(stderr, " (no vmlinux)");
> +		pr_debug("no vmlinux\n");
>  		return 0;
>  	case TEST_CODE_READING_NO_KCORE:
> -		fprintf(stderr, " (no kcore)");
> +		pr_debug("no kcore\n");
>  		return 0;
>  	case TEST_CODE_READING_NO_ACCESS:
> -		fprintf(stderr, " (no access)");
> +		pr_debug("no access\n");
>  		return 0;
>  	case TEST_CODE_READING_NO_KERNEL_OBJ:
> -		fprintf(stderr, " (no kernel obj)");
> +		pr_debug("no kernel obj\n");
>  		return 0;
>  	default:
>  		return -1;
> diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
> index 4d4b983..a2e2269 100644
> --- a/tools/perf/tests/keep-tracking.c
> +++ b/tools/perf/tests/keep-tracking.c
> @@ -90,8 +90,8 @@ int test__keep_tracking(void)
>  	evsel->attr.enable_on_exec = 0;
>  
>  	if (perf_evlist__open(evlist) < 0) {
> -		fprintf(stderr, " (not supported)");
> -		err = 0;
> +		pr_debug("Unable to open dummy and cycles event\n");
> +		err = TEST_SKIP;
>  		goto out_err;
>  	}
>  
> diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
> index 52d5597..512d362 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)
>  static int test__bpf_parsing(void *obj_buf __maybe_unused,
>  			     size_t obj_buf_sz __maybe_unused)
>  {
> -	fprintf(stderr, " (skip bpf parsing)");
> +	pr_debug("Skip bpf parsing\n");
>  	return 0;
>  }
>  #endif
> @@ -55,7 +55,7 @@ int test__llvm(void)
>  	 * 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()) {
> -		fprintf(stderr, " (no clang, try 'perf test -v LLVM')");
> +		pr_debug("No clang and no verbosive, skip this test\n");
>  		return TEST_SKIP;
>  	}
>  
> @@ -86,11 +86,8 @@ int test__llvm(void)
>  	err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz);
>  
>  	verbose = old_verbose;
> -	if (err) {
> -		if (!verbose)
> -			fprintf(stderr, " (use -v to see error message)");
> -		return -1;
> -	}
> +	if (err)
> +		return TEST_FAIL;
>  
>  	err = test__bpf_parsing(obj_buf, obj_buf_sz);
>  	free(obj_buf);
> diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
> index e698742..a02af50 100644
> --- a/tools/perf/tests/switch-tracking.c
> +++ b/tools/perf/tests/switch-tracking.c
> @@ -366,7 +366,7 @@ int test__switch_tracking(void)
>  
>  	/* Third event */
>  	if (!perf_evlist__can_select_event(evlist, sched_switch)) {
> -		fprintf(stderr, " (no sched_switch)");
> +		pr_debug("No sched_switch\n");
>  		err = 0;
>  		goto out;
>  	}
> @@ -442,7 +442,7 @@ int test__switch_tracking(void)
>  	}
>  
>  	if (perf_evlist__open(evlist) < 0) {
> -		fprintf(stderr, " (not supported)");
> +		pr_debug("Not supported\n");
>  		err = 0;
>  		goto out;
>  	}
> -- 
> 1.8.3.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265010 — [tip:perf/urgent] perf test: Keep test result clean if '-v' not set

Fromtip-bot for Wang Nan <tipbot@zytor.com>
Date2015-11-08 08:30 +0100
Subject[tip:perf/urgent] perf test: Keep test result clean if '-v' not set
Message-ID<qssAi-5wU-13@gated-at.bofh.it>
In reply to#1261391
Commit-ID:  597bdeb4ab7396c43935eded15f82e3e100b3ff3
Gitweb:     http://git.kernel.org/tip/597bdeb4ab7396c43935eded15f82e3e100b3ff3
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Tue, 3 Nov 2015 10:44:42 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 3 Nov 2015 11:45:40 -0300

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>
---
 tools/perf/tests/attr.c            |  3 +--
 tools/perf/tests/code-reading.c    |  8 ++++----
 tools/perf/tests/keep-tracking.c   |  4 ++--
 tools/perf/tests/llvm.c            | 11 ++++-------
 tools/perf/tests/switch-tracking.c |  4 ++--
 5 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 2dfc9ad..638875a 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -171,6 +171,5 @@ int test__attr(void)
 	    !lstat(path_perf, &st))
 		return run_dir(path_dir, path_perf);
 
-	fprintf(stderr, " (omitted)");
-	return 0;
+	return TEST_SKIP;
 }
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 49b1959..a767a64 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -613,16 +613,16 @@ int test__code_reading(void)
 	case TEST_CODE_READING_OK:
 		return 0;
 	case TEST_CODE_READING_NO_VMLINUX:
-		fprintf(stderr, " (no vmlinux)");
+		pr_debug("no vmlinux\n");
 		return 0;
 	case TEST_CODE_READING_NO_KCORE:
-		fprintf(stderr, " (no kcore)");
+		pr_debug("no kcore\n");
 		return 0;
 	case TEST_CODE_READING_NO_ACCESS:
-		fprintf(stderr, " (no access)");
+		pr_debug("no access\n");
 		return 0;
 	case TEST_CODE_READING_NO_KERNEL_OBJ:
-		fprintf(stderr, " (no kernel obj)");
+		pr_debug("no kernel obj\n");
 		return 0;
 	default:
 		return -1;
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 4d4b983..a2e2269 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -90,8 +90,8 @@ int test__keep_tracking(void)
 	evsel->attr.enable_on_exec = 0;
 
 	if (perf_evlist__open(evlist) < 0) {
-		fprintf(stderr, " (not supported)");
-		err = 0;
+		pr_debug("Unable to open dummy and cycles event\n");
+		err = TEST_SKIP;
 		goto out_err;
 	}
 
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 52d5597..512d362 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)
 static int test__bpf_parsing(void *obj_buf __maybe_unused,
 			     size_t obj_buf_sz __maybe_unused)
 {
-	fprintf(stderr, " (skip bpf parsing)");
+	pr_debug("Skip bpf parsing\n");
 	return 0;
 }
 #endif
@@ -55,7 +55,7 @@ int test__llvm(void)
 	 * 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()) {
-		fprintf(stderr, " (no clang, try 'perf test -v LLVM')");
+		pr_debug("No clang and no verbosive, skip this test\n");
 		return TEST_SKIP;
 	}
 
@@ -86,11 +86,8 @@ int test__llvm(void)
 	err = llvm__compile_bpf("-", &obj_buf, &obj_buf_sz);
 
 	verbose = old_verbose;
-	if (err) {
-		if (!verbose)
-			fprintf(stderr, " (use -v to see error message)");
-		return -1;
-	}
+	if (err)
+		return TEST_FAIL;
 
 	err = test__bpf_parsing(obj_buf, obj_buf_sz);
 	free(obj_buf);
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index e698742..a02af50 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -366,7 +366,7 @@ int test__switch_tracking(void)
 
 	/* Third event */
 	if (!perf_evlist__can_select_event(evlist, sched_switch)) {
-		fprintf(stderr, " (no sched_switch)");
+		pr_debug("No sched_switch\n");
 		err = 0;
 		goto out;
 	}
@@ -442,7 +442,7 @@ int test__switch_tracking(void)
 	}
 
 	if (perf_evlist__open(evlist) < 0) {
-		fprintf(stderr, " (not supported)");
+		pr_debug("Not supported\n");
 		err = 0;
 		goto out;
 	}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web