From patchwork Mon Nov 9 07:55:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wallen, Carl \(Nokia - FI/Espoo\)" X-Patchwork-Id: 56187 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp40670lbb; Sun, 8 Nov 2015 23:57:38 -0800 (PST) X-Received: by 10.140.132.139 with SMTP id 133mr30062426qhe.49.1447055858472; Sun, 08 Nov 2015 23:57:38 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h51si10207417qgh.97.2015.11.08.23.57.38; Sun, 08 Nov 2015 23:57:38 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 228A8619EE; Mon, 9 Nov 2015 07:57:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C8DE661B5F; Mon, 9 Nov 2015 07:56:14 +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 9B37F619EE; Mon, 9 Nov 2015 07:56:07 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id D6A90618D3 for ; Mon, 9 Nov 2015 07:56:05 +0000 (UTC) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id tA97u4J1019482 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Nov 2015 07:56:04 GMT Received: from 10.144.19.15 ([10.144.164.243]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id tA97u0rL024441 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 9 Nov 2015 08:56:04 +0100 From: Carl Wallen To: lng-odp@lists.linaro.org Date: Mon, 9 Nov 2015 09:55:57 +0200 Message-Id: <1447055757-8654-4-git-send-email-carl.wallen@nokia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447055757-8654-1-git-send-email-carl.wallen@nokia.com> References: <1447055757-8654-1-git-send-email-carl.wallen@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 3367 X-purgate-ID: 151667::1447055764-00006110-A9C0AE40/0/0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 3/3] validation: queue: api validation tests for odp_queue_info() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Verify the functionality of the queue api function odp_queue_info() for different queue types. Signed-off-by: Carl Wallen --- test/validation/queue/queue.c | 57 +++++++++++++++++++++++++++++++++++++++++++ test/validation/queue/queue.h | 1 + 2 files changed, 58 insertions(+) -- 2.1.4 diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index 98da2ec..3b522c9 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -125,8 +125,65 @@ void queue_test_sunnydays(void) CU_ASSERT(odp_queue_destroy(queue_id) == 0); } +void queue_test_info(void) +{ + odp_queue_t q_poll, q_order; + const char *const nq_poll = "test_q_poll"; + const char *const nq_order = "test_q_order"; + odp_queue_info_t info; + odp_queue_param_t param; + char q_poll_ctx[] = "test_q_poll context data"; + char q_order_ctx[] = "test_q_order context data"; + unsigned lock_count; + char *ctx; + int ret; + + /* Create a polled queue and set context */ + q_poll = odp_queue_create(nq_poll, ODP_QUEUE_TYPE_POLL, NULL); + CU_ASSERT(ODP_QUEUE_INVALID != q_poll); + CU_ASSERT(odp_queue_context_set(q_poll, q_poll_ctx) == 0); + + /* Create a scheduled ordered queue with explicitly set params */ + odp_queue_param_init(¶m); + param.sched.prio = ODP_SCHED_PRIO_NORMAL; + param.sched.sync = ODP_SCHED_SYNC_ORDERED; + param.sched.group = ODP_SCHED_GROUP_ALL; + param.sched.lock_count = 1; + param.context = q_order_ctx; + q_order = odp_queue_create(nq_order, ODP_QUEUE_TYPE_SCHED, ¶m); + CU_ASSERT(ODP_QUEUE_INVALID != q_order); + + /* Check info for the polled queue */ + CU_ASSERT(odp_queue_info(q_poll, &info) == 0); + CU_ASSERT(strcmp(nq_poll, info.name) == 0); + CU_ASSERT(info.type == ODP_QUEUE_TYPE_POLL); + CU_ASSERT(info.type == odp_queue_type(q_poll)); + ctx = info.param.context; /* 'char' context ptr */ + CU_ASSERT(ctx == q_poll_ctx); + CU_ASSERT(info.param.context == odp_queue_context(q_poll)); + + /* Check info for the scheduled ordered queue */ + CU_ASSERT(odp_queue_info(q_order, &info) == 0); + CU_ASSERT(strcmp(nq_order, info.name) == 0); + CU_ASSERT(info.type == ODP_QUEUE_TYPE_SCHED); + CU_ASSERT(info.type == odp_queue_type(q_order)); + ctx = info.param.context; /* 'char' context ptr */ + CU_ASSERT(ctx == q_order_ctx); + CU_ASSERT(info.param.context == odp_queue_context(q_order)); + CU_ASSERT(info.param.sched.prio == odp_queue_sched_prio(q_order)); + CU_ASSERT(info.param.sched.sync == odp_queue_sched_type(q_order)); + CU_ASSERT(info.param.sched.group == odp_queue_sched_group(q_order)); + CU_ASSERT(ret = odp_queue_lock_count(q_order) >= 0); + lock_count = (unsigned) ret; + CU_ASSERT(info.param.sched.lock_count == lock_count); + + CU_ASSERT(odp_queue_destroy(q_poll) == 0); + CU_ASSERT(odp_queue_destroy(q_order) == 0); +} + odp_testinfo_t queue_suite[] = { ODP_TEST_INFO(queue_test_sunnydays), + ODP_TEST_INFO(queue_test_info), ODP_TEST_INFO_NULL, }; diff --git a/test/validation/queue/queue.h b/test/validation/queue/queue.h index 5de7b2c..813fe1e 100644 --- a/test/validation/queue/queue.h +++ b/test/validation/queue/queue.h @@ -11,6 +11,7 @@ /* test functions: */ void queue_test_sunnydays(void); +void queue_test_info(void); /* test arrays: */ extern odp_testinfo_t queue_suite[];