From patchwork Mon Jan 15 13:00:09 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: 124525 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp663180lje; Mon, 15 Jan 2018 05:09:34 -0800 (PST) X-Google-Smtp-Source: ACJfBotaTxx7KuACqLFVJlZnb8AP2XdTedIrNkhmFGEq/1pRKHjIDIOD8ElHstJMg2gmObkhgZMT X-Received: by 10.55.99.143 with SMTP id x137mr22721039qkb.90.1516021774341; Mon, 15 Jan 2018 05:09:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516021774; cv=none; d=google.com; s=arc-20160816; b=vJ7FPjIJ+rUIRf/gdFYVR1ba9jv22l+ff9cWhI2Q+rdGWbVkCqc/blh/su1NcrYfAY tczYgZUvrjq/FmuzhFwE+VDupSbvRigRV1DmEoUOmiLhonRH3AhEnvFqJGRzn0WKYh31 dQl8ix1qEPyOqvG+P8TE8phfNXtSBa91YqOBvsq0nrUvDW8Uvh2+RH36vCcCtb2RBr/4 eJ6cWplabSDdBbnbaDbkDCVttnaAFWedr4spqLSXfw+QMRhEv2JOVFiAWVWAsvShPnWQ HgSvm0n7RMsFp1JhzZ5aMRACV/fzRdOji2opfn/N8Nax3eVpDU5OIYPIn3wzyFOwcA5k Zu0A== 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=VzJ0vHpWCibZlY+Jjx8X9M8rM/m47NMHSWj/h2iVYJo=; b=Q5ULRTYHXefmt1yy4OOts726Cv4xWm/35ofnDLkJ5lKGo0TWbpnIxVAk7nO5dXx1oe 8BGgh681PbrTfg9LGqMAHnUVvmEYyuh8nJV4+HCb/dhwh4cCvmBD5QiIJSJwU21fxyVv F+PV4/S98uiwLEcvZwnQvtycSFb5IdMeaeISd4Ut2B7MWA99GEAATbqdSKLcnF36bgIB foqe6gEKgcIOHaA+FrwzbbdKhBg5nyGHqkf0bDycVTKvvBozHbUzi81XOEozPS5SzQU3 SwxmvjsNq94xHDuXB4xfM/pj3BY9GAPBZCsAfMyrJxeHvR6rahflPvWnrKHIvLP4tMJH hm+w== 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 v89si3933657qte.236.2018.01.15.05.09.34; Mon, 15 Jan 2018 05:09:34 -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 01C42617B7; Mon, 15 Jan 2018 13:09:33 +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 F2980617BE; Mon, 15 Jan 2018 13:04:13 +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 3AA8F60956; Mon, 15 Jan 2018 13:03:50 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 20C3F61747 for ; Mon, 15 Jan 2018 13:00:16 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 007EE6A82E88 for ; Mon, 15 Jan 2018 16:00:15 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DHrgXvaVgy-0EHWRsqx; Mon, 15 Jan 2018 16:00:14 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Bnqb3pkuSH-0E1qeULu; Mon, 15 Jan 2018 16:00:14 +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, 15 Jan 2018 16:00:09 +0300 Message-Id: <1516021209-8997-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516021209-8997-1-git-send-email-odpbot@yandex.ru> References: <1516021209-8997-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 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 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: 76bd874ba5677533132a4c0a39c8e5cf9049a9af **/ 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 75e50d531..e63bd74e5 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)