From patchwork Wed Jun 24 16:51:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 50295 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 404CF21575 for ; Wed, 24 Jun 2015 16:54:40 +0000 (UTC) Received: by laer2 with SMTP id r2sf12530404lae.3 for ; Wed, 24 Jun 2015 09:54:39 -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=XiHYEq0mnyyouU7Ok7N5zVtmxwVDKqDdaRHRxN5YJZo=; b=P3zzaAfbNpMVQ37GEd00S55e/fyEHxKQeKhhgnQH2ctV2JG3krD5fGLI603VytlvNy JqEk6U1nWRwNFpCFAYLiCGbe52mgYbm+F+uEFTpT5bzjoweTCA7aJqO9NqgKwfFDgNiG W7nksQib54kdG6Zi0svEMy6JxV+wKGENXng+Swaws8A125JqN5OaWFT5g+g6ULUajlW/ rSMcSl/HdjxUfDEYDZKzxXLUAq6pHH5a7BGXou9p1diSWSdKRzXOzEA5xEn2QZgTAXBu nzlc72LoZkSvrggCjOZwUICP5d+C3gUuCnRedvWiXxaUc+CuiZ3+oKsUNXIlDdsKKaX1 oKIg== X-Gm-Message-State: ALoCoQlNPn9E1Ehvzc5u8ZIOEQNOKaX5j5xWvrT+7A1erBMtTdJswM6+xJKe9GP4Xby/2v/hdwL0 X-Received: by 10.180.35.162 with SMTP id i2mr2573141wij.6.1435164879249; Wed, 24 Jun 2015 09:54:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.232 with SMTP id r8ls217829lal.55.gmail; Wed, 24 Jun 2015 09:54:39 -0700 (PDT) X-Received: by 10.152.44.132 with SMTP id e4mr41638494lam.34.1435164879075; Wed, 24 Jun 2015 09:54:39 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id p1si2248138laj.140.2015.06.24.09.54.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jun 2015 09:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lacny3 with SMTP id ny3so29720004lac.3 for ; Wed, 24 Jun 2015 09:54:39 -0700 (PDT) X-Received: by 10.152.1.40 with SMTP id 8mr41779368laj.56.1435164878940; Wed, 24 Jun 2015 09:54:38 -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 hn6csp35827lbb; Wed, 24 Jun 2015 09:54:37 -0700 (PDT) X-Received: by 10.55.20.16 with SMTP id e16mr85846908qkh.71.1435164877210; Wed, 24 Jun 2015 09:54:37 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z76si26404346qkg.52.2015.06.24.09.54.36; Wed, 24 Jun 2015 09:54:37 -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 5D80D61F10; Wed, 24 Jun 2015 16:54:36 +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_H2, 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 F1B1A62052; Wed, 24 Jun 2015 16:52:30 +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 C8C1B61F10; Wed, 24 Jun 2015 16:52:18 +0000 (UTC) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by lists.linaro.org (Postfix) with ESMTPS id AEFDD61F00 for ; Wed, 24 Jun 2015 16:51:51 +0000 (UTC) Received: by lbbvz5 with SMTP id vz5so30108616lbb.0 for ; Wed, 24 Jun 2015 09:51:50 -0700 (PDT) X-Received: by 10.152.21.5 with SMTP id r5mr40622417lae.24.1435164710699; Wed, 24 Jun 2015 09:51:50 -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 k9sm3638444lbp.13.2015.06.24.09.51.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jun 2015 09:51:49 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Wed, 24 Jun 2015 18:51:30 +0200 Message-Id: <1435164691-6714-4-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435164691-6714-1-git-send-email-christophe.milard@linaro.org> References: <1435164691-6714-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 3/4] validation: creating own dir and lib for init 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.53 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 Module init now create its own lib (currentely only containing its executables) Signed-off-by: Christophe Milard --- configure.ac | 1 + test/validation/.gitignore | 3 - test/validation/Makefile.am | 19 ++--- test/validation/init/.gitignore | 4 + test/validation/init/Makefile.am | 14 +++ test/validation/init/init.c | 151 +++++++++++++++++++++++++++++++++ test/validation/init/init.h | 9 ++ test/validation/init/init_main_abort.c | 11 +++ test/validation/init/init_main_log.c | 11 +++ test/validation/init/init_main_ok.c | 11 +++ test/validation/init/odp_init.c | 57 ------------- test/validation/init/odp_init_abort.c | 67 --------------- test/validation/init/odp_init_log.c | 83 ------------------ 13 files changed, 217 insertions(+), 224 deletions(-) create mode 100644 test/validation/init/.gitignore create mode 100644 test/validation/init/Makefile.am create mode 100644 test/validation/init/init.c create mode 100644 test/validation/init/init.h create mode 100644 test/validation/init/init_main_abort.c create mode 100644 test/validation/init/init_main_log.c create mode 100644 test/validation/init/init_main_ok.c delete mode 100644 test/validation/init/odp_init.c delete mode 100644 test/validation/init/odp_init_abort.c delete mode 100644 test/validation/init/odp_init_log.c diff --git a/configure.ac b/configure.ac index 68b65d5..f58b472 100644 --- a/configure.ac +++ b/configure.ac @@ -306,6 +306,7 @@ AC_CONFIG_FILES([Makefile test/validation/classification/Makefile test/validation/common/Makefile test/validation/crypto/Makefile + test/validation/init/Makefile test/validation/pktio/Makefile test/validation/random/Makefile test/validation/system/Makefile diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 8f78055..067914f 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -3,9 +3,6 @@ odp_ver_abt_log_dbg odp_buffer odp_cpumask -odp_init -odp_init_abort -odp_init_log odp_packet odp_pool odp_queue diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index bccc886..44a5a74 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,9 +6,6 @@ AM_LDFLAGS += -static EXECUTABLES = odp_buffer \ odp_cpumask \ - odp_init \ - odp_init_abort \ - odp_init_log \ odp_packet \ odp_pool \ odp_queue \ @@ -20,7 +17,10 @@ EXECUTABLES = odp_buffer \ odp_ver_abt_log_dbg if test_vald -TESTS = $(EXECUTABLES) +TESTS = $(EXECUTABLES) \ + init/init_main_ok \ + init/init_main_abort \ + init/init_main_log endif bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY) @@ -30,16 +30,6 @@ ODP_CU_COMMON=common/odp_cunit_common.c odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer dist_odp_buffer_SOURCES = odp_buffer.c odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto -odp_init_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \ - $(LIB)/libodp.la -dist_odp_init_SOURCES = init/odp_init.c -odp_init_abort_LDADD = \ - $(top_builddir)/test/validation/common/libcunit_common.a \ - $(LIB)/libodp.la -dist_odp_init_abort_SOURCES = init/odp_init_abort.c -odp_init_log_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \ - $(LIB)/libodp.la -dist_odp_init_log_SOURCES = init/odp_init_log.c dist_odp_queue_SOURCES = odp_queue.c odp_random_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \ $(LIB)/libodp.la @@ -58,6 +48,7 @@ dist_odp_ver_abt_log_dbg_SOURCES = ver_abt_log_dbg/odp_system.c \ ODP_MODULES = classification \ crypto \ + init \ pktio \ random \ system diff --git a/test/validation/init/.gitignore b/test/validation/init/.gitignore new file mode 100644 index 0000000..79eb713 --- /dev/null +++ b/test/validation/init/.gitignore @@ -0,0 +1,4 @@ +libinit.a +init_main_abort +init_main_log +init_main_ok diff --git a/test/validation/init/Makefile.am b/test/validation/init/Makefile.am new file mode 100644 index 0000000..08b1ca7 --- /dev/null +++ b/test/validation/init/Makefile.am @@ -0,0 +1,14 @@ +include ../Makefile.inc +noinst_LIBRARIES = libinit.a +libinit_a_SOURCES = init.c + +# most platforms are expected not to support multiple ODP inits +# following each other: therefore 3 separate binaries are +# created, each containing its ODP init test. +bin_PROGRAMS = init_main_abort init_main_log init_main_ok +dist_init_main_abort_SOURCES = init_main_abort.c +dist_init_main_log_SOURCES = init_main_log.c +dist_init_main_ok_SOURCES = init_main_ok.c +init_main_abort_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP) +init_main_log_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP) +init_main_ok_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP) diff --git a/test/validation/init/init.c b/test/validation/init/init.c new file mode 100644 index 0000000..169bd5c --- /dev/null +++ b/test/validation/init/init.c @@ -0,0 +1,151 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include "odp_cunit_common.h" +#include "init.h" + +/* flag set when the replacement logging function is used */ +int replacement_logging_used; + +/* replacement abort function: */ +static void odp_init_abort(void) ODP_NORETURN; + +/* replacement log function: */ +ODP_PRINTF_FORMAT(2, 3) +static int odp_init_log(odp_log_level_e level, const char *fmt, ...); + +/* test ODP global init, with alternate abort function */ +static void init_test_odp_init_global_replace_abort(void) +{ + int status; + struct odp_init_t init_data; + + memset(&init_data, 0, sizeof(init_data)); + init_data.abort_fn = &odp_init_abort; + + status = odp_init_global(&init_data, NULL); + CU_ASSERT_FATAL(status == 0); + + status = odp_term_global(); + CU_ASSERT(status == 0); +} + +static CU_TestInfo init_suite_abort[] = { + {"replace abort", init_test_odp_init_global_replace_abort}, + CU_TEST_INFO_NULL, +}; + +static CU_SuiteInfo init_suites_abort[] = { + {"Init", NULL, NULL, NULL, NULL, init_suite_abort}, + CU_SUITE_INFO_NULL, +}; + +static void odp_init_abort(void) +{ + abort(); +} + +int init_main_abort(void) +{ + /* prevent default ODP init: */ + odp_cunit_register_global_init(NULL); + odp_cunit_register_global_term(NULL); + + /* run the tests: */ + return odp_cunit_run(init_suites_abort); +} + +/* test ODP global init, with alternate log function */ +static void init_test_odp_init_global_replace_log(void) +{ + int status; + struct odp_init_t init_data; + + memset(&init_data, 0, sizeof(init_data)); + init_data.log_fn = &odp_init_log; + + replacement_logging_used = 0; + + status = odp_init_global(&init_data, NULL); + CU_ASSERT_FATAL(status == 0); + + CU_ASSERT_TRUE(replacement_logging_used); + + status = odp_term_global(); + CU_ASSERT(status == 0); +} + +static CU_TestInfo init_suite_log[] = { + {"replace log", init_test_odp_init_global_replace_log}, + CU_TEST_INFO_NULL, +}; + +static CU_SuiteInfo init_suites_log[] = { + {"Init", NULL, NULL, NULL, NULL, init_suite_log}, + CU_SUITE_INFO_NULL, +}; + +static int odp_init_log(odp_log_level_e level __attribute__((unused)), + const char *fmt, ...) +{ + va_list args; + int r; + + /* just set a flag to be sure the replacement fn was used */ + replacement_logging_used = 1; + + va_start(args, fmt); + r = vfprintf(stderr, fmt, args); + va_end(args); + + return r; +} + +int init_main_log(void) +{ + /* prevent default ODP init: */ + odp_cunit_register_global_init(NULL); + odp_cunit_register_global_term(NULL); + + /* run the tests: */ + return odp_cunit_run(init_suites_log); +} + +/* test normal ODP global init */ +static void init_test_odp_init_global(void) +{ + int status; + + status = odp_init_global(NULL, NULL); + CU_ASSERT_FATAL(status == 0); + + status = odp_term_global(); + CU_ASSERT(status == 0); +} + +static CU_TestInfo init_suite_ok[] = { + {"test_odp_init_global", init_test_odp_init_global}, + CU_TEST_INFO_NULL, +}; + +static CU_SuiteInfo init_suites_ok[] = { + {"Init", NULL, NULL, NULL, NULL, init_suite_ok}, + CU_SUITE_INFO_NULL, +}; + +int init_main_ok(void) +{ + /* prevent default ODP init: */ + odp_cunit_register_global_init(NULL); + odp_cunit_register_global_term(NULL); + + /* run the tests: */ + return odp_cunit_run(init_suites_ok); +} diff --git a/test/validation/init/init.h b/test/validation/init/init.h new file mode 100644 index 0000000..ca03994 --- /dev/null +++ b/test/validation/init/init.h @@ -0,0 +1,9 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +int init_main_abort(void); +int init_main_log(void); +int init_main_ok(void); diff --git a/test/validation/init/init_main_abort.c b/test/validation/init/init_main_abort.c new file mode 100644 index 0000000..c7bdd9d --- /dev/null +++ b/test/validation/init/init_main_abort.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "init.h" + +int main(void) +{ + return init_main_abort(); +} diff --git a/test/validation/init/init_main_log.c b/test/validation/init/init_main_log.c new file mode 100644 index 0000000..f35ac38 --- /dev/null +++ b/test/validation/init/init_main_log.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "init.h" + +int main(void) +{ + return init_main_log(); +} diff --git a/test/validation/init/init_main_ok.c b/test/validation/init/init_main_ok.c new file mode 100644 index 0000000..285c747 --- /dev/null +++ b/test/validation/init/init_main_ok.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "init.h" + +int main(void) +{ + return init_main_ok(); +} diff --git a/test/validation/init/odp_init.c b/test/validation/init/odp_init.c deleted file mode 100644 index 0e159ac..0000000 --- a/test/validation/init/odp_init.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#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 init_test_odp_init_global(void) -{ - int status; - - status = odp_init_global(NULL, NULL); - CU_ASSERT_FATAL(status == 0); - - status = odp_term_global(); - CU_ASSERT(status == 0); -} - -static CU_TestInfo init_suite_ok[] = { - {"test_odp_init_global", init_test_odp_init_global}, - CU_TEST_INFO_NULL, -}; - -static CU_SuiteInfo init_suites_ok[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_ok}, - CU_SUITE_INFO_NULL, -}; - -static int init_main_ok(void) -{ - return odp_cunit_run(init_suites_ok); -} - -/* the following main function will be separated when lib is created */ -int main(void) -{ - return init_main_ok(); -} diff --git a/test/validation/init/odp_init_abort.c b/test/validation/init/odp_init_abort.c deleted file mode 100644 index 675c6b9..0000000 --- a/test/validation/init/odp_init_abort.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#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; - -static void init_test_odp_init_global_replace_abort(void) -{ - int status; - struct odp_init_t init_data; - - memset(&init_data, 0, sizeof(init_data)); - init_data.abort_fn = &odp_init_abort; - - status = odp_init_global(&init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - status = odp_term_global(); - CU_ASSERT(status == 0); -} - -static CU_TestInfo init_suite_abort[] = { - {"replace abort", init_test_odp_init_global_replace_abort}, - CU_TEST_INFO_NULL, -}; - -static CU_SuiteInfo init_suites_abort[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_abort}, - CU_SUITE_INFO_NULL, -}; - -void odp_init_abort(void) -{ - abort(); -} - -static int init_main_abort(void) -{ - return odp_cunit_run(init_suites_abort); -} - -/* the following main function will be separated when lib is created */ -int main(void) -{ - return init_main_abort(); -} diff --git a/test/validation/init/odp_init_log.c b/test/validation/init/odp_init_log.c deleted file mode 100644 index 303fe6f..0000000 --- a/test/validation/init/odp_init_log.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#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, ...); - -static void init_test_odp_init_global_replace_log(void) -{ - int status; - struct odp_init_t init_data; - - memset(&init_data, 0, sizeof(init_data)); - init_data.log_fn = &odp_init_log; - - replacement_logging_used = 0; - - status = odp_init_global(&init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - CU_ASSERT_TRUE(replacement_logging_used); - - status = odp_term_global(); - CU_ASSERT(status == 0); -} - -static CU_TestInfo init_suite_log[] = { - {"replace log", init_test_odp_init_global_replace_log}, - CU_TEST_INFO_NULL, -}; - -static CU_SuiteInfo init_suites_log[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_log}, - CU_SUITE_INFO_NULL, -}; - -int odp_init_log(odp_log_level_e level __attribute__((unused)), - const char *fmt, ...) -{ - va_list args; - int r; - - /* just set a flag to be sure the replacement fn was used */ - replacement_logging_used = 1; - - va_start(args, fmt); - r = vfprintf(stderr, fmt, args); - va_end(args); - - return r; -} - -static int init_main_log(void) -{ - return odp_cunit_run(init_suites_log); -} - -/* the following main function will be separated when lib is created */ -int main(void) -{ - return init_main_log(); -}