From patchwork Fri Dec 12 16:38:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 42191 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A2D2E26C77 for ; Fri, 12 Dec 2014 16:39:44 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf5127116wgh.1 for ; Fri, 12 Dec 2014 08:39:43 -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=Qc+VxaP46aXIttZJbfZGckUl76IpK3eetkSM+3IChQc=; b=FSGHYtgAdlmg81L0IEVSTFde0r89sczIezHs/uBEvm71nYiLt2glfZQPwXE0v/hD6X MJFjtD6FpSUC1gXr2IyaRyDBkggmrj72u/ypByO7kqdBaA8JNAXhi/AYreTyznib1zTA HysEnXlD+7S60IXTDxBolZLsm/vqj89wlxLXL9fedOr+ShobUkjJpjh5L7Pr76W85Xho tyMEJZ0bNpSUDPoO+FaLa7CQC64/6qekzk2tQ/UWoNmaixKe458/8DR/6RZcdEWygNr9 gMxUIjvcCKPcxzZsor7k/acDjK3xUD3AcITd4kJU0I3J5caH262H4J+nZqhJk7DdcBOH YyaQ== X-Gm-Message-State: ALoCoQmxu23MXKDyehXRLA7hTG32XhFA/Do4wct7s1qm3wC9Sl0F9e44ATE4Nnjr5trUFiK95fYo X-Received: by 10.194.92.34 with SMTP id cj2mr515075wjb.5.1418402383935; Fri, 12 Dec 2014 08:39:43 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.134 with SMTP id b6ls389023laa.27.gmail; Fri, 12 Dec 2014 08:39:43 -0800 (PST) X-Received: by 10.112.183.197 with SMTP id eo5mr16310675lbc.81.1418402383765; Fri, 12 Dec 2014 08:39:43 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id m7si1902037lbp.85.2014.12.12.08.39.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Dec 2014 08:39:43 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so6480874lab.17 for ; Fri, 12 Dec 2014 08:39:43 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr15947070lar.47.1418402383678; Fri, 12 Dec 2014 08:39:43 -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 ru5csp29826lbb; Fri, 12 Dec 2014 08:39:42 -0800 (PST) X-Received: by 10.52.53.71 with SMTP id z7mr9198587vdo.7.1418402382229; Fri, 12 Dec 2014 08:39:42 -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 hc1si631952vdb.14.2014.12.12.08.39.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Dec 2014 08:39:42 -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 1XzTFj-0004MD-JG; Fri, 12 Dec 2014 16:39:39 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XzTFE-0004HK-3m for lng-odp@lists.linaro.org; Fri, 12 Dec 2014 16:39:08 +0000 Received: by mail-lb0-f171.google.com with SMTP id w7so1912549lbi.16 for ; Fri, 12 Dec 2014 08:39:02 -0800 (PST) X-Received: by 10.112.85.11 with SMTP id d11mr16375780lbz.100.1418402342232; Fri, 12 Dec 2014 08:39:02 -0800 (PST) Received: from localhost.localdomain ([80.77.38.170]) by mx.google.com with ESMTPSA id b4sm524127lbp.17.2014.12.12.08.39.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Dec 2014 08:39:01 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Fri, 12 Dec 2014 18:38:44 +0200 Message-Id: <1418402325-6798-4-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418402325-6798-1-git-send-email-taras.kondratiuk@linaro.org> References: <1418402325-6798-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 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.215.44 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 81fd933..41c48ec 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -25,4 +25,5 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ odp_crypto.c common/odp_cunit_common.c dist_odp_shm_SOURCES = odp_shm.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 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, };