From patchwork Wed May 20 16:11:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 48810 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 286C92121F for ; Wed, 20 May 2015 16:13:05 +0000 (UTC) Received: by wgwl7 with SMTP id l7sf19098738wgw.0 for ; Wed, 20 May 2015 09:13:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc: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=NiKsjZBrpi2cJrHafOAHEB/lj5QWZJm69YSYai1GUKs=; b=JR3Xvi0ubTgOZ1eEXymTlSCvXNJVA9t4AY0WnEvBFjRt404ENk9upkTYDzDPkcTWni U2ODterk4cXruxJrMimwAKp7otPgfESto4PX/XAw8EYynbk2Ng1wXcPGa7ImiGEiD857 AXrb9vwnRgkcW2UltUUOOk8L2+N8dqTcp4nT2M1iZRpltnVlXPQXp9Ip297Eh+5yWMhR AX5719wLpK2KXSWTzqmbM03EX/ffUqUk21SGlH/fhL7XeKhu3vkYfNCkbfapsI9DoF5f Qor4y40ldmVAl9wQZLUN6FmBHoHKZd9lK2eLKmxjauYj1hCs3l+5fpkXny7H0WIuJWyZ l34w== X-Gm-Message-State: ALoCoQlq4IIr7JMDhFVjgrkRlBTJpf5VkeoRVKrRZK78Q+72omYHhpdY9TkjY71Slx8oqXG7JvoP X-Received: by 10.194.143.98 with SMTP id sd2mr27104142wjb.6.1432138384221; Wed, 20 May 2015 09:13:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls250966laz.2.gmail; Wed, 20 May 2015 09:13:04 -0700 (PDT) X-Received: by 10.112.12.68 with SMTP id w4mr26108255lbb.87.1432138384051; Wed, 20 May 2015 09:13:04 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id l7si11421657lae.121.2015.05.20.09.13.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 09:13:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labbd9 with SMTP id bd9so81946525lab.2 for ; Wed, 20 May 2015 09:13:03 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr26683810lbc.86.1432138383682; Wed, 20 May 2015 09:13:03 -0700 (PDT) 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.108.230 with SMTP id hn6csp1639586lbb; Wed, 20 May 2015 09:13:02 -0700 (PDT) X-Received: by 10.140.85.101 with SMTP id m92mr45009966qgd.37.1432138379628; Wed, 20 May 2015 09:12:59 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 89si3531954qkx.87.2015.05.20.09.12.58; Wed, 20 May 2015 09:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 4623F61E73; Wed, 20 May 2015 16:12:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8379561E6D; Wed, 20 May 2015 16:12:28 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0001961E55; Wed, 20 May 2015 16:12:18 +0000 (UTC) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 3707361E6D for ; Wed, 20 May 2015 16:11:56 +0000 (UTC) Received: by lagv1 with SMTP id v1so81703353lag.3 for ; Wed, 20 May 2015 09:11:55 -0700 (PDT) X-Received: by 10.152.7.239 with SMTP id m15mr3690653laa.95.1432138315031; Wed, 20 May 2015 09:11:55 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id v6sm4680381laa.23.2015.05.20.09.11.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 May 2015 09:11:54 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Wed, 20 May 2015 18:11:29 +0200 Message-Id: <1432138289-26907-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432138289-26907-1-git-send-email-christophe.milard@linaro.org> References: <1432138289-26907-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCHv3 2/2] validation: init tests using common main X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christophe.milard@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.45 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 The 3 init tests (init, abort,log) now links with common/odp_cunit_common, as other tests. In main, ODP init is now performed via weak functions which are overloaded (to do nothing) by the 3 init tests. And other cosmetic fixes to please check-odp. Signed-off-by: Christophe Milard --- test/validation/Makefile.am | 6 ++--- test/validation/common/odp_cunit_common.c | 45 +++++++++++++++---------------- test/validation/init/odp_init.c | 34 +++++++++-------------- test/validation/init/odp_init_abort.c | 35 ++++++++++-------------- test/validation/init/odp_init_log.c | 34 +++++++++-------------- test/validation/odp_crypto.c | 19 +++++++++++++ test/validation/odp_synchronizers.c | 9 +++++++ 7 files changed, 93 insertions(+), 89 deletions(-) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 814873c..577063b 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -47,9 +47,9 @@ dist_odp_classification_SOURCES = classification/odp_classification_tests.c \ odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto dist_odp_crypto_SOURCES = crypto/odp_crypto_test_inp.c \ odp_crypto.c $(ODP_CU_COMMON) -dist_odp_init_SOURCES = init/odp_init.c -dist_odp_init_abort_SOURCES = init/odp_init_abort.c -dist_odp_init_log_SOURCES = init/odp_init_log.c +dist_odp_init_SOURCES = init/odp_init.c $(ODP_CU_COMMON) +dist_odp_init_abort_SOURCES = init/odp_init_abort.c $(ODP_CU_COMMON) +dist_odp_init_log_SOURCES = init/odp_init_log.c $(ODP_CU_COMMON) dist_odp_queue_SOURCES = odp_queue.c $(ODP_CU_COMMON) dist_odp_random_SOURCES = odp_random.c $(ODP_CU_COMMON) dist_odp_scheduler_SOURCES = odp_scheduler.c $(ODP_CU_COMMON) diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index 2af4410..eac2d81 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -39,13 +39,32 @@ int odp_cunit_thread_exit(pthrd_arg *arg) return 0; } -__attribute__((__weak__)) int tests_global_init(void) +ODP_WEAK_SYMBOL int tests_global_init(void) { + if (0 != odp_init_global(NULL, NULL)) { + fprintf(stderr, "error: odp_init_global() failed.\n"); + return -1; + } + if (0 != odp_init_local()) { + fprintf(stderr, "error: odp_init_local() failed.\n"); + return -1; + } + return 0; } -__attribute__((__weak__)) int tests_global_term(void) +ODP_WEAK_SYMBOL int tests_global_term(void) { + if (0 != odp_term_local()) { + fprintf(stderr, "error: odp_term_local() failed.\n"); + return -1; + } + + if (0 != odp_term_global()) { + fprintf(stderr, "error: odp_term_global() failed.\n"); + return -1; + } + return 0; } @@ -56,18 +75,8 @@ int main(void) 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)) { - fprintf(stderr, "error: odp_init_global() failed.\n"); + if (0 != tests_global_init()) return -1; - } - if (0 != odp_init_local()) { - fprintf(stderr, "error: odp_init_local() failed.\n"); - return -1; - } - - ret = tests_global_init(); - if (ret) - return ret; CU_set_error_action(CUEA_ABORT); @@ -83,15 +92,5 @@ int main(void) if (0 != tests_global_term()) return -1; - if (0 != odp_term_local()) { - fprintf(stderr, "error: odp_term_local() failed.\n"); - return -1; - } - - if (0 != odp_term_global()) { - fprintf(stderr, "error: odp_term_global() failed.\n"); - return -1; - } - return (ret) ? -1 : 0; } diff --git a/test/validation/init/odp_init.c b/test/validation/init/odp_init.c index 1332757..082e7c2 100644 --- a/test/validation/init/odp_init.c +++ b/test/validation/init/odp_init.c @@ -7,10 +7,23 @@ #include #include #include +#include "odp_cunit_common.h" #define DEFAULT_MSG_POOL_SIZE (4 * 1024 * 1024) #define DEFAULT_MSG_SIZE (8) +/* overwrite common default so as not to perform odp init in main */ +int tests_global_init(void) +{ + return 0; +} + +/* overwrite common default so as not to perform odp term in main */ +int tests_global_term(void) +{ + return 0; +} + static void test_odp_init_global(void) { int status; @@ -31,24 +44,3 @@ CU_SuiteInfo odp_testsuites[] = { {"Init", NULL, NULL, NULL, NULL, test_odp_init}, CU_SUITE_INFO_NULL, }; - -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()); - - 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(); - - return ret; -} diff --git a/test/validation/init/odp_init_abort.c b/test/validation/init/odp_init_abort.c index ceb82b5..c83c8d3 100644 --- a/test/validation/init/odp_init_abort.c +++ b/test/validation/init/odp_init_abort.c @@ -8,6 +8,20 @@ #include #include #include +#include "odp_cunit_common.h" + +/* overwrite common default so as not to perform odp init in main */ +int tests_global_init(void) +{ + return 0; +} + +/* overwrite common default so as not to perform odp term in main */ +int tests_global_term(void) +{ + return 0; +} + static void odp_init_abort(void) ODP_NORETURN; @@ -36,27 +50,6 @@ CU_SuiteInfo odp_testsuites[] = { CU_SUITE_INFO_NULL, }; -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()); - - 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(); - - return ret; -} - void odp_init_abort(void) { abort(); diff --git a/test/validation/init/odp_init_log.c b/test/validation/init/odp_init_log.c index 98cc059..fe1be71 100644 --- a/test/validation/init/odp_init_log.c +++ b/test/validation/init/odp_init_log.c @@ -7,9 +7,22 @@ #include #include #include +#include "odp_cunit_common.h" int replacement_logging_used; +/* overwrite common default so as not to perform odp init in main */ +int tests_global_init(void) +{ + return 0; +} + +/* overwrite common default so as not to perform odp term in main */ +int tests_global_term(void) +{ + return 0; +} + ODP_PRINTF_FORMAT(2, 3) static int odp_init_log(odp_log_level_e level, const char *fmt, ...); @@ -42,27 +55,6 @@ CU_SuiteInfo odp_testsuites[] = { CU_SUITE_INFO_NULL, }; -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()); - - 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(); - - return ret; -} - int odp_init_log(odp_log_level_e level __attribute__((unused)), const char *fmt, ...) { diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c index f364b1a..2a20ea1 100644 --- a/test/validation/odp_crypto.c +++ b/test/validation/odp_crypto.c @@ -28,6 +28,15 @@ int tests_global_init(void) odp_pool_t pool; odp_queue_t out_queue; + if (0 != odp_init_global(NULL, NULL)) { + fprintf(stderr, "error: odp_init_global() failed.\n"); + return -1; + } + if (0 != odp_init_local()) { + fprintf(stderr, "error: odp_init_local() failed.\n"); + return -1; + } + memset(¶ms, 0, sizeof(params)); params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE; params.pkt.len = SHM_PKT_POOL_BUF_SIZE; @@ -71,5 +80,15 @@ int tests_global_term(void) fprintf(stderr, "Packet pool not found.\n"); } + if (0 != odp_term_local()) { + fprintf(stderr, "error: odp_term_local() failed.\n"); + return -1; + } + + if (0 != odp_term_global()) { + fprintf(stderr, "error: odp_term_global() failed.\n"); + return -1; + } + return 0; } diff --git a/test/validation/odp_synchronizers.c b/test/validation/odp_synchronizers.c index 5123177..71342d1 100644 --- a/test/validation/odp_synchronizers.c +++ b/test/validation/odp_synchronizers.c @@ -1051,6 +1051,15 @@ int tests_global_init(void) uint32_t core_count, max_threads; int ret = 0; + if (0 != odp_init_global(NULL, NULL)) { + fprintf(stderr, "error: odp_init_global() failed.\n"); + return -1; + } + if (0 != odp_init_local()) { + fprintf(stderr, "error: odp_init_local() failed.\n"); + return -1; + } + global_shm = odp_shm_reserve(GLOBAL_SHM_NAME, sizeof(global_shared_mem_t), 64, ODP_SHM_SW_ONLY);