From patchwork Fri Mar 13 10:02:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45762 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CDFCE214BF for ; Fri, 13 Mar 2015 10:02:53 +0000 (UTC) Received: by wggy19 with SMTP id y19sf15573519wgg.2 for ; Fri, 13 Mar 2015 03:02:53 -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: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=ljrlO7+9qiDhh7TQPinqymM/g/OhlguhVTeDG+nPGHg=; b=eI3VCP7oWdYQpqQVG4pHeo8ByPCxcuvCjTDYDuRY+/zhCRDYAD9inaTwW0NiyWAfM+ NsWY2Ba4vYF63iIDB12SzvQy9fpFArm8v19B2QAq4UoOf1rGfTNXUHioSMSBAVyMcXcp foojN4kyqb5yHr5dJx09PDf0X77wvBr8R5GefE/RNWtD/h/4i9HNjOsngQLkQUYin2C5 NiqgPGrLQxlyLCBZ1vWlwDDMCH6BRlWswJSbKcQIUol3rIlDwCQRz4yBokttkl/TNNP7 M82jCrKAWL53BlQZlk3dS2kqcIlLlrqBGHO/RBXfQsYjrNQttInczxw5HR6Ff4AHTNUe wI/A== X-Gm-Message-State: ALoCoQlcVGLezyHU+HdVSEd9e7UqfoqgoHKulVXmW7n1pgKYMHDezVXvn2vSsrrL0jUTUXmJhYjc X-Received: by 10.112.41.131 with SMTP id f3mr7228255lbl.20.1426240971983; Fri, 13 Mar 2015 03:02:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.42 with SMTP id g10ls399014laa.51.gmail; Fri, 13 Mar 2015 03:02:51 -0700 (PDT) X-Received: by 10.152.204.6 with SMTP id ku6mr69761lac.62.1426240971669; Fri, 13 Mar 2015 03:02:51 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id p8si1019169laf.145.2015.03.13.03.02.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 03:02:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbvp9 with SMTP id p9so21652802lbv.8 for ; Fri, 13 Mar 2015 03:02:51 -0700 (PDT) X-Received: by 10.112.201.231 with SMTP id kd7mr22090326lbc.35.1426240971430; Fri, 13 Mar 2015 03:02: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 h5csp792132lbj; Fri, 13 Mar 2015 03:02:50 -0700 (PDT) X-Received: by 10.140.88.80 with SMTP id s74mr53444215qgd.59.1426240970126; Fri, 13 Mar 2015 03:02: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 8si1467006qhu.45.2015.03.13.03.02.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Mar 2015 03:02: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 1YWMQZ-0005GO-EW; Fri, 13 Mar 2015 10:02:47 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YWMQP-0005Fy-KH for lng-odp@lists.linaro.org; Fri, 13 Mar 2015 10:02:37 +0000 Received: by lbiw7 with SMTP id w7so21671447lbi.6 for ; Fri, 13 Mar 2015 03:02:32 -0700 (PDT) X-Received: by 10.112.73.65 with SMTP id j1mr42167314lbv.87.1426240952037; Fri, 13 Mar 2015 03:02:32 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id dz1sm295488lbc.47.2015.03.13.03.02.31 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Mar 2015 03:02:31 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Fri, 13 Mar 2015 12:02:14 +0200 Message-Id: <1426240935-28353-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426240935-28353-1-git-send-email-ciprian.barbu@linaro.org> References: <1426240935-28353-1-git-send-email-ciprian.barbu@linaro.org> Subject: [lng-odp] [RFC 1/2] 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.181 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 --- test/validation/odp_schedule.c | 56 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..b86f997 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,58 @@ 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)) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_a", i, j); + if (destroy_queue(name)) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_o", i, j); + if (destroy_queue(name)) + return -1; + } + } + + return 0; +} + +static int schd_suite_term(void) +{ + odp_pool_t pool; + + destroy_queues(); + 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 +709,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, };