From patchwork Mon Mar 16 14:51:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45853 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A2E7A2142A for ; Mon, 16 Mar 2015 14:51:57 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf27245879lab.1 for ; Mon, 16 Mar 2015 07:51:56 -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=F+SAaYeu6aZVMv1qLkIqq1OlinXfXEkCMrfVQJbEofH4+6lgJaPlCF1ZWHABPj6V2e BUoimuSUD2c7/n3F4CHpXNWaaZvVwsBbNwsYQONNQWLK+3Kf2+gA+MdELfPCWTSTd10B 6GZFJ/QX/301hR/dX7QMfpqU3dkQBzZJ6q5c1KDWbU7MDUqjwRXxvvLtO3Xtqd31ZhSJ J6Azq37PGFaZgcPOfTc4veF4maf8PHV15NEL41ERju/S6JHEdrfusD8lAj6iy3W1HhXU YOHomBkmCNexBWv1SiQQoVmKs1gwT0QBrbFjXKRhKJW7BD/zfqMJ3SQJLjnJZtPdsDDE FVzA== X-Gm-Message-State: ALoCoQlCuiQCYf9VmAHdtmwEMLa4VYmqZQjBjBVMS7eF8k5zYhIDOSrHcrIYUEexgNXUBGCQJYN4 X-Received: by 10.112.125.67 with SMTP id mo3mr7536995lbb.6.1426517516675; Mon, 16 Mar 2015 07:51:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.163 with SMTP id az3ls629665lab.64.gmail; Mon, 16 Mar 2015 07:51:56 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr57133929lac.56.1426517516534; Mon, 16 Mar 2015 07:51:56 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id q1si8321419laj.84.2015.03.16.07.51.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 07:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcds1 with SMTP id ds1so32593600lbc.3 for ; Mon, 16 Mar 2015 07:51:56 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr54800969lbb.41.1426517516441; Mon, 16 Mar 2015 07:51:56 -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 h5csp2635034lbj; Mon, 16 Mar 2015 07:51:55 -0700 (PDT) X-Received: by 10.55.42.27 with SMTP id q27mr95583861qkh.64.1426517515005; Mon, 16 Mar 2015 07:51:55 -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 h34si10141506qgf.2.2015.03.16.07.51.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Mar 2015 07:51:54 -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 1YXWMy-000252-85; Mon, 16 Mar 2015 14:51:52 +0000 Received: from mail-la0-f44.google.com ([209.85.215.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YXWMo-00024D-1N for lng-odp@lists.linaro.org; Mon, 16 Mar 2015 14:51:42 +0000 Received: by ladw1 with SMTP id w1so42041004lad.0 for ; Mon, 16 Mar 2015 07:51:36 -0700 (PDT) X-Received: by 10.112.9.139 with SMTP id z11mr10572020lba.102.1426517496516; Mon, 16 Mar 2015 07:51:36 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id ps2sm2236822lbb.20.2015.03.16.07.51.35 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Mar 2015 07:51:35 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Mon, 16 Mar 2015 16:51:25 +0200 Message-Id: <1426517487-7124-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426517487-7124-1-git-send-email-ciprian.barbu@linaro.org> References: <1426517487-7124-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 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.176 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, };