@@ -191,7 +191,7 @@ static int utest_help(void)
191
191
return 0 ;
192
192
}
193
193
194
- static void utest_run (const char * utest_name )
194
+ static void utest_do_run (const char * utest_name )
195
195
{
196
196
rt_size_t i ;
197
197
rt_uint32_t index ;
@@ -304,41 +304,55 @@ static void utest_thr_entry(const char *utest_name)
304
304
{
305
305
/* see commit:0dc7b9a for details */
306
306
rt_thread_mdelay (1000 );
307
+ utest_do_run (utest_name );
308
+ }
307
309
308
- utest_run (utest_name );
310
+ static void utest_thread_create (const char * utest_name )
311
+ {
312
+ rt_thread_t tid = RT_NULL ;
313
+ tid = rt_thread_create ("utest" ,
314
+ (void (* )(void * ))utest_thr_entry , RT_NULL /*utest_name*/ ,
315
+ UTEST_THREAD_STACK_SIZE , UTEST_THREAD_PRIORITY , 10 );
316
+ if (tid != RT_NULL )
317
+ {
318
+ rt_thread_startup (tid );
319
+ }
309
320
}
310
321
311
- long utest_testcase_run (int argc , char * * argv )
322
+ #ifdef RT_USING_CI_ACTION
323
+ static int utest_ci_action (void )
312
324
{
325
+ tc_loop = 1 ;
326
+ utest_thread_create (RT_NULL );
327
+ return RT_EOK ;
328
+ }
329
+ INIT_APP_EXPORT (utest_ci_action );
330
+ #endif /* RT_USING_CI_ACTION */
313
331
332
+ long utest_testcase_run (int argc , char * * argv )
333
+ {
314
334
static char utest_name [UTEST_NAME_MAX_LEN ];
315
335
rt_memset (utest_name , 0x0 , sizeof (utest_name ));
316
336
317
337
tc_loop = 1 ;
318
338
319
339
if (argc == 1 )
320
340
{
321
- utest_run (RT_NULL );
322
- return 0 ;
341
+ utest_thread_create (RT_NULL );
323
342
}
324
343
else if (argc == 2 || argc == 3 || argc == 4 )
325
344
{
326
345
if (rt_strcmp (argv [1 ], "-thread" ) == 0 )
327
346
{
328
- rt_thread_t tid = RT_NULL ;
329
347
if (argc == 3 || argc == 4 )
330
348
{
331
349
rt_strncpy (utest_name , argv [2 ], sizeof (utest_name ) - 1 );
332
-
333
- if (argc == 4 ) tc_loop = atoi (argv [3 ]);
334
- }
335
- tid = rt_thread_create ("utest" ,
336
- (void (* )(void * ))utest_thr_entry , utest_name ,
337
- UTEST_THREAD_STACK_SIZE , UTEST_THREAD_PRIORITY , 10 );
338
- if (tid != NULL )
339
- {
340
- rt_thread_startup (tid );
350
+ if (argc == 4 )
351
+ {
352
+ tc_loop = atoi (argv [3 ]);
353
+ }
341
354
}
355
+ utest_thread_create (utest_name );
342
356
}
343
357
else if (rt_strcmp (argv [1 ], "-help" ) == 0 )
344
358
{
@@ -348,7 +362,7 @@ long utest_testcase_run(int argc, char** argv)
348
362
{
349
363
rt_strncpy (utest_name , argv [1 ], sizeof (utest_name ) - 1 );
350
364
if (argc == 3 ) tc_loop = atoi (argv [2 ]);
351
- utest_run (utest_name );
365
+ utest_do_run (utest_name );
352
366
}
353
367
}
354
368
else
0 commit comments