From patchwork Thu Dec 4 17:50:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 41947 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AEC9D2486D for ; Thu, 4 Dec 2014 17:51:27 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id ge10sf7794232lab.0 for ; Thu, 04 Dec 2014 09:51:26 -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=Rdh18c7geRuJT7/ZYwpQLikY3Nu40mRQbGPA65birO4=; b=T1G/3YWkv0XE5HC3hBgVQfawxfVthfKSbHvi4idonGrX0zIPrG9Q+waWdkyaTD83ug 8soyO3Z3E7ZF3a0oqB3Pem8fxuJAS7er4fBqL6wyFw9ULWH2qRCiA9bhVI5dnf6dj5Du k7138ZKdxDFOrQvpSXSxVUjOkIoLbp+mP+ucimqrKGyoDXtRS4ZsWXQ3z1N1f8PTscrS OCkvONc+2bg5j0cvHNzcisJZXDjORR2FOkVT29JXtekmuou8EPACiL9eGBo60jjWd43e 8dM33KJbNB67sOmPPqS07DMmlTzAc3pAL9VRHEeZcfv45U2j4lGPMuiz8wnWwXUkJDIs eAiA== X-Gm-Message-State: ALoCoQniMv9ZkE6q/lA0wOjVexMiBObXppTY+E/QiqKz+EOS+BZqTvBrCrzPy6wgUZTEsSVE0ucw X-Received: by 10.152.42.196 with SMTP id q4mr745237lal.6.1417715486655; Thu, 04 Dec 2014 09:51:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls236134lau.68.gmail; Thu, 04 Dec 2014 09:51:26 -0800 (PST) X-Received: by 10.112.171.136 with SMTP id au8mr10870331lbc.71.1417715486507; Thu, 04 Dec 2014 09:51:26 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id g5si26672704lbd.20.2014.12.04.09.51.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 09:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id u10so14584938lbd.3 for ; Thu, 04 Dec 2014 09:51:26 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr10564276lbo.32.1417715486380; Thu, 04 Dec 2014 09:51:26 -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.184.201 with SMTP id ew9csp81091lbc; Thu, 4 Dec 2014 09:51:25 -0800 (PST) X-Received: by 10.224.67.7 with SMTP id p7mr18554673qai.97.1417715484840; Thu, 04 Dec 2014 09:51:24 -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 u2si32087273qaf.41.2014.12.04.09.51.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Dec 2014 09:51:24 -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 1XwaYj-0001yB-Rr; Thu, 04 Dec 2014 17:51:21 +0000 Received: from mail-qg0-f50.google.com ([209.85.192.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwaYe-0001x9-D7 for lng-odp@lists.linaro.org; Thu, 04 Dec 2014 17:51:16 +0000 Received: by mail-qg0-f50.google.com with SMTP id i50so12756841qgf.23 for ; Thu, 04 Dec 2014 09:51:11 -0800 (PST) X-Received: by 10.224.88.3 with SMTP id y3mr18368340qal.75.1417715471196; Thu, 04 Dec 2014 09:51:11 -0800 (PST) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id j91sm27224022qgd.8.2014.12.04.09.51.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Dec 2014 09:51:10 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 4 Dec 2014 12:50:59 -0500 Message-Id: <1417715459-10571-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH] 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.217.172 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: Mike Holmes --- 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 37e2594..e3b86f6 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -4,3 +4,4 @@ odp_init odp_queue odp_crypto odp_shm +odp_system diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 8547085..f85166a 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,13 +6,14 @@ AM_LDFLAGS += -static if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_system odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) odp_shm_CFLAGS = $(AM_CFLAGS) odp_shm_LDFLAGS = $(AM_LDFLAGS) +odp_system_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -22,3 +23,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_rng.c \ odp_crypto.c common/odp_cunit_common.c dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c new file mode 100644 index 0000000..193b8f3 --- /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) +{ + uint64_t 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]; + + strcpy(model, odp_sys_cpu_model_str()); + CU_ASSERT(strlen(model) > 0) + CU_ASSERT(strlen(model) < 127) +} + +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) +} + +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, +};