From patchwork Wed Feb 3 14:09:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 61098 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp317914lbl; Wed, 3 Feb 2016 06:14:16 -0800 (PST) X-Received: by 10.55.78.207 with SMTP id c198mr1818614qkb.34.1454508856388; Wed, 03 Feb 2016 06:14:16 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u91si5664341qgu.58.2016.02.03.06.14.16; Wed, 03 Feb 2016 06:14:16 -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 E2FA26168F; Wed, 3 Feb 2016 14:14:15 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=OG+KEOiX; 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 11B7F61782; Wed, 3 Feb 2016 14:11:38 +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 C120261789; Wed, 3 Feb 2016 14:11:34 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id 305B161761 for ; Wed, 3 Feb 2016 14:10:11 +0000 (UTC) Received: by mail-lf0-f52.google.com with SMTP id l143so14550739lfe.2 for ; Wed, 03 Feb 2016 06:10:11 -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=GibmtCuxMRg0uE71AfXlqryMAY5I1/tavwe5BpDvNm0=; b=OG+KEOiX1PyXdwLrhloSCWyF/hZleZPXgMaBqPS6yAL8z0yVZtRVXWPCr8clUUvwvR K/+6XzsjVlvw+3T2N7D4wIDdH5dxWr7SCwBst4VsfJoFAMR4ZKCxRJ/Twrj3mKfHZ9EN LDGgRxozlv3ZzNgYH3jQGvFL0hn/4WGn11C9U= 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=GibmtCuxMRg0uE71AfXlqryMAY5I1/tavwe5BpDvNm0=; b=KpoC+fp0Hy8e+utJlKFuCqXX4h9XBkqTV/UrMy2Cle1wYy+fVBlBW2f5cQyxFKl/uZ lWHDl43CRQ3dTPOyDJFTFQ+SXNm6OV/g4Nr89ik/4hslDzfguvZQGTQN3p1Qs67w/yPn 2mFtEQWB+3bitxy4bkcGZxWy5GB2xkrtw61Clkwdx64P7kEree1t/nKee94ml8gONRc4 cLnwfje0MjVHL03h4Z1AwOrC86EcGO1BlLeR7PdSQIEny1ooOXwDn3dpUvJKSlt/Qcof cg/lPk/A/kYURvumF9BSlR95X3WPLMuVaKruKgiK5Q5mxK+9He2cHviz46gyuoRfv1cF cDyw== X-Gm-Message-State: AG10YORxNwnay9glyLVxnvAoNOH45/0eA6Zc3ofCkH06XeViqeP20MAKWdTTd+xFeEGnAQThhok= X-Received: by 10.25.148.141 with SMTP id w135mr749712lfd.137.1454508609940; Wed, 03 Feb 2016 06:10:09 -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 m3sm941274lfb.8.2016.02.03.06.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Feb 2016 06:10:09 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 3 Feb 2016 17:09:57 +0300 Message-Id: <1454508597-6666-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2] 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..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);