From patchwork Mon Dec 1 17:05:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41799 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C06A24001 for ; Mon, 1 Dec 2014 17:06:21 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf6845925wgh.8 for ; Mon, 01 Dec 2014 09:06:20 -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:in-reply-to :references: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=/GnSqAmkpwthCgsEeGLDqdQ73nOYM3sMhowx/AQ3U2k=; b=Kcw8ABK2oAa+RZs0hrjCu5zi7BiVE+Fhae6Pm0/w7dAkCrFFzImjF27dIp8W0BPC48 v/wh3S5CkFOXt9/8IVZkVm3Dh0YUotarclZIeksYn1fnq77uPWx/AqKUMNECiNhULq69 dsrB7YkP/a6177kx4sui8xYsxeANHWBP0M+NJhlAvXXdP0oplwmfR+onCsvAS1En2u2k Vkoas4n84NDhJY+/ZfzVQ3FYqSDtoqqh7hMQCkGnDYIhFkQ+pMQYBozi4fmj93jd5Yu3 UU22wW346XVHWnSqpELEgNnoJMgszGP70nkYOLGLbMFQY4fI40qXeZt0u1Qp8eznRzGa ZNdw== X-Gm-Message-State: ALoCoQmYvKpasWREdiFjGIfPmUPfy+Ccti6BcnDED239OEjwHcUyYkPEKyZ9j0/ooJK9vykW9SUS X-Received: by 10.181.27.135 with SMTP id jg7mr13976264wid.5.1417453580402; Mon, 01 Dec 2014 09:06:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.170 with SMTP id p10ls1189653lal.35.gmail; Mon, 01 Dec 2014 09:06:20 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr57016583lbo.32.1417453579965; Mon, 01 Dec 2014 09:06:19 -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 aq3si18205463lbc.78.2014.12.01.09.06.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 09:06:19 -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 s18so9226456lam.29 for ; Mon, 01 Dec 2014 09:06:19 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr34472515lal.29.1417453579868; Mon, 01 Dec 2014 09:06:19 -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 ew9csp330482lbc; Mon, 1 Dec 2014 09:06:17 -0800 (PST) X-Received: by 10.140.30.163 with SMTP id d32mr2260687qgd.105.1417453569586; Mon, 01 Dec 2014 09:06:09 -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 w9si21181313qgd.24.2014.12.01.09.06.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 09:06:09 -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 1XvUQJ-00010V-MI; Mon, 01 Dec 2014 17:06:07 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvUPw-0000zC-UD for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 17:05:45 +0000 Received: by mail-lb0-f181.google.com with SMTP id 10so8860293lbg.26 for ; Mon, 01 Dec 2014 09:05:39 -0800 (PST) X-Received: by 10.112.136.38 with SMTP id px6mr2240193lbb.88.1417453538758; Mon, 01 Dec 2014 09:05:38 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id kw10sm1228243lac.45.2014.12.01.09.05.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 09:05:38 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 19:05:26 +0200 Message-Id: <1417453530-18743-2-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417453530-18743-1-git-send-email-taras.kondratiuk@linaro.org> References: <1417453530-18743-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 1/5] validation: shm: move main() to a common place 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: taras.kondratiuk@linaro.org 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 Most of test application will have the same main function. Move main() from odp_shm to a common place where it can be reused by other test applications. Unifying main() will also simplify transition to a combined single test application in future. Signed-off-by: Taras Kondratiuk Reviewed-by: Mike Holmes --- test/validation/Makefile.am | 4 +-- test/validation/common/odp_cunit_common.c | 33 +++++++++++++++++++++++ test/validation/common/odp_cunit_common.h | 9 +++++++ test/validation/odp_shm.c | 42 ++--------------------------- 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 4bee2ab..8b55bad 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/test/Makefile.inc -AM_CFLAGS += -I$(CUNIT_PATH)/include +AM_CFLAGS += -I$(CUNIT_PATH)/include -I$(srcdir)/common AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED @@ -11,7 +11,7 @@ odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) -odp_shm_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/common +odp_shm_CFLAGS = $(AM_CFLAGS) odp_shm_LDFLAGS = $(AM_LDFLAGS) endif diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index 885b981..c87e103 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -35,3 +35,36 @@ int odp_cunit_thread_exit(pthrd_arg *arg) return 0; } + +int main(void) +{ + int ret; + + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); + + if (0 != odp_init_global(NULL, NULL)) { + printf("odp_init_global fail.\n"); + return -1; + } + if (0 != odp_init_local()) { + printf("odp_init_local fail.\n"); + return -1; + } + + CU_set_error_action(CUEA_ABORT); + + CU_initialize_registry(); + CU_register_suites(odp_testsuites); + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + + ret = CU_get_number_of_failure_records(); + + CU_cleanup_registry(); + + odp_term_local(); + odp_term_global(); + + return ret; +} diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 71a3350..1f30788 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -13,8 +13,17 @@ #ifndef ODP_CUNICT_COMMON_H #define ODP_CUNICT_COMMON_H +#include "CUnit/Basic.h" + #define MAX_WORKERS 32 /**< Maximum number of work threads */ +/** + * Array of testsuites provided by a test application. Array must be terminated + * by CU_SUITE_INFO_NULL and must be suitable to be used by + * CU_register_suites(). + */ +extern CU_SuiteInfo odp_testsuites[]; + typedef struct { uint32_t foo; uint32_t bar; diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c index bcd46c7..8a991b1 100644 --- a/test/validation/odp_shm.c +++ b/test/validation/odp_shm.c @@ -5,7 +5,6 @@ */ #include "odp.h" -#include "CUnit/Basic.h" #include "odp_cunit_common.h" #define ALIGE_SIZE (128) @@ -71,50 +70,13 @@ static void test_odp_shm_sunnyday(void) odp_cunit_thread_exit(&thrdarg); } -static int init(void) -{ - printf("\tODP API version: %s\n", odp_version_api_str()); - printf("\tODP implementation version: %s\n", odp_version_impl_str()); - return 0; -} - CU_TestInfo test_odp_shm[] = { {"test_odp_shm_creat", test_odp_shm_sunnyday}, CU_TEST_INFO_NULL, }; -CU_SuiteInfo suites[] = { - {"odp_system", init, NULL, NULL, NULL, test_odp_shm}, +CU_SuiteInfo odp_testsuites[] = { + {"Shared Memory", NULL, NULL, NULL, NULL, test_odp_shm}, CU_SUITE_INFO_NULL, }; - -int main(void) -{ - int ret; - - if (0 != odp_init_global(NULL, NULL)) { - printf("odp_init_global fail.\n"); - return -1; - } - if (0 != odp_init_local()) { - printf("odp_init_local fail.\n"); - return -1; - } - - CU_set_error_action(CUEA_ABORT); - - CU_initialize_registry(); - CU_register_suites(suites); - CU_basic_set_mode(CU_BRM_VERBOSE); - CU_basic_run_tests(); - - ret = CU_get_number_of_failure_records(); - - CU_cleanup_registry(); - - odp_term_local(); - odp_term_global(); - - return ret; -}