From patchwork Fri Dec 19 18:23:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 42495 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 69C2D26C68 for ; Fri, 19 Dec 2014 18:23:59 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf1072178lab.3 for ; Fri, 19 Dec 2014 10:23:58 -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=NaELARNGroc+6Pm3SjHsAJgeu4yoHR4hbbaFGgCw8YI=; b=gHm0n3/8xUosu6u9Lk6E6Ib701Tb2NBMIgODP1I5Kn4D6o5Jh29H90FYm0CX51XWiV 3ztrPef2NhEM77XgB3r9rW4R50XOKUxP/ghc4V5dRCbLcYOh52oUBkehsi1Wltu2GYwU JSSdr0v0ketTGPrzjNuVRxYghZwjdQI7vXJ05+zhniRnMiYfm85lIw9apJclyInk8zgR hwPjPvexv3gEv1Pwb8/Yqf6ffq+z00bH0QU80yJP5guZCzf5HBzLkHV8cv0ocD94WwyN 48Xjd9/5BRJFk+15Yp7ATjP4clCQj+BQdUG4c7gPGe+twSS8LkmEE70UJ1G6cvnMgE2a 8kHA== X-Gm-Message-State: ALoCoQlyPmPpVGRGm6DNgnsEE8BSrsfqsxqMAmHrWs+U8DgdPL9pdixTVuvyxzodVSREZmAkTh8u X-Received: by 10.112.154.232 with SMTP id vr8mr519141lbb.10.1419013438193; Fri, 19 Dec 2014 10:23:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.136 with SMTP id kq8ls1305461lac.84.gmail; Fri, 19 Dec 2014 10:23:57 -0800 (PST) X-Received: by 10.112.222.135 with SMTP id qm7mr9088502lbc.19.1419013437932; Fri, 19 Dec 2014 10:23:57 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ks1si10761700lac.22.2014.12.19.10.23.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 10:23:57 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so1386271lbj.37 for ; Fri, 19 Dec 2014 10:23:57 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr9320611lag.50.1419013437764; Fri, 19 Dec 2014 10:23:57 -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 ru5csp358433lbb; Fri, 19 Dec 2014 10:23:56 -0800 (PST) X-Received: by 10.140.34.204 with SMTP id l70mr15426362qgl.55.1419013435578; Fri, 19 Dec 2014 10:23:55 -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 t35si12574754qge.54.2014.12.19.10.23.51 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Dec 2014 10:23:55 -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 1Y22DM-0001KX-PO; Fri, 19 Dec 2014 18:23:48 +0000 Received: from mail-qa0-f54.google.com ([209.85.216.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y22DH-0001KM-7E for lng-odp@lists.linaro.org; Fri, 19 Dec 2014 18:23:43 +0000 Received: by mail-qa0-f54.google.com with SMTP id k15so951917qaq.41 for ; Fri, 19 Dec 2014 10:23:38 -0800 (PST) X-Received: by 10.224.37.131 with SMTP id x3mr13831519qad.104.1419013417951; Fri, 19 Dec 2014 10:23:37 -0800 (PST) Received: from localhost.localdomain ([98.221.136.245]) by mx.google.com with ESMTPSA id h6sm10061761qgh.32.2014.12.19.10.23.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Dec 2014 10:23:36 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Fri, 19 Dec 2014 13:23:31 -0500 Message-Id: <1419013411-27081-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH v3] 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.178 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 --- Add additional assert to page size test/validation/.gitignore | 1 + test/validation/Makefile.am | 9 +++++- test/validation/odp_system.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 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 a12fdfa..247175f 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,8 +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 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 +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 @@ -18,3 +24,4 @@ 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 diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c new file mode 100644 index 0000000..2afd4a7 --- /dev/null +++ b/test/validation/odp_system.c @@ -0,0 +1,76 @@ +/* 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); + CU_ASSERT(ODP_CACHE_LINE_SIZE == 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); + CU_ASSERT(ODP_PAGE_SIZE == 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, +}; +