perf tests: Fix to get negative exit codes
PATCH 1/2 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
--- tools/perf/tests/builtin-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/builtin-test.c +1 -1
@@ -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 ;
Signature · 1 line
1.8.5.2
PATCH 2/2 perf trace: Fix typo in builtin-trace.c
Duplication NULL test for trace.evlist.
--- tools/perf/builtin-trace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/builtin-trace.c +1 -2
@@ -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; }
Signature · 1 line
1.8.5.2
Re: [PATCH 2/2] perf trace: Fix typo in builtin-trace.c
Em Mon, May 11, 2015 at 12:28:36PM +0000, He Kuang escreveu:
Quoted 1 line
Duplication NULL test for trace.evlist.
Thanks, applied.
tip-bot for He Kuang
merge bot[tip:perf/core] perf trace: Removed duplicated NULL test
In reply to He Kuangperf trace: Removed duplicated NULL test
Commit-ID: ff8f695c0ec9d73d8a9f92fe634d6476ad74e3a1 Gitweb: http://git.kernel.org/tip/ff8f695c0ec9d73d8a9f92fe634d6476ad74e3a1 Author: He Kuang <[email protected]> AuthorDate: Mon, 11 May 2015 12:28:36 +0000 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 12 May 2015 09:59:49 -0300
perf trace: Removed duplicated NULL test
No need to test trace.evlist against NULL twice.
--- tools/perf/builtin-trace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/builtin-trace.c +1 -2
@@ -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; }
Quoted 19 lines · He Kuang
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!
Quoted 7 lines
After this patch:
$ perf test -v 1 ... test child finished with -2 ---- end ---- vmlinux symtab matches kallsyms: Skip
thanks,
jirka
Quoted 22 lines
Signed-off-by He Kuang <[email protected]>--- tools/perf/tests/builtin-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/builtin-test.c +1
-1@@ -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 ;Signature · 1 line
1.8.5.2
Em Mon, May 11, 2015 at 03:17:07PM +0200, Jiri Olsa escreveu:
Quoted 10 lines · He Kuang
Quoted 7 lines
After this patch:
$ perf test -v 1 ... test child finished with -2 ---- end ---- vmlinux symtab matches kallsyms: SkipAcked-by Jiri Olsa <[email protected]>
Thanks, applied,
- Arnaldo
tip-bot for He Kuang
merge botperf tests: Fix to get negative exit codes
Commit-ID: 189c466f77d421aef5c196454ab2e9517af7abc9 Gitweb: http://git.kernel.org/tip/189c466f77d421aef5c196454ab2e9517af7abc9 Author: He Kuang <[email protected]> AuthorDate: Mon, 11 May 2015 12:28:35 +0000 Committer: Arnaldo Carvalho de Melo <[email protected]> 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
--- tools/perf/tests/builtin-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/builtin-test.c +1 -1
@@ -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 ;