From patchwork Thu Nov 20 16:26:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 41248 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 83B3823588 for ; Thu, 20 Nov 2014 16:27:33 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf2298700eek.5 for ; Thu, 20 Nov 2014 08:27:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=5VVZeuF9CvZiUtCcAjJn1HM3nIwW2N7gMMxPib65VrY=; b=TR8sMQyESPI7Y/JPZ4Eu51ed7iV8NgSbaiUIWjb85tcvdAKsqQeZVidZYlne1D66N5 +NrIkag9u9lW7SnJqYiAciM4LP1UFJVRPLb7iOFu7Us4VM4UbipHOoPteuqqS+VCE0/F Dy4Vraqb4Hr5wJNYXRu/AlgfjNcvzqMjaaPYYV4VIU6PIh4S/rvn9ZFjNi1SFsSC4U+E m2vZ2Lx1UlrXp/IgPHbPp/ORLK0NKrGbeck9Rane68S4/QzsHI2tyFkvLLo2dsF1HBmh +nwOwOPjlSBz3Q9y88Q/OpzP8SFhLbDUONoLwFc79apfjYM6gbFVBDzAhwvglGxa6sgC DXeg== X-Gm-Message-State: ALoCoQkcnKZiwbo5LEk2ExsLjsgNZecqZizcZu2yX2P9bpX9klGnXEw8zwbE24yC0UHHHrQKlqpa X-Received: by 10.152.26.72 with SMTP id j8mr3448525lag.3.1416500852797; Thu, 20 Nov 2014 08:27:32 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.36 with SMTP id cr4ls85003lad.41.gmail; Thu, 20 Nov 2014 08:27:32 -0800 (PST) X-Received: by 10.112.146.162 with SMTP id td2mr12076486lbb.40.1416500852216; Thu, 20 Nov 2014 08:27:32 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id g1si2563370lah.45.2014.11.20.08.27.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 08:27:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id s18so2768222lam.1 for ; Thu, 20 Nov 2014 08:27:32 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr12101161laa.71.1416500852065; Thu, 20 Nov 2014 08:27:32 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp291574lbc; Thu, 20 Nov 2014 08:27:31 -0800 (PST) X-Received: by 10.180.100.104 with SMTP id ex8mr24210200wib.80.1416500851322; Thu, 20 Nov 2014 08:27:31 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id dj9si4206567wjb.43.2014.11.20.08.27.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Nov 2014 08:27:30 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XrUZp-0005R3-HH; Thu, 20 Nov 2014 16:27:25 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XrUZi-0005Qy-RL for lng-odp@lists.linaro.org; Thu, 20 Nov 2014 16:27:19 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 20 Nov 2014 16:27:17 +0000 Received: from e106441.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 20 Nov 2014 16:27:15 +0000 From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Thu, 20 Nov 2014 16:26:19 +0000 Message-Id: <1416500779-28218-1-git-send-email-stuart.haslam@arm.com> X-Mailer: git-send-email 2.1.1 X-OriginalArrivalTime: 20 Nov 2014 16:27:15.0081 (UTC) FILETIME=[D83C0F90:01D004DE] X-MC-Unique: 114112016271702701 X-Topics: patch Subject: [lng-odp] [PATCH] cunit: fix exit status so failures are caught by make check X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Running "make check" from the top level currently does not detect test failures as the individual test applications report an exit status of 0 even when failures occur. Stop using CU_get_error() as it reports framework errors rather than test / suite failures, and the CU_cleanup_registry() clears the error anyway. Instead exit with a failure code on framework errors, and only exit with 0 if no tests or test suite init/cleanup functions failed. Signed-off-by: Stuart Haslam --- test/cunit/odp_init.c | 23 +++++++++++++---------- test/cunit/odp_queue.c | 19 +++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/test/cunit/odp_init.c b/test/cunit/odp_init.c index 88e6235..dcd71ea 100644 --- a/test/cunit/odp_init.c +++ b/test/cunit/odp_init.c @@ -33,24 +33,27 @@ static int finalise(void) int main(void) { + int ret; CU_pSuite ptr_suite = NULL; + /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) - return CU_get_error(); + exit(EXIT_FAILURE); + /* add a suite to the registry */ ptr_suite = CU_add_suite(__FILE__, init, finalise); - if (NULL == ptr_suite) { - CU_cleanup_registry(); - return CU_get_error(); - } + if (NULL == ptr_suite) + exit(EXIT_FAILURE); + /* add the tests to the suite */ - if (NULL == CU_ADD_TEST(ptr_suite, test_odp_init_global)) { - CU_cleanup_registry(); - return CU_get_error(); - } + if (NULL == CU_ADD_TEST(ptr_suite, test_odp_init_global)) + exit(EXIT_FAILURE); + /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); + ret = (CU_get_number_of_failure_records() != 0); CU_cleanup_registry(); - return CU_get_error(); + + return ret; } diff --git a/test/cunit/odp_queue.c b/test/cunit/odp_queue.c index 4d233e0..caabd3b 100644 --- a/test/cunit/odp_queue.c +++ b/test/cunit/odp_queue.c @@ -131,27 +131,26 @@ static int finalize(void) int main(void) { + int ret; CU_pSuite ptr_suite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) - return CU_get_error(); + exit(EXIT_FAILURE); /* add the tests to the queue suite */ ptr_suite = CU_add_suite(__FILE__, init, finalize); - if (NULL == ptr_suite) { - CU_cleanup_registry(); - return CU_get_error(); - } + if (NULL == ptr_suite) + exit(EXIT_FAILURE); - if (NULL == CU_ADD_TEST(ptr_suite, test_odp_queue_sunnyday)) { - CU_cleanup_registry(); - return CU_get_error(); - } + if (NULL == CU_ADD_TEST(ptr_suite, test_odp_queue_sunnyday)) + exit(EXIT_FAILURE); /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); + ret = (CU_get_number_of_failure_records() != 0); CU_cleanup_registry(); - return CU_get_error(); + + return ret; }