From patchwork Thu Jan 22 16:18:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 43536 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 E7081240DB for ; Thu, 22 Jan 2015 16:19:12 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf2215626wiv.2 for ; Thu, 22 Jan 2015 08:19:12 -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=pggfBMhLEBrXUKELxTNY8MVa2QI3q/IxUvZ9VrbSfUw=; b=jCZL19iMR3HLJCovIrUJzw11bNa+IVh9SLm63qIm6t7a356A0feBCz93j2UruLmgPn PdRujsbKFQxm8UfrcutQ4/V4kN8Bth/MZ104CoyUi7IojzKyP3yPZNomkFcek4XchknT OE4UY8nHar1Jr5g3mxo4anr25Ng0aDOQa1wFAMy9yTMenWoWJngNY0IRWh6oGjPgHVS5 +Oj+zafZHyPmYguUkhYWpG9z8XWbZOx/i7eEudaWbctk/CXfil2vMQ7DVaMGY4p3XW7D Na1fjRwrAumPGjH7t8qxpJOvQLuMJqKnZKie7i5ggoqXTyRM74nCaZGNSYg8frE8t/bP Q1Ig== X-Gm-Message-State: ALoCoQn5D99R0YMusPx1L9CzGy4BnyeOzRt8avtSkUNHH60AfmFvIXg76NY3ae372q4fVqkJ9QEd X-Received: by 10.180.105.97 with SMTP id gl1mr4454979wib.7.1421943552191; Thu, 22 Jan 2015 08:19:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.202.198 with SMTP id kk6ls170867lac.103.gmail; Thu, 22 Jan 2015 08:19:12 -0800 (PST) X-Received: by 10.112.198.233 with SMTP id jf9mr2675862lbc.9.1421943551926; Thu, 22 Jan 2015 08:19:11 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id rq8si8123172lbb.78.2015.01.22.08.19.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 08:19:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id p9so2424681lbv.8 for ; Thu, 22 Jan 2015 08:19:11 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr2686288lav.34.1421943551504; Thu, 22 Jan 2015 08:19:11 -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.9.200 with SMTP id c8csp315147lbb; Thu, 22 Jan 2015 08:19:10 -0800 (PST) X-Received: by 10.224.63.70 with SMTP id a6mr4177369qai.42.1421943549977; Thu, 22 Jan 2015 08:19:09 -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 z20si9473896qax.23.2015.01.22.08.19.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:19:09 -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 1YEKTK-0000a2-SS; Thu, 22 Jan 2015 16:19:06 +0000 Received: from mail-la0-f53.google.com ([209.85.215.53]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YEKTE-0000ZC-Kv for lng-odp@lists.linaro.org; Thu, 22 Jan 2015 16:19:00 +0000 Received: by mail-la0-f53.google.com with SMTP id gq15so2518052lab.12 for ; Thu, 22 Jan 2015 08:18:55 -0800 (PST) X-Received: by 10.153.6.6 with SMTP id cq6mr2635389lad.23.1421943534924; Thu, 22 Jan 2015 08:18:54 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id r5sm3454333lal.34.2015.01.22.08.18.53 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:18:54 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Thu, 22 Jan 2015 18:18:44 +0200 Message-Id: <1421943524-19649-1-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv2] 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.177 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 --- v2: rebased test/validation/odp_schedule.c | 57 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 5df3c86..159081b 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -13,7 +13,9 @@ #define BUF_SIZE 64 #define TEST_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" @@ -261,7 +263,7 @@ 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_cpus = globals->cpu_count; @@ -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, };