Merge pull request #218 from grissiom/more-tc

More tc
This commit is contained in:
Bernard Xiong 2013-12-21 04:12:41 -08:00
commit 99d56ba766
27 changed files with 1427 additions and 1419 deletions

View File

@ -25,9 +25,13 @@ static void thread_entry(void* parameter)
result = rt_sem_take(sem, 10); result = rt_sem_take(sem, 10);
if (result == -RT_ETIMEOUT) if (result == -RT_ETIMEOUT)
{ {
/* 判断是否刚好过去10个OS Tick */ rt_tick_t new_tick = rt_tick_get();
if (rt_tick_get() - tick != 10) /* 可以有两个 tick 的误差 */
if (new_tick - tick >= 12)
{ {
rt_kprintf("tick error to large: expect: 10, get %d\n",
new_tick - tick);
/* 如果失败,则测试失败 */ /* 如果失败,则测试失败 */
tc_done(TC_STAT_FAILED); tc_done(TC_STAT_FAILED);
rt_sem_delete(sem); rt_sem_delete(sem);

View File

@ -27,9 +27,13 @@ static void thread_entry(void* parameter)
result = rt_sem_take(&sem, 10); result = rt_sem_take(&sem, 10);
if (result == -RT_ETIMEOUT) if (result == -RT_ETIMEOUT)
{ {
/* 超时后判断是否刚好是10个OS Tick */ rt_tick_t new_tick = rt_tick_get();
if (rt_tick_get() - tick != 10) /* 可以有两个 tick 的误差 */
if (new_tick - tick >= 12)
{ {
rt_kprintf("tick error to large: expect: 10, get %d\n",
new_tick - tick);
tc_done(TC_STAT_FAILED); tc_done(TC_STAT_FAILED);
rt_sem_detach(&sem); rt_sem_detach(&sem);
return; return;

View File

@ -14,7 +14,7 @@ static void thread_entry(void* parameter)
rt_kprintf("thread delay 10 tick\n"); rt_kprintf("thread delay 10 tick\n");
tick = rt_tick_get(); tick = rt_tick_get();
rt_thread_delay(10); rt_thread_delay(10);
if (rt_tick_get() - tick > 10) if (rt_tick_get() - tick > 11)
{ {
tc_done(TC_STAT_FAILED); tc_done(TC_STAT_FAILED);
return; return;
@ -23,7 +23,7 @@ static void thread_entry(void* parameter)
rt_kprintf("thread delay 15 tick\n"); rt_kprintf("thread delay 15 tick\n");
tick = rt_tick_get(); tick = rt_tick_get();
rt_thread_delay(15); rt_thread_delay(15);
if (rt_tick_get() - tick > 15) if (rt_tick_get() - tick > 16)
{ {
tc_done(TC_STAT_FAILED); tc_done(TC_STAT_FAILED);
return; return;