From patchwork Thu Feb 15 14:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128434 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1782502ljc; Thu, 15 Feb 2018 06:02:53 -0800 (PST) X-Google-Smtp-Source: AH8x227vVWCgUCxzCuN3Xsex+RmxPGQb6t2uou4P0ekruwqsmgPNyBumqNli1pMWGSolS0YahJFk X-Received: by 10.37.2.4 with SMTP id 4mr202274ybc.372.1518703373795; Thu, 15 Feb 2018 06:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703373; cv=none; d=google.com; s=arc-20160816; b=drbH7cSn4oZDLJwCB94dn6wt+VvP4Q2lGTGgTnLZzMuXYp+glyDSi8ysdV2xqPjXzF 1MdB96SU0Sa+UumYGzRUuowjSAkTLwZ9ae9bPKxZ5WF0bPqDTbINbciTBJ17KoAaOOIf 6GgOHdtGk/dAJL3fTI7AZimEGpfkT/cXJObf+hAbZHRsZoo+fQ89tabnIe2b5GgGJkJx voSEcsxEf6eAotd2Gyt5JiLuXBmuvizDysKBoNNfqmvcuzuy5wYQR82qesNvOFVexPR6 T1xDhjqkj2JMruieT2TxuUhYK8VSlX/r626Fj0D+xZfDalVelO3fMicUajLK06lqFfwH MpSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=5lRowbh6vbKRYcLpcrsuW/b4tF6G4zHW2uM/zhoYScM=; b=gBQ6FTzPqW2pYUCOkfVvlxKZakxQwZ0Fd9M0geXrmqNygybd6UvV4qSTp9I3RXEWkf m1i6d9W0OdnPSt3S+icQcZ0KmlEKw+H/XngdXJbz7uW0Roc3QMx6zSc5k9I5Yz4GYIYd 7GLf8LYOlIxd6osdE/U0mH4ojYsDOST07Cdv1ajesLz+DUjAmu0pXlAkI2DkWpsEItsv EtSZPVWul4w9LsfUytGK2bkVAMvdLG+7LZefWQpALx8loofw/RjLKidKTMgP0rt9/A/m uUaZevZl/uKr7yBkjdMUfDBY17poRcIinQrtYEi24BVBpt0jhObXnSFmk3qyi6w8W5bK skAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id a15si1100399qkj.271.2018.02.15.06.02.53; Thu, 15 Feb 2018 06:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 674096176B; Thu, 15 Feb 2018 14:02:53 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 C88A360BF4; Thu, 15 Feb 2018 14:02:39 +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 B190760722; Thu, 15 Feb 2018 14:02:31 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 72E2360722 for ; Thu, 15 Feb 2018 14:01:05 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 2A2055880F7E for ; Thu, 15 Feb 2018 17:00:09 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FbNXROEekY-09E4leC8; Thu, 15 Feb 2018 17:00:09 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yLwPeDorb6-08KSE3YO; Thu, 15 Feb 2018 17:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 15 Feb 2018 17:00:04 +0300 Message-Id: <1518703206-19713-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518703206-19713-1-git-send-email-odpbot@yandex.ru> References: <1518703206-19713-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 484 Subject: [lng-odp] [PATCH v1 1/3] validation: sched: add order_unlock_lock test 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added simple ordered lock test, so that new ordered_unlock_lock function is tested at least on single thread. Signed-off-by: Petri Savolainen --- /** Email created from pull request 484 (psavol:master-missing-validation) ** https://github.com/Linaro/odp/pull/484 ** Patch: https://github.com/Linaro/odp/pull/484.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 595ea205e4c4680f6a9a674fbe637dcab24b038e **/ test/validation/api/scheduler/scheduler.c | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 2c0d44100..0be6ce3f8 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -1336,6 +1336,76 @@ void scheduler_test_pause_resume(void) CU_ASSERT(ret == 0); } +/* Basic, single threaded ordered lock API testing */ +static void scheduler_test_ordered_lock(void) +{ + odp_queue_t queue; + odp_buffer_t buf; + odp_event_t ev; + odp_queue_t from; + int i; + int ret; + uint32_t lock_count; + + queue = odp_queue_lookup("sched_0_0_o"); + CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); + CU_ASSERT_FATAL(odp_queue_type(queue) == ODP_QUEUE_TYPE_SCHED); + CU_ASSERT_FATAL(odp_queue_sched_type(queue) == ODP_SCHED_SYNC_ORDERED); + + lock_count = odp_queue_lock_count(queue); + + if (lock_count == 0) { + printf(" NO ORDERED LOCKS. Ordered locks not tested.\n"); + return; + } + + pool = odp_pool_lookup(MSG_POOL_NAME); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (i = 0; i < BUFS_PER_QUEUE; i++) { + buf = odp_buffer_alloc(pool); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + ev = odp_buffer_to_event(buf); + ret = odp_queue_enq(queue, ev); + CU_ASSERT(ret == 0); + + if (ret) + odp_buffer_free(buf); + } + + for (i = 0; i < BUFS_PER_QUEUE / 2; i++) { + from = ODP_QUEUE_INVALID; + ev = odp_schedule(&from, ODP_SCHED_WAIT); + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); + CU_ASSERT(from == queue); + buf = odp_buffer_from_event(ev); + odp_schedule_order_lock(0); + odp_schedule_order_unlock(0); + odp_buffer_free(buf); + } + + if (lock_count < 2) { + printf(" ONLY ONE ORDERED LOCK. Unlock_lock not tested.\n"); + return; + } + + for (i = 0; i < BUFS_PER_QUEUE / 2; i++) { + from = ODP_QUEUE_INVALID; + ev = odp_schedule(&from, ODP_SCHED_WAIT); + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); + CU_ASSERT(from == queue); + buf = odp_buffer_from_event(ev); + odp_schedule_order_lock(0); + odp_schedule_order_unlock_lock(0, 1); + odp_schedule_order_unlock(1); + odp_buffer_free(buf); + } + + ret = exit_schedule_loop(); + + CU_ASSERT(ret == 0); +} + static int create_queues(void) { int i, j, prios, rc; @@ -1618,6 +1688,7 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_queue_destroy), ODP_TEST_INFO(scheduler_test_groups), ODP_TEST_INFO(scheduler_test_pause_resume), + ODP_TEST_INFO(scheduler_test_ordered_lock), ODP_TEST_INFO(scheduler_test_parallel), ODP_TEST_INFO(scheduler_test_atomic), ODP_TEST_INFO(scheduler_test_ordered),