tests: resolve shippable errors

During previous commit Shippable let me know about errors
for some boards, resolved them.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
This commit is contained in:
Maksim Masalski 2020-05-12 11:13:48 +03:00 committed by Anas Nashif
commit 416feaab0c
2 changed files with 16 additions and 4 deletions

View file

@ -5,3 +5,4 @@ CONFIG_THREAD_NAME=y
CONFIG_TEST_USERSPACE=y CONFIG_TEST_USERSPACE=y
CONFIG_POLL=y CONFIG_POLL=y
CONFIG_MP_NUM_CPUS=1 CONFIG_MP_NUM_CPUS=1
CONFIG_MAX_THREAD_BYTES=3

View file

@ -154,7 +154,7 @@ void test_sched_delayed_work_item(void)
{ {
s32_t ms_remain, ms_spent, start_time, stop_time, cycles_spent; s32_t ms_remain, ms_spent, start_time, stop_time, cycles_spent;
s32_t ms_delta = 10; s32_t ms_delta = 15;
k_sem_reset(&sync_sema); k_sem_reset(&sync_sema);
@ -164,6 +164,7 @@ void test_sched_delayed_work_item(void)
start_time = k_cycle_get_32(); start_time = k_cycle_get_32();
k_delayed_work_submit_to_queue(&workq, &work_item_delayed, TIMEOUT); k_delayed_work_submit_to_queue(&workq, &work_item_delayed, TIMEOUT);
ms_remain = k_delayed_work_remaining_get(&work_item_delayed); ms_remain = k_delayed_work_remaining_get(&work_item_delayed);
printk("\nmy test time remain %d\n", ms_remain);
k_sem_take(&sync_sema, K_FOREVER); k_sem_take(&sync_sema, K_FOREVER);
stop_time = k_cycle_get_32(); stop_time = k_cycle_get_32();
@ -288,6 +289,7 @@ static void tdelayed_work_submit_1(struct k_work_q *work_q,
{ {
int32_t time_remaining; int32_t time_remaining;
int32_t timeout_ticks; int32_t timeout_ticks;
u64_t tick_to_ms;
/**TESTPOINT: init via k_delayed_work_init*/ /**TESTPOINT: init via k_delayed_work_init*/
k_delayed_work_init(w, handler); k_delayed_work_init(w, handler);
@ -306,16 +308,25 @@ static void tdelayed_work_submit_1(struct k_work_q *work_q,
} }
time_remaining = k_delayed_work_remaining_get(w); time_remaining = k_delayed_work_remaining_get(w);
printk("\ntime_remaining %d\n", time_remaining);
timeout_ticks = z_ms_to_ticks(TIMEOUT_MS); timeout_ticks = z_ms_to_ticks(TIMEOUT_MS);
printk("\ntimeout_ticks %d\n", timeout_ticks);
tick_to_ms = k_ticks_to_ms_floor64(timeout_ticks + _TICK_ALIGN);
printk("\ntick_to_ms %lld\n", tick_to_ms);
/**TESTPOINT: check remaining timeout after submit */ /**TESTPOINT: check remaining timeout after submit */
zassert_true(time_remaining <= k_ticks_to_ms_floor64(timeout_ticks + zassert_true(time_remaining <= tick_to_ms,
_TICK_ALIGN),
NULL); NULL);
timeout_ticks -= z_ms_to_ticks(15); timeout_ticks -= z_ms_to_ticks(15);
printk("\nz_ms_to_ticks(15) %d\n", z_ms_to_ticks(15));
zassert_true(time_remaining >= k_ticks_to_ms_floor64(timeout_ticks), tick_to_ms = k_ticks_to_ms_floor64(timeout_ticks);
printk("\ntick_to_ms %lld\n\n", k_ticks_to_ms_floor64(timeout_ticks));
zassert_true(time_remaining >= tick_to_ms,
NULL); NULL);
/**TESTPOINT: check pending after delayed work submit*/ /**TESTPOINT: check pending after delayed work submit*/