From patchwork Mon Mar 9 11:28:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 45537 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2B2920285 for ; Mon, 9 Mar 2015 11:28:27 +0000 (UTC) Received: by labhs14 with SMTP id hs14sf38000203lab.0 for ; Mon, 09 Mar 2015 04:28:26 -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: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=FyYGF09iFBbYS+BDDhlX/sYuLxFMgoWS1wfamiUieic=; b=eCwTyIr6x+h1GY9r831CKc+W3MTb/NSviQ1IkRzLySffeetHGQoFeRyWrn4IJN+fOq enyb6+RTNLDT6FJPrRptIUItsjKAnuttZF2wr4DbRYOYmpIobtMhgxmULGTIl9foUIxn 6hZHK3qqollgCQ3a5VboTSoKSZElEeBk6ukN17IhHSf4OLTVX0bTFVj+yKlrue/M5f9q V+90oS9cFewGoQ4Nq49fbzfhVDfLD9asxc6uv4e1/Db/I2U+v1iX5HPLlKAAi6Nf7MAQ s46bWxgsU2Gj5tAPo2sXrNgWwu3igYD+SDnvOFYwycjTLexTOQ1LuMbcCv1vecS4q3ac 8uUA== X-Gm-Message-State: ALoCoQmPad7a5j08gT4YKRLUvuOdhn9s7oZc0Djqi1KIQHgSH9YGn/m0aWcVsdFSiWAT+T3Oc8ns X-Received: by 10.180.101.101 with SMTP id ff5mr7022425wib.5.1425900506762; Mon, 09 Mar 2015 04:28:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.208 with SMTP id l16ls270084laa.66.gmail; Mon, 09 Mar 2015 04:28:26 -0700 (PDT) X-Received: by 10.152.27.232 with SMTP id w8mr20576182lag.51.1425900506598; Mon, 09 Mar 2015 04:28:26 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id aa5si14056934lbc.64.2015.03.09.04.28.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Mar 2015 04:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labmn12 with SMTP id mn12so3021961lab.8 for ; Mon, 09 Mar 2015 04:28:26 -0700 (PDT) X-Received: by 10.152.5.194 with SMTP id u2mr25247828lau.88.1425900506275; Mon, 09 Mar 2015 04:28:26 -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.35.133 with SMTP id h5csp1414249lbj; Mon, 9 Mar 2015 04:28:25 -0700 (PDT) X-Received: by 10.140.234.142 with SMTP id f136mr21871728qhc.13.1425900504555; Mon, 09 Mar 2015 04:28:24 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 66si18087355qhf.1.2015.03.09.04.28.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Mar 2015 04:28:24 -0700 (PDT) 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 1YUvrB-0002GL-Bi; Mon, 09 Mar 2015 11:28:21 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YUvr5-0002G4-JK for lng-odp@lists.linaro.org; Mon, 09 Mar 2015 11:28:15 +0000 Received: by lbvp9 with SMTP id p9so35081389lbv.10 for ; Mon, 09 Mar 2015 04:28:09 -0700 (PDT) X-Received: by 10.112.139.136 with SMTP id qy8mr25206356lbb.38.1425900489583; Mon, 09 Mar 2015 04:28:09 -0700 (PDT) Received: from macmini.lan (78-82-119-153.tn.glocalnet.net. [78.82.119.153]) by mx.google.com with ESMTPSA id en12sm3412411lbc.11.2015.03.09.04.28.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Mar 2015 04:28:08 -0700 (PDT) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Mon, 9 Mar 2015 12:28:03 +0100 Message-Id: <1425900483-4619-1-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [PATCHv4] validation: odp_timer: cleanup for clean termination 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.54 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 Free queue and timeouts, destroy timeout pool before termination. https://bugs.linaro.org/show_bug.cgi?id=1285 Signed-off-by: Ola Liljedahl Reviewed-by: Bill Fischofer --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) v2: Removed reference to Linaro CARDS as this is internal. v3: Added check of return value from odp_queue_destroy(). v4: Declare 'rc' variable at start of function. test/validation/odp_timer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 88af61b..b625b80 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -188,6 +188,7 @@ static void *worker_entrypoint(void *arg) int thr = odp_thread_id(); uint32_t i; unsigned seed = thr; + int rc; (void)arg; odp_queue_t queue = odp_queue_create("timer_queue", @@ -251,7 +252,7 @@ static void *worker_entrypoint(void *arg) if (tt[i].ev == ODP_EVENT_INVALID && (rand_r(&seed) % 2 == 0)) { /* Timer active, cancel it */ - int rc = odp_timer_cancel(tt[i].tim, &tt[i].ev); + rc = odp_timer_cancel(tt[i].tim, &tt[i].ev); if (rc != 0) /* Cancel failed, timer already expired */ ntoolate++; @@ -336,6 +337,12 @@ static void *worker_entrypoint(void *arg) if (ev != ODP_EVENT_INVALID) CU_FAIL("Unexpected event received"); + rc = odp_queue_destroy(queue); + CU_ASSERT(rc == 0); + for (i = 0; i < NTIMERS; i++) { + if (tt[i].ev != ODP_EVENT_INVALID) + odp_timeout_free(odp_timeout_from_event(tt[i].ev)); + } LOG_DBG("Thread %u: exiting\n", thr); return NULL; } @@ -343,6 +350,7 @@ static void *worker_entrypoint(void *arg) /* @private Timer test case entrypoint */ static void test_odp_timer_all(void) { + int rc; odp_pool_param_t params; odp_timer_pool_param_t tparam; /* Reserve at least one core for running other processes so the timer @@ -426,6 +434,10 @@ static void test_odp_timer_all(void) /* Destroy timer pool, all timers must have been freed */ odp_timer_pool_destroy(tp); + /* Destroy timeout pool, all timeouts must have been freed */ + rc = odp_pool_destroy(tbp); + CU_ASSERT(rc == 0); + CU_PASS("ODP timer test"); }