diff options
| author | Bernard Xiong <[email protected]> | 2013-12-18 18:05:31 -0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2013-12-18 18:05:31 -0800 |
| commit | 0e8b23ff954fe2164ea5aedc4efc334982158b62 (patch) | |
| tree | 09043f8117d205b3be4c308004948d357e6851c7 /examples/kernel/tc_comm.c | |
| parent | cb347f5af05be87d673ec7c53662eb5e61ed681d (diff) | |
| parent | a51b5799f73c7fb6df3d53d540b94fa85fb283c1 (diff) | |
Merge pull request #212 from grissiom/fix-tc
Fix tc
Diffstat (limited to 'examples/kernel/tc_comm.c')
| -rw-r--r-- | examples/kernel/tc_comm.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/examples/kernel/tc_comm.c b/examples/kernel/tc_comm.c index 60d843171f..7804701284 100644 --- a/examples/kernel/tc_comm.c +++ b/examples/kernel/tc_comm.c @@ -37,34 +37,25 @@ void tc_thread_entry(void* parameter) _tc_current = index->name + 4; rt_kprintf("Run TestCase: %s\n", _tc_current); _tc_stat = TC_STAT_PASSED | TC_STAT_RUNNING; - tick = index->func(); - if (tick > 0) - { - rt_sem_take(&_tc_sem, tick * _tc_scale); + tick = index->func(); + if (tick > 0) + { + /* Make sure we are going to be blocked. */ + rt_sem_control(&_tc_sem, RT_IPC_CMD_RESET, 0); + rt_sem_take(&_tc_sem, tick * _tc_scale); + } - if (_tc_cleanup != RT_NULL) - { - /* perform testcase cleanup */ - _tc_cleanup(); - _tc_cleanup = RT_NULL; - } + if (_tc_cleanup != RT_NULL) + { + /* perform testcase cleanup */ + _tc_cleanup(); + _tc_cleanup = RT_NULL; + } - rt_sem_trytake(&_tc_sem);/* by nl1031 */ - - if (_tc_stat & TC_STAT_FAILED) - rt_kprintf("TestCase[%s] failed\n", _tc_current); - else - rt_kprintf("TestCase[%s] passed\n", _tc_current); - } - else - { - if (_tc_cleanup != RT_NULL) - { - /* perform testcase cleanup */ - _tc_cleanup(); - _tc_cleanup = RT_NULL; - } - } + if (_tc_stat & TC_STAT_FAILED) + rt_kprintf("TestCase[%s] failed\n", _tc_current); + else + rt_kprintf("TestCase[%s] passed\n", _tc_current); } } } |
