Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753779AbbEKM26 (ORCPT ); Mon, 11 May 2015 08:28:58 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:39398 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752197AbbEKM24 (ORCPT ); Mon, 11 May 2015 08:28:56 -0400 From: He Kuang To: , , , CC: , Subject: [PATCH 1/2] perf tests: Fix to get negative exit codes Date: Mon, 11 May 2015 12:28:35 +0000 Message-ID: <1431347316-30401-1-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1443 Lines: 53 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/