Skip to content

Commit

Permalink
testing: cv_wait_example: relax max waiting time
Browse files Browse the repository at this point in the history
  • Loading branch information
clementperon committed Jul 2, 2024
1 parent 6bce2c5 commit d2483b4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions testing/cv_wait_example_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,29 @@ static void example_cv_wait (testing t) {
"one\n"
"three\n"
"two\n"
"timeout 0.1s\n"
"timeout 0.2s\n"
"four\n"
"timeout 0.1s\n"
"timeout 0.2s\n"
"five\n"
"timeout 1s\n";
"timeout 2s\n";

memset ((void *) &q, 0, sizeof (q));
memset (&output, 0, sizeof (output));

closure_fork (closure_add_and_wait_cv (&add_and_wait_cv, &q,
nsync_time_ms (500), NELEM (input), input));
nsync_time_ms (1000), NELEM (input), input));

/* delay: "one", "two", "three" are queued; not "four" */
nsync_time_sleep (nsync_time_ms (1200));

remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* "one" */
remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* "three" (less than "two") */
remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* "two" */
remove_and_print_cv (&q, nsync_time_ms (100), &output); /* time out because 1.3 < 0.5*3 */
remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* "four" */
remove_and_print_cv (&q, nsync_time_ms (100), &output); /* time out because 0.1 < 0.5 */
remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* "five" */
remove_and_print_cv (&q, nsync_time_ms (1000), &output); /* time out: no more to fetch */
nsync_time_sleep (nsync_time_ms (2400));

remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* "one" */
remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* "three" (less than "two") */
remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* "two" */
remove_and_print_cv (&q, nsync_time_ms (200), &output); /* time out because 1.3 < 0.5*3 */
remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* "four" */
remove_and_print_cv (&q, nsync_time_ms (200), &output); /* time out because 0.1 < 0.5 */
remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* "five" */
remove_and_print_cv (&q, nsync_time_ms (2000), &output); /* time out: no more to fetch */

A_PUSH (&output) = 0;
if (strcmp (&A (&output, 0), expected) != 0) {
Expand Down

0 comments on commit d2483b4

Please sign in to comment.