From patchwork Mon Dec 1 22:00:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 41803 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 4345A25E60 for ; Mon, 1 Dec 2014 22:01:09 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf7348888eek.0 for ; Mon, 01 Dec 2014 14:01:08 -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=tlNSdMrzV8RJU3+Q4oY9d6pw0rTdLh4jIY0YDLR6TC8=; b=c1v7+GEErnJUwvAmnMEj3LG1LLlKgZeaSrkJn8ZEOVaR8qN2eEHZZA7U7UDPE6UG5q ylKpeCGiLDCGjqF30R8edbStoVKsWwuXO0u4hAlzR4VIGkG2vl+AvJtmp31SQ6EADII2 2M+F3HUJiYYXgYnQSn7mpOBwa9G7fd1yr2ELtP0VQDQmR3uW09np2BJknOjjgekHIJ3v Ib68OXBSSKNjGDY7rPhiQhhvuwtY/hxCMnaZSsyhOvD7jPfFlZcMkTdrOnaxmWUBDUhZ z3Q/zByOWMPpWjG/eSFDAEqr0LVAoHdt75yVTZUf2l4ljjln0dkgcbZCkW+jQbIuUlSt rbMA== X-Gm-Message-State: ALoCoQnAzpvOr8F37Bs0v0G4qRRQ5DkeXEHqvCmm4Ule954Ztepbh4QRPh6GHbcVWfGOPKEpq+G8 X-Received: by 10.180.98.165 with SMTP id ej5mr15822494wib.1.1417471268003; Mon, 01 Dec 2014 14:01:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.37 with SMTP id ll5ls582873lac.53.gmail; Mon, 01 Dec 2014 14:01:07 -0800 (PST) X-Received: by 10.112.171.199 with SMTP id aw7mr41323362lbc.40.1417471267845; Mon, 01 Dec 2014 14:01:07 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id r6si7345203lae.60.2014.12.01.14.01.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 14:01:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so8846049lab.37 for ; Mon, 01 Dec 2014 14:01:07 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr6116529lal.67.1417471267764; Mon, 01 Dec 2014 14:01:07 -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 ew9csp386189lbc; Mon, 1 Dec 2014 14:01:06 -0800 (PST) X-Received: by 10.224.137.130 with SMTP id w2mr58546699qat.60.1417471265616; Mon, 01 Dec 2014 14:01:05 -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 r6si2235265qay.111.2014.12.01.14.01.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 14:01:05 -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 1XvZ1j-0005sH-78; Mon, 01 Dec 2014 22:01:03 +0000 Received: from mail-qg0-f42.google.com ([209.85.192.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvZ1d-0005ri-3Q for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 22:00:57 +0000 Received: by mail-qg0-f42.google.com with SMTP id z107so8497648qgd.29 for ; Mon, 01 Dec 2014 14:00:51 -0800 (PST) X-Received: by 10.224.152.18 with SMTP id e18mr90185963qaw.65.1417471251836; Mon, 01 Dec 2014 14:00:51 -0800 (PST) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id 34sm18509800qgt.19.2014.12.01.14.00.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 14:00:51 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 17:00:43 -0500 Message-Id: <1417471243-17795-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: Architecture patch Subject: [lng-odp] [PATCH v2 ARCH] 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.50 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 Reviewed-by: Yan Songming --- test/validation/.gitignore | 1 + test/validation/Makefile.am | 4 +- test/validation/odp_system.c | 114 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 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 4bee2ab..1e02f27 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,13 +6,14 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit 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) -I$(srcdir)/common odp_shm_LDFLAGS = $(AM_LDFLAGS) +odp_system_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -21,3 +22,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c +dist_odp_system_SOURCES = odp_system.c diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c new file mode 100644 index 0000000..938981b --- /dev/null +++ b/test/validation/odp_system.c @@ -0,0 +1,114 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "odp.h" +#include "CUnit/Basic.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) +} + +static int init_suite(void) +{ + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); + + if (odp_init_global(NULL, NULL)) { + printf("ODP global init failed.\n"); + return -1; + } + odp_init_local(); + + return 0; +} + +static int finalise(void) +{ + odp_term_local(); + odp_term_global(); + + return 0; +} + +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 suites[] = { + {"odp_system", init_suite, finalise, NULL, NULL, + test_odp_system}, + CU_SUITE_INFO_NULL, +}; + + +int main(void) +{ + int ret; + + CU_set_error_action(CUEA_ABORT); + + CU_initialize_registry(); + CU_register_suites(suites); + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + + ret = CU_get_number_of_failure_records(); + + CU_cleanup_registry(); + + return ret; +}