public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf tests: Fix to get negative exit codes
@ 2015-05-11 12:28 He Kuang
  2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: He Kuang @ 2015-05-11 12:28 UTC (permalink / raw)
  To: acme, jolsa, mingo, a.p.zijlstra; +Cc: wangnan0, linux-kernel

WEXITSTATUS consists of the least significant 8 bits of the status
argument, so we should convert the value to signed char if we have valid
negative exit codes. And the return value of test->func() contains
negative values:

  enum {
          TEST_OK   =  0,
          TEST_FAIL = -1,
          TEST_SKIP = -2,
  };

Before this patch:

  $ perf test -v 1
  ...
  test child finished with 254
  ---- end ----
  vmlinux symtab matches kallsyms: FAILED!

After this patch:

  $ perf test -v 1
  ...
  test child finished with -2
  ---- end ----
  vmlinux symtab matches kallsyms: Skip

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/tests/builtin-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 4f40981..f42af98 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -219,7 +219,7 @@ static int run_test(struct test *test)
 	wait(&status);
 
 	if (WIFEXITED(status)) {
-		err = WEXITSTATUS(status);
+		err = (signed char)WEXITSTATUS(status);
 		pr_debug("test child finished with %d\n", err);
 	} else if (WIFSIGNALED(status)) {
 		err = -1;
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] perf trace: Fix typo in builtin-trace.c
  2015-05-11 12:28 [PATCH 1/2] perf tests: Fix to get negative exit codes He Kuang
@ 2015-05-11 12:28 ` He Kuang
  2015-05-11 14:06   ` Arnaldo Carvalho de Melo
  2015-05-15  6:43   ` [tip:perf/core] perf trace: Removed duplicated NULL test tip-bot for He Kuang
  2015-05-11 13:17 ` [PATCH 1/2] perf tests: Fix to get negative exit codes Jiri Olsa
  2015-05-15  6:44 ` [tip:perf/core] " tip-bot for He Kuang
  2 siblings, 2 replies; 7+ messages in thread
From: He Kuang @ 2015-05-11 12:28 UTC (permalink / raw)
  To: acme, jolsa, mingo, a.p.zijlstra; +Cc: wangnan0, linux-kernel

Duplication NULL test for trace.evlist.

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/builtin-trace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index bb05e44..ca39530 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2715,11 +2715,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	signal(SIGFPE, sighandler_dump_stack);
 
 	trace.evlist = perf_evlist__new();
-	if (trace.evlist == NULL)
-		return -ENOMEM;
 
 	if (trace.evlist == NULL) {
 		pr_err("Not enough memory to run!\n");
+		err = -ENOMEM;
 		goto out;
 	}
 
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] perf tests: Fix to get negative exit codes
  2015-05-11 12:28 [PATCH 1/2] perf tests: Fix to get negative exit codes He Kuang
  2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
@ 2015-05-11 13:17 ` Jiri Olsa
  2015-05-11 14:07   ` Arnaldo Carvalho de Melo
  2015-05-15  6:44 ` [tip:perf/core] " tip-bot for He Kuang
  2 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2015-05-11 13:17 UTC (permalink / raw)
  To: He Kuang; +Cc: acme, jolsa, mingo, a.p.zijlstra, wangnan0, linux-kernel

On Mon, May 11, 2015 at 12:28:35PM +0000, He Kuang wrote:
> WEXITSTATUS consists of the least significant 8 bits of the status
> argument, so we should convert the value to signed char if we have valid
> negative exit codes. And the return value of test->func() contains
> negative values:
> 
>   enum {
>           TEST_OK   =  0,
>           TEST_FAIL = -1,
>           TEST_SKIP = -2,
>   };
> 
> Before this patch:
> 
>   $ perf test -v 1
>   ...
>   test child finished with 254
>   ---- end ----
>   vmlinux symtab matches kallsyms: FAILED!
> 
> After this patch:
> 
>   $ perf test -v 1
>   ...
>   test child finished with -2
>   ---- end ----
>   vmlinux symtab matches kallsyms: Skip

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> 
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
>  tools/perf/tests/builtin-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index 4f40981..f42af98 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -219,7 +219,7 @@ static int run_test(struct test *test)
>  	wait(&status);
>  
>  	if (WIFEXITED(status)) {
> -		err = WEXITSTATUS(status);
> +		err = (signed char)WEXITSTATUS(status);
>  		pr_debug("test child finished with %d\n", err);
>  	} else if (WIFSIGNALED(status)) {
>  		err = -1;
> -- 
> 1.8.5.2
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf trace: Fix typo in builtin-trace.c
  2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
@ 2015-05-11 14:06   ` Arnaldo Carvalho de Melo
  2015-05-15  6:43   ` [tip:perf/core] perf trace: Removed duplicated NULL test tip-bot for He Kuang
  1 sibling, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-11 14:06 UTC (permalink / raw)
  To: He Kuang; +Cc: jolsa, mingo, a.p.zijlstra, wangnan0, linux-kernel

Em Mon, May 11, 2015 at 12:28:36PM +0000, He Kuang escreveu:
> Duplication NULL test for trace.evlist.

Thanks, applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] perf tests: Fix to get negative exit codes
  2015-05-11 13:17 ` [PATCH 1/2] perf tests: Fix to get negative exit codes Jiri Olsa
@ 2015-05-11 14:07   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-11 14:07 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: He Kuang, jolsa, mingo, a.p.zijlstra, wangnan0, linux-kernel

Em Mon, May 11, 2015 at 03:17:07PM +0200, Jiri Olsa escreveu:
> On Mon, May 11, 2015 at 12:28:35PM +0000, He Kuang wrote:
> > After this patch:
> > 
> >   $ perf test -v 1
> >   ...
> >   test child finished with -2
> >   ---- end ----
> >   vmlinux symtab matches kallsyms: Skip
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied,

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:perf/core] perf trace: Removed duplicated NULL test
  2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
  2015-05-11 14:06   ` Arnaldo Carvalho de Melo
@ 2015-05-15  6:43   ` tip-bot for He Kuang
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for He Kuang @ 2015-05-15  6:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, a.p.zijlstra, acme, hpa, hekuang, mingo, wangnan0, jolsa,
	linux-kernel

Commit-ID:  ff8f695c0ec9d73d8a9f92fe634d6476ad74e3a1
Gitweb:     http://git.kernel.org/tip/ff8f695c0ec9d73d8a9f92fe634d6476ad74e3a1
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Mon, 11 May 2015 12:28:36 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 May 2015 09:59:49 -0300

perf trace: Removed duplicated NULL test

No need to test trace.evlist against NULL twice.

Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1431347316-30401-2-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index cbfdb95..96a2eba 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2721,11 +2721,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	signal(SIGFPE, sighandler_dump_stack);
 
 	trace.evlist = perf_evlist__new();
-	if (trace.evlist == NULL)
-		return -ENOMEM;
 
 	if (trace.evlist == NULL) {
 		pr_err("Not enough memory to run!\n");
+		err = -ENOMEM;
 		goto out;
 	}
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:perf/core] perf tests: Fix to get negative exit codes
  2015-05-11 12:28 [PATCH 1/2] perf tests: Fix to get negative exit codes He Kuang
  2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
  2015-05-11 13:17 ` [PATCH 1/2] perf tests: Fix to get negative exit codes Jiri Olsa
@ 2015-05-15  6:44 ` tip-bot for He Kuang
  2 siblings, 0 replies; 7+ messages in thread
From: tip-bot for He Kuang @ 2015-05-15  6:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, linux-kernel, acme, wangnan0, jolsa, a.p.zijlstra, tglx,
	hekuang, mingo

Commit-ID:  189c466f77d421aef5c196454ab2e9517af7abc9
Gitweb:     http://git.kernel.org/tip/189c466f77d421aef5c196454ab2e9517af7abc9
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Mon, 11 May 2015 12:28:35 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 May 2015 09:59:50 -0300

perf tests: Fix to get negative exit codes

WEXITSTATUS consists of the least significant 8 bits of the status
argument, so we should convert the value to signed char if we have valid
negative exit codes. And the return value of test->func() contains
negative values:

  enum {
          TEST_OK   =  0,
          TEST_FAIL = -1,
          TEST_SKIP = -2,
  };

Before this patch:

  $ perf test -v 1
  ...
  test child finished with 254
  ---- end ----
  vmlinux symtab matches kallsyms: FAILED!

After this patch:

  $ perf test -v 1
  ...
  test child finished with -2
  ---- end ----
  vmlinux symtab matches kallsyms: Skip

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1431347316-30401-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/builtin-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 4f40981..f42af98 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -219,7 +219,7 @@ static int run_test(struct test *test)
 	wait(&status);
 
 	if (WIFEXITED(status)) {
-		err = WEXITSTATUS(status);
+		err = (signed char)WEXITSTATUS(status);
 		pr_debug("test child finished with %d\n", err);
 	} else if (WIFSIGNALED(status)) {
 		err = -1;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-15  6:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-11 12:28 [PATCH 1/2] perf tests: Fix to get negative exit codes He Kuang
2015-05-11 12:28 ` [PATCH 2/2] perf trace: Fix typo in builtin-trace.c He Kuang
2015-05-11 14:06   ` Arnaldo Carvalho de Melo
2015-05-15  6:43   ` [tip:perf/core] perf trace: Removed duplicated NULL test tip-bot for He Kuang
2015-05-11 13:17 ` [PATCH 1/2] perf tests: Fix to get negative exit codes Jiri Olsa
2015-05-11 14:07   ` Arnaldo Carvalho de Melo
2015-05-15  6:44 ` [tip:perf/core] " tip-bot for He Kuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox