From patchwork Fri Mar 20 09:34:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 46133 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B02CA21515 for ; Fri, 20 Mar 2015 09:34:53 +0000 (UTC) Received: by lbdu14 with SMTP id u14sf252742lbd.3 for ; Fri, 20 Mar 2015 02:34:52 -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=NHqums6NbUHQhVAaf0cN+0nDqUsaiHLVCDkGodeKgiA=; b=StRM3fAWXke7SE2SV7mrmeUBuX4LFQK/7lJelgxHq7ltHOG/m94ECtZ1fK5MXuxGqt 9a5gz6lH0rI51d+MRDWVeCj56LYbikUmrzDJxXCrXoKVJKpT/tlKXLY8kzzHTce3zlJX VdenmNVWNy80gCCYMcJp0dg83r7DsgOmySXbTXIXmd3ZRk6d4YCmdzv6EwdD1h6wPihK zkw5zIK8DF0/tEUdsShy9v4ZqRnNLTz1e76bWrp/NyflQ/0QYdoE9LbGCU/Nq+m4uOb2 8V+JOyYj4Go0C89jVb2nrbAZ3v3hrzSpuEL88S+/cPmlAzKks/jx2M4NkKiMK42RFNuN tJSA== X-Gm-Message-State: ALoCoQnlxy8a3DCISLmX3/fiRCwXwtSSpRv13jbke5K/yxXGX9LLRLyLgzhINmgWvby+ofHhtCsm X-Received: by 10.194.221.65 with SMTP id qc1mr12887795wjc.7.1426844092273; Fri, 20 Mar 2015 02:34:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.130 with SMTP id v2ls329227lae.98.gmail; Fri, 20 Mar 2015 02:34:51 -0700 (PDT) X-Received: by 10.152.23.195 with SMTP id o3mr69920425laf.11.1426844091944; Fri, 20 Mar 2015 02:34:51 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id g4si2796023lbs.114.2015.03.20.02.34.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 02:34:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbsy1 with SMTP id sy1so71214525lbb.1 for ; Fri, 20 Mar 2015 02:34:51 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr74225651lac.56.1426844091848; Fri, 20 Mar 2015 02:34:51 -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 h5csp906006lbj; Fri, 20 Mar 2015 02:34:51 -0700 (PDT) X-Received: by 10.55.26.91 with SMTP id a88mr147148825qka.0.1426844090373; Fri, 20 Mar 2015 02:34:50 -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 9si3822357qgo.114.2015.03.20.02.34.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 02:34:50 -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 1YYtKJ-0001Jg-7n; Fri, 20 Mar 2015 09:34:47 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYtKD-0001Jb-HG for lng-odp@lists.linaro.org; Fri, 20 Mar 2015 09:34:41 +0000 Received: by lbbrr9 with SMTP id rr9so6654902lbb.0 for ; Fri, 20 Mar 2015 02:34:35 -0700 (PDT) X-Received: by 10.152.243.4 with SMTP id wu4mr72825633lac.33.1426844075158; Fri, 20 Mar 2015 02:34:35 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id kv10sm810037lac.23.2015.03.20.02.34.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Mar 2015 02:34:34 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Fri, 20 Mar 2015 11:34:22 +0200 Message-Id: <1426844062-554-1-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv5 1/3] validation: schedule: free queues and pool 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: ciprian.barbu@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.171 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 With the implementation of termination APIs it is now necessarry to cleanup all allocated resources, queues and pool in this case. Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 Signed-off-by: Ciprian Barbu --- v5: - add return -1 in termination routine v4: - check return code of destroy_queues test/validation/odp_schedule.c | 61 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..efc7c8b 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,63 @@ static int schd_suite_init(void) return 0; } -struct CU_TestInfo test_odp_schedule[] = { +static int destroy_queue(const char *name) +{ + odp_queue_t q; + + q = odp_queue_lookup(name); + + if (q == ODP_QUEUE_INVALID) + return -1; + + return odp_queue_destroy(q); +} + +static int destroy_queues(void) +{ + int i, j, prios; + + prios = odp_schedule_num_prio(); + + for (i = 0; i < prios; i++) { + for (j = 0; j < QUEUES_PER_PRIO; j++) { + char name[32]; + + snprintf(name, sizeof(name), "sched_%d_%d_n", i, j); + if (destroy_queue(name) != 0) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_a", i, j); + if (destroy_queue(name) != 0) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_o", i, j); + if (destroy_queue(name) != 0) + return -1; + } + } + + return 0; +} + +static int schd_suite_term(void) +{ + odp_pool_t pool; + + if (destroy_queues() != 0) { + fprintf(stderr, "error: failed to destroy queues\n"); + return -1; + } + + pool = odp_pool_lookup(MSG_POOL_NAME); + if (odp_pool_destroy(pool) != 0) { + fprintf(stderr, "error: failed to destroy pool\n"); + } + + return 0; +} + +struct CU_TestInfo schd_tests[] = { {"schedule_wait_time", test_schedule_wait_time}, {"schedule_num_prio", test_schedule_num_prio}, {"schedule_1q_1t_n", test_schedule_1q_1t_n}, @@ -658,6 +714,7 @@ struct CU_TestInfo test_odp_schedule[] = { }; CU_SuiteInfo odp_testsuites[] = { - {"Scheduler", schd_suite_init, NULL, NULL, NULL, test_odp_schedule}, + {"Scheduler", + schd_suite_init, schd_suite_term, NULL, NULL, schd_tests}, CU_SUITE_INFO_NULL, };