From patchwork Fri Aug 14 15:58:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 52452 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 40AC92031F for ; Fri, 14 Aug 2015 15:59:24 +0000 (UTC) Received: by labia3 with SMTP id ia3sf29348378lab.1 for ; Fri, 14 Aug 2015 08:59:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=B3UFRVMUS0h5cpwYcD0cRWGC5XKBFLP7ea8X//OJxqU=; b=W+97Tfaus/G59hg3HGUDefLZWXjz05nSq3G4UiHTUWUoo+TqRWggcqrlwQ6A07Nb2f zO8I1MO2lFzFG9n8qoj8cieHe5h8blu/ons5c/H13aDO+SUi7BQDoqpNuR+BSbjCFhUi zndeYVKEO+U8L5C6xsuJ4qDNB4sp61N53LxoNJUjdRXGNElh2EI4IPvjDtPnDXyLEFvj U+gk4eH1q0urz3hstToHNtf/DPjddFV439R+E80EUlaCGNUkah2dgxlty6XCMaB0LbEb VIeCEyZn7u3m/X5+SleDu/EFZKMKmiRqilDRdDeN/hBXt8JvWSx1kr0nCmApVJ+PL4Mu DEWg== X-Gm-Message-State: ALoCoQlCJS1r8QFyc7DHTxlRVQAjO6o6by0NDM21sm4f5r5V0U0WjrEeX/ELAJXssg3igGs95Oey X-Received: by 10.180.75.49 with SMTP id z17mr1160662wiv.7.1439567963113; Fri, 14 Aug 2015 08:59:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.146 with SMTP id j18ls385666laa.44.gmail; Fri, 14 Aug 2015 08:59:22 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr44440175lav.36.1439567962941; Fri, 14 Aug 2015 08:59:22 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id ob10si3546438lbb.45.2015.08.14.08.59.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2015 08:59:22 -0700 (PDT) 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 lbbsx3 with SMTP id sx3so48070152lbb.0 for ; Fri, 14 Aug 2015 08:59:22 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr45356816lbb.56.1439567962827; Fri, 14 Aug 2015 08:59:22 -0700 (PDT) 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.7.198 with SMTP id l6csp1719665lba; Fri, 14 Aug 2015 08:59:21 -0700 (PDT) X-Received: by 10.140.89.197 with SMTP id v63mr78992765qgd.97.1439567960916; Fri, 14 Aug 2015 08:59:20 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l5si10112153qhl.59.2015.08.14.08.59.17; Fri, 14 Aug 2015 08:59:20 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id 4D62262188; Fri, 14 Aug 2015 15:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 748A562158; Fri, 14 Aug 2015 15:59:13 +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 CB47F6215D; Fri, 14 Aug 2015 15:59:07 +0000 (UTC) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by lists.linaro.org (Postfix) with ESMTPS id 8640E62154 for ; Fri, 14 Aug 2015 15:59:05 +0000 (UTC) Received: by wibhh20 with SMTP id hh20so25617330wib.0 for ; Fri, 14 Aug 2015 08:59:04 -0700 (PDT) X-Received: by 10.194.122.168 with SMTP id lt8mr1077922wjb.35.1439567944787; Fri, 14 Aug 2015 08:59:04 -0700 (PDT) Received: from khorivan.synapse.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id w8sm3710864wiy.10.2015.08.14.08.59.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Aug 2015 08:59:03 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 14 Aug 2015 18:58:56 +0300 Message-Id: <1439567936-8168-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [Patch] validation: time: use timer resolution instead of TOLERANCE X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@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.mailfrom=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 The TOLERANCE hardcodes a timer resolution, so replace it on real timer resolution that can be got by odp_time_tick_to_ns(1). Signed-off-by: Ivan Khoronzhuk --- Based on "api: time: change API to use ticks instead of cycles" https://lists.linaro.org/pipermail/lng-odp/2015-August/014198.html test/validation/time/time.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 89aef00..fa7e372 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -8,7 +8,6 @@ #include "odp_cunit_common.h" #include "time.h" -#define TOLERANCE 1 #define BUSY_LOOP_CNT 100 /* check that a counts difference gives a reasonable result */ @@ -45,9 +44,12 @@ static void time_test_odp_counts_negative_diff(void) /* check that related conversions come back to the same value */ static void time_test_odp_time_conversion(void) { - uint64_t ns1, ns2, tick; + uint64_t ns1, ns2, res, tick; uint64_t upper_limit, lower_limit; + /* get timer resolution */ + res = odp_time_tick_to_ns(1) + 1; + ns1 = 100; tick = odp_time_ns_to_tick(ns1); CU_ASSERT(tick > 0); @@ -56,8 +58,8 @@ static void time_test_odp_time_conversion(void) /* need to check within arithmetic tolerance that the same * value in ns is returned after conversions */ - upper_limit = ns1 + TOLERANCE; - lower_limit = ns1 - TOLERANCE; + upper_limit = ns1 + res; + lower_limit = ns1 - res; CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit)); }