From patchwork Thu May 12 11:22:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 67639 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp698067qge; Thu, 12 May 2016 04:23:19 -0700 (PDT) X-Received: by 10.55.20.97 with SMTP id e94mr4019936qkh.150.1463052199376; Thu, 12 May 2016 04:23:19 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 60si8264429qgf.15.2016.05.12.04.23.19; Thu, 12 May 2016 04:23:19 -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; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 09A5661646; Thu, 12 May 2016 11:23:19 +0000 (UTC) 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.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 [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id ADA9A61563; Thu, 12 May 2016 11:23:14 +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 2BFBD610AC; Thu, 12 May 2016 11:23:12 +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 EAADD610AC for ; Thu, 12 May 2016 11:23:10 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id j8so69668297lfd.2 for ; Thu, 12 May 2016 04:23:10 -0700 (PDT) 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=SHTwCZ6mVHBAUoM/+48yR94WGn0hfL7HNA3gJ/SbhJM=; b=XUDwUkkQFtBN79lNHjyF7wU0FO5sND+1XFYrmeC0AezngauVAKcnVq5/ZKipYjuRRL n36Vb4BOsyVRmF9w+7WI8gKIkdDYUEYdguTUGRHdc5iQi0Llowidal2kUUH8bbjrSLjw LuVGZN7wL7CcKziUZtIX9D09QispoIN95Gg5xXJxMKQRJt9GnYYFTR2FRObTvyuIHPXl 1QRgwXys0GoMDjW7n07NI4Y0OINsoDrI1lG904pSdFnsLGbw/S1du6uoD1XApRipunds GnI4Za8BkFvMKkdD1JGFQcFcMX64+jMv+eUAty7cMHqwPAMRiVHBom7rsau2rTEo1AWm yBHA== X-Gm-Message-State: AOPr4FXQ1r9zK494Z7rjJVbJVEHVkOitUCspQDEwuhOTPVPnN+Jz8fbBspAFr00C6Vz9qILf2JM= X-Received: by 10.25.35.145 with SMTP id j139mr3583418lfj.55.1463052189783; Thu, 12 May 2016 04:23:09 -0700 (PDT) Received: from localhost.localdomain (ppp91-77-173-31.pppoe.mtu-net.ru. [91.77.173.31]) by smtp.gmail.com with ESMTPSA id 81sm2021505lfr.38.2016.05.12.04.23.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 May 2016 04:23:09 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 12 May 2016 14:22:56 +0300 Message-Id: <1463052176-16065-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: patch Subject: [lng-odp] [PATCH] validation: time: remove print and add verbose faults 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" Having system call inside loop couse unpredictable delay as the result wrong time diff calculation. Just removing print make hole test execution shorter on 0.1 seconds according to cunit stats. Also make verbose errors in places where we out of limit in cunit. This should be very helpful to understand DELAY_TOLERANCE value suitable for all platforms. Signed-off-by: Maxim Uvarov Reviewed-by: Bill Fischofer --- test/validation/time/time.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/test/validation/time/time.c b/test/validation/time/time.c index da456ea..f7f3d14 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -331,7 +331,6 @@ static void time_test_wait_until(time_cb time, time_from_ns_cb time_from_ns) for (i = 0; i < WAIT_SECONDS; i++) { wait = odp_time_sum(wait, second); odp_time_wait_until(wait); - printf("%d..", i + 1); } end_time = time(); @@ -341,8 +340,19 @@ static void time_test_wait_until(time_cb time, time_from_ns_cb time_from_ns) upper_limit = time_from_ns(WAIT_SECONDS * ODP_TIME_SEC_IN_NS + DELAY_TOLERANCE); - CU_ASSERT(odp_time_cmp(wait, lower_limit) >= 0); - CU_ASSERT(odp_time_cmp(wait, upper_limit) <= 0); + if (odp_time_cmp(wait, lower_limit) < 0) { + fprintf(stderr, "Exceed lower limit: " + "wait is %" PRIu64 ", lower_limit %" PRIu64 "\n", + odp_time_to_ns(wait), odp_time_to_ns(lower_limit)); + CU_FAIL("Exceed lower limit\n"); + } + + if (odp_time_cmp(wait, upper_limit) > 0) { + fprintf(stderr, "Exceed upper limit: " + "wait is %" PRIu64 ", upper_limit %" PRIu64 "\n", + odp_time_to_ns(wait), odp_time_to_ns(lower_limit)); + CU_FAIL("Exceed upper limit\n"); + } } void time_test_local_wait_until(void) @@ -362,10 +372,8 @@ void time_test_wait_ns(void) odp_time_t start_time, end_time, diff; start_time = odp_time_local(); - for (i = 0; i < WAIT_SECONDS; i++) { + for (i = 0; i < WAIT_SECONDS; i++) odp_time_wait_ns(ODP_TIME_SEC_IN_NS); - printf("%d..", i + 1); - } end_time = odp_time_local(); diff = odp_time_diff(end_time, start_time); @@ -375,8 +383,19 @@ void time_test_wait_ns(void) upper_limit = odp_time_local_from_ns(WAIT_SECONDS * ODP_TIME_SEC_IN_NS + DELAY_TOLERANCE); - CU_ASSERT(odp_time_cmp(diff, lower_limit) >= 0); - CU_ASSERT(odp_time_cmp(diff, upper_limit) <= 0); + if (odp_time_cmp(diff, lower_limit) < 0) { + fprintf(stderr, "Exceed lower limit: " + "diff is %" PRIu64 ", lower_limit %" PRIu64 "\n", + odp_time_to_ns(diff), odp_time_to_ns(lower_limit)); + CU_FAIL("Exceed lower limit\n"); + } + + if (odp_time_cmp(diff, upper_limit) > 0) { + fprintf(stderr, "Exceed upper limit: " + "diff is %" PRIu64 ", upper_limit %" PRIu64 "\n", + odp_time_to_ns(diff), odp_time_to_ns(lower_limit)); + CU_FAIL("Exceed upper limit\n"); + } } static void time_test_to_u64(time_cb time)