From patchwork Thu Dec 3 16:37:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 57665 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp30670lbb; Thu, 3 Dec 2015 08:38:09 -0800 (PST) X-Received: by 10.55.78.78 with SMTP id c75mr12172739qkb.71.1449160689585; Thu, 03 Dec 2015 08:38:09 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w75si6523728qhw.0.2015.12.03.08.38.09; Thu, 03 Dec 2015 08:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 35D2662CCF; Thu, 3 Dec 2015 16:38:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9AD5662CC6; Thu, 3 Dec 2015 16:38:04 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 11C7062CC2; Thu, 3 Dec 2015 16:38:02 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 06B7B62CC2 for ; Thu, 3 Dec 2015 16:37:56 +0000 (UTC) Received: by lffu14 with SMTP id u14so94355608lff.1 for ; Thu, 03 Dec 2015 08:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=OuD9MgC3rgPFW6ZKN5znYe02n552LW2SE8WCMJJqkq4=; b=GG82LT5LGIbRvrOq6v3PYEIc9hQ7yAC8H8kzwgwFfCPjt/XOYYWnfY31/MlyPUxO+k QfWFW4GK4/4wIjiwpSaFUMwQc7V+456HTX/GYzyN6ySa2tFsCyV/vqYWiW7s4rp2IHHb wkMYxmo45cSZkagCMjiHnvsHkSxkUQ11rCH/uF2qd/NpgaqOQMqfwyaE9W/DRsx2KgUM cjO4OUNNfO5fFoPMDsd/6LwN8NGJ5kAQEWopEcsEixgY7UmYXT/+u9Az0E2tkLLRY4+N TRxnz/3f+kg/xcN035iU0lnprZKeuDsmPsURUkczdHawMjYe2Dz2OZwpYc59vI9p7wVf 3JTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OuD9MgC3rgPFW6ZKN5znYe02n552LW2SE8WCMJJqkq4=; b=X2hke3xjQec3yRr8iXjQjGVIrL4l/u8ZagAWWaLR/XDQ0YHjIZuaOONIgnrlvNrg58 b7uXfMW1nPqboOY7xjGf3pyH0iscWQnTv8+XknvLarmu82j49VJyjmnwbPDxjSAYVM04 aryQD3DMCtvu5rGirY55YqHw7SmHnX3Wg8/tNFPWWOxbtmIDB/W78AXoiCzHasXAgmL/ wP4/65p8DbLTLO1m1rz2JRbNfRXSWbVQbvVa+cRU/q6dUB/D0Ztq8wKJagl4lT85MJU6 NY6Tvi0hrV5mZhgNHUAV1UXINx56pcX87zbxfKl+F+4Y0oYKh/ECxGwDxRvXUHZCSc1b 9Xhg== X-Gm-Message-State: ALoCoQls8tkDv/QROD1rJen5k4OenPTpZwReRhZRkbPQw1BvAG5zzeH/c72AW5BPakg8GFEj6wa5 X-Received: by 10.25.24.77 with SMTP id o74mr5970708lfi.5.1449160674859; Thu, 03 Dec 2015 08:37:54 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id w7sm1520586lbb.14.2015.12.03.08.37.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Dec 2015 08:37:53 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 3 Dec 2015 18:37:47 +0200 Message-Id: <1449160667-22027-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] validation: scheduler: use fail timeout when waiting on events in chaos X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" In case if smth bad was happened and events are not received, it's better finish than looping forever. Signed-off-by: Ivan Khoronzhuk Reviewed-by: Bill Fischofer --- test/validation/scheduler/scheduler.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index fb36d20..2e157a5 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -46,6 +46,7 @@ #define CHAOS_DEBUG (CHAOS_NUM_ROUNDS < 1000) #define CHAOS_PTR_TO_NDX(p) ((uint64_t)(uint32_t)(uintptr_t)p) #define CHAOS_NDX_TO_PTR(n) ((void *)(uintptr_t)n) +#define CHAOS_WAIT_FAIL (5 * ODP_TIME_SEC_IN_NS) /* Test global variables */ typedef struct { @@ -401,7 +402,7 @@ void scheduler_test_groups(void) static void *chaos_thread(void *arg) { - uint64_t i; + uint64_t i, wait; int rc; chaos_buf *cbuf; odp_event_t ev; @@ -417,8 +418,9 @@ static void *chaos_thread(void *arg) odp_barrier_wait(&globals->barrier); /* Run the test */ + wait = odp_schedule_wait_time(CHAOS_WAIT_FAIL); for (i = 0; i < CHAOS_NUM_ROUNDS * CHAOS_NUM_EVENTS; i++) { - ev = odp_schedule(&from, ODP_SCHED_WAIT); + ev = odp_schedule(&from, wait); CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); cbuf = odp_buffer_addr(odp_buffer_from_event(ev)); CU_ASSERT_FATAL(cbuf != NULL); @@ -481,6 +483,7 @@ void scheduler_test_chaos(void) odp_shm_t shm; odp_queue_t from; int i, rc; + uint64_t wait; odp_schedule_sync_t sync[] = {ODP_SCHED_SYNC_NONE, ODP_SCHED_SYNC_ATOMIC, ODP_SCHED_SYNC_ORDERED}; @@ -554,9 +557,10 @@ void scheduler_test_chaos(void) odp_thread_id()); /* Cleanup: Drain queues, free events */ + wait = odp_schedule_wait_time(CHAOS_WAIT_FAIL); while (odp_atomic_fetch_dec_u32( &globals->chaos_pending_event_count) > 0) { - ev = odp_schedule(&from, ODP_SCHED_WAIT); + ev = odp_schedule(&from, wait); CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); cbuf = odp_buffer_addr(odp_buffer_from_event(ev)); if (CHAOS_DEBUG)