Skip to content
Permalink
Browse files

tests/kernel/workq/work_queue: Fix for fast/non-standard tick rates

This test was written to properly align its millisecond-measured wait
time and assumed that there would be no other overhead.  In fact on
fast tick rate systems (or even ones where the alignment computation
doesn't provide the needed padding as "slop") that's not quite enough
time to complete the full test.  There are cycles between the sleep
calls that need to be accounted for, and aren't.

Just give it one extra work item of time before failing.  We aren't
testing work queue timing precision here, just evaluation semantics.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information...
andyross authored and nashif committed Jun 16, 2019
1 parent 5238f5b commit 03164a7802f228120a024489c5603f59341d6330
Showing with 9 additions and 4 deletions.
  1. +9 −4 tests/kernel/workq/work_queue/src/main.c
@@ -27,6 +27,11 @@

#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)

/* How long to wait for the full test suite to complete. Allow for a
* little slop
*/
#define CHECK_WAIT ((NUM_TEST_ITEMS + 1) * WORK_ITEM_WAIT_ALIGNED)

struct test_item {
int key;
struct k_delayed_work work;
@@ -144,7 +149,7 @@ static void test_sequence(void)
test_items_submit();

TC_PRINT(" - Waiting for work to finish\n");
k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED);
k_sleep(CHECK_WAIT);

check_results(NUM_TEST_ITEMS);
reset_results();
@@ -184,7 +189,7 @@ static void test_resubmit(void)
k_work_submit(&tests[0].work.work);

TC_PRINT(" - Waiting for work to finish\n");
k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED);
k_sleep(CHECK_WAIT);

TC_PRINT(" - Checking results\n");
check_results(NUM_TEST_ITEMS);
@@ -336,7 +341,7 @@ static void test_delayed_resubmit(void)
k_delayed_work_submit(&tests[0].work, WORK_ITEM_WAIT);

TC_PRINT(" - Waiting for work to finish\n");
k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED);
k_sleep(CHECK_WAIT);

TC_PRINT(" - Checking results\n");
check_results(NUM_TEST_ITEMS);
@@ -408,7 +413,7 @@ static void test_delayed(void)
test_delayed_submit();

TC_PRINT(" - Waiting for delayed work to finish\n");
k_sleep(NUM_TEST_ITEMS * WORK_ITEM_WAIT_ALIGNED);
k_sleep(CHECK_WAIT);

TC_PRINT(" - Checking results\n");
check_results(NUM_TEST_ITEMS);

0 comments on commit 03164a7

Please sign in to comment.
You can’t perform that action at this time.