From patchwork Tue Nov 4 10:45:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "yan.songming" X-Patchwork-Id: 40113 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0F6BC240A6 for ; Tue, 4 Nov 2014 10:46:03 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id n3sf3823517wiv.5 for ; Tue, 04 Nov 2014 02:46:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:references :mime-version:message-id:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type; bh=w59z3bKa2PRGSvUpKGUe/2+ZYzML8kXAU+oo6KxrUPk=; b=FeyoP3uIPNmT5sY1zXftN8bqZ7dbF5iM58Kzg8g7yXHfkTpAOYgTEOdJLHVt7gpaKa BNlmHVCB3GY02qVaPYlenYfoRpkCjtjdegwK7Labslme0PVT/E64c+u9C2KMSHI5cB4I nIWGfMvGetU4gSojsBdqZb94sYXtWOZGRDztth2guTmAp5jmP6x/c5zWgINLzqRJYsEr bBIQcnBKlR0Mz/XRp/OBFc7JxTC3yU6R5VCuWSOkqxnDWZJr1tWRxm3EmL0Z5tG2IdaV bklFbQ2zfEv8df7YmPUabeRNkDbCCjvI6rr1tsQH1hFkmYaj0OWSNZ8/hyR/IkcuRCcB iMYA== X-Gm-Message-State: ALoCoQkw//yhdtD8RVFHYaeLWWKSFihLTDf2fVURzv4dsR7nENUy0vkIY9Z9ZD1YcwudyqI+Y0yy X-Received: by 10.112.154.194 with SMTP id vq2mr1773936lbb.10.1415097963193; Tue, 04 Nov 2014 02:46:03 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.131 with SMTP id e3ls61105lam.31.gmail; Tue, 04 Nov 2014 02:46:03 -0800 (PST) X-Received: by 10.112.169.106 with SMTP id ad10mr58265410lbc.13.1415097963025; Tue, 04 Nov 2014 02:46:03 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id mi5si42084lbc.61.2014.11.04.02.46.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 02:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id ge10so636240lab.16 for ; Tue, 04 Nov 2014 02:46:02 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr58435865lab.40.1415097962778; Tue, 04 Nov 2014 02:46:02 -0800 (PST) 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.184.201 with SMTP id ew9csp95336lbc; Tue, 4 Nov 2014 02:46:01 -0800 (PST) X-Received: by 10.224.68.73 with SMTP id u9mr50940204qai.75.1415097960984; Tue, 04 Nov 2014 02:46:00 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id i34si34111245qgf.90.2014.11.04.02.45.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Nov 2014 02:46:00 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xlbcc-0002Cb-3p; Tue, 04 Nov 2014 10:45:58 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XlbcV-00029f-FR for lng-odp@lists.linaro.org; Tue, 04 Nov 2014 10:45:51 +0000 Received: by mail-pa0-f48.google.com with SMTP id ey11so14188711pad.21 for ; Tue, 04 Nov 2014 02:45:45 -0800 (PST) X-Received: by 10.70.132.130 with SMTP id ou2mr552600pdb.168.1415097945827; Tue, 04 Nov 2014 02:45:45 -0800 (PST) Received: from ZTE-20140828BZT ([210.51.195.9]) by mx.google.com with ESMTPSA id d5sm23449pdp.61.2014.11.04.02.45.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 02:45:45 -0800 (PST) Date: Tue, 4 Nov 2014 18:45:45 +0800 From: "yan.songming@linaro.org" To: mike.holmes References: <1415032263-9819-1-git-send-email-yan.songming@linaro.org>, , X-Priority: 3 X-GUID: A271E2A1-8AE9-4B87-B59D-1D6053D16D40 X-Has-Attach: no X-Mailer: Foxmail 7, 2, 5, 136[cn] Mime-Version: 1.0 Message-ID: <201411041840377887457@linaro.org> X-Topics: patch Cc: lng-odp Subject: Re: [lng-odp] [PATCH v3] add tests for queue X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: yan.songming@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.43 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 Mike, In fact i never use checkpatch before. I will use it from now on. This two internal function is not include ,because i just test the base queue type. As you said, i think this two function will be include in the odp_packet_io tests or the deep test in queue later. yan.songming@linaro.org From: Mike Holmes Date: 2014-11-04 01:42 To: Yan Songming CC: lng-odp Subject: Re: [lng-odp] [PATCH v3] add tests for queue http://people.linaro.org/~mike.holmes/linux-generic-gcov-html/linux-generic/index.html Yan it looks like there odp_buffer_t queue_sched_buf(odp_queue_t handle) was not called in the test suite. Also the internal void queue_lock(queue_entry_t *queue) was not called but maybe odp_packet_io tests may cover that, I believe it is used there. Mike On 3 November 2014 11:45, Mike Holmes wrote: mike@fedora1:~/git/odp$ git am ~/incoming/lng-odp_PATCH_v3_add_tests_for_queue.mbox Applying: add tests for queue /home/mike/git/odp/.git/rebase-apply/patch:81: trailing whitespace. /home/mike/git/odp/.git/rebase-apply/patch:85: trailing whitespace. /home/mike/git/odp/.git/rebase-apply/patch:101: trailing whitespace. CU_ASSERT_EQUAL(queue_creat_id, queue_id); /home/mike/git/odp/.git/rebase-apply/patch:152: trailing whitespace. /home/mike/git/odp/.git/rebase-apply/patch:155: trailing whitespace. warning: squelched 1 whitespace error warning: 6 lines add whitespace errors. If scripts/checkpatch did not see these problems you need to make a branch or new repo and apply the patch so that git am can show you the issues. On 3 November 2014 11:31, Yan Songming wrote: From: "yan.songming" Add the cunit test for none sync queue. Test the base queue function. Signed-off-by: yan.songming --- Fix spelling problem and commend problem. Add term_local and term_global. Move cunit queue test to test_odp_queue_base for none syn queue. --- test/cunit/Makefile.am | 4 +- test/cunit/odp_queue_test.c | 168 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 test/cunit/odp_queue_test.c -- 1.8.3.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- Mike Holmes Linaro Sr Technical Manager LNG - ODP -- Mike Holmes Linaro Sr Technical Manager LNG - ODP diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am index 927a5a5..46f46c9 100644 --- a/test/cunit/Makefile.am +++ b/test/cunit/Makefile.am @@ -6,8 +6,10 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init +bin_PROGRAMS = odp_init odp_queue odp_init_LDFLAGS = $(AM_LDFLAGS) -static -lcunit +odp_queue_LDFLAGS = $(AM_LDFLAGS) -static -lcunit endif +dist_odp_queue_SOURCES = odp_queue_test.c dist_odp_init_SOURCES = odp_init_test.c diff --git a/test/cunit/odp_queue_test.c b/test/cunit/odp_queue_test.c new file mode 100644 index 0000000..04342a6 --- /dev/null +++ b/test/cunit/odp_queue_test.c @@ -0,0 +1,168 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "odp.h" +#include "CUnit/Basic.h" + +#define MAX_BUFFER_QUEUE (8) /**< Max enqueue buf num */ +#define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */ + +static int Queue_Contest = 0xff; + +static int test_odp_buffer_pool_init(void) +{ + odp_buffer_pool_t pool; + void *pool_base; + odp_shm_t shm; + + shm = odp_shm_reserve("msg_pool", + MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + + pool_base = odp_shm_addr(shm); + + if (pool_base == NULL) { + printf("Shared memory reserve failed.\n"); + return -1; + } + + pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE, + 0, + ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW); + + if (pool == ODP_BUFFER_POOL_INVALID) { + printf("Pool create failed.\n"); + return -1; + } + return 0; +} + +static void test_odp_queue_base(void) +{ + odp_queue_t queue_creat_id; + odp_queue_t queue_id; + odp_buffer_t Enbuf[MAX_BUFFER_QUEUE]; + odp_buffer_t Debuf[MAX_BUFFER_QUEUE]; + odp_buffer_pool_t msg_pool; + odp_queue_param_t param; + + int i; + odp_buffer_t buf; + void *pRtn = NULL; + + /* test odp_queue_create */ + memset(¶m, 0, sizeof(param)); + param.sched.sync = ODP_SCHED_SYNC_NONE; + + queue_creat_id = odp_queue_create("test_queue", ODP_QUEUE_TYPE_POLL, ¶m); + CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id); + + /* test odp_queue_type */ + CU_ASSERT_EQUAL(ODP_QUEUE_TYPE_POLL, odp_queue_type(queue_creat_id)); + + /* test odp_queue_type */ + CU_ASSERT_EQUAL(ODP_SCHED_SYNC_NONE, odp_queue_sched_type(queue_creat_id)); + + /* test odp_queue_lookup */ + queue_id = odp_queue_lookup("test_queue"); + CU_ASSERT_EQUAL(queue_creat_id, queue_id); + + /* test odp_queue_set_context */ + CU_ASSERT(0 == odp_queue_set_context(queue_id, &Queue_Contest)); + + /* test odp_queue_get_context*/ + pRtn = odp_queue_get_context(queue_id); + CU_ASSERT(&Queue_Contest == (int *)pRtn); + + /* apply for buffer */ + msg_pool = odp_buffer_pool_lookup("msg_pool"); + buf = odp_buffer_alloc(msg_pool); + + /* test odp_queue_enq and odp_queue_deq */ + odp_queue_enq(queue_id, buf); + CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id)); + odp_buffer_free(buf); + + /* apply for mutili buffer */ + for(i=0; i