From patchwork Wed Dec 3 09:22:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41835 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3039125E66 for ; Wed, 3 Dec 2014 09:22:51 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf9193949wgh.2 for ; Wed, 03 Dec 2014 01:22:50 -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=ZEkIX6DGxBr0Ea56aaDCO1wzgCWtlXdVCmdJQixOHnc=; b=PLPxEszjU05lp6DnCMpYqxmmP/+HlOvumgEeZ6ZjEpxhlG06p83B1iSBCqCNkLNGPz SjKxWPIDaLY7vuTduw4Fb5tBEkAMQJXaXt6sTSdSk3ErekOXTBv7EeMPPacOSmc8IHs/ Rq+9JPhLFt265tmdRw/MHojbhI9xSxj0mlsMMNOFBVI7x4j5yJFf5h8a62xE2qXNoyMY kFHHAL6Hg+sIEs5gXBXBZSRh48uUORDJAXsn9C5XybhrMvPsvCq2PFpTIIPufRXJaN02 sZWEFIv/ZWnceGp0goWus/W6ivfQbDPdLQd0ptnmzb5/+jJPx9jEHf3kKcRv3hzMHfSb sSig== X-Gm-Message-State: ALoCoQld2ZcrWPzzvd8t05QK5K437tIwHYXRcj3W00ecddSrmlO0Jbp98129gplylbTgHiHAkail X-Received: by 10.181.27.135 with SMTP id jg7mr1873077wid.5.1417598570410; Wed, 03 Dec 2014 01:22:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.131 with SMTP id ei3ls107400lad.106.gmail; Wed, 03 Dec 2014 01:22:49 -0800 (PST) X-Received: by 10.152.5.132 with SMTP id s4mr3270830las.39.1417598569695; Wed, 03 Dec 2014 01:22:49 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id ll1si16545588lac.41.2014.12.03.01.22.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 01:22:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ms9so12127325lab.10 for ; Wed, 03 Dec 2014 01:22:49 -0800 (PST) X-Received: by 10.152.21.66 with SMTP id t2mr3228972lae.27.1417598569349; Wed, 03 Dec 2014 01:22:49 -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 ew9csp633449lbc; Wed, 3 Dec 2014 01:22:48 -0800 (PST) X-Received: by 10.229.215.137 with SMTP id he9mr6463405qcb.6.1417598567843; Wed, 03 Dec 2014 01:22:47 -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 c9si27283140qcm.44.2014.12.03.01.22.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 01:22:47 -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 1Xw68z-0005wE-Ik; Wed, 03 Dec 2014 09:22:45 +0000 Received: from mail-wg0-f51.google.com ([74.125.82.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xw68p-0005vO-N0 for lng-odp@lists.linaro.org; Wed, 03 Dec 2014 09:22:35 +0000 Received: by mail-wg0-f51.google.com with SMTP id k14so19289433wgh.10 for ; Wed, 03 Dec 2014 01:22:30 -0800 (PST) X-Received: by 10.180.182.199 with SMTP id eg7mr11769879wic.17.1417598550263; Wed, 03 Dec 2014 01:22:30 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id mc10sm49901450wic.24.2014.12.03.01.22.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 01:22:29 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Wed, 3 Dec 2014 11:22:17 +0200 Message-Id: <1417598541-31897-2-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417598541-31897-1-git-send-email-taras.kondratiuk@linaro.org> References: <1417598541-31897-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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.51 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 | 3 ++- 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(+), 41 deletions(-) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 2632fb8..837ae95 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -1,5 +1,6 @@ include $(top_srcdir)/test/Makefile.inc +AM_CFLAGS += -I$(srcdir)/common AM_LDFLAGS += -static if ODP_CUNIT_ENABLED @@ -10,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; -}