From patchwork Mon Jan 22 10:00:19 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: 125373 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1067451ljf; Mon, 22 Jan 2018 02:02:12 -0800 (PST) X-Google-Smtp-Source: AH8x227bm+raeNWljNOKYWa5rGA9Whrfvy+vOZjGrhDhchgiE3vffq0UvyzIcrHefZD3G4XawqpZ X-Received: by 10.200.13.139 with SMTP id s11mr10077624qti.287.1516615331992; Mon, 22 Jan 2018 02:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516615331; cv=none; d=google.com; s=arc-20160816; b=ecVLRjEULx4GqHrYnQKDcZVXZiGgIyEPJStbf8CInf8hCdwe6ZqJLIDD5E7RzLk4dY NBf3vtNG5VCYD0jg8PeaPbA5+/Lx6MWrzXzZcAzHA9GueuWxfi6wZ2QsafQBjM/RQ6j1 oStbAail4s7b0knBF7D9ztO1p/LfKOcsAlf/a22jWNw8yjkYrssICDQxWcOIA6Nih3bd 15qVl/GRYRdT/DcNnq10m8O6SeKJEyqJoflr8+hRge/FwyZVbzxpeLVZReoj1ebofaBK iKVgI/fUSueBFarW1Pg1IHidWkmsAsPKqzJEkqdbHncTFOff7RvTuvzomu7/29Mq6HUe 6uAg== 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=Opu0FGPGHCbBrO8Bhj4Q6/l19Ae8ELx6xnwmvzNlEXo=; b=kuw0MbWDTIfoukZNkd8mT2r9ckUSzPPPec4uvns5BLnOGzDY+p/dB5jy39lEBvQlvk nt2vmxM70rC4kXtHPMbtdwL2q2hkHQaucdTHJN1uPIl5L0f2/H4jujnYizb4+rV94dzg f6tNkB+3j+LElFDE672sO5twzVGukBiv1KzkvSW1kOIgxnPaKthLawRLBEcz3E6MzKoi EgfdQfsc0NTpLCnZnKiPbOqpNMbdL384ZsAJCmvKni/9sm0rqlYPz6kPDlcPvB/tMlw4 YTsfKAlOwv5280A082Xy7Bn7NFgPNj7TGgc2sZ9fp/5aY8L/DVqHEdEiumf97Jy16jM1 P4sg== 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 f95si1372730qkh.117.2018.01.22.02.02.11; Mon, 22 Jan 2018 02:02:11 -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 9942B61706; Mon, 22 Jan 2018 10:02:11 +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 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 A9E8D617A3; Mon, 22 Jan 2018 10:00:44 +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 2E2A8607B5; Mon, 22 Jan 2018 10:00:30 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id BBDD6614E3 for ; Mon, 22 Jan 2018 10:00:25 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward102j.mail.yandex.net (Yandex) with ESMTP id C62E856027C2 for ; Mon, 22 Jan 2018 13:00:24 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id TfqOA8aSMj-0O48kOYv; Mon, 22 Jan 2018 13:00:24 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id uZYuxzgHNY-0OHSlTPB; Mon, 22 Jan 2018 13:00:24 +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: Mon, 22 Jan 2018 13:00:19 +0300 Message-Id: <1516615219-32202-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516615219-32202-1-git-send-email-odpbot@yandex.ru> References: <1516615219-32202-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v2 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: f925f103c90591776f73863d30159357b08bf71e ** Merge commit sha: 81c268611ef9755e8347f532022e22148f7d2a09 **/ 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 74154e9e7..d783bc465 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)