tests: rebase with 2.3 release changes
Rebase using the latest master changes for 2.3 release Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
This commit is contained in:
parent
416feaab0c
commit
6eabee2681
1 changed files with 8 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Intel Corporation
|
* Copyright (c) 2016, 2020 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ void common_work_handler(struct k_work *unused)
|
||||||
*/
|
*/
|
||||||
void test_work_item_supplied_with_func(void)
|
void test_work_item_supplied_with_func(void)
|
||||||
{
|
{
|
||||||
u32_t sem_count = 0;
|
uint32_t sem_count = 0;
|
||||||
|
|
||||||
k_sem_reset(&sync_sema);
|
k_sem_reset(&sync_sema);
|
||||||
|
|
||||||
|
@ -152,9 +152,9 @@ void test_process_work_items_fifo(void)
|
||||||
*/
|
*/
|
||||||
void test_sched_delayed_work_item(void)
|
void test_sched_delayed_work_item(void)
|
||||||
{
|
{
|
||||||
s32_t ms_remain, ms_spent, start_time, stop_time, cycles_spent;
|
int32_t ms_remain, ms_spent, start_time, stop_time, cycles_spent;
|
||||||
|
|
||||||
s32_t ms_delta = 15;
|
int32_t ms_delta = 15;
|
||||||
|
|
||||||
k_sem_reset(&sync_sema);
|
k_sem_reset(&sync_sema);
|
||||||
|
|
||||||
|
@ -164,12 +164,11 @@ 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();
|
||||||
cycles_spent = stop_time - start_time;
|
cycles_spent = stop_time - start_time;
|
||||||
ms_spent = (u32_t)k_cyc_to_ms_floor32(cycles_spent);
|
ms_spent = (uint32_t)k_cyc_to_ms_floor32(cycles_spent);
|
||||||
|
|
||||||
zassert_within(ms_spent, ms_remain, ms_delta, NULL);
|
zassert_within(ms_spent, ms_remain, ms_delta, NULL);
|
||||||
}
|
}
|
||||||
|
@ -185,9 +184,9 @@ void test_sched_delayed_work_item(void)
|
||||||
*/
|
*/
|
||||||
void test_workqueue_max_number(void)
|
void test_workqueue_max_number(void)
|
||||||
{
|
{
|
||||||
u32_t work_q_num = 0;
|
uint32_t work_q_num = 0;
|
||||||
|
|
||||||
for (u32_t i = 0; i < MAX_WORK_Q_NUMBER; i++) {
|
for (uint32_t i = 0; i < MAX_WORK_Q_NUMBER; i++) {
|
||||||
work_q_num++;
|
work_q_num++;
|
||||||
k_work_q_start(&work_q_max_number[i], new_stack_area[i],
|
k_work_q_start(&work_q_max_number[i], new_stack_area[i],
|
||||||
K_THREAD_STACK_SIZEOF(new_stack_area[i]),
|
K_THREAD_STACK_SIZEOF(new_stack_area[i]),
|
||||||
|
@ -289,7 +288,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;
|
uint64_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);
|
||||||
|
@ -308,23 +307,15 @@ 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);
|
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 <= tick_to_ms,
|
zassert_true(time_remaining <= tick_to_ms,
|
||||||
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));
|
|
||||||
|
|
||||||
tick_to_ms = 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,
|
zassert_true(time_remaining >= tick_to_ms,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue