diff --git a/libc-test/src/functional/pthread_getname_np.c b/libc-test/src/functional/pthread_getname_np.c index 19a46c61a70d64ea9bfbaa6ef426ca33a8d65fbc..37cd3d3ce19475ae2f4cc0c23ecb7d8e16e3fde1 100644 --- a/libc-test/src/functional/pthread_getname_np.c +++ b/libc-test/src/functional/pthread_getname_np.c @@ -14,7 +14,7 @@ static void *threadfunc(void *parm) { - sleep(5); // allow main program to set the thread name + sleep(1); // allow main program to set the thread name return NULL; } @@ -24,8 +24,8 @@ int main(int argc, char **argv) int rc; char thread_name[NAMELEN]; char set_thread_name[] = "THREADFOO"; - char default_name[] = "pthread_getname_np"; - + char default_name[] = "pthread_getname"; + rc = pthread_getname_np(pthread_self(), thread_name, NAMELEN); if (rc != 0) errExitEN(rc, "pthread_getname_np failed"); if(strcmp(thread_name, default_name) != 0) perror("pthread name comparison failed"); @@ -36,8 +36,6 @@ int main(int argc, char **argv) rc = pthread_setname_np(thread, (argc > 1) ? argv[1] : set_thread_name); if (rc != 0) errExitEN(rc, "pthread_setname_np failed"); - sleep(2); - rc = pthread_getname_np(thread, thread_name, (argc > 2) ? atoi(argv[1]) : NAMELEN); if (rc != 0) errExitEN(rc, "pthread_getname_np failed"); if(strcmp(thread_name, set_thread_name) != 0) perror("pthread name comparison failed"); diff --git a/libc-test/src/functional/pthread_gettid_np.c b/libc-test/src/functional/pthread_gettid_np.c index 71d8311df146d40a089b985b69e87bb3f0c0f6ad..7d4c7608b8cf6b4b0d6199a2528775ca733fceab 100644 --- a/libc-test/src/functional/pthread_gettid_np.c +++ b/libc-test/src/functional/pthread_gettid_np.c @@ -7,29 +7,22 @@ #define TEST(c, ...) ((c) ? 1 : (t_error(#c" failed: " __VA_ARGS__),0)) -static pthread_mutex_t mutex ; - void* pthread_test(void* arg) { - pthread_mutex_lock(&mutex); *((pid_t *)arg) = gettid(); - pthread_mutex_unlock(&mutex); return NULL; } int main(int argc, char const *argv[]) { - pthread_mutex_init(&mutex, NULL); TEST(gettid() == pthread_gettid_np(pthread_self()),"pthread_gettid_np() is failed\n"); - pthread_mutex_lock(&mutex); pid_t tid; pthread_t t; pthread_create(&t,NULL,pthread_test,&tid); pid_t recv_result = pthread_gettid_np(t); TEST(0 == pthread_join(t,NULL),"pthread_join is failed\n"); - pthread_mutex_unlock(&mutex); TEST(tid == recv_result,"the tid of pthread or tid of pthread_gettid_np() is wrong\n"); return 0; } \ No newline at end of file diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 4184cdc3a687282d1c174621aa3b1d076e26e338..ce42a8281570aae38c96e155ec909fb5a9eec17d 100755 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -72,6 +72,9 @@ do || [ -d $file ] then continue + elif [ "$file" = "tgkill" ] + then + src/common/runtest -w '' $dir/$file 12345 34567 >> src/REPORT else # echo file=$dir/$file src/common/runtest -w '' $dir/$file >> src/REPORT