From patchwork Wed Feb 25 12:16:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 45046 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 BCE9F2142A for ; Wed, 25 Feb 2015 12:17:08 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf3105617wib.2 for ; Wed, 25 Feb 2015 04:17:08 -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:from:to:date:message-id:in-reply-to :references: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=TexjIlcj8ywDjRWwoIx6Pjp8cT+Ljurkx2x09jt1Xs4=; b=HBmrfkW57aPImWlgJzr0OPWbPxzdevfQaKtK3hIEIGPh8LTEl/Lajda+imZgFi1g9m XD7bzLS/Exwx1ppgFD96s6umOU2r8f+KNx1QyN6qFJa0u4cgL7GkNLjLX8/bfZeNoL+j Xw90EWVZ1waFJ0xaatdOEtWCw1RZdz5vBld4F1gj79bW8o7Bk5Uf2VVGItZ75vlS1m7e FkUllYig+LUwF4DIGwZS7mCJionlATRJG2C93y/PeEQ/onfuDDHx3ItOj0wrFZptrOZ6 3ZNsHjxvO/imSMzwAMuWVM0hvZfLIeUJWEjDIjaVkz1wRG3IjxWeE8/W4zRhgk2DhuiU 8mQg== X-Gm-Message-State: ALoCoQkUpi6nUbiJwcbUsk9UHx6eHG2VmvPMcqI/OhjosKWKuHK/fGlmn/ELdvuMGxcY2ks99euY X-Received: by 10.180.182.201 with SMTP id eg9mr468363wic.3.1424866628081; Wed, 25 Feb 2015 04:17:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.101 with SMTP id lv5ls807291lac.22.gmail; Wed, 25 Feb 2015 04:17:07 -0800 (PST) X-Received: by 10.152.4.136 with SMTP id k8mr2447985lak.103.1424866627920; Wed, 25 Feb 2015 04:17:07 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id dg12si16544377lac.48.2015.02.25.04.17.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 04:17:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbiz11 with SMTP id z11so3403172lbi.5 for ; Wed, 25 Feb 2015 04:17:07 -0800 (PST) X-Received: by 10.152.26.199 with SMTP id n7mr2457917lag.29.1424866627830; Wed, 25 Feb 2015 04:17:07 -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.35.133 with SMTP id h5csp2578567lbj; Wed, 25 Feb 2015 04:17:07 -0800 (PST) X-Received: by 10.140.145.3 with SMTP id 3mr6210715qhr.43.1424866626319; Wed, 25 Feb 2015 04:17:06 -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 g6si42173302qga.61.2015.02.25.04.17.03 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 04:17:06 -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 1YQath-00068k-MT; Wed, 25 Feb 2015 12:17:01 +0000 Received: from mail-we0-f176.google.com ([74.125.82.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQatS-00067g-Ji for lng-odp@lists.linaro.org; Wed, 25 Feb 2015 12:16:46 +0000 Received: by wesw55 with SMTP id w55so3208576wes.5 for ; Wed, 25 Feb 2015 04:16:41 -0800 (PST) X-Received: by 10.180.72.208 with SMTP id f16mr5782239wiv.17.1424866601216; Wed, 25 Feb 2015 04:16:41 -0800 (PST) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::1]) by mx.google.com with ESMTPSA id u16sm25388747wjr.5.2015.02.25.04.16.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 04:16:40 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 25 Feb 2015 12:16:01 +0000 Message-Id: <1424866561-3728-4-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1424866561-3728-1-git-send-email-stuart.haslam@linaro.org> References: <1424866561-3728-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 3/3] validation: pktio: free unexpected packets/events 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: , MIME-Version: 1.0 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: stuart.haslam@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.217.177 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 Signed-off-by: Stuart Haslam --- test/validation/odp_pktio.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index effe059..a3476e3 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -314,11 +314,15 @@ static odp_packet_t wait_for_packet(odp_queue_t queue, else ev = odp_schedule(NULL, ns); - if (ev != ODP_EVENT_INVALID && - odp_event_type(ev) == ODP_EVENT_PACKET) { - pkt = odp_packet_from_event(ev); - if (pktio_pkt_seq(pkt) == seq) - return pkt; + if (ev != ODP_EVENT_INVALID) { + if (odp_event_type(ev) == ODP_EVENT_PACKET) { + pkt = odp_packet_from_event(ev); + if (pktio_pkt_seq(pkt) == seq) + return pkt; + } + + /* not interested in this event */ + odp_buffer_free(odp_buffer_from_event(ev)); } now = odp_time_cycles(); @@ -518,6 +522,7 @@ static void test_odp_pktio_inq_remdef(void) { odp_pktio_t pktio = create_pktio(iface_name[0]); odp_queue_t inq; + odp_event_t ev; int i; CU_ASSERT(pktio != ODP_PKTIO_INVALID); @@ -525,8 +530,13 @@ static void test_odp_pktio_inq_remdef(void) CU_ASSERT((inq = odp_pktio_inq_getdef(pktio)) != ODP_QUEUE_INVALID); CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0); - for (i = 0; i < 100; i++) - odp_schedule(NULL, ODP_TIME_MSEC); + for (i = 0; i < 100; i++) { + ev = odp_schedule(NULL, ODP_TIME_MSEC); + if (ev != ODP_EVENT_INVALID) { + odp_buffer_free(odp_buffer_from_event(ev)); + CU_FAIL("received unexpected event"); + } + } CU_ASSERT(odp_queue_destroy(inq) == 0); CU_ASSERT(odp_pktio_close(pktio) == 0);