From patchwork Tue Jan 23 09:00:14 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: 125488 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1633894ljf; Tue, 23 Jan 2018 01:05:43 -0800 (PST) X-Google-Smtp-Source: AH8x226Hz0WvSHFtlu1ZidMGxmKZ0lkXM1WEYvw4eEWypI6hfktHrXOp6TSgjugqxpoUhLvLoXqi X-Received: by 10.55.160.14 with SMTP id j14mr2274224qke.305.1516698342907; Tue, 23 Jan 2018 01:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698342; cv=none; d=google.com; s=arc-20160816; b=o5oj0pZTmlSsIXI/zqs2/4eowunb48ROn8zeN61dQRfjbFFvNf1PEqJTuo8lnoiQAA eoy0p7V4tip3ZDDr9nTZfiCVWKUtzBRHzmpMrFjdVUxPv3znWYgvLHlqgA0t+pHBv1t9 //e+GdNogMqr0StdlSQW0JDQKg9lMmSjxsvag4PZqzSPUyHb1/xaeEE8UglylQruzeDK gWgQF/LbglJ2Le7RWzatvu3K/IKJAtwfv1gTLYYvtbpxmnmCAm16h31JZi+v2lrH/SX5 vCfXDHUrkANNqxUdvTMEgDzG6He/oQGC/rkp2mZ3rp1OFlqIbG/WbIMWw0jJoLhc628W WtrQ== 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=wdBuCzhyJCZwx3ciujOFlZff4aXKn/Jwv2sqvx+DMP8=; b=QLBCxtAn3Y1Fu4IZlne7GobKbCdx3fh9RDNZS64fVmK2pZ9rZ17yeZer8KZeG4Xp4Q 9/2wcVvfDt4De2x2UvB55N6GKYX8k9LBnLBmGvP4inh0IY/9mmjfwJYYrVGfaWnl7HRc WJPOgTuJ9eEmMYO8CxOmVjcdkMYPSW7rd91D6l6KaK/YIiBZstsmTMpOBNuX74o51ont baGoB874T5T4qCqmDSzLts48R8Gj29zOzr4+zvJISJAoSTyyfmvVpF0oZ1mVrvdNO1xC X8FvURLavisdBerfpwo+5GU5hOE0zDAayCHlUSQ4aeseShcvMNIr39tWe7Vs3nl2fpbJ UX4w== 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 b27si2664402qkb.194.2018.01.23.01.05.42; Tue, 23 Jan 2018 01:05:42 -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 7E35D61719; Tue, 23 Jan 2018 09:05:42 +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_H2 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 2CC5C617B5; Tue, 23 Jan 2018 09:01:06 +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 0B74761722; Tue, 23 Jan 2018 09:00:32 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 592B161698 for ; Tue, 23 Jan 2018 09:00:21 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 415C94302AA1 for ; Tue, 23 Jan 2018 12:00:20 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id O563I7QoIz-0Kve18k7; Tue, 23 Jan 2018 12:00:20 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0JDmm50V; Tue, 23 Jan 2018 12:00:19 +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: Tue, 23 Jan 2018 12:00:14 +0300 Message-Id: <1516698014-28886-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 6/6] validation: packet: test user pointer init to NULL 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 if user pointer is NULL after alloc and reset. Signed-off-by: Petri Savolainen --- /** Email created from pull request 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ test/validation/api/packet/packet.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 184473aba..7d19e0125 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -290,6 +290,9 @@ void packet_test_alloc_free(void) CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID)); + /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet) == NULL); + /* Pool should have only one packet */ CU_ASSERT_FATAL(odp_packet_alloc(pool, packet_len) == ODP_PACKET_INVALID); @@ -369,6 +372,9 @@ void packet_test_alloc_free_multi(void) CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID)); + + /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet[i]) == NULL); } /* Pools should have no more packets */ @@ -648,7 +654,15 @@ void packet_test_context(void) CU_ASSERT(memcmp(udat, &test_packet_udata, sizeof(struct udata_struct)) == 0); + odp_packet_user_ptr_set(pkt, NULL); + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); + odp_packet_user_ptr_set(pkt, (void *)0xdead); + CU_ASSERT(odp_packet_user_ptr(pkt) == (void *)0xdead); + odp_packet_reset(pkt, packet_len); + + /* User pointer should be NULL after reset */ + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); } void packet_test_layer_offsets(void)