From patchwork Fri Jun 26 15:01:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 50356 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3C205228FD for ; Fri, 26 Jun 2015 15:02:54 +0000 (UTC) Received: by lbbwc1 with SMTP id wc1sf27334654lbb.3 for ; Fri, 26 Jun 2015 08:02:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc: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=/Wln8l5Jxmkv346T1SmLelhwkdG0v3oVhap3QxjOD1I=; b=L96WLAfBFe2xSqckN4LBOwGhrF4wgXwLcxadnwxZ7SP6LiZkjuArQKfhlDIoFBrh4O 5kczsrNbOgACVb2v9mteA1mrf9hYe0vqt5MFdj2NBxE5oKg6HqupHJ7xldv8do++xwS6 qlbtduZhuVp8b/k91NndcSGGKRAWMSijP/e7yk0g88VmlOLwzb6mopk38pT7DyDcAJau wSXf7NW64cL4/ibyoKR9div7oWonqZRBiAtGlRzLFSEK8KeOyXCL+7hCq2dUl/YFLB8D lbBgzt8jt2QlmAZyHQPY7vw8y3nmWzGZf/55JLtUNqUBmHKchq5ISmRY2mn10T4bdAsH WO2w== X-Gm-Message-State: ALoCoQlhx9S1kAkTG91cMEEsCIJtk8le7P7Ihr9uA/NdWq9Vj/5JbjYtFN193nMGyAyfqDPLXzIq X-Received: by 10.194.47.179 with SMTP id e19mr1405829wjn.4.1435330973218; Fri, 26 Jun 2015 08:02:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.10 with SMTP id j10ls199798lae.6.gmail; Fri, 26 Jun 2015 08:02:53 -0700 (PDT) X-Received: by 10.152.179.234 with SMTP id dj10mr1989101lac.73.1435330973044; Fri, 26 Jun 2015 08:02:53 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id u14si27618599lal.40.2015.06.26.08.02.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 08:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbwc1 with SMTP id wc1so66218601lbb.2 for ; Fri, 26 Jun 2015 08:02:53 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr2010082laj.88.1435330972934; Fri, 26 Jun 2015 08:02:52 -0700 (PDT) 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.108.230 with SMTP id hn6csp1386337lbb; Fri, 26 Jun 2015 08:02:51 -0700 (PDT) X-Received: by 10.140.31.161 with SMTP id f30mr2803621qgf.23.1435330971268; Fri, 26 Jun 2015 08:02:51 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c31si15528350qgc.52.2015.06.26.08.02.21; Fri, 26 Jun 2015 08:02:51 -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; Received: by lists.linaro.org (Postfix, from userid 109) id 108EA62104; Fri, 26 Jun 2015 15:02:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id AC0DF61D37; Fri, 26 Jun 2015 15:02:15 +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 8A0F261D66; Fri, 26 Jun 2015 15:02:08 +0000 (UTC) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by lists.linaro.org (Postfix) with ESMTPS id 2562161D37 for ; Fri, 26 Jun 2015 15:02:07 +0000 (UTC) Received: by laar3 with SMTP id r3so3491603laa.0 for ; Fri, 26 Jun 2015 08:02:05 -0700 (PDT) X-Received: by 10.153.5.2 with SMTP id ci2mr2049501lad.28.1435330925651; Fri, 26 Jun 2015 08:02:05 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id q17sm5380493lal.37.2015.06.26.08.02.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jun 2015 08:02:04 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Fri, 26 Jun 2015 17:01:46 +0200 Message-Id: <1435330910-15536-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435330910-15536-1-git-send-email-christophe.milard@linaro.org> References: <1435330910-15536-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 1/5] validation: removed odp_buffer_pool_test.c X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christophe.milard@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.171 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 removed from directory buffer. The file is not compiled nor included. Signed-off-by: Christophe Milard --- test/validation/buffer/odp_buffer_pool_test.c | 269 -------------------------- 1 file changed, 269 deletions(-) delete mode 100644 test/validation/buffer/odp_buffer_pool_test.c diff --git a/test/validation/buffer/odp_buffer_pool_test.c b/test/validation/buffer/odp_buffer_pool_test.c deleted file mode 100644 index ebeae75..0000000 --- a/test/validation/buffer/odp_buffer_pool_test.c +++ /dev/null @@ -1,269 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "odp_buffer_tests.h" - -static int pool_name_number = 1; -static const int default_buffer_size = 1500; -static const int default_buffer_num = 1000; - -odp_pool_t pool_create(int num, int size, int type) -{ - odp_pool_t pool; - char pool_name[ODP_POOL_NAME_LEN]; - odp_pool_param_t param; - - memset(¶m, 0, sizeof(param)); - - switch (type) { - case ODP_POOL_BUFFER: - param.buf.size = size; - param.buf.align = ODP_CACHE_LINE_SIZE; - param.buf.num = num; - break; - case ODP_POOL_PACKET: - param.pkt.seg_len = size; - param.pkt.len = size; - param.pkt.num = num; - break; - case ODP_POOL_TIMEOUT: - param.tmo.num = num; - break; - default: - CU_FAIL("Bad pool type"); - return ODP_POOL_INVALID; - } - - param.type = type; - - snprintf(pool_name, sizeof(pool_name), - "test_buffer_pool-%d", pool_name_number++); - - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, ¶m); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - return pool; -} - -static void pool_create_destroy_type(int type) -{ - odp_pool_t pool; - pool = pool_create(default_buffer_num, default_buffer_size, type); - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -static void pool_create_destroy_raw(void) -{ - pool_create_destroy_type(ODP_POOL_BUFFER); -} - -static void pool_create_destroy_packet(void) -{ - pool_create_destroy_type(ODP_POOL_PACKET); -} - -static void pool_create_destroy_timeout(void) -{ - pool_create_destroy_type(ODP_POOL_TIMEOUT); -} - -static void pool_create_destroy_raw_shm(void) -{ - odp_pool_t pool; - odp_shm_t test_shm; - odp_pool_param_t params = { - .buf = { - .size = 1500, - .align = ODP_CACHE_LINE_SIZE, - .num = 10, - }, - .type = ODP_POOL_BUFFER, - }; - - test_shm = odp_shm_reserve("test_shm", - params.buf.size * params.buf.num * 2, - ODP_CACHE_LINE_SIZE, - 0); - CU_ASSERT_FATAL(test_shm != ODP_SHM_INVALID); - - pool = odp_pool_create("test_shm_pool", test_shm, ¶ms); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - CU_ASSERT(odp_pool_destroy(pool) == 0); - CU_ASSERT(odp_shm_free(test_shm) == 0); -} - -static void pool_lookup_info_print(void) -{ - odp_pool_t pool; - const char pool_name[] = "pool_for_lookup_test"; - odp_pool_info_t info; - odp_pool_param_t params = { - .buf = { - .size = default_buffer_size, - .align = ODP_CACHE_LINE_SIZE, - .num = default_buffer_num, - }, - .type = ODP_POOL_BUFFER, - }; - - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, ¶ms); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - pool = odp_pool_lookup(pool_name); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0); - CU_ASSERT(strncmp(pool_name, info.name, sizeof(pool_name)) == 0); - CU_ASSERT(info.shm == ODP_SHM_INVALID); - CU_ASSERT(params.buf.size <= info.params.buf.size); - CU_ASSERT(params.buf.align <= info.params.buf.align); - CU_ASSERT(params.buf.num <= info.params.buf.num); - CU_ASSERT(params.type == info.params.type); - - odp_pool_print(pool); - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -static void pool_alloc_type(int type) -{ - odp_pool_t pool; - const int num = 3; - const size_t size = 1500; - odp_buffer_t buffer[num]; - odp_packet_t packet[num]; - odp_timeout_t tmo[num]; - odp_event_t ev; - int index; - char wrong_type = 0, wrong_size = 0; - - pool = pool_create(num, size, type); - odp_pool_print(pool); - - /* Try to allocate num items from the pool */ - for (index = 0; index < num; index++) { - switch (type) { - case ODP_POOL_BUFFER: - buffer[index] = odp_buffer_alloc(pool); - - if (buffer[index] == ODP_BUFFER_INVALID) - break; - - ev = odp_buffer_to_event(buffer[index]); - if (odp_event_type(ev) != ODP_EVENT_BUFFER) - wrong_type = 1; - if (odp_buffer_size(buffer[index]) < size) - wrong_size = 1; - if (wrong_type || wrong_size) - odp_buffer_print(buffer[index]); - break; - case ODP_POOL_PACKET: - packet[index] = odp_packet_alloc(pool, size); - - if (packet[index] == ODP_PACKET_INVALID) - break; - - ev = odp_packet_to_event(packet[index]); - if (odp_event_type(ev) != ODP_EVENT_PACKET) - wrong_type = 1; - break; - case ODP_POOL_TIMEOUT: - tmo[index] = odp_timeout_alloc(pool); - - if (tmo[index] == ODP_TIMEOUT_INVALID) - break; - - ev = odp_timeout_to_event(tmo[index]); - if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) - wrong_type = 1; - break; - default: - break; - } - - } - - /* Check that the pool had at least num items */ - CU_ASSERT(index == num); - /* index points out of buffer[] or it point to an invalid buffer */ - index--; - - /* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); - CU_ASSERT(wrong_size == 0); - - switch (type) { - case ODP_POOL_BUFFER: - for (; index >= 0; index--) - odp_buffer_free(buffer[index]); - break; - case ODP_POOL_PACKET: - for (; index >= 0; index--) - odp_packet_free(packet[index]); - break; - case ODP_POOL_TIMEOUT: - for (; index >= 0; index--) - odp_timeout_free(tmo[index]); - break; - default: - break; - } - - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -static void pool_alloc_buffer_raw(void) -{ - pool_alloc_type(ODP_POOL_BUFFER); -} - -static void pool_alloc_buffer_packet(void) -{ - pool_alloc_type(ODP_POOL_PACKET); -} - -static void pool_alloc_buffer_timeout(void) -{ - pool_alloc_type(ODP_POOL_TIMEOUT); -} - -static void pool_free_buffer(void) -{ - odp_pool_t pool; - odp_buffer_t buffer; - pool = pool_create(1, 64, ODP_POOL_BUFFER); - - /* Allocate the only buffer from the pool */ - buffer = odp_buffer_alloc(pool); - CU_ASSERT_FATAL(buffer != ODP_BUFFER_INVALID); - - /** @todo: is it correct to assume the pool had only one buffer? */ - CU_ASSERT_FATAL(odp_buffer_alloc(pool) == ODP_BUFFER_INVALID) - - odp_buffer_free(buffer); - - /* Check that the buffer was returned back to the pool */ - buffer = odp_buffer_alloc(pool); - CU_ASSERT_FATAL(buffer != ODP_BUFFER_INVALID); - - odp_buffer_free(buffer); - CU_ASSERT(odp_pool_destroy(pool) == 0); -} - -CU_TestInfo buffer_pool_tests[] = { - _CU_TEST_INFO(pool_create_destroy_raw), - _CU_TEST_INFO(pool_create_destroy_packet), - _CU_TEST_INFO(pool_create_destroy_timeout), - _CU_TEST_INFO(pool_create_destroy_raw_shm), - _CU_TEST_INFO(pool_lookup_info_print), - _CU_TEST_INFO(pool_alloc_buffer_raw), - _CU_TEST_INFO(pool_alloc_buffer_packet), - _CU_TEST_INFO(pool_alloc_buffer_timeout), - _CU_TEST_INFO(pool_free_buffer), - CU_TEST_INFO_NULL, -};