1 #include <utest.h> 2 #include <pthread.h> posix_unit_test(void)3static void posix_unit_test(void) 4 { 5 pthread_t new_th; /* Create a new thread. */ 6 int err_val; 7 8 if (pthread_create(&new_th, NULL, (void *(*)(void *))posix_testcase, NULL) != 0) { 9 perror("Error creating thread\n"); 10 } 11 12 /* Wait for thread to return */ 13 if (pthread_join(new_th, (void*)&err_val) != 0) { 14 perror("Error in pthread_join()\n"); 15 } 16 17 rt_thread_mdelay(1000); 18 19 uassert_true(err_val == 0); 20 } testcase(void)21static void testcase(void) 22 { 23 UTEST_UNIT_RUN(posix_unit_test); 24 } 25