summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-12-21 11:50:22 +0800
committerGrissiom <[email protected]>2013-12-21 11:59:21 +0800
commit6b02886eb381e5758a3977444e5d4d78419e8c5a (patch)
treecbc50106975a804d12eab425c0ccf3313927f078 /examples
parentca270a46678b8de14fc23b2851ef84d265f29268 (diff)
TC: print a summary after all the tests
Diffstat (limited to 'examples')
-rw-r--r--examples/kernel/tc_comm.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/examples/kernel/tc_comm.c b/examples/kernel/tc_comm.c
index ac4b36d8be..bdc6471b3f 100644
--- a/examples/kernel/tc_comm.c
+++ b/examples/kernel/tc_comm.c
@@ -20,6 +20,7 @@ FINSH_VAR_EXPORT(_tc_scale, finsh_type_int, the testcase timer timeout scale)
void tc_thread_entry(void* parameter)
{
+ unsigned int fail_count = 0;
struct finsh_syscall* index;
/* create tc semaphore */
@@ -59,17 +60,30 @@ void tc_thread_entry(void* parameter)
_tc_current);
/* If the TC forgot to clear the flag, we do it. */
_tc_stat &= ~TC_STAT_RUNNING;
- }
+ }
- if (_tc_stat & TC_STAT_FAILED)
- rt_kprintf("TestCase[%s] failed\n", _tc_current);
- else
- rt_kprintf("TestCase[%s] passed\n", _tc_current);
+ if (_tc_stat & TC_STAT_FAILED)
+ {
+ rt_kprintf("TestCase[%s] failed\n", _tc_current);
+ fail_count++;
+ }
+ else
+ {
+ rt_kprintf("TestCase[%s] passed\n", _tc_current);
+ }
}
}
}
rt_kprintf("RT-Thread TestCase Running Done!\n");
+ if (fail_count)
+ {
+ rt_kprintf("%d tests failed\n", fail_count);
+ }
+ else
+ {
+ rt_kprintf("All tests passed\n");
+ }
/* detach tc semaphore */
rt_sem_detach(&_tc_sem);
}