From patchwork Thu Feb 5 08:15:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 44407 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BEE7C21173 for ; Thu, 5 Feb 2015 08:16:42 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf1596501wes.2 for ; Thu, 05 Feb 2015 00:16:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references: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=Q/6ZQ/Wy0a8j8ftV9g2EmiGzF3V+3xLCvJAGA1xIcQU=; b=CYcXq1cZ2eaOLmRjkF+THw+BqmbhzbmuPLF3uzc756u0imifspxsa2qL92SoUMWn2v HJB11m97nBu/ZdxeiDCGrsf8wF+XP2eKHLBj8jHxzozeSes3Ww4mSdA1w6d1JYbAKCXC xGaQTL904JCg+Tfq4IB1sW2qnIxWTK1pa+H9WLw8C5joe3Jf3lbbHQb9hQJXwG+ohl3F tByJVyYZNntCtZoS6xyTAYDoxEW5WiAe7jQ6X5+TDLwJHNsYk3CGjbXJkL6OY4dKPcb3 drKA/y22yizqINqtFHLY9Fdp0jaVOC/rMBzpI4AgsReZEQG0bFGQ7lKLQEzC436HMVpG f1Sg== X-Gm-Message-State: ALoCoQkJrW9WHZE7EUg5MPMXRnoAzRE6nswmn6hd5bkisMdUjdgB0HUjdigGMdgkraRxxu3vqPhm X-Received: by 10.180.84.7 with SMTP id u7mr879943wiy.0.1423124201996; Thu, 05 Feb 2015 00:16:41 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.137 with SMTP id y9ls140069laj.59.gmail; Thu, 05 Feb 2015 00:16:41 -0800 (PST) X-Received: by 10.112.27.173 with SMTP id u13mr2106814lbg.7.1423124201595; Thu, 05 Feb 2015 00:16:41 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id rq8si3327777lbb.78.2015.02.05.00.16.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 00:16:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id pv20so5885776lab.7 for ; Thu, 05 Feb 2015 00:16:41 -0800 (PST) X-Received: by 10.112.181.41 with SMTP id dt9mr2085993lbc.56.1423124201501; Thu, 05 Feb 2015 00:16:41 -0800 (PST) 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.35.133 with SMTP id h5csp991906lbj; Thu, 5 Feb 2015 00:16:40 -0800 (PST) X-Received: by 10.140.98.38 with SMTP id n35mr5524027qge.62.1423124200017; Thu, 05 Feb 2015 00:16:40 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id c17si5386928qgd.17.2015.02.05.00.16.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 00:16:40 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YJHc4-0003bt-CQ; Thu, 05 Feb 2015 08:16:36 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YJHbk-0003aE-Ru for lng-odp@lists.linaro.org; Thu, 05 Feb 2015 08:16:16 +0000 Received: by mail-lb0-f175.google.com with SMTP id n10so1440182lbv.6 for ; Thu, 05 Feb 2015 00:16:10 -0800 (PST) X-Received: by 10.152.27.69 with SMTP id r5mr2114851lag.18.1423124170645; Thu, 05 Feb 2015 00:16:10 -0800 (PST) Received: from macmini.lan (78-82-118-111.tn.glocalnet.net. [78.82.118.111]) by mx.google.com with ESMTPSA id nq7sm807336lbb.49.2015.02.05.00.16.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Feb 2015 00:16:10 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Thu, 5 Feb 2015 09:15:59 +0100 Message-Id: <1423124161-18716-5-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423124161-18716-1-git-send-email-ola.liljedahl@linaro.org> References: <1423124161-18716-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCHv5 4/6] validation: odp_timer.c: cunit cleanup Replace printf with LOG_DBG. X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@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.215.48 as permitted sender) smtp.mail=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 Use CU_ASSERT_FATAL instead of plain assert so to work better with the cunit test framework. Use LOG_DBG instead of printf. Remove some unnecessary printouts. Signed-off-by: Ola Liljedahl --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) test/validation/odp_timer.c | 50 ++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index d74a273..5c997ee 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -10,7 +10,6 @@ /* For rand_r and nanosleep */ #define _POSIX_C_SOURCE 200112L -#include #include #include #include @@ -54,8 +53,7 @@ struct test_timer { /* @private Handle a received (timeout) event */ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) { - /* Use assert() for internal correctness checks of test program */ - assert(ev != ODP_EVENT_INVALID); + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); /* Internal error */ if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { /* Not a timeout event */ CU_FAIL("Unexpected event type received"); @@ -87,7 +85,7 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) CU_FAIL("Wrong status (stale) for fresh timeout"); /* Fresh timeout => local timer must have matching tick */ if (ttp != NULL && ttp->tick != tick) { - printf("Wrong tick: expected %"PRIu64" actual %"PRIu64"\n", + LOG_DBG("Wrong tick: expected %"PRIu64" actual %"PRIu64"\n", ttp->tick, tick); CU_FAIL("odp_timeout_tick() wrong tick"); } @@ -95,8 +93,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) if (tick > odp_timer_current_tick(tp)) CU_FAIL("Timeout delivered early"); if (tick < prev_tick) { - printf("Too late tick: %"PRIu64" prev_tick %"PRIu64"\n", - tick, prev_tick); + LOG_DBG("Too late tick: %"PRIu64" prev_tick %"PRIu64"\n", + tick, prev_tick); /* We don't report late timeouts using CU_FAIL */ odp_atomic_inc_u32(&ndelivtoolate); } @@ -233,14 +231,14 @@ static void *worker_entrypoint(void *arg) CU_FAIL("odp_timer_free"); } - printf("Thread %u: %u timers set\n", thr, nset); - printf("Thread %u: %u timers reset\n", thr, nreset); - printf("Thread %u: %u timers cancelled\n", thr, ncancel); - printf("Thread %u: %u timers reset/cancelled too late\n", - thr, ntoolate); - printf("Thread %u: %u timeouts received\n", thr, nrcv); - printf("Thread %u: %u stale timeout(s) after odp_timer_free()\n", - thr, nstale); + LOG_DBG("Thread %u: %u timers set\n", thr, nset); + LOG_DBG("Thread %u: %u timers reset\n", thr, nreset); + LOG_DBG("Thread %u: %u timers cancelled\n", thr, ncancel); + LOG_DBG("Thread %u: %u timers reset/cancelled too late\n", + thr, ntoolate); + LOG_DBG("Thread %u: %u timeouts received\n", thr, nrcv); + LOG_DBG("Thread %u: %u stale timeout(s) after odp_timer_free()\n", + thr, nstale); /* Delay some more to ensure timeouts for expired timers can be * received */ @@ -264,7 +262,7 @@ static void *worker_entrypoint(void *arg) if (ev != ODP_EVENT_INVALID) CU_FAIL("Unexpected event received"); - printf("Thread %u: exiting\n", thr); + LOG_DBG("Thread %u: exiting\n", thr); return NULL; } @@ -309,19 +307,11 @@ static void test_odp_timer_all(void) CU_ASSERT(tpinfo.param.res_ns == RES); CU_ASSERT(tpinfo.param.min_tmo == MIN); CU_ASSERT(tpinfo.param.max_tmo == MAX); - printf("Timer pool\n"); - printf("----------\n"); - printf(" name: %s\n", tpinfo.name); - printf(" resolution: %"PRIu64" ns (%"PRIu64" us)\n", - tpinfo.param.res_ns, tpinfo.param.res_ns / 1000); - printf(" min tmo: %"PRIu64" ns\n", tpinfo.param.min_tmo); - printf(" max tmo: %"PRIu64" ns\n", tpinfo.param.max_tmo); - printf("\n"); - - printf("#timers..: %u\n", NTIMERS); - printf("Tmo range: %u ms (%"PRIu64" ticks)\n", RANGE_MS, - odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); - printf("\n"); + CU_ASSERT(strcmp(tpinfo.name, NAME) == 0); + + LOG_DBG("#timers..: %u\n", NTIMERS); + LOG_DBG("Tmo range: %u ms (%"PRIu64" ticks)\n", RANGE_MS, + odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); uint64_t tick; for (tick = 0; tick < 1000000000000ULL; tick += 1000000ULL) { @@ -345,8 +335,8 @@ static void test_odp_timer_all(void) /* Wait for worker threads to exit */ odp_cunit_thread_exit(&thrdarg); - printf("Number of timeouts delivered/received too late: %u\n", - odp_atomic_load_u32(&ndelivtoolate)); + LOG_DBG("Number of timeouts delivered/received too late: %u\n", + odp_atomic_load_u32(&ndelivtoolate)); /* Check some statistics after the test */ if (odp_timer_pool_info(tp, &tpinfo) != 0)