From patchwork Fri Dec 12 20:40:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 42199 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D213726C77 for ; Fri, 12 Dec 2014 20:40:53 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf5699411eek.4 for ; Fri, 12 Dec 2014 12:40:53 -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: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=Jw7q7duLanSpN7cd1wwsjr7Gf/1gGKmiRFgW9oN4Jek=; b=fRh7MMy2irJ4cUQQyxb0hvgopRlcAsyHVhq/PKsbVjJ1U+1aXve65WlnsQ5+q5wveA WxGV20/jsen5xNFVyrmcEV/DI08jdpjnCoH9oRpIfz2UDy/I+xGImUDsgaZUIjDEyVTI c+MTYgxdFHzJIfn7/WhVOmTTm0dKiYEgqsAExYFo7KPa6nKoNc/SCSDjKFsyho6zacKQ iuc4sjIdXvbOO42PFFpn5//sY7B0zOGLqfphTexQxFetn00xQ8PQn3qeBrWszrbRxSNW JIlM9EP9UGkq83F54O56Da3+yw8v0hHGPmYcev+9tvWoybIlW3jzYq7J/UG3PJsJ1W/c NvLQ== X-Gm-Message-State: ALoCoQm19fgxW/4mUj9k2wSncrnrXSV3LToXU2+hChNhvz6XVIsIWk+VmPGkMHVI+obPKWzZxzE8 X-Received: by 10.194.173.97 with SMTP id bj1mr2912696wjc.2.1418416852994; Fri, 12 Dec 2014 12:40:52 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.40 with SMTP id h8ls495540lah.12.gmail; Fri, 12 Dec 2014 12:40:52 -0800 (PST) X-Received: by 10.112.138.9 with SMTP id qm9mr17566968lbb.62.1418416852658; Fri, 12 Dec 2014 12:40:52 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id z5si2532234lal.63.2014.12.12.12.40.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Dec 2014 12:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ms9so6727689lab.10 for ; Fri, 12 Dec 2014 12:40:52 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr10824474lag.50.1418416852444; Fri, 12 Dec 2014 12:40:52 -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 ru5csp89651lbb; Fri, 12 Dec 2014 12:40:51 -0800 (PST) X-Received: by 10.224.128.129 with SMTP id k1mr34402792qas.14.1418416850366; Fri, 12 Dec 2014 12:40:50 -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 e2si2790393qab.21.2014.12.12.12.40.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Dec 2014 12:40:50 -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 1XzX14-0005cE-E9; Fri, 12 Dec 2014 20:40:46 +0000 Received: from mail-qc0-f178.google.com ([209.85.216.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XzX0y-0005Zb-OK for lng-odp@lists.linaro.org; Fri, 12 Dec 2014 20:40:40 +0000 Received: by mail-qc0-f178.google.com with SMTP id b13so6926312qcw.9 for ; Fri, 12 Dec 2014 12:40:35 -0800 (PST) X-Received: by 10.229.176.198 with SMTP id bf6mr34730587qcb.12.1418416835535; Fri, 12 Dec 2014 12:40:35 -0800 (PST) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id k6sm2391050qaz.41.2014.12.12.12.40.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Dec 2014 12:40:34 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Fri, 12 Dec 2014 15:40:29 -0500 Message-Id: <1418416829-23031-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH v2] validation: add odp_system test 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: mike.holmes@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.51 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 Add tests for ODP system_info interface Signed-off-by: Mike Holmes --- This api has poor documentaion, these testis attempt to do something sensible against linux-generic in its present form. test/validation/.gitignore | 1 + test/validation/Makefile.am | 4 ++- test/validation/odp_system.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_system.c diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 32834ae..a388488 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -5,3 +5,4 @@ odp_queue odp_crypto odp_schedule odp_shm +odp_system diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index d0b5426..98376b9 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,7 +6,7 @@ AM_LDFLAGS += -static if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto @@ -15,6 +15,7 @@ odp_shm_CFLAGS = $(AM_CFLAGS) odp_shm_LDFLAGS = $(AM_LDFLAGS) odp_schedule_CFLAGS = $(AM_CFLAGS) odp_schedule_LDFLAGS = $(AM_LDFLAGS) +odp_system_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -25,6 +26,7 @@ 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_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c #For Linux generic the unimplemented crypto API functions break the #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975 diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c new file mode 100644 index 0000000..dfad677 --- /dev/null +++ b/test/validation/odp_system.c @@ -0,0 +1,73 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "odp.h" +#include "odp_cunit_common.h" + +static void test_odp_sys_core_count(void) +{ + int cores; + + cores = odp_sys_core_count(); + CU_ASSERT(0 < cores); +} + +static void test_odp_sys_cache_line_size(void) +{ + int cache_size; + + cache_size = odp_sys_cache_line_size(); + CU_ASSERT(0 < cache_size); +} + +static void test_odp_sys_cpu_model_str(void) +{ + char model[128]; + + snprintf(model, 128, "%s", odp_sys_cpu_model_str()); + CU_ASSERT(strlen(model) <= 127); + CU_ASSERT_PTR_NOT_NULL(odp_sys_cpu_model_str()); +} + +static void test_odp_sys_page_size(void) +{ + uint64_t page; + + page = odp_sys_page_size(); + CU_ASSERT(0 < page); +} + +static void test_odp_sys_huge_page_size(void) +{ + uint64_t page; + + page = odp_sys_huge_page_size(); + CU_ASSERT(0 < page || 0 == page); +} + +static void test_odp_sys_cpu_hz(void) +{ + uint64_t hz; + + hz = odp_sys_cpu_hz(); + CU_ASSERT(0 < hz); +} + +CU_TestInfo test_odp_system[] = { + {"odp_sys_core_count", test_odp_sys_core_count}, + {"odp_sys_cache_line_size", test_odp_sys_cache_line_size}, + {"odp_sys_cpu_model_str", test_odp_sys_cpu_model_str}, + {"odp_sys_page_size", test_odp_sys_page_size}, + {"odp_sys_huge_page_size", test_odp_sys_huge_page_size}, + {"odp_sys_cpu_hz", test_odp_sys_cpu_hz}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo odp_testsuites[] = { + {"System Info", NULL, NULL, NULL, NULL, + test_odp_system}, + CU_SUITE_INFO_NULL, +};