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 <[email protected]>
---
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
Duplication NULL test for trace.evlist.
Signed-off-by: He Kuang <[email protected]>
---
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
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 <[email protected]>
thanks,
jirka
>
> Signed-off-by: He Kuang <[email protected]>
> ---
> 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
>
Em Mon, May 11, 2015 at 12:28:36PM +0000, He Kuang escreveu:
> Duplication NULL test for trace.evlist.
Thanks, applied.
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 <[email protected]>
Thanks, applied,
- Arnaldo
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.
Signed-off-by: He Kuang <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
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;
}
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
Signed-off-by: He Kuang <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
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;