All of lore.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

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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.