| 48 | } |
| 49 | |
| 50 | static void do_work_test(void) |
| 51 | { |
| 52 | struct rt_workqueue *queue; |
| 53 | rt_uint8_t curr_priority; |
| 54 | struct rt_work work; |
| 55 | volatile int work_flag = 0; |
| 56 | rt_err_t err; |
| 57 | |
| 58 | /* 1 higher priority than the current test thread */ |
| 59 | curr_priority = get_test_thread_priority(-1); |
| 60 | queue = rt_workqueue_create("test", 2048, curr_priority); |
| 61 | if (queue == RT_NULL) |
| 62 | { |
| 63 | LOG_E("queue create failed, L:%d", __LINE__); |
| 64 | return; |
| 65 | } |
| 66 | rt_work_init(&work, do_work_test_fun, (void *)&work_flag); |
| 67 | err = rt_workqueue_submit_work(queue, &work, 0); |
| 68 | uassert_int_equal(err, RT_EOK); |
| 69 | |
| 70 | /* Delay 5 ticks to ensure that the task has been executed */ |
| 71 | rt_thread_delay(5); |
| 72 | uassert_int_equal(work_flag, 1); |
| 73 | |
| 74 | rt_thread_delay(100); |
| 75 | rt_workqueue_destroy(queue); |
| 76 | } |
| 77 | |
| 78 | static void do_delay_work_test_fun(struct rt_work *work, void *work_data) |
| 79 | { |
nothing calls this directly
no test coverage detected