diff mbox

validation: scheduler: use fail timeout when waiting on events in chaos

Message ID 1449160667-22027-1-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit b6407767cabfcfb75592efbb3cfb9ea4c44674a7
Headers show

Commit Message

Ivan Khoronzhuk Dec. 3, 2015, 4:37 p.m. UTC
In case if smth bad was happened and events are not received,
it's better finish than looping forever.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/validation/scheduler/scheduler.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Bill Fischofer Dec. 4, 2015, 3:49 p.m. UTC | #1
On Thu, Dec 3, 2015 at 10:37 AM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
> wrote:


> In case if smth bad was happened and events are not received,

> it's better finish than looping forever.

>

> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  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)

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov Dec. 7, 2015, 11:34 a.m. UTC | #2
make[3]: Entering directory `/opt/Linaro/odp2.git/helper/test'
FAIL: odp_chksum


At the same time you need update test for that function.

Maxim.

On 12/04/2015 18:49, Bill Fischofer wrote:
>
>
> On Thu, Dec 3, 2015 at 10:37 AM, Ivan Khoronzhuk 
> <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:
>
>     In case if smth bad was happened and events are not received,
>     it's better finish than looping forever.
>
>     Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
>     <mailto:ivan.khoronzhuk@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      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)
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer Dec. 7, 2015, 11:37 a.m. UTC | #3
That test makes no references to odp_chksum, so I'm not sure what the
intersect is here.

On Mon, Dec 7, 2015 at 5:34 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> make[3]: Entering directory `/opt/Linaro/odp2.git/helper/test'

> FAIL: odp_chksum

>

>

> At the same time you need update test for that function.

>

> Maxim.

>

> On 12/04/2015 18:49, Bill Fischofer wrote:

>

>>

>>

>> On Thu, Dec 3, 2015 at 10:37 AM, Ivan Khoronzhuk <

>> ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:

>>

>>     In case if smth bad was happened and events are not received,

>>     it's better finish than looping forever.

>>

>>     Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org

>>     <mailto:ivan.khoronzhuk@linaro.org>>

>>

>>

>> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org <mailto:

>> bill.fischofer@linaro.org>>

>>

>>

>>     ---

>>      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)

>>     --

>>     1.9.1

>>

>>     _______________________________________________

>>     lng-odp mailing list

>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>

>>     https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>>

>>

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov Dec. 7, 2015, 11:58 a.m. UTC | #4
Sorry, replayed to wrong email window. But I caught that bug only after 
applying that patch. On previous patch it
tools said that everything is ok.

That patch is applied.

Maxim.

On 12/07/2015 14:37, Bill Fischofer wrote:
> That test makes no references to odp_chksum, so I'm not sure what the 
> intersect is here.
>
> On Mon, Dec 7, 2015 at 5:34 AM, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     make[3]: Entering directory `/opt/Linaro/odp2.git/helper/test'
>     FAIL: odp_chksum
>
>
>     At the same time you need update test for that function.
>
>     Maxim.
>
>     On 12/04/2015 18:49, Bill Fischofer wrote:
>
>
>
>         On Thu, Dec 3, 2015 at 10:37 AM, Ivan Khoronzhuk
>         <ivan.khoronzhuk@linaro.org
>         <mailto:ivan.khoronzhuk@linaro.org>
>         <mailto:ivan.khoronzhuk@linaro.org
>         <mailto:ivan.khoronzhuk@linaro.org>>> wrote:
>
>             In case if smth bad was happened and events are not received,
>             it's better finish than looping forever.
>
>             Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
>         <mailto:ivan.khoronzhuk@linaro.org>
>             <mailto:ivan.khoronzhuk@linaro.org
>         <mailto:ivan.khoronzhuk@linaro.org>>>
>
>
>         Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org
>         <mailto:bill.fischofer@linaro.org>
>         <mailto:bill.fischofer@linaro.org
>         <mailto:bill.fischofer@linaro.org>>>
>
>
>             ---
>              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)
>             --
>             1.9.1
>
>             _______________________________________________
>             lng-odp mailing list
>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>         <mailto:lng-odp@lists.linaro.org
>         <mailto:lng-odp@lists.linaro.org>>
>         https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
>         _______________________________________________
>         lng-odp mailing list
>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>         https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

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)