From patchwork Tue Jan 16 11:00:08 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: 124653 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp972268lje; Tue, 16 Jan 2018 03:02:03 -0800 (PST) X-Google-Smtp-Source: ACJfBov0Ug5Ovw0u0o+SvLO1HlaIL2dWJ+WUF0fM7j0toiEafE/ZSGQ0NcFSRMiwzzLRgQNdcTPz X-Received: by 10.200.23.47 with SMTP id w44mr19430818qtj.131.1516100523169; Tue, 16 Jan 2018 03:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516100523; cv=none; d=google.com; s=arc-20160816; b=0TleysKV+Uf1Jh9CZ6Rm3MPyL1TymaoGa06yGiANX6tOCB1vhYuMeAhL42t3gz+Kw1 AO3PdtqGDPS7lXNmJE+DEhlHUYpHQ3sSZVpYI9NkIkQPBKv4vC2g2VZCM3495zzj0b// b4XS9Og8fU6aQ/vZ+G85ZfiTYqL939w0C960kosi3YK+ZgCk+GD+6tAwIXoKJKLbV06l gZxxCyaBMqijmkdbgxnaGSFDojXERhlNLADmWB+RdCp+Gmh1HPoY+zAJME8g/Q8qZKEL tfwogPt7bekSrHQu+lbkD50A046UBe3I8kOwmHR0hM92hBO8AG9d9r9Xw6Ayg7mS2Ich IDhQ== 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=FupmAjUdGwoIZ4nd+FCRFqPZYC1BKs2lq36K+INdlsc=; b=Z9mCNR6akXlEA/QPPee+PUFx+zU8ZJVSPbuYi1COqblR4WnQcLgHG16iBQ9EJTAs0H hd/gUHa3Ua1blr4SVj+lM2VU4A9Okyt8Az4VPOXtKU5iqrKeqm16nY2xPyKMEsP/Flnv N5BDONDv6Ltwv8tOyA3iWZVe/vdgy6J4vRfVIXS+P69aMUmsWFy9LKHecBQ2DkQcyzqC dqC6kAc0HMdIKbtPrJAIla/XbBJaJb+P/8NUE25a1ck4tAvnI54zcVuclcfHGVriuM3D NgLxk7KjkbqoAnod3/BhLjlDBl11xQwsYZ95kq1sqGCm++EthzsGwuSjgn+pIKtNhOIn U0Lg== 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 h58si1978966qta.418.2018.01.16.03.02.02; Tue, 16 Jan 2018 03:02:03 -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 CCDB8617AF; Tue, 16 Jan 2018 11:02:02 +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 40FD561767; Tue, 16 Jan 2018 11:00:32 +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 59BC561767; Tue, 16 Jan 2018 11:00:20 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 9A84B61751 for ; Tue, 16 Jan 2018 11:00:15 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 59052430375E for ; Tue, 16 Jan 2018 14:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id qFyvRkw7vc-0ExuoOIF; Tue, 16 Jan 2018 14:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7uRxxYxlfl-0D6mRceS; Tue, 16 Jan 2018 14:00:13 +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, 16 Jan 2018 14:00:08 +0300 Message-Id: <1516100408-8246-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516100408-8246-1-git-send-email-odpbot@yandex.ru> References: <1516100408-8246-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v1 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: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e ** Merge commit sha: 7244f46bcf5e4a0fce4048e306f224f31e9a4d2f **/ 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)