From patchwork Mon Dec 15 16:52:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 42263 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C92EC26C69 for ; Mon, 15 Dec 2014 16:53:23 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf7525295lbv.5 for ; Mon, 15 Dec 2014 08:53:22 -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=YNHhLrJCWs6eSzrNynXgYke7VWYw/rfw2qNqsf7w/eA=; b=NNF/gyQ97WsSPGVBXFGCFWCYBHLz+UhHA3tBxn9PakvkQzCq3z4gVLTG0V6VLVwUyH 1UFbCP7GazczxVVFeD1rKhwrNtXrW7K1s0AHTGzXsORAjVUoL/sTQkjqPZNwAe0uFIiX eJSjGPfm4E0vMJoeTkMTXkpKX7Z8MvSG7aau7XGs+RD5dTQAAykGeWNgnYrJY1KZ9mAM EBPguYx6J4ChZlOginMl/DDU9GqD2gwi4rBq3vJeAknrHOT9Til5+naAgm6QljtripFe 7iwCx75X0Io4RcZULYWItUD2CpGBZeOZgOXc2EFEvUK4TAzfH9o3unTaIRn1p1h9jpbD 1u/A== X-Gm-Message-State: ALoCoQmLbTlbdV3D8DnqCtzKToUWpOenHRYKyGY4ou8JX+oLQCusleO72rkMNnE6xemA9bQMtmTA X-Received: by 10.180.89.211 with SMTP id bq19mr2992130wib.4.1418662402712; Mon, 15 Dec 2014 08:53:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.100 with SMTP id p4ls403996laj.24.gmail; Mon, 15 Dec 2014 08:53:22 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr31383736lal.29.1418662402445; Mon, 15 Dec 2014 08:53:22 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id l7si10963728lbd.107.2014.12.15.08.53.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 08:53:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id z12so9390001lbi.32 for ; Mon, 15 Dec 2014 08:53:22 -0800 (PST) X-Received: by 10.112.159.129 with SMTP id xc1mr31306351lbb.24.1418662402253; Mon, 15 Dec 2014 08:53:22 -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 ru5csp776752lbb; Mon, 15 Dec 2014 08:53:21 -0800 (PST) X-Received: by 10.140.84.70 with SMTP id k64mr27543501qgd.76.1418662400547; Mon, 15 Dec 2014 08:53:20 -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 t9si11254329qcn.5.2014.12.15.08.53.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 08:53:20 -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 1Y0YtZ-0007In-9m; Mon, 15 Dec 2014 16:53:17 +0000 Received: from mail-qg0-f48.google.com ([209.85.192.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y0YtN-0007GZ-QV for lng-odp@lists.linaro.org; Mon, 15 Dec 2014 16:53:05 +0000 Received: by mail-qg0-f48.google.com with SMTP id f51so8844091qge.35 for ; Mon, 15 Dec 2014 08:53:00 -0800 (PST) X-Received: by 10.140.98.162 with SMTP id o31mr49526969qge.49.1418662380598; Mon, 15 Dec 2014 08:53:00 -0800 (PST) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id b7sm11020526qae.4.2014.12.15.08.52.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Dec 2014 08:53:00 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 15 Dec 2014 11:52:50 -0500 Message-Id: <1418662370-23461-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.173 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 check from Jerin. test/validation/.gitignore | 1 + test/validation/Makefile.am | 4 ++- test/validation/odp_system.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 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..605145b --- /dev/null +++ b/test/validation/odp_system.c @@ -0,0 +1,74 @@ +/* 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); + CU_ASSERT(ODP_CACHE_LINE_SIZE == 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, +};