From patchwork Thu May 28 10:58:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 49052 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 48CD2218EC for ; Thu, 28 May 2015 11:00:22 +0000 (UTC) Received: by wifq9 with SMTP id q9sf12724054wif.3 for ; Thu, 28 May 2015 04:00:21 -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=F0/tpJ8uPFKSFdPQ3P8io07/w0tj/Wh+kgw7TnNq+gg=; b=ECX1OxV+G+BbWpQPhkcx5wS6VvdxNuvAoNa5oDhxDPiGwN+oUaHT8y1xPDdLtngdIL jyAdkiKOnRXY3XikYCdM0m3M3VBENeZnbUyqfBVtSmJUJGpR5Ga9Y9U6bweOFLS7SLIc crvBlqyFGRNf0Fnnt7M4+FAt+1oJt8vwyBVkCe8DvQH5kCDRJUoDAkUAzrT0XunDAzhP B0GyvPdYU+NFyLHtT3WLGcf+daPCYVm+KBNAXTb/JFReQrWAjnhd34eMdUt7b+ysnjeu SlRiXex5dl7pxvZZRw/HYx1GK+/WeZpkc9EMrnyDEBhQ24UcQZ1FsAuL/9SP6/F3ZBcR xEcA== X-Gm-Message-State: ALoCoQkCAu3fvq10KgMPNELp5eE/aclIx3szE7Usfkqfq3KRFk0JXBUDpcGgwh4lDqHlNLXzrgXL X-Received: by 10.194.142.205 with SMTP id ry13mr2215288wjb.2.1432810821465; Thu, 28 May 2015 04:00:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.137 with SMTP id o9ls159184lal.16.gmail; Thu, 28 May 2015 04:00:21 -0700 (PDT) X-Received: by 10.112.160.73 with SMTP id xi9mr2133801lbb.92.1432810821226; Thu, 28 May 2015 04:00:21 -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 k5si1626876lbp.148.2015.05.28.04.00.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 04:00:20 -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 laat2 with SMTP id t2so28638748laa.1 for ; Thu, 28 May 2015 04:00:20 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr2131328lay.72.1432810820774; Thu, 28 May 2015 04:00:20 -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 hn6csp1059071lbb; Thu, 28 May 2015 04:00:19 -0700 (PDT) X-Received: by 10.55.41.24 with SMTP id p24mr3724036qkh.55.1432810819437; Thu, 28 May 2015 04:00:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 124si2013685qht.12.2015.05.28.04.00.18; Thu, 28 May 2015 04:00:19 -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 5D6E061CA0; Thu, 28 May 2015 11:00:18 +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 DF42461D83; Thu, 28 May 2015 10:59:10 +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 BD77F61E75; Thu, 28 May 2015 10:59:04 +0000 (UTC) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id BAD6F61E65 for ; Thu, 28 May 2015 10:58:29 +0000 (UTC) Received: by labpy14 with SMTP id py14so16792670lab.0 for ; Thu, 28 May 2015 03:58:28 -0700 (PDT) X-Received: by 10.112.159.162 with SMTP id xd2mr2079467lbb.67.1432810708385; Thu, 28 May 2015 03:58:28 -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 j10sm440024lbs.21.2015.05.28.03.58.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 03:58:27 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Thu, 28 May 2015 12:58:08 +0200 Message-Id: <1432810692-25231-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432810692-25231-1-git-send-email-christophe.milard@linaro.org> References: <1432810692-25231-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 2/6] validation: own main and renaming in odp_pktio.c 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 Renaming of things which may be, one day, exported in a lib. This renaming is important, as it creates consistency between test symbols, which is needed if things get eventually exported in the lib. Also, tests are often created from other tests: Fixing the first exemples will help geting future tests better. Also defining local test main. Things that are candidate to be exported in the lib in the future have been named as follows: -Tests, i.e. functions which are used in CUNIT testsuites are named: _test_* -Test arrays, i.e. arrays of CU_TestInfo, listing the test functions belonging to a suite, are called: _suite[_*] where the possible suffix can be used if many suites are declared. -CUNIT suite init and termination functions are called: _suite[_*]_init() and _suite[_*]_term() respectively. -Suite arrays, i.e. arrays of CU_SuiteInfo used in executables are called: _suites[_*] where the possible suffix identifies the executable using it, if many. -Main function(s), are called: _main[_*] where the possible suffix identifies the executable using it Signed-off-by: Christophe Milard --- test/Makefile.inc | 7 +++- test/validation/Makefile.am | 8 ++--- test/validation/odp_pktio.c | 81 +++++++++++++++++++++++++-------------------- 3 files changed, 55 insertions(+), 41 deletions(-) diff --git a/test/Makefile.inc b/test/Makefile.inc index e20a848..c579c46 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 using them! The includer is given a chance to add things before libodp +#by setting PRE_LDDAD before the inclusion. +LDADD = $(PRE_LDDAD) $(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 965f603..8299e01 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -1,13 +1,9 @@ +PRE_LDDAD = $(top_builddir)/test/validation/common/libcunit_common_as_main.a include $(top_srcdir)/test/Makefile.inc AM_CFLAGS += -I$(srcdir)/common AM_LDFLAGS += -static -#warning: in the following line, the libs using the symbols should come before -#the libs using them! -LDADD = $(top_builddir)/test/validation/common/libcunit_common_as_main.a \ - $(LIB)/libodp.la - TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} TEST_DIR=${builddir} EXECUTABLES = odp_buffer \ @@ -62,6 +58,8 @@ 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 +odp_pktio_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \ + $(LIB)/libodp.la dist_odp_pktio_SOURCES = odp_pktio.c dist_odp_packet_SOURCES = odp_packet.c dist_odp_pool_SOURCES = odp_pool.c diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index d4bf7bf..9806376 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -420,7 +420,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, CU_ASSERT(i == num_pkts); } -static void pktio_test_txrx(odp_queue_type_t q_type, int num_pkts) +static void test_txrx(odp_queue_type_t q_type, int num_pkts) { int ret, i, if_b; pktio_info_t pktios[MAX_NUM_IFACES]; @@ -456,34 +456,34 @@ static void pktio_test_txrx(odp_queue_type_t q_type, int num_pkts) } } -static void test_odp_pktio_poll_queue(void) +static void pktio_test_poll_queue(void) { - pktio_test_txrx(ODP_QUEUE_TYPE_POLL, 1); + test_txrx(ODP_QUEUE_TYPE_POLL, 1); } -static void test_odp_pktio_poll_multi(void) +static void pktio_test_poll_multi(void) { - pktio_test_txrx(ODP_QUEUE_TYPE_POLL, 4); + test_txrx(ODP_QUEUE_TYPE_POLL, 4); } -static void test_odp_pktio_sched_queue(void) +static void pktio_test_sched_queue(void) { - pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 1); + test_txrx(ODP_QUEUE_TYPE_SCHED, 1); } -static void test_odp_pktio_sched_multi(void) +static void pktio_test_sched_multi(void) { - pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4); + test_txrx(ODP_QUEUE_TYPE_SCHED, 4); } -static void test_odp_pktio_jumbo(void) +static void pktio_test_jumbo(void) { packet_len = PKT_LEN_JUMBO; - test_odp_pktio_sched_multi(); + pktio_test_sched_multi(); packet_len = PKT_LEN_NORMAL; } -static void test_odp_pktio_mtu(void) +static void pktio_test_mtu(void) { int ret; int mtu; @@ -500,7 +500,7 @@ static void test_odp_pktio_mtu(void) return; } -static void test_odp_pktio_promisc(void) +static void pktio_test_promisc(void) { int ret; odp_pktio_t pktio = create_pktio(iface_name[0]); @@ -525,7 +525,7 @@ static void test_odp_pktio_promisc(void) return; } -static void test_odp_pktio_mac(void) +static void pktio_test_mac(void) { unsigned char mac_addr[ODPH_ETHADDR_LEN]; int mac_len; @@ -551,7 +551,7 @@ static void test_odp_pktio_mac(void) return; } -static void test_odp_pktio_inq_remdef(void) +static void pktio_test_inq_remdef(void) { odp_pktio_t pktio = create_pktio(iface_name[0]); odp_queue_t inq; @@ -575,7 +575,7 @@ static void test_odp_pktio_inq_remdef(void) CU_ASSERT(odp_pktio_close(pktio) == 0); } -static void test_odp_pktio_open(void) +static void pktio_test_open(void) { odp_pktio_t pktio; int i; @@ -591,7 +591,7 @@ static void test_odp_pktio_open(void) CU_ASSERT(pktio == ODP_PKTIO_INVALID); } -static void test_odp_pktio_lookup(void) +static void pktio_test_lookup(void) { odp_pktio_t pktio, pktio_inval; @@ -609,7 +609,7 @@ static void test_odp_pktio_lookup(void) CU_ASSERT(odp_pktio_lookup(iface_name[0]) == ODP_PKTIO_INVALID); } -static void test_odp_pktio_inq(void) +static void pktio_test_inq(void) { odp_pktio_t pktio; @@ -621,7 +621,7 @@ static void test_odp_pktio_inq(void) CU_ASSERT(odp_pktio_close(pktio) == 0); } -static int init_pktio_suite(void) +static int pktio_suite_init(void) { odp_atomic_init_u32(&ip_seq, 0); iface_name[0] = getenv("ODP_PKTIO_IF0"); @@ -647,7 +647,7 @@ static int init_pktio_suite(void) return 0; } -static int term_pktio_suite(void) +static int pktio_suite_term(void) { char pool_name[ODP_POOL_NAME_LEN]; odp_pool_t pool; @@ -676,24 +676,35 @@ static int term_pktio_suite(void) return ret; } -CU_TestInfo pktio_tests[] = { - {"pktio open", test_odp_pktio_open}, - {"pktio lookup", test_odp_pktio_lookup}, - {"pktio inq", test_odp_pktio_inq}, - {"pktio poll queues", test_odp_pktio_poll_queue}, - {"pktio poll multi", test_odp_pktio_poll_multi}, - {"pktio sched queues", test_odp_pktio_sched_queue}, - {"pktio sched multi", test_odp_pktio_sched_multi}, - {"pktio jumbo frames", test_odp_pktio_jumbo}, - {"pktio mtu", test_odp_pktio_mtu}, - {"pktio promisc mode", test_odp_pktio_promisc}, - {"pktio mac", test_odp_pktio_mac}, - {"pktio inq_remdef", test_odp_pktio_inq_remdef}, +CU_TestInfo pktio_suite[] = { + {"pktio open", pktio_test_open}, + {"pktio lookup", pktio_test_lookup}, + {"pktio inq", pktio_test_inq}, + {"pktio poll queues", pktio_test_poll_queue}, + {"pktio poll multi", pktio_test_poll_multi}, + {"pktio sched queues", pktio_test_sched_queue}, + {"pktio sched multi", pktio_test_sched_multi}, + {"pktio jumbo frames", pktio_test_jumbo}, + {"pktio mtu", pktio_test_mtu}, + {"pktio promisc mode", pktio_test_promisc}, + {"pktio mac", pktio_test_mac}, + {"pktio inq_remdef", pktio_test_inq_remdef}, CU_TEST_INFO_NULL }; -CU_SuiteInfo odp_testsuites[] = { +static CU_SuiteInfo pktio_suites[] = { {"Packet I/O", - init_pktio_suite, term_pktio_suite, NULL, NULL, pktio_tests}, + pktio_suite_init, pktio_suite_term, NULL, NULL, pktio_suite}, CU_SUITE_INFO_NULL }; + +static int pktio_main(void) +{ + return odp_cunit_run(pktio_suites); +} + +/* the following main function will be separated when lib is created */ +int main(void) +{ + return pktio_main(); +}