From patchwork Wed Dec 17 13:10:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 42378 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C57A26C76 for ; Wed, 17 Dec 2014 13:10:46 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf6292887wib.2 for ; Wed, 17 Dec 2014 05:10:45 -0800 (PST) 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: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=dIk8Of8BAGXrYHf7LaJjLclT3nZtnF3boeTg4pPyVGs=; b=hnkCKS4zim5tzdYgkiqIt4EpHbEF9p4HpiPUZHD4mlBrRMZXAaYPOLlDVZr04Bufsu +9DmAOOxxpVjbjcqA5oZlF1MCvl41+Sh1DpyRXwPqjy9dnzH0cxpIV3MCR21GwVZ6JaR zMrgPAlP7mmCalfZNUaZ7Bod4JktL5QahwP9I1HFCy3MWYvxzyKQ5TSpgAch83hwJHqm Nl/6IcHADztjf1F1QO6GwHDIdE7gIf34ZZbB4x78+ELMib+EC9uh0INhSCRHUiyc70aP Vaj1KrW3UW0fZ7JqOh7QvIX0KZtsa9OMYGWK/L9U4a+GtA3Ons/6FDstLOzwrl5OqcMD mfzA== X-Gm-Message-State: ALoCoQkcBub5P09JAZreWrkRgw6j7r6ixtjnpAiG0ezSPJLQ8FYd6/Flw63vM8lTItkBEA5vrzFz X-Received: by 10.180.81.39 with SMTP id w7mr1320767wix.1.1418821845394; Wed, 17 Dec 2014 05:10:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.137 with SMTP id b9ls1136899lah.29.gmail; Wed, 17 Dec 2014 05:10:44 -0800 (PST) X-Received: by 10.152.6.8 with SMTP id w8mr5019375law.41.1418821844876; Wed, 17 Dec 2014 05:10:44 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id d2si3860367laf.39.2014.12.17.05.10.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:10:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so14168676lbj.9 for ; Wed, 17 Dec 2014 05:10:44 -0800 (PST) X-Received: by 10.152.116.46 with SMTP id jt14mr5487404lab.59.1418821844764; Wed, 17 Dec 2014 05:10:44 -0800 (PST) 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.142.69 with SMTP id ru5csp1357882lbb; Wed, 17 Dec 2014 05:10:43 -0800 (PST) X-Received: by 10.224.80.195 with SMTP id u3mr67384161qak.60.1418821843203; Wed, 17 Dec 2014 05:10:43 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j7si4493793qce.45.2014.12.17.05.10.42 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:10:43 -0800 (PST) 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 1Y1ENE-0004Xf-7A; Wed, 17 Dec 2014 13:10:40 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1EN7-0004TS-Cr for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 13:10:33 +0000 Received: by mail-lb0-f177.google.com with SMTP id b6so12350870lbj.22 for ; Wed, 17 Dec 2014 05:10:27 -0800 (PST) X-Received: by 10.152.22.199 with SMTP id g7mr41345764laf.23.1418821827799; Wed, 17 Dec 2014 05:10:27 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id s8sm932998lae.47.2014.12.17.05.10.26 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:10:27 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 17 Dec 2014 15:10:11 +0200 Message-Id: <1418821811-11734-1-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCH] validation: add odp_schedule_pause and odp_schedule_resume tests 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.178 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 Signed-off-by: Ciprian Barbu --- test/validation/odp_schedule.c | 63 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 31be742..bdbcf77 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -11,9 +11,11 @@ #define MSG_POOL_SIZE (4*1024*1024) #define QUEUES_PER_PRIO 16 #define BUF_SIZE 64 -#define TEST_NUM_BUFS 100 +#define NUM_BUFS 100 #define BURST_BUF_SIZE 4 -#define TEST_NUM_BUFS_EXCL 10000 +#define NUM_BUFS_EXCL 10000 +#define NUM_BUFS_PAUSE 1000 +#define NUM_BUFS_BEFORE_PAUSE 10 #define GLOBALS_SHM_NAME "test_globals" #define MSG_POOL_NAME "msg_pool" @@ -229,7 +231,7 @@ static void schedule_common(odp_schedule_sync_t sync, int num_queues, args.sync = sync; args.num_queues = num_queues; args.num_prio = num_prio; - args.num_bufs = TEST_NUM_BUFS; + args.num_bufs = NUM_BUFS; args.num_cores = 1; args.enable_schd_multi = enable_schd_multi; args.enable_excl_atomic = 0; /* Not needed with a single core */ @@ -261,9 +263,9 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, thr_args->num_queues = num_queues; thr_args->num_prio = num_prio; if (enable_excl_atomic) - thr_args->num_bufs = TEST_NUM_BUFS_EXCL; + thr_args->num_bufs = NUM_BUFS_EXCL; else - thr_args->num_bufs = TEST_NUM_BUFS; + thr_args->num_bufs = NUM_BUFS; thr_args->num_cores = globals->core_count; thr_args->enable_schd_multi = enable_schd_multi; thr_args->enable_excl_atomic = enable_excl_atomic; @@ -459,6 +461,56 @@ static void test_schedule_multi_1q_mt_a_excl(void) ENABLE_EXCL_ATOMIC); } +static void test_schedule_pause_resume(void) +{ + odp_queue_t queue; + odp_buffer_t buf; + odp_queue_t from; + int i; + int local_bufs = 0; + + queue = odp_queue_lookup("sched_0_0_n"); + CU_ASSERT(queue != ODP_QUEUE_INVALID); + + pool = odp_buffer_pool_lookup(MSG_POOL_NAME); + CU_ASSERT_FATAL(pool != ODP_BUFFER_POOL_INVALID); + + + for (i = 0; i < NUM_BUFS_PAUSE; i++) { + buf = odp_buffer_alloc(pool); + CU_ASSERT(buf != ODP_BUFFER_INVALID); + odp_queue_enq(queue, buf); + } + + for (i = 0; i < NUM_BUFS_BEFORE_PAUSE; i++) { + buf = odp_schedule(&from, ODP_SCHED_NO_WAIT); + CU_ASSERT(from == queue); + odp_buffer_free(buf); + } + + odp_schedule_pause(); + + while (1) { + buf = odp_schedule(&from, ODP_SCHED_NO_WAIT); + if (buf == ODP_BUFFER_INVALID) + break; + + CU_ASSERT(from == queue); + odp_buffer_free(buf); + local_bufs++; + } + + CU_ASSERT(local_bufs < NUM_BUFS_PAUSE - NUM_BUFS_BEFORE_PAUSE); + + odp_schedule_resume(); + + for (i = local_bufs + NUM_BUFS_BEFORE_PAUSE; i < NUM_BUFS_PAUSE; i++) { + buf = odp_schedule(&from, ODP_SCHED_WAIT); + CU_ASSERT(from == queue); + odp_buffer_free(buf); + } +} + static int create_queues(void) { int i, j, prios; @@ -594,6 +646,7 @@ struct CU_TestInfo test_odp_schedule[] = { {"schedule_multi_mq_mt_prio_a", test_schedule_multi_mq_mt_prio_a}, {"schedule_multi_mq_mt_prio_o", test_schedule_multi_mq_mt_prio_o}, {"schedule_multi_1q_mt_a_excl", test_schedule_multi_1q_mt_a_excl}, + {"schedule_pause_resume", test_schedule_pause_resume}, CU_TEST_INFO_NULL, };