From patchwork Tue Mar 17 09:53:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82AE12153C for ; Tue, 17 Mar 2015 09:54:05 +0000 (UTC) Received: by lbiz11 with SMTP id z11sf823638lbi.2 for ; Tue, 17 Mar 2015 02:54:04 -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=Vx3eAO+IYbdHDlWjZxkY2q3oMr+s5E9YpGyXsvOJS0BkoRcZx0lbmSV74Thzathe7K seDO0nC9FGVFVleDVdD9RLaZgyFNVQzlojZx3ridNDAOCacDEHwqZCfMlCaQbHmH0P1c XRIydBRhJifj5KWK/K7c6tEoo/jfzS5X86xv1xBclh6vAJ0X+7ndrsTO+RGLffMY/nRd dQdMDCPh4XW6cmCnPfCy5EhpAcA8zSy3dO4fYkcdqbPzk8SLNUe4eISASe9269YI5Sbh K7SjYuSVvJOzRA4NUNUzGXyZTZkAccboSKmpnjcP4X1/O+CZsHcp2goHkzEh6iB2XrH1 yfgQ== X-Gm-Message-State: ALoCoQmN4xjGsAiU8U0xv6BoGRFdYwCIO3H5hWsBhu5o/Wfp3SXuVfk4gQ8qJoMGB12DABh8asHM X-Received: by 10.112.130.70 with SMTP id oc6mr10167753lbb.13.1426586044023; Tue, 17 Mar 2015 02:54:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.102 with SMTP id q6ls17551laa.24.gmail; Tue, 17 Mar 2015 02:54:03 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr58109918lag.112.1426586043220; Tue, 17 Mar 2015 02:54:03 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ll8si10129602lac.95.2015.03.17.02.54.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2015 02:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labjg1 with SMTP id jg1so3754763lab.2 for ; Tue, 17 Mar 2015 02:54:03 -0700 (PDT) X-Received: by 10.152.206.70 with SMTP id lm6mr60184294lac.35.1426586043126; Tue, 17 Mar 2015 02:54:03 -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 h5csp393084lbj; Tue, 17 Mar 2015 02:54:02 -0700 (PDT) X-Received: by 10.140.44.4 with SMTP id f4mr77951434qga.3.1426586041582; Tue, 17 Mar 2015 02:54:01 -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 b79si12681809qge.107.2015.03.17.02.54.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Mar 2015 02:54:01 -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 1YXoCE-0004dv-AJ; Tue, 17 Mar 2015 09:53:58 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YXoC5-0004dM-1c for lng-odp@lists.linaro.org; Tue, 17 Mar 2015 09:53:49 +0000 Received: by labjg1 with SMTP id jg1so3748530lab.2 for ; Tue, 17 Mar 2015 02:53:43 -0700 (PDT) X-Received: by 10.112.89.71 with SMTP id bm7mr31540700lbb.20.1426586023431; Tue, 17 Mar 2015 02:53:43 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id x4sm2708712lba.22.2015.03.17.02.53.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Mar 2015 02:53:42 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Tue, 17 Mar 2015 11:53:27 +0200 Message-Id: <1426586009-21519-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426586009-21519-1-git-send-email-ciprian.barbu@linaro.org> References: <1426586009-21519-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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.215.49 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, };