From patchwork Mon Apr 27 15:54:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 47634 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D03E720553 for ; Mon, 27 Apr 2015 15:55:11 +0000 (UTC) Received: by laat2 with SMTP id t2sf27700152laa.2 for ; Mon, 27 Apr 2015 08:55:10 -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=twvgyPhpJ5SS4vAnoNaqJW0inToCGaYRuT2H5E8S2g0=; b=QbIcysQyolADjijqtUqG3DS+jJxNYk/IK3/IgW5tzJI2OxP6fETG86mC4K5NeHtiFF G75D3UqlAhNjUckALpPEsIyqD6eXozQVhB9x1cpe1boAkHsPfEuH1B9/6QE6FmEZ5DMo sYFfoECwHuOisGGcwAaj7ynese8Wn7Gt+v+UWcsefxWR6APKwcRSqAMTgHsdcESWyiUG aOBBErArQMigL/I57/+vEmfbXtQ6PntFANEdZXo8RXV/Bcv19f9jWHtz5wB1eh4c27g4 snmyLZzZdU5b8nKriDA9MIGItQ/BqKk1Xh4R9RkYZzGH96oTX/KjgyX8Y6zUugiGX3lk dRmg== X-Gm-Message-State: ALoCoQlJTkixdtwH3g4ZnopbkvtJ8eqtmkh2KYubf+tYxxdgxwq8wQXyWKWXJf32r+qvtFgpmRQW X-Received: by 10.112.142.170 with SMTP id rx10mr7731506lbb.12.1430150110772; Mon, 27 Apr 2015 08:55:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.72 with SMTP id b8ls806111laf.81.gmail; Mon, 27 Apr 2015 08:55:10 -0700 (PDT) X-Received: by 10.112.160.41 with SMTP id xh9mr10441124lbb.96.1430150110595; Mon, 27 Apr 2015 08:55:10 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id dy7si15048486lbc.63.2015.04.27.08.55.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 08:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labbd9 with SMTP id bd9so83343321lab.2 for ; Mon, 27 Apr 2015 08:55:10 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr10488458lag.112.1430150110467; Mon, 27 Apr 2015 08:55:10 -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.67.65 with SMTP id l1csp1358540lbt; Mon, 27 Apr 2015 08:55:09 -0700 (PDT) X-Received: by 10.236.109.36 with SMTP id r24mr18696002yhg.113.1430150108828; Mon, 27 Apr 2015 08:55:08 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v133si11773247ykv.2.2015.04.27.08.55.06; Mon, 27 Apr 2015 08:55:08 -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 C226861DCC; Mon, 27 Apr 2015 15:55:05 +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=unavailable autolearn_force=no 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 18BEA61CF5; Mon, 27 Apr 2015 15:54:38 +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 57D5861C97; Mon, 27 Apr 2015 15:54:35 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by lists.linaro.org (Postfix) with ESMTPS id 84CFB61C88 for ; Mon, 27 Apr 2015 15:54:18 +0000 (UTC) Received: by lbbuc2 with SMTP id uc2so85620144lbb.2 for ; Mon, 27 Apr 2015 08:54:17 -0700 (PDT) X-Received: by 10.152.27.74 with SMTP id r10mr10836987lag.31.1430150057243; Mon, 27 Apr 2015 08:54:17 -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 z2sm4850441lae.20.2015.04.27.08.54.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Apr 2015 08:54:16 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Mon, 27 Apr 2015 17:54:00 +0200 Message-Id: <1430150040-10463-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430150040-10463-1-git-send-email-christophe.milard@linaro.org> References: <1430150040-10463-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCHv2 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.54 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. 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 | 35 ++++++++++-------------- test/validation/odp_crypto.c | 20 ++++++++++++++ test/validation/odp_synchronizers.c | 9 +++++++ 7 files changed, 95 insertions(+), 89 deletions(-) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 7ea86c4..ba622c3 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -48,9 +48,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_schedule_SOURCES = odp_schedule.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 82f8849..3bbec11 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; @@ -30,24 +43,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 275d343..f37ed91 100644 --- a/test/validation/init/odp_init_log.c +++ b/test/validation/init/odp_init_log.c @@ -7,9 +7,23 @@ #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 +56,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..022c9bd 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,16 @@ 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 edb6bf1..c334015 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);