From patchwork Thu Dec 18 12:11:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 42443 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F051226C8B for ; Thu, 18 Dec 2014 12:12:28 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf661134lab.7 for ; Thu, 18 Dec 2014 04:12:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Qv8NxroINUtThm1bgWUuHwGnUGu+HezEjstJ1iy04eU=; b=ZpFwh5NZevkeZZukhxF+giEqVFC34J02vMAJ0+bqABtSsm3YOSu3GTo8u4pa+fyCLy jmWhIh/YYXWNCNhr4bUGXMz0CChv3aBquNS0vu4yNsGJJ2bwRHtEgqHXXsDjX3gFYK/B 5wQlfxdeK8PPoDiwCNs51KuftDYkWL74Jj4BUwCv+w1faBcqsUYFs0x+F5Xf0PVUCXNE /TcNE8aV8SYJx5ebJDwpA+EtjoCANrl9eSyoIa4L5hiyPMUszUsYgfLFupVuQ32URqcM HA+19b1Jtf43i/hoD66LU5H+DRCw9PI/+3vuSVnYw5A4x0HjIPIQEH2YXdrc3JF9Gtww Rg/A== X-Gm-Message-State: ALoCoQlCBp3WHrwh9MYuBaUC9w1JBHEBZ3NCpZjMwlMUL17zwR3hoHclfGJ8qNSVsgUkCJbjf3uQ X-Received: by 10.194.134.193 with SMTP id pm1mr252511wjb.4.1418904747902; Thu, 18 Dec 2014 04:12:27 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.72 with SMTP id b8ls864226laf.6.gmail; Thu, 18 Dec 2014 04:12:27 -0800 (PST) X-Received: by 10.152.206.1 with SMTP id lk1mr332248lac.92.1418904747638; Thu, 18 Dec 2014 04:12:27 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id l5si6657388lbs.94.2014.12.18.04.12.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id b6so820762lbj.22 for ; Thu, 18 Dec 2014 04:12:27 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr1867010lbc.91.1418904747531; Thu, 18 Dec 2014 04:12:27 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1683840lbb; Thu, 18 Dec 2014 04:12:26 -0800 (PST) X-Received: by 10.224.129.9 with SMTP id m9mr2923662qas.30.1418904746138; Thu, 18 Dec 2014 04:12:26 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id e14si7960484qac.43.2014.12.18.04.12.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:12:26 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1ZwN-0003kk-NU; Thu, 18 Dec 2014 12:12:23 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1Zw6-0003ef-39 for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 12:12:06 +0000 Received: by mail-lb0-f174.google.com with SMTP id 10so838938lbg.5 for ; Thu, 18 Dec 2014 04:12:00 -0800 (PST) X-Received: by 10.112.35.234 with SMTP id l10mr1973160lbj.12.1418904720505; Thu, 18 Dec 2014 04:12:00 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id xk7sm1731858lbb.7.2014.12.18.04.11.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Dec 2014 04:11:59 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org, bill.fischofer@linaro.org Date: Thu, 18 Dec 2014 14:11:47 +0200 Message-Id: <1418904708-1412-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418904708-1412-1-git-send-email-taras.kondratiuk@linaro.org> References: <1418904708-1412-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 2/3] validation: buffer: add initial buffer tests X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Taras Kondratiuk --- test/validation/Makefile.am | 1 + test/validation/buffer/odp_buffer_test.c | 52 ++++++++++++++++++++++++++ test/validation/buffer/odp_buffer_testsuites.h | 4 ++ test/validation/odp_buffer.c | 5 +++ 4 files changed, 62 insertions(+) create mode 100644 test/validation/buffer/odp_buffer_test.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index d2ca969..bbec23f 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -20,6 +20,7 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \ + buffer/odp_buffer_test.c \ odp_buffer.c common/odp_cunit_common.c #For Linux generic the unimplemented crypto API functions break the diff --git a/test/validation/buffer/odp_buffer_test.c b/test/validation/buffer/odp_buffer_test.c new file mode 100644 index 0000000..73ae4cb --- /dev/null +++ b/test/validation/buffer/odp_buffer_test.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "odp_buffer_testsuites.h" + +static odp_buffer_pool_t raw_pool; +static odp_buffer_t raw_buffer = ODP_BUFFER_INVALID; +static const size_t raw_buffer_size = 1500; + +int buffer_testsuite_init(void) +{ + odp_buffer_pool_param_t params = { + .buf_size = raw_buffer_size, + .buf_align = ODP_CACHE_LINE_SIZE, + .num_bufs = 100, + .buf_type = ODP_BUFFER_TYPE_RAW, + }; + + raw_pool = odp_buffer_pool_create("raw_pool", ODP_SHM_INVALID, ¶ms); + if (raw_pool == ODP_BUFFER_POOL_INVALID) + return -1; + raw_buffer = odp_buffer_alloc(raw_pool); + if (raw_buffer == ODP_BUFFER_INVALID) + return -1; + return 0; +} + +int buffer_testsuite_finalize(void) +{ + odp_buffer_free(raw_buffer); + if (odp_buffer_pool_destroy(raw_pool) != 0) + return -1; + return 0; +} + +static void buffer_management_basic(void) +{ + CU_ASSERT(odp_buffer_is_valid(raw_buffer) == 1); + CU_ASSERT(odp_buffer_pool(raw_buffer) != ODP_BUFFER_POOL_INVALID); + CU_ASSERT(odp_buffer_type(raw_buffer) == ODP_BUFFER_TYPE_RAW); + CU_ASSERT(odp_buffer_size(raw_buffer) >= raw_buffer_size); + CU_ASSERT(odp_buffer_addr(raw_buffer) != NULL); + odp_buffer_print(raw_buffer); +} + +CU_TestInfo buffer_tests[] = { + _CU_TEST_INFO(buffer_management_basic), + CU_TEST_INFO_NULL, +}; diff --git a/test/validation/buffer/odp_buffer_testsuites.h b/test/validation/buffer/odp_buffer_testsuites.h index 08fb4e0..ca42c2d 100644 --- a/test/validation/buffer/odp_buffer_testsuites.h +++ b/test/validation/buffer/odp_buffer_testsuites.h @@ -15,6 +15,10 @@ #define _CU_TEST_INFO(test_func) {#test_func, test_func} extern CU_TestInfo buffer_pool_tests[]; +extern CU_TestInfo buffer_tests[]; + +extern int buffer_testsuite_init(void); +extern int buffer_testsuite_finalize(void); odp_buffer_pool_t pool_create(int buf_num, int buf_size, int buf_type); diff --git a/test/validation/odp_buffer.c b/test/validation/odp_buffer.c index bfd9f6d..8aa61a9 100644 --- a/test/validation/odp_buffer.c +++ b/test/validation/odp_buffer.c @@ -10,5 +10,10 @@ CU_SuiteInfo odp_testsuites[] = { { .pName = "buffer Pool tests", .pTests = buffer_pool_tests, }, + { .pName = "buffer tests", + .pTests = buffer_tests, + .pInitFunc = buffer_testsuite_init, + .pCleanupFunc = buffer_testsuite_finalize, + }, CU_SUITE_INFO_NULL, };