public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for He Kuang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, acme@redhat.com,
	wangnan0@huawei.com, jolsa@kernel.org, a.p.zijlstra@chello.nl,
	tglx@linutronix.de, hekuang@huawei.com, mingo@kernel.org
Subject: [tip:perf/core] perf tests: Fix to get negative exit codes
Date: Thu, 14 May 2015 23:44:46 -0700	[thread overview]
Message-ID: <tip-189c466f77d421aef5c196454ab2e9517af7abc9@git.kernel.org> (raw)
In-Reply-To: <1431347316-30401-1-git-send-email-hekuang@huawei.com>

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;

      parent reply	other threads:[~2015-05-15  6:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-bot for He Kuang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-189c466f77d421aef5c196454ab2e9517af7abc9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox