From patchwork Mon Jul 31 13:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109026 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp193652qge; Mon, 31 Jul 2017 06:02:43 -0700 (PDT) X-Received: by 10.55.126.198 with SMTP id z189mr21056956qkc.299.1501506163520; Mon, 31 Jul 2017 06:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501506163; cv=none; d=google.com; s=arc-20160816; b=dsqsrjcquXDT42IAKMU6twsBg1WqRYXYftdHEnDUWO/HeDIfJ12Jsg7usWgHmaA1Aq aD9R9iugdGixy9NJwmqFlC6ECBrT0BIW3vZb9ApMZSV0FWuYDtwsACLg6noq2WQ9NfUS gEEUDhv0YL7gVSmGFUT0c1TzA3cd4XZHtjP8VsDhExjQVsE2Hta0k/T8W750iPjAzFj9 mNduc7EuhwXqyg3lV34xxW/X5UBpUmGd5MJ6vN0vpvsmPRlLNf/P5MTjHUF8QnPh5Dtg b0h6gRpMj03pxknV1WQSKVYdvM2TYB5zWdzC4H2FA2icHz2Yirhhen1XI5hvQtcHk0Kj bKCw== 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=hNHoyl/jw2gN9nHd35W3WhDwDkyIW1RmuahzcDH+G0A=; b=v8GEQ3Q72zaZqlBtoLvtaisOnJk+0sRGdjyIy/Ja69oUObNUqlQFECCxAXRFZ/ru8X EZd0//o4aZVzOIWQE7V0VfcLeqySWOAcAstjwt5C0uKMtbHiC7mz0xqswWMYQkb8bU5w 4Zl9+ugH8GMXtCdQKfGBQUINLH4vT+qEUVJF1YSeaG/a7lFre+1CC3UeLbu7L8YuTby4 8gf1W5qdus91ApbFjlkH50H/32VLwlPeU+Gp5Krxqy1zNBvMgnK8AjUtvipwJYO5T4Gq nkj91w5XLMR1GKxFUm4RfBNwSp75NI8oONUeSpfb8B1trSq0F6mB/qA4n/sVjlY3mbV5 IB2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j61si5661275qtd.429.2017.07.31.06.02.43; Mon, 31 Jul 2017 06:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 0FA76644CE; Mon, 31 Jul 2017 13:02:43 +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,URIBL_BLOCKED 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 D736E64498; Mon, 31 Jul 2017 13:00:39 +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 BC5CE62CE2; Mon, 31 Jul 2017 13:00:26 +0000 (UTC) Received: from forward3j.cmail.yandex.net (forward3j.cmail.yandex.net [5.255.227.21]) by lists.linaro.org (Postfix) with ESMTPS id E4F4762CD6 for ; Mon, 31 Jul 2017 13:00:21 +0000 (UTC) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [37.140.190.29]) by forward3j.cmail.yandex.net (Yandex) with ESMTP id 9921220E96 for ; Mon, 31 Jul 2017 16:00:20 +0300 (MSK) Received: from smtp4o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp4o.mail.yandex.net (Yandex) with ESMTP id E7C0E6C00FD1 for ; Mon, 31 Jul 2017 16:00:19 +0300 (MSK) Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lh14K6cxxM-0Ir8c7Nj; Mon, 31 Jul 2017 16:00:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 31 Jul 2017 16:00:05 +0300 Message-Id: <1501506009-28910-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501506009-28910-1-git-send-email-odpbot@yandex.ru> References: <1501506009-28910-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 94 Subject: [lng-odp] [PATCH API-NEXT v1 2/6] validation: packet: add tests for o_p_set_data and o_p_cmp_data 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: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 94 (lumag:crypto-long-keys) ** https://github.com/Linaro/odp/pull/94 ** Patch: https://github.com/Linaro/odp/pull/94.patch ** Base sha: c16f1363303cd5fc11324acbc4dfebe0a9680a41 ** Merge commit sha: bab24526ba91a4499aff896c5e82d4ac3f03fea9 **/ test/common_plat/validation/api/packet/packet.c | 35 +++++++++++++++++++++++++ test/common_plat/validation/api/packet/packet.h | 1 + 2 files changed, 36 insertions(+) diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index fa6f4afd..e1c3a4df 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -1311,6 +1311,40 @@ void packet_test_copydata(void) odp_packet_free(pkt); } +void packet_test_setcmpdata(void) +{ + odp_packet_t pkt = test_packet; + uint32_t pkt_len = odp_packet_len(pkt); + uint8_t *data_buf; + uint32_t i; + int correct_memory; + + CU_ASSERT_FATAL(pkt_len > 0); + + data_buf = malloc(pkt_len); + CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf); + + CU_ASSERT(!odp_packet_set_data(pkt, 0, 0xa5, pkt_len)); + memset(data_buf, 0, pkt_len); + CU_ASSERT(!odp_packet_copy_to_mem(pkt, 0, pkt_len, data_buf)); + + correct_memory = 1; + for (i = 0; i < pkt_len; i++) + if (data_buf[i] != 0xa5) { + correct_memory = 0; + break; + } + CU_ASSERT(correct_memory); + + CU_ASSERT(!odp_packet_cmp_data(pkt, 0, data_buf, pkt_len)); + + data_buf[pkt_len - 1] = 0x5a; + + CU_ASSERT(odp_packet_cmp_data(pkt, 0, data_buf, pkt_len)); + + free(data_buf); +} + void packet_test_concatsplit(void) { odp_packet_t pkt, pkt2; @@ -2431,6 +2465,7 @@ odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_add_rem_data), ODP_TEST_INFO(packet_test_copy), ODP_TEST_INFO(packet_test_copydata), + ODP_TEST_INFO(packet_test_setcmpdata), ODP_TEST_INFO(packet_test_concatsplit), ODP_TEST_INFO(packet_test_concat_small), ODP_TEST_INFO(packet_test_concat_extend_trunc), diff --git a/test/common_plat/validation/api/packet/packet.h b/test/common_plat/validation/api/packet/packet.h index 783b7a11..2080544b 100644 --- a/test/common_plat/validation/api/packet/packet.h +++ b/test/common_plat/validation/api/packet/packet.h @@ -29,6 +29,7 @@ void packet_test_error_flags(void); void packet_test_add_rem_data(void); void packet_test_copy(void); void packet_test_copydata(void); +void packet_test_setcmpdata(void); void packet_test_concatsplit(void); void packet_test_concat_small(void); void packet_test_concat_extend_trunc(void);