tests: fifo: fix code style

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-06-16 21:59:45 -04:00 committed by Kumar Gala
commit 1a93489935
4 changed files with 18 additions and 17 deletions

View file

@ -25,13 +25,13 @@ extern void test_fifo_is_empty_isr(void);
void test_main(void *p1, void *p2, void *p3)
{
ztest_test_suite(test_fifo_api,
ztest_unit_test(test_fifo_thread2thread),
ztest_unit_test(test_fifo_thread2isr),
ztest_unit_test(test_fifo_isr2thread),
ztest_unit_test(test_fifo_get_fail),
ztest_unit_test(test_fifo_loop),
ztest_unit_test(test_fifo_cancel_wait),
ztest_unit_test(test_fifo_is_empty_thread),
ztest_unit_test(test_fifo_is_empty_isr));
ztest_unit_test(test_fifo_thread2thread),
ztest_unit_test(test_fifo_thread2isr),
ztest_unit_test(test_fifo_isr2thread),
ztest_unit_test(test_fifo_get_fail),
ztest_unit_test(test_fifo_loop),
ztest_unit_test(test_fifo_cancel_wait),
ztest_unit_test(test_fifo_is_empty_thread),
ztest_unit_test(test_fifo_is_empty_isr));
ztest_run_test_suite(test_fifo_api);
}

View file

@ -25,11 +25,12 @@ static void t_cancel_wait_entry(void *p1, void *p2, void *p3)
static void tfifo_thread_thread(struct k_fifo *pfifo)
{
k_tid_t tid = k_thread_create(&thread, tstack, STACK_SIZE,
t_cancel_wait_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
t_cancel_wait_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
u32_t start_t = k_uptime_get_32();
void *ret = k_fifo_get(pfifo, 500);
u32_t dur = k_uptime_get_32() - start_t;
/* While we observed the side effect of the last statement
* ( call to k_fifo_cancel_wait) of the thread, it's not fact
* that it returned, within the thread. Then it may happen
@ -39,14 +40,14 @@ static void tfifo_thread_thread(struct k_fifo *pfifo)
*/
k_thread_abort(tid);
zassert_is_null(ret,
"k_fifo_get didn't get 'timeout expired' status");
"k_fifo_get didn't get 'timeout expired' status");
/* 80 includes generous fuzz factor as k_sleep() will add an extra
* tick for non-tickless systems, and we may cross another tick
* boundary while doing this. We just want to ensure we didn't
* hit the timeout anyway.
*/
zassert_true(dur < 80,
"k_fifo_get didn't get cancelled in expected timeframe");
"k_fifo_get didn't get cancelled in expected timeframe");
}
/*test cases*/

View file

@ -40,7 +40,7 @@ static void tfifo_put(struct k_fifo *pfifo)
}
/**TESTPOINT: fifo put list*/
static fdata_t *head = &data_l[0], *tail = &data_l[LIST_LEN-1];
static fdata_t *head = &data_l[0], *tail = &data_l[LIST_LEN - 1];
head->snode.next = (sys_snode_t *)tail;
tail->snode.next = NULL;
@ -101,8 +101,8 @@ static void tfifo_thread_thread(struct k_fifo *pfifo)
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: thread-thread data passing via fifo*/
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
tThread_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
tThread_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
tfifo_put(pfifo);
k_sem_take(&end_sema, K_FOREVER);
k_thread_abort(tid);

View file

@ -83,8 +83,8 @@ static void tfifo_read_write(struct k_fifo *pfifo)
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: thread-isr-thread data passing via fifo*/
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
tThread_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
tThread_entry, pfifo, NULL, NULL,
K_PRIO_PREEMPT(0), 0, 0);
TC_PRINT("main fifo put ---> ");
tfifo_put(pfifo);