From patchwork Wed Mar 18 11:36:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45938 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF5F42153C for ; Wed, 18 Mar 2015 11:37:10 +0000 (UTC) Received: by widex7 with SMTP id ex7sf7173615wid.2 for ; Wed, 18 Mar 2015 04:37: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: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=GO2Okv/+7v+3pqzDfaWP8CI7N/l0vbnytssz1JXmZ6I=; b=NBouS21vHbKy7WFaDAWqtP72OaH/gVd30mwg0+LGnb2UkHon613BXvH9VwKo4TLWS6 daqnY1r7JTOBOZDYGu46tcG9V6/xfvpieKtiOnAvPuJH+kXMLH8DfDJDRmwe2kl9Ckvs 28IxHnrWTc+mEo3WE0/ydIlzcYx10mhVh1aP44x4E3BR3ZFRAD20c5lHN+Ru/RQlDtZo WN/YXbaPeHGL2f/aQZVzKzZmvj6/GFz8wCXfZOMmy9QW2V7ir5UW8Ius86U3mREubmf+ 6dn49uE3dL/6TxR9r5EzevM5lMNp0FJ6xjykFEtQxmUQvz18U1OXpm/QwH+wnH5b0RLv YPkA== X-Gm-Message-State: ALoCoQmX3TzNSaXxqv5ngkaarHYm/O9GCF+uKRQlDaSu6/7Jl2vwWQ5hvXvJBMvASc4jOH1kI9/j X-Received: by 10.194.201.10 with SMTP id jw10mr11004919wjc.3.1426678630026; Wed, 18 Mar 2015 04:37:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.237 with SMTP id r13ls143993lal.74.gmail; Wed, 18 Mar 2015 04:37:09 -0700 (PDT) X-Received: by 10.152.88.99 with SMTP id bf3mr62586999lab.37.1426678629598; Wed, 18 Mar 2015 04:37:09 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id x6si12699536lal.29.2015.03.18.04.37.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 04:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbblx11 with SMTP id lx11so5111761lbb.3 for ; Wed, 18 Mar 2015 04:37:09 -0700 (PDT) X-Received: by 10.112.130.195 with SMTP id og3mr62903009lbb.112.1426678629459; Wed, 18 Mar 2015 04:37:09 -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 h5csp1095138lbj; Wed, 18 Mar 2015 04:37:08 -0700 (PDT) X-Received: by 10.140.96.165 with SMTP id k34mr85064921qge.79.1426678628018; Wed, 18 Mar 2015 04:37:08 -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 q41si16298284qkq.55.2015.03.18.04.37.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Mar 2015 04:37:08 -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 1YYCHX-0001lK-Oj; Wed, 18 Mar 2015 11:37:03 +0000 Received: from mail-la0-f47.google.com ([209.85.215.47]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYCHP-0001kp-RO for lng-odp@lists.linaro.org; Wed, 18 Mar 2015 11:36:55 +0000 Received: by lagg8 with SMTP id g8so33400347lag.1 for ; Wed, 18 Mar 2015 04:36:49 -0700 (PDT) X-Received: by 10.152.43.201 with SMTP id y9mr63316723lal.25.1426678609374; Wed, 18 Mar 2015 04:36:49 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id pd1sm2551936lbc.9.2015.03.18.04.36.47 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 04:36:48 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 18 Mar 2015 13:36:32 +0200 Message-Id: <1426678594-29398-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426678594-29398-1-git-send-email-ciprian.barbu@linaro.org> References: <1426678594-29398-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 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.175 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 --- v4: - check return code of destroy_queues test/validation/odp_schedule.c | 58 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..a9b6283 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,60 @@ 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; + + if (destroy_queues() != 0) + fprintf(stderr, "error: failed to destroy queues\n"); + + 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 +711,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, };