From patchwork Wed Feb 3 13:42:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 61088 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp299016lbl; Wed, 3 Feb 2016 05:42:37 -0800 (PST) X-Received: by 10.140.109.247 with SMTP id l110mr1587076qgf.52.1454506957574; Wed, 03 Feb 2016 05:42:37 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l62si5525249qhc.126.2016.02.03.05.42.37; Wed, 03 Feb 2016 05:42:37 -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 0D52A6173D; Wed, 3 Feb 2016 13:42:37 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=FLGkJ2Xa; 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 0A055610E1; Wed, 3 Feb 2016 13:42:33 +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 CD7D5611F4; Wed, 3 Feb 2016 13:42:30 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 0BA0E610B9 for ; Wed, 3 Feb 2016 13:42:25 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id l143so13975879lfe.2 for ; Wed, 03 Feb 2016 05:42:24 -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=NSmMgF7x0gXJgNfYgFuEofBdACIKwyzTyOATjiP2GDY=; b=FLGkJ2XaWOe0OvaOB+IBAM3yzuVkiboovxdD8hrx/Mi0SXtuP8U5D7f9R3ZwOxCcBo 2ZzbaLa5NJu0WkLrqOkK2JE0q9BmNLIdHG7JePg/lKHjE738jmBPxe9cQDCE1NDqYinl rMLpstEipHsNDQ45+oVYqps+6stm8CdjacGTA= 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=NSmMgF7x0gXJgNfYgFuEofBdACIKwyzTyOATjiP2GDY=; b=IkRoLKsmlWNJTPiofMq6wcf7najnque7s667PHQnDTgkBpql7eM9s6meEfKw5Ank66 UbIHz8OiMs84sagdS/RkkBBgN8+n2R3C2MbNmgADT+HJ8fUqpdqaZwz0ikn7Ly0Pm9It OCbb/Y6VSSDyq2APn5wYbQ3u8cd3H1oDmRFp1sCo+m/FPYn4YnQGjou85ZEYT64lfaMp qwB17QEGDQJeDVITt+G2K/ttdM/mn2/m18TpDI2LaknM3Ow1nmIlY+c3pbIgsi0B87ki SRitgWJjurWFw0m0iIpw2hDIO43G8cPjI/bNkW2ny7Ym6H+xvp34SFjREao+B0NGdH6G 8Liw== X-Gm-Message-State: AG10YOQ+12qLZZwKSyIn7Ofh1XQRnG9BYJHCTaNPJxLPj9ih2zNYTFlI9E3B56Ay6Jlvl1MWT/M= X-Received: by 10.25.21.29 with SMTP id l29mr689476lfi.123.1454506944031; Wed, 03 Feb 2016 05:42:24 -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 bf5sm877114lbc.49.2016.02.03.05.42.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Feb 2016 05:42:23 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 3 Feb 2016 16:42:16 +0300 Message-Id: <1454506936-2819-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] 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 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..0216624 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 * GHz); + + /* larger than 1kHz */ + CU_ASSERT(hz > 1 * kHz); } 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..4f8c67f 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -9,6 +9,9 @@ #include +#define GHz 1000000000 +#define kHz 1000 + /* 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);