From patchwork Wed Feb 3 14:46:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 61100 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp336886lbl; Wed, 3 Feb 2016 06:46:57 -0800 (PST) X-Received: by 10.107.128.75 with SMTP id b72mr3467612iod.87.1454510817483; Wed, 03 Feb 2016 06:46:57 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id ru5si31209416igb.7.2016.02.03.06.46.57; Wed, 03 Feb 2016 06:46:57 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C3D3461778; Wed, 3 Feb 2016 14:46:56 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=GDkAkei4; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2A03C6176F; Wed, 3 Feb 2016 14:46:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2371C6170E; Wed, 3 Feb 2016 14:46:24 +0000 (UTC) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by lists.linaro.org (Postfix) with ESMTPS id D12B16168F for ; Wed, 3 Feb 2016 14:46:19 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id j78so15347226lfb.1 for ; Wed, 03 Feb 2016 06:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=cOyo9qsAoFMI/yFKKzAp2cXz8aszWRDAVZbNuWonZqg=; b=GDkAkei4kVoJ0Sm6Wdxo1Zzu1K3chs/yOXSc3IcxfGtmPMvm2kxR54Vz9RfEQf2TCt l4sUMnT8df3bed25HP9GYKVZgXQ1JuBQmMOP3/htN2SO7BDflmLucCXKVtuY8Qgs4Oyi qbWgv2aCWY8kGOS5cwOsSiQPkByCqsDvk1wJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cOyo9qsAoFMI/yFKKzAp2cXz8aszWRDAVZbNuWonZqg=; b=TnBqMqKF7xg7rHRoqjg2qDrJh6dfsTdw8mFpMejq4d6giI4FYqx2TBCQAfeOuafR+E Pfy+47NfFLJO1tJkPCCq9627or3EAhomFHICXav2GicXX7G0gVneiR2nYffCnBJyI9s1 OrD8TJOTaxjZlBI/n+VuD3tx24QctTvSlxl8CyWb6k3n9gLNuQhoxi9ulVe8p/3FZyUW mAPcJbeSodBrrTikDyuih/KfPS1fK+LDH9C+e53KzUMiTVkJkUl3LeyaX7AdoMS5t3FV Z2p3H0lbmnIxtWtf9ZiEUINfICzZKsdo572ynzIE7/JmQGIYGM+q/QgcQB2yuhlvh1Cm Lqvg== X-Gm-Message-State: AG10YOTG6R8/hcNPhsjzSeEkJxBXpdmwydFAON59l/vjO3A8p7ya7+rT3Lp8XUCaBl33htoZ3tE= X-Received: by 10.25.166.65 with SMTP id p62mr1049948lfe.51.1454510778760; Wed, 03 Feb 2016 06:46:18 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id l129sm944329lfl.37.2016.02.03.06.46.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Feb 2016 06:46:18 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 3 Feb 2016 17:46:09 +0300 Message-Id: <1454510770-11548-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 1/2] validation: system: make odp_cpu_hz optional in validation test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Do not fail if odp_cpu_hz() returns 0, just skip the test. Suggested-by: Petri Savolainen Reviewed-by: Petri Savolainen Signed-off-by: Maxim Uvarov --- test/validation/system/system.c | 22 ++++++++++++++++++---- test/validation/system/system.h | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/test/validation/system/system.c b/test/validation/system/system.c index c72590b..942905a 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -214,12 +214,25 @@ void system_test_odp_sys_huge_page_size(void) CU_ASSERT(0 < page); } +int system_check_odp_cpu_hz(void) +{ + if (odp_cpu_hz() == 0) { + fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); + return -1; + } + + return 0; +} + void system_test_odp_cpu_hz(void) { - uint64_t hz; + uint64_t hz = odp_cpu_hz(); - hz = odp_cpu_hz(); - CU_ASSERT(0 < hz); + /* Test value sanity: less than 10GHz */ + CU_ASSERT(hz < 10 * GIGA_HZ); + + /* larger than 1kHz */ + CU_ASSERT(hz > 1 * KILO_HZ); } void system_test_odp_cpu_hz_id(void) @@ -270,7 +283,8 @@ odp_testinfo_t system_suite[] = { ODP_TEST_INFO(system_test_odp_cpu_model_str_id), ODP_TEST_INFO(system_test_odp_sys_page_size), ODP_TEST_INFO(system_test_odp_sys_huge_page_size), - ODP_TEST_INFO(system_test_odp_cpu_hz), + ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz, + system_check_odp_cpu_hz), ODP_TEST_INFO(system_test_odp_cpu_hz_id), ODP_TEST_INFO(system_test_odp_cpu_hz_max), ODP_TEST_INFO(system_test_odp_cpu_hz_max_id), diff --git a/test/validation/system/system.h b/test/validation/system/system.h index c5f3058..a258933 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -9,6 +9,9 @@ #include +#define GIGA_HZ 1000000000ULL +#define KILO_HZ 1000ULL + /* test functions: */ void system_test_odp_version_numbers(void); void system_test_odp_cpu_count(void); @@ -17,6 +20,7 @@ void system_test_odp_cpu_model_str(void); void system_test_odp_cpu_model_str_id(void); void system_test_odp_sys_page_size(void); void system_test_odp_sys_huge_page_size(void); +int system_check_odp_cpu_hz(void); void system_test_odp_cpu_hz(void); void system_test_odp_cpu_hz_id(void); void system_test_odp_cpu_hz_max(void);