From patchwork Wed Mar 18 10:16:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45923 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 44D042153C for ; Wed, 18 Mar 2015 10:17:20 +0000 (UTC) Received: by lbvp9 with SMTP id p9sf6485942lbv.0 for ; Wed, 18 Mar 2015 03:17:19 -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=fUyWySEFyLR5iiwURmieoTxqGqCX6KFs9hvMuW0MH3My0RqAKKWUfNZUKqndYlISGD aFLnuQQ02nHaR/cIaBMAJUqh3fnfXEE2gO2zQVSiu3QAyEKXq8FUw8K01Vjsj6/J2cLc 34OCi9eiFoluaLTxR3TxBpNjOp5p3FHS9MXg2x3t21fpO6Q7MQcNCU/AlG/fLXTAIjYF xI05adjtUNJCR74S8x2Q7e4TGcw6c81pdMOiWAwVz2hcbJYbW+All1kquNPvm931E4+T kKYArA4BLcSkPbvlDYMx22plmdSMz5qRi1unGCEuyQrP6EWI95n2XfZUOumP8nMPJ7hU Y1Yg== X-Gm-Message-State: ALoCoQnJ2cQoT15VpI8pkWnqnvozf4e8gu0fxNOzPhsf6egZ0Ahqyk+MRrBbAE4gZn6oq7oH46G7 X-Received: by 10.112.181.166 with SMTP id dx6mr8480664lbc.17.1426673839111; Wed, 18 Mar 2015 03:17:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.38 with SMTP id p6ls116708lap.17.gmail; Wed, 18 Mar 2015 03:17:18 -0700 (PDT) X-Received: by 10.152.87.46 with SMTP id u14mr43213667laz.82.1426673838820; Wed, 18 Mar 2015 03:17:18 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id o3si12559940laf.47.2015.03.18.03.17.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 03:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbsy1 with SMTP id sy1so25995167lbb.1 for ; Wed, 18 Mar 2015 03:17:18 -0700 (PDT) X-Received: by 10.152.121.33 with SMTP id lh1mr63845813lab.86.1426673838706; Wed, 18 Mar 2015 03:17:18 -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 h5csp1055882lbj; Wed, 18 Mar 2015 03:17:17 -0700 (PDT) X-Received: by 10.55.26.167 with SMTP id l39mr113682514qkh.63.1426673837233; Wed, 18 Mar 2015 03:17:17 -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 z123si16101900qhd.91.2015.03.18.03.17.13 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Mar 2015 03:17:17 -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 1YYB2E-00060f-Ch; Wed, 18 Mar 2015 10:17:10 +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 1YYB26-000607-8n for lng-odp@lists.linaro.org; Wed, 18 Mar 2015 10:17:02 +0000 Received: by labjg1 with SMTP id jg1so31772946lab.2 for ; Wed, 18 Mar 2015 03:16:56 -0700 (PDT) X-Received: by 10.112.39.69 with SMTP id n5mr63749309lbk.1.1426673816050; Wed, 18 Mar 2015 03:16:56 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id bm5sm1681413lbb.25.2015.03.18.03.16.54 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 03:16:55 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 18 Mar 2015 12:16:37 +0200 Message-Id: <1426673799-28116-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426673799-28116-1-git-send-email-ciprian.barbu@linaro.org> References: <1426673799-28116-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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.182 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, };