提交 80ff88b2 编写于 作者: B Bernard Xiong

Merge pull request #220 from grissiom/more-tc

[RFC] More tc
...@@ -18,6 +18,8 @@ static void (*_tc_cleanup)(void) = RT_NULL; ...@@ -18,6 +18,8 @@ static void (*_tc_cleanup)(void) = RT_NULL;
static rt_uint32_t _tc_scale = 1; static rt_uint32_t _tc_scale = 1;
FINSH_VAR_EXPORT(_tc_scale, finsh_type_int, the testcase timer timeout scale) FINSH_VAR_EXPORT(_tc_scale, finsh_type_int, the testcase timer timeout scale)
static rt_uint32_t _tc_loop;
void tc_thread_entry(void* parameter) void tc_thread_entry(void* parameter)
{ {
unsigned int fail_count = 0; unsigned int fail_count = 0;
...@@ -26,8 +28,7 @@ void tc_thread_entry(void* parameter) ...@@ -26,8 +28,7 @@ void tc_thread_entry(void* parameter)
/* create tc semaphore */ /* create tc semaphore */
rt_sem_init(&_tc_sem, "tc", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&_tc_sem, "tc", 0, RT_IPC_FLAG_FIFO);
while (_tc_stat & TC_STAT_RUNNING) do {
{
for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
/* search testcase */ /* search testcase */
...@@ -73,7 +74,7 @@ void tc_thread_entry(void* parameter) ...@@ -73,7 +74,7 @@ void tc_thread_entry(void* parameter)
} }
} }
} }
} } while (_tc_loop);
rt_kprintf("RT-Thread TestCase Running Done!\n"); rt_kprintf("RT-Thread TestCase Running Done!\n");
if (fail_count) if (fail_count)
...@@ -90,9 +91,9 @@ void tc_thread_entry(void* parameter) ...@@ -90,9 +91,9 @@ void tc_thread_entry(void* parameter)
void tc_stop() void tc_stop()
{ {
_tc_stat &= ~TC_STAT_RUNNING; _tc_loop = 0;
rt_thread_delay(RT_TICK_PER_SECOND/2); rt_thread_delay(10 * RT_TICK_PER_SECOND);
if (_tc_thread.stat != RT_THREAD_INIT) if (_tc_thread.stat != RT_THREAD_INIT)
{ {
/* lock scheduler */ /* lock scheduler */
...@@ -155,9 +156,9 @@ void tc_start(const char* tc_prefix) ...@@ -155,9 +156,9 @@ void tc_start(const char* tc_prefix)
rt_snprintf(_tc_prefix, sizeof(_tc_prefix), "_tc_%s", tc_prefix); rt_snprintf(_tc_prefix, sizeof(_tc_prefix), "_tc_%s", tc_prefix);
result = rt_thread_init(&_tc_thread, "tc", result = rt_thread_init(&_tc_thread, "tc",
tc_thread_entry, RT_NULL, tc_thread_entry, RT_NULL,
&_tc_stack[0], sizeof(_tc_stack), &_tc_stack[0], sizeof(_tc_stack),
TC_PRIORITY - 3, 5); TC_PRIORITY - 3, 5);
/* set tc stat */ /* set tc stat */
_tc_stat = TC_STAT_RUNNING | TC_STAT_FAILED; _tc_stat = TC_STAT_RUNNING | TC_STAT_FAILED;
...@@ -167,6 +168,13 @@ void tc_start(const char* tc_prefix) ...@@ -167,6 +168,13 @@ void tc_start(const char* tc_prefix)
} }
FINSH_FUNCTION_EXPORT(tc_start, start testcase with testcase prefix or name); FINSH_FUNCTION_EXPORT(tc_start, start testcase with testcase prefix or name);
void tc_loop(const char *tc_prefix)
{
_tc_loop = 1;
tc_start(tc_prefix);
}
FINSH_FUNCTION_EXPORT(tc_loop, start testcase with testcase prefix or name in loop mode);
void list_tc() void list_tc()
{ {
struct finsh_syscall* index; struct finsh_syscall* index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册