From patchwork Fri Dec 1 15:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120349 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1258267qgn; Fri, 1 Dec 2017 07:09:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMa16DYswhXrZdttDPhgBog+1fgCHbr1wVEwRTh58RA4sXIDxs8NjpPnT01dXtsj3KqjHPsp X-Received: by 10.55.139.129 with SMTP id n123mr7510374qkd.177.1512140940709; Fri, 01 Dec 2017 07:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140940; cv=none; d=google.com; s=arc-20160816; b=d6MNwGbMNEbWDiAsdjfsu1jEu3XuCP32M3fQ4mQ3SAwDrXk0+iRhE9G3cUgvJ4x0xo QHxvgppUX6sLF5aYB7kF/LKsWGPNAM99InLaMpmoKaYDwiEkCi9e1B9X+zv9rQQsAefb CCI9gM6AaxRLWHkB43CFhttJ57lyiT9fAEwy6zy6R8S696jlU5grnvtxzJCQqlSY5v4I PJmzrWxtGq44TFC5PkFOj6Zk/X+UYIOEhz5QBafMb9a8/4PJrLt6PASHYa5oguGZXTDy qutQyaRq1gxRRBGjnfnyk0QjhR+iTrnj5XpkCCzsm9a+zPPiSRdmcFmjooWk81D+72T1 hmGw== 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=stbkojVCPvc76GJXEkBu0YkXBusAEhKho6oQc7vATjg=; b=dpickVYoZ9bRqivqYRDrOmYNoP9soFJd2cO+MwN+/+lN1Wnhh/H66NYAbMxf601s04 qvHDjXl4yJcwkw4HBwbFc4CA7nb/DlQWpKVnE9h3P3XVkThAOGaniuMWfzrBSrzl48fj dcBFRW/mSIAtDPnN9ldb4P065ts9mBM6pSMU2c67+0W5tGL4f5coZkHKMeJq9cZQsOGj CiMKEdsoDv7B3m561wXCqHJxk/HwYndFmimg0lHkWtjgwHy16NHDQTeOv5iwoqzTDsM7 SoBLAx8iKshPpoXlLdKU5msSOAWb2HlM4cjE6EMePX6xckyQl3XI/DwqxpsI9o1FdZoO htIQ== 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 g64si2792410qtd.88.2017.12.01.07.09.00; Fri, 01 Dec 2017 07:09:00 -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 4546660982; Fri, 1 Dec 2017 15:09:00 +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,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 3481860981; Fri, 1 Dec 2017 15:01:33 +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 4E002609F2; Fri, 1 Dec 2017 15:01:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id CC15F6097C for ; Fri, 1 Dec 2017 15:00:22 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id BFD6B4305697 for ; Fri, 1 Dec 2017 18:00:21 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GxSNpdP5qL-0LCieu4o; Fri, 01 Dec 2017 18:00:21 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0LeKPCq4; Fri, 01 Dec 2017 18:00:21 +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: Fri, 1 Dec 2017 18:00:07 +0300 Message-Id: <1512140407-13534-13-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512140407-13534-1-git-send-email-odpbot@yandex.ru> References: <1512140407-13534-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 318 Subject: [lng-odp] [PATCH API-NEXT v1 12/12] validation: event: filter packet 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 Test the new filter packet function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 318 (psavol:next-multi-apis) ** https://github.com/Linaro/odp/pull/318 ** Patch: https://github.com/Linaro/odp/pull/318.patch ** Base sha: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0 ** Merge commit sha: aee2bcc574d2a8efdfcecc3b8e681ce391119798 **/ test/validation/api/event/event.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/validation/api/event/event.c b/test/validation/api/event/event.c index 901fe6ed2..5add99c32 100644 --- a/test/validation/api/event/event.c +++ b/test/validation/api/event/event.c @@ -348,11 +348,50 @@ static void event_test_type_multi(void) CU_ASSERT(odp_pool_destroy(pkt_pool) == 0); } +static void event_test_filter_packet(void) +{ + odp_pool_t buf_pool, pkt_pool; + int i, num_pkt, num_rem; + int num = 2 * NUM_TYPE_TEST; + odp_event_t buf_event[NUM_TYPE_TEST]; + odp_event_t pkt_event[NUM_TYPE_TEST]; + odp_event_t event[num]; + odp_packet_t packet[num]; + odp_event_t remain[num]; + + type_test_init(&buf_pool, &pkt_pool, buf_event, pkt_event, event); + + for (i = 0; i < num; i++) { + packet[i] = ODP_PACKET_INVALID; + remain[i] = ODP_EVENT_INVALID; + } + + num_pkt = odp_event_filter_packet(event, packet, remain, num); + CU_ASSERT(num_pkt == NUM_TYPE_TEST); + + for (i = 0; i < num_pkt; i++) + CU_ASSERT(packet[i] != ODP_PACKET_INVALID); + + num_rem = num - num_pkt; + CU_ASSERT(num_rem == NUM_TYPE_TEST); + + for (i = 0; i < num_rem; i++) { + CU_ASSERT(remain[i] != ODP_EVENT_INVALID); + CU_ASSERT(odp_event_type(remain[i]) == ODP_EVENT_BUFFER); + } + + odp_event_free_multi(event, num); + + CU_ASSERT(odp_pool_destroy(buf_pool) == 0); + CU_ASSERT(odp_pool_destroy(pkt_pool) == 0); +} + odp_testinfo_t event_suite[] = { ODP_TEST_INFO(event_test_free), ODP_TEST_INFO(event_test_free_multi), ODP_TEST_INFO(event_test_free_multi_mixed), ODP_TEST_INFO(event_test_type_multi), + ODP_TEST_INFO(event_test_filter_packet), ODP_TEST_INFO_NULL, };