From patchwork Wed Nov 26 15:23:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 41540 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30658203C2 for ; Wed, 26 Nov 2014 15:24:06 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf2083499wib.10 for ; Wed, 26 Nov 2014 07:24:05 -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=d9iSh4esgfIcGcupeXJlTEkOkKb4txIXYrZXeAM9hh0=; b=dQ+n2IxeB6ZcCNIxoUtjHbhW4xk5Stwa8f1FAHZAwetI5bD9Un8BaDTgpTSYUDBpit SGGmhk3wFUbpWhAo8DGutmhRvK35gEcggNghuhcCWBDf6UA9/PoN6TNX3j7izqa3yxok CiyjwcmUIj3FLGYuApu4ktEGHbkcvXtrYtXUpB1mfpXV7X1fw5JG0sxgq64iw//P/WHi pvEq1Tia1bvOt+wxy6lttf6FWjnP8NHKqfvzmuLgLgduekdpAYftxLDDoZfS5XUoLIyF YSn/ovjBfyzKF9KFpjzDvDzhwUEerwgHNi0XrHW24lF3QEtNI1+4xz8xPcFvFXpX84Rk ybiw== X-Gm-Message-State: ALoCoQmp+nGYbHypROSxeMlmvHBHNU5kzIQ6fMaSdUSVlyQrfUZZZzONAZRVAdTPdjZS7myh1LGo X-Received: by 10.112.201.169 with SMTP id kb9mr161732lbc.20.1417015445220; Wed, 26 Nov 2014 07:24:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.104 with SMTP id kx8ls483763lac.82.gmail; Wed, 26 Nov 2014 07:24:04 -0800 (PST) X-Received: by 10.153.6.33 with SMTP id cr1mr34966518lad.63.1417015444672; Wed, 26 Nov 2014 07:24:04 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id u18si4681885lal.73.2014.11.26.07.24.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 07:24:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so2678611lab.34 for ; Wed, 26 Nov 2014 07:24:04 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr34462547lbc.34.1417015444535; Wed, 26 Nov 2014 07:24:04 -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 ew9csp639572lbc; Wed, 26 Nov 2014 07:24:03 -0800 (PST) X-Received: by 10.140.101.68 with SMTP id t62mr45675315qge.92.1417015443019; Wed, 26 Nov 2014 07:24:03 -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 z74si5394196qgz.19.2014.11.26.07.24.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Nov 2014 07:24:02 -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 1XteRj-0005ni-6k; Wed, 26 Nov 2014 15:23:59 +0000 Received: from mail-qg0-f41.google.com ([209.85.192.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XteRd-0005nd-Cg for lng-odp@lists.linaro.org; Wed, 26 Nov 2014 15:23:53 +0000 Received: by mail-qg0-f41.google.com with SMTP id j5so2195874qga.14 for ; Wed, 26 Nov 2014 07:23:48 -0800 (PST) X-Received: by 10.224.39.10 with SMTP id d10mr45449402qae.29.1417015428094; Wed, 26 Nov 2014 07:23:48 -0800 (PST) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id s3sm4146563qat.4.2014.11.26.07.23.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 07:23:47 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Wed, 26 Nov 2014 10:23:39 -0500 Message-Id: <1417015419-20842-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.215.47 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 | 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 2917c66..ba204a0 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -3,4 +3,5 @@ odp_init odp_queue odp_crypto +odp_system CUnit-Memory-Dump.xml diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..c991900 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ 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 +bin_PROGRAMS = odp_init odp_queue odp_crypto 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_system_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.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..abcc746 --- /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[64]; + + 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; +}