From patchwork Fri Jan 12 16:00:11 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: 124369 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2226719qgn; Fri, 12 Jan 2018 08:05:45 -0800 (PST) X-Google-Smtp-Source: ACJfBotPeLlCn45OvMscprIAhXFIYAXLTYQMIQcdyAPdO5rRcrQAyYsN3zUpUAY5/0PNtRBb/Ifh X-Received: by 10.200.18.202 with SMTP id b10mr12502167qtj.152.1515773145552; Fri, 12 Jan 2018 08:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515773145; cv=none; d=google.com; s=arc-20160816; b=sQdWjYeiJwrLskiVE6LtnW7aMpVoOYIG5GDEe7WTvlrpexlLOmUIxeQiGYfovnknCh qnP1MgzUyN5BaYMXzCEHJF5JUpJVbLlPMPciO2FUWPUNfFbiR8qcwHe0YfVAXJtu6mtz eunZBCzpGHiUeJbf4oJhqjCGfgOishL+LrG4YzIvdzS83PrvVFrAcI4P+hSQYQ6c8fcF 2BUMgI95ghlkCxA/ZYzRd2yyxKB25vU0GsFPOiTf+YGnPhjU171DQ8bf0NMB/mQxhThZ Rk+1JyVJEXE46LL9oZ2+vj9Cs06UNeBxgOtY5e0liAM8ffRrxZ7laPhoAFQJAC2z21Jp 8Lsw== 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=O/aJVVcFutI9Q2b0eobuoQx7O7HzksKzlvwErepJmVI=; b=rze4v8udADY6kcafti++jl/IInOWXWRHhgeK+unNZoDmAPsohzHZfQGMyOkGOjetPq OErBRD9MoTxDBnDSIqyXCnV6C3phZYNJARYTaHBi6OzXsP0kJ9640jn1D1APSf0vJU0P udOoWxxvSwvHObOyJ5HApwSduwTIeCElrPOkVd3K93cxpi8ExV0B9yEVgVQx1piNVKng d2A8n//8Ld62qpx2tOlsB2Ho5e2fgtaB5jmwUdcMMONW4EcOxpEAe6hgmxVXSpc+tCHX JGwo2aj3r2VNEIcm8ClYrZzc7mCh11lHq+F5UsnoHRe9eczzNmO/RLDxFQAWOrj2fpbx k6rg== 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 10si7477467qtp.445.2018.01.12.08.05.45; Fri, 12 Jan 2018 08:05:45 -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 3D07461527; Fri, 12 Jan 2018 16:05:45 +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 E22C46174B; Fri, 12 Jan 2018 16:01:30 +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 4FE99616F5; Fri, 12 Jan 2018 16:01:01 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id AA68561722 for ; Fri, 12 Jan 2018 16:00:19 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward101o.mail.yandex.net (Yandex) with ESMTP id D6916134224B for ; Fri, 12 Jan 2018 19:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id McjG9tYiRI-0G0GBQVF; Fri, 12 Jan 2018 19:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0GhWA3dl; Fri, 12 Jan 2018 19:00:16 +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, 12 Jan 2018 19:00:11 +0300 Message-Id: <1515772811-30441-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 5/5] 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 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ test/validation/api/packet/packet.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 75e50d531..3b80e9919 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,12 @@ void packet_test_context(void) CU_ASSERT(memcmp(udat, &test_packet_udata, sizeof(struct udata_struct)) == 0); + odp_packet_user_ptr_set(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)