From patchwork Mon Sep 25 22:00:06 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: 114188 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3103672qgf; Mon, 25 Sep 2017 15:02:25 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBvm0qiez1SjFaWmPAFgC4+45YF/QbWLzp9Ni3txhL0DuTZumlur+gqAjq8ERMpGQL/BSuR X-Received: by 10.36.48.3 with SMTP id q3mr2939294itq.66.1506376945194; Mon, 25 Sep 2017 15:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506376945; cv=none; d=google.com; s=arc-20160816; b=DdDGWisyfrfl8+8/+qY4YOg80a6Hn7CcRdhJKTNMSU1blqZGy/SxXeIDmKU+JApYk5 2JgS/pI3QC6fZingyxmvVJ95nKbHP0m1Yqj5v2yFw45pg7mMQVOvFjF/Jdv0Hpy6kbvA h6uPa/bHpHvflAxQBTf8Ho/z3krqyGsCy0VLibl2VFFbadZ4FDBgQizMFTikYwy9ZjtL 3uTlA7f9KdRc3IpOO+OUsZuLqQEi03hZmXMDraJlCLiBo26+tVchRtYCgc0/i7BNB3vB mXPx1fg0pyLJm5kaVhllfd+a05KcLhU7tt5lirUc+1O4/U3xIq5gl58CxtKdtxS2qrhO 51Eg== 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=BbIKef9PvxpQ90ci4WTP4iC+NgjJ46a5kmyrQ5BkyvA=; b=Za0XYDe0Yl9qnCOEW+GK3AmsuZoz+fs/k/df5sByVn6E9tbMza91geKxAmd19Zbbub H2F+FoUhRmwGWYY8QCZPzlex63MuuV5OvZJ5cgEHwv2y9X7lBHXsdSk5TLD2evHFw3rv aIxoGafVJ4Uy8gjwavlBNCeRXP7FkxoG8/hXBM7fMIVdo4qT0oxcYqd9kPlrCLzY1+G6 mqzT83mji/afpLXhvFkN+/cp9VGVWg6zXa8LwydIX09+6AXDuVcoAJXhGw97HKTw7V1H L0wffaRVn+WIWb5vMc9bV3Yk6SuchbXGhVmekkCVpUaOB4xa4niniowSaCLKPXXumwBO 6qBQ== 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 c66si6174872ioc.177.2017.09.25.15.02.24; Mon, 25 Sep 2017 15:02:25 -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 BE26360B3F; Mon, 25 Sep 2017 22:02:24 +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 BAAF460BDB; Mon, 25 Sep 2017 22: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 171B060A35; Mon, 25 Sep 2017 22:00:22 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id D43DC607F1 for ; Mon, 25 Sep 2017 22:00:18 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 8A2DD6A839DA for ; Tue, 26 Sep 2017 01:00:17 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id mjIGMI2f4J-0HOGBe0P; Tue, 26 Sep 2017 01:00:17 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id YWIwh59QMn-0GFeTdHG; Tue, 26 Sep 2017 01: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: Tue, 26 Sep 2017 01:00:06 +0300 Message-Id: <1506376806-27771-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506376806-27771-1-git-send-email-odpbot@yandex.ru> References: <1506376806-27771-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 193 Subject: [lng-odp] [PATCH API-NEXT v1 3/3] validation: chksum: add test chksum suite 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 Create chksum test suite and ones complement sum test in there. Signed-off-by: Petri Savolainen --- /** Email created from pull request 193 (psavol:next-ip-checksum) ** https://github.com/Linaro/odp/pull/193 ** Patch: https://github.com/Linaro/odp/pull/193.patch ** Base sha: 13322ca632f8ffba292bec058e597719bc54142d ** Merge commit sha: 405aaa1f3768170dd025f0a4c3bfdd63600f68df **/ test/common_plat/m4/configure.m4 | 1 + test/common_plat/validation/api/Makefile.am | 1 + test/common_plat/validation/api/chksum/.gitignore | 1 + test/common_plat/validation/api/chksum/Makefile.am | 5 ++ test/common_plat/validation/api/chksum/chksum.c | 70 ++++++++++++++++++++++ test/common_plat/validation/api/chksum/chksum.h | 24 ++++++++ .../validation/api/chksum/chksum_main.c | 12 ++++ test/linux-generic/Makefile.am | 1 + 8 files changed, 115 insertions(+) create mode 100644 test/common_plat/validation/api/chksum/.gitignore create mode 100644 test/common_plat/validation/api/chksum/Makefile.am create mode 100644 test/common_plat/validation/api/chksum/chksum.c create mode 100644 test/common_plat/validation/api/chksum/chksum.h create mode 100644 test/common_plat/validation/api/chksum/chksum_main.c diff --git a/test/common_plat/m4/configure.m4 b/test/common_plat/m4/configure.m4 index 13a13bd50..c06daea28 100644 --- a/test/common_plat/m4/configure.m4 +++ b/test/common_plat/m4/configure.m4 @@ -11,6 +11,7 @@ AC_CONFIG_FILES([test/common_plat/Makefile test/common_plat/validation/api/atomic/Makefile test/common_plat/validation/api/barrier/Makefile test/common_plat/validation/api/buffer/Makefile + test/common_plat/validation/api/chksum/Makefile test/common_plat/validation/api/classification/Makefile test/common_plat/validation/api/cpumask/Makefile test/common_plat/validation/api/crypto/Makefile diff --git a/test/common_plat/validation/api/Makefile.am b/test/common_plat/validation/api/Makefile.am index b00fb2e95..65b2e3b9c 100644 --- a/test/common_plat/validation/api/Makefile.am +++ b/test/common_plat/validation/api/Makefile.am @@ -1,6 +1,7 @@ ODP_MODULES = atomic \ barrier \ buffer \ + chksum \ classification \ cpumask \ crypto \ diff --git a/test/common_plat/validation/api/chksum/.gitignore b/test/common_plat/validation/api/chksum/.gitignore new file mode 100644 index 000000000..c69e8c470 --- /dev/null +++ b/test/common_plat/validation/api/chksum/.gitignore @@ -0,0 +1 @@ +chksum_main diff --git a/test/common_plat/validation/api/chksum/Makefile.am b/test/common_plat/validation/api/chksum/Makefile.am new file mode 100644 index 000000000..46f3643ef --- /dev/null +++ b/test/common_plat/validation/api/chksum/Makefile.am @@ -0,0 +1,5 @@ +include ../Makefile.inc + +test_PROGRAMS = chksum_main$(EXEEXT) +chksum_main_SOURCES = chksum_main.c chksum.c chksum.h +chksum_main_LDADD = $(LIBCUNIT_COMMON) $(LIBODP) diff --git a/test/common_plat/validation/api/chksum/chksum.c b/test/common_plat/validation/api/chksum/chksum.c new file mode 100644 index 000000000..c3255d697 --- /dev/null +++ b/test/common_plat/validation/api/chksum/chksum.c @@ -0,0 +1,70 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include "chksum.h" + +#define NUM_IP_HDR 5 +#define IP_HDR_LEN 20 + +uint8_t ip_hdr_test_vect[NUM_IP_HDR][IP_HDR_LEN] ODP_ALIGNED(4) = { + { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xAB, 0x33, 0xC0, 0xA8, 0x2C, 0xA2, 0xC0, 0xA8, 0x21, 0x99 + }, + { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xAB, 0xCA, 0xC0, 0xA8, 0x2C, 0x5E, 0xC0, 0xA8, 0x21, 0x46 + }, + { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xAB, 0x64, 0xC0, 0xA8, 0x2C, 0x20, 0xC0, 0xA8, 0x21, 0xEA + }, + { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xAB, 0x59, 0xC0, 0xA8, 0x2C, 0xD2, 0xC0, 0xA8, 0x21, 0x43 + }, + { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xAC, 0x06, 0xC0, 0xA8, 0x2C, 0x5C, 0xC0, 0xA8, 0x21, 0x0C + } +}; + +/* Test ones complement sum with IPv4 headers */ +void chksum_ones_complement_ip(void) +{ + int i; + uint16_t sum, res; + + for (i = 0; i < NUM_IP_HDR; i++) { + sum = odp_chksum_ones_comp16(ip_hdr_test_vect[0], IP_HDR_LEN); + res = ~sum; + + CU_ASSERT(res == 0); + } +} + +odp_testinfo_t chksum_suite[] = { + ODP_TEST_INFO(chksum_ones_complement_ip), + ODP_TEST_INFO_NULL, +}; + +odp_suiteinfo_t chksum_suites[] = { + {"Checksum", NULL, NULL, chksum_suite}, + ODP_SUITE_INFO_NULL +}; + +int chksum_main(int argc, char *argv[]) +{ + int ret; + + /* parse common options: */ + if (odp_cunit_parse_options(argc, argv)) + return -1; + + ret = odp_cunit_register(chksum_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; +} diff --git a/test/common_plat/validation/api/chksum/chksum.h b/test/common_plat/validation/api/chksum/chksum.h new file mode 100644 index 000000000..2086aeae7 --- /dev/null +++ b/test/common_plat/validation/api/chksum/chksum.h @@ -0,0 +1,24 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _ODP_TEST_CHKSUM_H_ +#define _ODP_TEST_CHKSUM_H_ + +#include + +/* test functions: */ +void chksum_ones_complement_ip(void); + +/* test arrays: */ +extern odp_testinfo_t chksum_suite[]; + +/* test registry: */ +extern odp_suiteinfo_t chksum_suites[]; + +/* main test program: */ +int chksum_main(int argc, char *argv[]); + +#endif diff --git a/test/common_plat/validation/api/chksum/chksum_main.c b/test/common_plat/validation/api/chksum/chksum_main.c new file mode 100644 index 000000000..bec10ddd4 --- /dev/null +++ b/test/common_plat/validation/api/chksum/chksum_main.c @@ -0,0 +1,12 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "chksum.h" + +int main(int argc, char *argv[]) +{ + return chksum_main(argc, argv); +} diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am index 4be5d94e9..0d3635880 100644 --- a/test/linux-generic/Makefile.am +++ b/test/linux-generic/Makefile.am @@ -13,6 +13,7 @@ TESTS = validation/api/pktio/pktio_run.sh \ $(ALL_API_VALIDATION_DIR)/atomic/atomic_main$(EXEEXT) \ $(ALL_API_VALIDATION_DIR)/barrier/barrier_main$(EXEEXT) \ $(ALL_API_VALIDATION_DIR)/buffer/buffer_main$(EXEEXT) \ + $(ALL_API_VALIDATION_DIR)/chksum/chksum_main$(EXEEXT) \ $(ALL_API_VALIDATION_DIR)/classification/classification_main$(EXEEXT) \ $(ALL_API_VALIDATION_DIR)/cpumask/cpumask_main$(EXEEXT) \ $(ALL_API_VALIDATION_DIR)/crypto/crypto_main$(EXEEXT) \