From patchwork Wed Jun 10 16:54:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 49715 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 40AC3245D4 for ; Wed, 10 Jun 2015 16:56:10 +0000 (UTC) Received: by wgme6 with SMTP id e6sf13400303wgm.3 for ; Wed, 10 Jun 2015 09:56:09 -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=StEsNkF+bXpMTf7/z6pJcrbS+VKELdih7JLw8mQfoVk=; b=C3SjjWQyvptXbc9P8Lipkf48RCbv/MpnTe4w1B3+hjet1z/OdyIzDrChPFdJdzObBJ wHPv4szI6SvqpFVJsw8qDSpR1Pz5yx0GuHzOC6hq+yx4NnhaR2peWNbYQbamoYsK89ko kxtp0b/FTdcWuXQMOIu1l/CQvBfEf3lGFmJh8tLRM2/pR5p5u3ZW9WkJ5cJ6sOmsCX6Q xFIAusEoDUafqwupax7XG8iOUO9hMzBUafUTv21rdE8mLb7sQLazR37nFajhQMn4NU1S bI1RcG98pem1zZkglY840q6bW+oA/6aHxPx9lY8pcDWgY2sgLMLLtLFCoJpCdsTW+6Ay fMKA== X-Gm-Message-State: ALoCoQkQUCBw/nExqzHx69H33S4Twy7QdpjjiudY8DuJRiv/KBDmcKVNbnLf8JvdeagzvQIQFGLY X-Received: by 10.112.203.168 with SMTP id kr8mr3792517lbc.10.1433955369533; Wed, 10 Jun 2015 09:56:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.232 with SMTP id p8ls280940laf.13.gmail; Wed, 10 Jun 2015 09:56:09 -0700 (PDT) X-Received: by 10.112.78.105 with SMTP id a9mr5140456lbx.70.1433955369181; Wed, 10 Jun 2015 09:56:09 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id f4si4267761lag.112.2015.06.10.09.56.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jun 2015 09:56:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labpy14 with SMTP id py14so37503833lab.0 for ; Wed, 10 Jun 2015 09:56:09 -0700 (PDT) X-Received: by 10.152.44.166 with SMTP id f6mr5173658lam.86.1433955368952; Wed, 10 Jun 2015 09:56:08 -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 hn6csp3461028lbb; Wed, 10 Jun 2015 09:56:07 -0700 (PDT) X-Received: by 10.55.33.30 with SMTP id h30mr8533879qkh.87.1433955367385; Wed, 10 Jun 2015 09:56:07 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q69si9265370qkq.49.2015.06.10.09.56.06; Wed, 10 Jun 2015 09:56:07 -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 94CE961F7E; Wed, 10 Jun 2015 16:56:06 +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 E514E61F65; Wed, 10 Jun 2015 16:55:31 +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 2AD9261840; Wed, 10 Jun 2015 16:55:25 +0000 (UTC) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by lists.linaro.org (Postfix) with ESMTPS id 6F54C61F63 for ; Wed, 10 Jun 2015 16:54:47 +0000 (UTC) Received: by lbcue7 with SMTP id ue7so32571098lbc.0 for ; Wed, 10 Jun 2015 09:54:46 -0700 (PDT) X-Received: by 10.112.28.74 with SMTP id z10mr5117387lbg.48.1433955286266; Wed, 10 Jun 2015 09:54:46 -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 i1sm2328544lae.45.2015.06.10.09.54.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jun 2015 09:54:45 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Wed, 10 Jun 2015 18:54:18 +0200 Message-Id: <1433955265-4180-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433955265-4180-1-git-send-email-christophe.milard@linaro.org> References: <1433955265-4180-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCHv5 1/8] validation: preparing for main in tests 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.52 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 In odp_cunit_common.c, a macro, called MODULE_HAS_OWN_MAIN is used to tell whether to define a main or not. If MODULE_HAS_OWN_MAIN is defined, odp_cunit_common.c does not define any main, but offers odp_cunit_run(CU_SuiteInfo testsuites[]) to run the tests. Two libs are then built, one with MODULE_HAS_OWN_MAIN defined (to be used in the future, by tests which define their own main) and one with MODULE_HAS_OWN_MAIN undefined, used by all tests at this stage. Signed-off-by: Christophe Milard Reviewed-by: Mike Holmes Reviewed-by: Stuart Haslam --- configure.ac | 1 + test/Makefile.inc | 7 +++++- test/validation/Makefile.am | 40 ++++++++++++++++--------------- test/validation/common/.gitignore | 2 ++ test/validation/common/Makefile.am | 10 ++++++++ test/validation/common/odp_cunit_common.c | 18 +++++++------- test/validation/common/odp_cunit_common.h | 3 +++ 7 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 test/validation/common/.gitignore create mode 100644 test/validation/common/Makefile.am diff --git a/configure.ac b/configure.ac index 69365fe..e773648 100644 --- a/configure.ac +++ b/configure.ac @@ -301,6 +301,7 @@ AC_CONFIG_FILES([Makefile test/api_test/Makefile test/performance/Makefile test/validation/Makefile + test/validation/common/Makefile test/miscellaneous/Makefile ]) diff --git a/test/Makefile.inc b/test/Makefile.inc index e20a848..1eb6ed5 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -1,7 +1,12 @@ include $(top_srcdir)/Makefile.inc include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib -LDADD = $(LIB)/libodp.la + +#in the following line, the libs using the symbols should come before +#the libs containing them! The includer is given a chance to add things +#before libodp by setting PRE_LDADD before the inclusion. +LDADD = $(PRE_LDADD) $(LIB)/libodp.la + INCFLAGS = -I$(srcdir) \ -I$(top_srcdir)/test \ -I$(top_srcdir)/platform/@with_platform@/include \ diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 577063b..e1474aa 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -1,3 +1,4 @@ +PRE_LDADD = $(top_builddir)/test/validation/common/libcunit_common_as_main.a include $(top_srcdir)/test/Makefile.inc AM_CFLAGS += -I$(srcdir)/common @@ -39,30 +40,31 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY) ODP_CU_COMMON=common/odp_cunit_common.c odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer -dist_odp_buffer_SOURCES = odp_buffer.c $(ODP_CU_COMMON) +dist_odp_buffer_SOURCES = odp_buffer.c odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification dist_odp_classification_SOURCES = classification/odp_classification_tests.c \ classification/odp_classification_basic.c \ - odp_classification.c $(ODP_CU_COMMON) + odp_classification.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 $(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) -dist_odp_shared_memory_SOURCES = odp_shared_memory.c $(ODP_CU_COMMON) -dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) -dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) -dist_odp_timer_SOURCES = odp_timer.c $(ODP_CU_COMMON) -dist_odp_pktio_SOURCES = odp_pktio.c $(ODP_CU_COMMON) -dist_odp_packet_SOURCES = odp_packet.c $(ODP_CU_COMMON) -dist_odp_pool_SOURCES = odp_pool.c $(ODP_CU_COMMON) -dist_odp_cpumask_SOURCES = odp_cpumask.c $(ODP_CU_COMMON) -dist_odp_thread_SOURCES = odp_thread.c $(ODP_CU_COMMON) + odp_crypto.c +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_queue_SOURCES = odp_queue.c +dist_odp_random_SOURCES = odp_random.c +dist_odp_scheduler_SOURCES = odp_scheduler.c +dist_odp_shared_memory_SOURCES = odp_shared_memory.c +dist_odp_synchronizers_SOURCES = odp_synchronizers.c +dist_odp_time_SOURCES = odp_time.c +dist_odp_timer_SOURCES = odp_timer.c +dist_odp_pktio_SOURCES = odp_pktio.c +dist_odp_packet_SOURCES = odp_packet.c +dist_odp_pool_SOURCES = odp_pool.c +dist_odp_cpumask_SOURCES = odp_cpumask.c +dist_odp_thread_SOURCES = odp_thread.c odp_ver_abt_log_dbg_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/ver_abt_log_dbg dist_odp_ver_abt_log_dbg_SOURCES = ver_abt_log_dbg/odp_system.c \ ver_abt_log_dbg/odp_errno.c \ - ver_abt_log_dbg/odp_ver_abt_log_dbg.c $(ODP_CU_COMMON) + ver_abt_log_dbg/odp_ver_abt_log_dbg.c +SUBDIRS = common diff --git a/test/validation/common/.gitignore b/test/validation/common/.gitignore new file mode 100644 index 0000000..e8aa876 --- /dev/null +++ b/test/validation/common/.gitignore @@ -0,0 +1,2 @@ +libcunit_common.a +libcunit_common_as_main.a diff --git a/test/validation/common/Makefile.am b/test/validation/common/Makefile.am new file mode 100644 index 0000000..bd2f214 --- /dev/null +++ b/test/validation/common/Makefile.am @@ -0,0 +1,10 @@ +AUTOMAKE_OPTIONS = foreign +include $(top_srcdir)/test/Makefile.inc + +#libcunit_common_as_main.a is meant to be removed when all tests define +#their own main +noinst_LIBRARIES = libcunit_common.a libcunit_common_as_main.a +libcunit_common_a_CFLAGS = $(AM_CFLAGS) -DMODULE_HAS_OWN_MAIN +libcunit_common_a_SOURCES = odp_cunit_common.c +libcunit_common_as_main_a_CFLAGS = $(AM_CFLAGS) +libcunit_common_as_main_a_SOURCES = odp_cunit_common.c diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index eac2d81..2b83ae6 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -4,12 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -/** - * @file - * - * ODP test application common - */ - #include #include #include @@ -68,7 +62,7 @@ ODP_WEAK_SYMBOL int tests_global_term(void) return 0; } -int main(void) +int odp_cunit_run(CU_SuiteInfo testsuites[]) { int ret; @@ -81,7 +75,7 @@ int main(void) CU_set_error_action(CUEA_ABORT); CU_initialize_registry(); - CU_register_suites(odp_testsuites); + CU_register_suites(testsuites); CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); @@ -94,3 +88,11 @@ int main(void) return (ret) ? -1 : 0; } + +/* this is left for old style main declartion. will be removed soon */ +#ifndef MODULE_HAS_OWN_MAIN +int main(void) +{ + return odp_cunit_run(odp_testsuites); +} +#endif diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 127020d..3b4d9fb 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -24,6 +24,9 @@ */ extern CU_SuiteInfo odp_testsuites[]; +/* the function, called by module main(), to run the testsuites: */ +int odp_cunit_run(CU_SuiteInfo testsuites[]); + typedef struct { uint32_t foo; uint32_t bar;