Lines Matching refs:ASSERT_EQ
55 ASSERT_EQ(0, pthread_key_create(&key, nullptr)); in TEST()
56 ASSERT_EQ(0, pthread_key_delete(key)); in TEST()
58 ASSERT_EQ(EINVAL, pthread_key_delete(key)); in TEST()
68 ASSERT_EQ(sysconf_max, PTHREAD_KEYS_MAX); in TEST()
86 ASSERT_EQ(0, pthread_key_create(&key, nullptr)) << i << " of " << nkeys; in TEST()
88 ASSERT_EQ(0, pthread_setspecific(key, reinterpret_cast<void*>(i))); in TEST()
92 ASSERT_EQ(reinterpret_cast<void*>(i), pthread_getspecific(keys.back())); in TEST()
95 ASSERT_EQ(0, pthread_key_delete(key)); in TEST()
123 ASSERT_EQ(EAGAIN, rv); in TEST()
129 ASSERT_EQ(0, pthread_key_create(&key, nullptr)); in TEST()
130 ASSERT_EQ(0, pthread_setspecific(key, expected)); in TEST()
131 ASSERT_EQ(expected, pthread_getspecific(key)); in TEST()
132 ASSERT_EQ(0, pthread_key_delete(key)); in TEST()
134 ASSERT_EQ(nullptr, pthread_getspecific(key)); in TEST()
136 ASSERT_EQ(EINVAL, pthread_setspecific(key, expected)); in TEST()
142 ASSERT_EQ(0, pthread_key_create(&key, nullptr)); in TEST()
143 ASSERT_EQ(0, pthread_setspecific(key, expected)); in TEST()
144 ASSERT_EQ(expected, pthread_getspecific(key)); in TEST()
151 ASSERT_EQ(expected, pthread_getspecific(key)); in TEST()
157 ASSERT_EQ(expected, pthread_getspecific(key)); in TEST()
158 ASSERT_EQ(0, pthread_key_delete(key)); in TEST()
167 ASSERT_EQ(0, pthread_key_create(&key, nullptr)); in TEST()
175 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
176 ASSERT_EQ(0, pthread_attr_setstack(&attr, stack, stack_size)); in TEST()
179 ASSERT_EQ(0, pthread_create(&t, &attr, DirtyKeyFn, &key)); in TEST()
182 ASSERT_EQ(0, pthread_join(t, &result)); in TEST()
183 ASSERT_EQ(nullptr, result); // Not ~0! in TEST()
185 ASSERT_EQ(0, munmap(stack, stack_size)); in TEST()
186 ASSERT_EQ(0, pthread_key_delete(key)); in TEST()
203 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
204 ASSERT_EQ(0, pthread_attr_setstack(&attr, stack.get(), stack_size)); in TEST()
207 ASSERT_EQ(0, pthread_create(&t, &attr, FnWithStackFrame, nullptr)); in TEST()
210 ASSERT_EQ(0, pthread_join(t, &result)); in TEST()
218 ASSERT_EQ(nullptr, pthread_getspecific(key)); in TEST()
219 ASSERT_EQ(EINVAL, pthread_setspecific(key, nullptr)); in TEST()
220 ASSERT_EQ(EINVAL, pthread_key_delete(key)); in TEST()
267 ASSERT_EQ(0, pthread_getattr_np(t, &attr)); in AssertDetached()
269 ASSERT_EQ(0, pthread_attr_getdetachstate(&attr, &detach_state)); in AssertDetached()
271 ASSERT_EQ(is_detached, (detach_state == PTHREAD_CREATE_DETACHED)); in AssertDetached()
275 ASSERT_EQ(0, pthread_create(&t, nullptr, IdFn, nullptr)); in MakeDeadThread()
276 ASSERT_EQ(0, pthread_join(t, nullptr)); in MakeDeadThread()
283 ASSERT_EQ(0, pthread_create(&t, nullptr, IdFn, expected_result)); in TEST()
286 ASSERT_EQ(0, pthread_join(t, &result)); in TEST()
287 ASSERT_EQ(expected_result, result); in TEST()
292 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
293 …ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, static_cast<size_t>(-1) & ~(getpagesize() - 1)… in TEST()
296 ASSERT_EQ(EAGAIN, pthread_create(&t, &attributes, IdFn, nullptr)); in TEST()
303 ASSERT_EQ(0, pthread_create(&t1, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
306 ASSERT_EQ(0, pthread_detach(t1)); in TEST()
310 ASSERT_EQ(EINVAL, pthread_join(t1, nullptr)); in TEST()
317 ASSERT_EQ(0, pthread_create(&t1, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
321 ASSERT_EQ(0, pthread_create(&t2, nullptr, JoinFn, reinterpret_cast<void*>(t1))); in TEST()
326 ASSERT_EQ(EINVAL, pthread_detach(t1)); in TEST()
328 ASSERT_EQ(0, pthread_detach(t1)); in TEST()
336 ASSERT_EQ(0, pthread_join(t2, &join_result)); in TEST()
337 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result)); in TEST()
341 ASSERT_EQ(EDEADLK, pthread_join(pthread_self(), nullptr)); in TEST()
351 ASSERT_EQ(0, pthread_mutex_init(&data.mutex, nullptr)); in main()
352 ASSERT_EQ(0, pthread_mutex_lock(&data.mutex)); in main()
355 …ASSERT_EQ(0, pthread_create(&t, nullptr, TestBug37410::thread_fn, reinterpret_cast<void*>(&data))); in main()
358 ASSERT_EQ(0, pthread_mutex_lock(&data.mutex)); in main()
359 ASSERT_EQ(0, pthread_mutex_unlock(&data.mutex)); in main()
399 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, nullptr, &original_set)); in TEST()
406 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, &set, nullptr)); in TEST()
411 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, nullptr, &final_set)); in TEST()
415 ASSERT_EQ(0, sigprocmask(SIG_BLOCK, nullptr, &final_set)); in TEST()
421 ASSERT_EQ(0, pthread_create(&signal_thread, nullptr, SignalHandlerFn, &received_signal)); in TEST()
428 ASSERT_EQ(0, pthread_join(signal_thread, &join_result)); in TEST()
429 ASSERT_EQ(SIGUSR1, received_signal); in TEST()
430 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result)); in TEST()
433 ASSERT_EQ(0, pthread_sigmask(SIG_SETMASK, &original_set, nullptr)); in TEST()
440 ASSERT_EQ(0, pthread_sigmask64(SIG_BLOCK, nullptr, &original_set)); in TEST()
447 ASSERT_EQ(0, pthread_sigmask64(SIG_BLOCK, &set, nullptr)); in TEST()
452 ASSERT_EQ(0, pthread_sigmask64(SIG_BLOCK, nullptr, &final_set)); in TEST()
456 ASSERT_EQ(0, sigprocmask64(SIG_BLOCK, nullptr, &final_set)); in TEST()
462 ASSERT_EQ(0, pthread_create(&signal_thread, nullptr, SignalHandlerFn, &received_signal)); in TEST()
469 ASSERT_EQ(0, pthread_join(signal_thread, &join_result)); in TEST()
470 ASSERT_EQ(SIGRTMIN, received_signal); in TEST()
471 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result)); in TEST()
474 ASSERT_EQ(0, pthread_sigmask64(SIG_SETMASK, &original_set, nullptr)); in TEST()
478 ASSERT_EQ(0, pthread_setname_np(t, "short")); in test_pthread_setname_np__pthread_getname_np()
480 ASSERT_EQ(0, pthread_getname_np(t, name, sizeof(name))); in test_pthread_setname_np__pthread_getname_np()
484 ASSERT_EQ(0, pthread_setname_np(t, "123456789012345")); in test_pthread_setname_np__pthread_getname_np()
485 ASSERT_EQ(0, pthread_getname_np(t, name, sizeof(name))); in test_pthread_setname_np__pthread_getname_np()
488 ASSERT_EQ(ERANGE, pthread_setname_np(t, "1234567890123456")); in test_pthread_setname_np__pthread_getname_np()
491 ASSERT_EQ(0, pthread_getname_np(t, name, 16)); in test_pthread_setname_np__pthread_getname_np()
492 ASSERT_EQ(ERANGE, pthread_getname_np(t, name, 15)); in test_pthread_setname_np__pthread_getname_np()
503 ASSERT_EQ(0, pthread_create(&t, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
506 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
512 ASSERT_EQ(0, prctl(PR_SET_DUMPABLE, 0)) << strerror(errno); in TEST()
517 ASSERT_EQ(0, pthread_create(&t, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
520 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
554 ASSERT_EQ(0, pthread_kill(pthread_self(), 0)); in TEST()
558 ASSERT_EQ(EINVAL, pthread_kill(pthread_self(), -1)); in TEST()
563 ASSERT_EQ(SIGALRM, signal_number); in pthread_kill__in_signal_handler_helper()
566 ASSERT_EQ(0, pthread_kill(pthread_self(), SIGALRM)); in pthread_kill__in_signal_handler_helper()
572 ASSERT_EQ(0, pthread_kill(pthread_self(), SIGALRM)); in TEST()
578 ASSERT_EQ(0, pthread_create(&thread, nullptr, in TEST()
591 ASSERT_EQ(ESRCH, pthread_kill(thread, 0)); in TEST()
611 ASSERT_EQ(0, pthread_create(&t, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
614 ASSERT_EQ(0, pthread_getcpuclockid(t, &c)); in TEST()
616 ASSERT_EQ(0, clock_gettime(c, &ts)); in TEST()
618 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
713 ASSERT_EQ(0, pthread_create(&t1, nullptr, spin_helper.GetFunction(), nullptr)); in TEST()
716 ASSERT_EQ(0, pthread_create(&t2, nullptr, JoinFn, reinterpret_cast<void*>(t1))); in TEST()
721 ASSERT_EQ(EINVAL, pthread_join(t1, nullptr)); in TEST()
727 ASSERT_EQ(0, pthread_join(t2, &join_result)); in TEST()
728 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result)); in TEST()
743 ASSERT_EQ(0, pthread_create(&t, &a, IdFn, nullptr)); in TEST()
744 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
745 ASSERT_EQ(0, munmap(stack, stack_size)); in TEST()
781 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
784 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 128)); in TEST()
786 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size)); in TEST()
787 ASSERT_EQ(128U, guard_size); in TEST()
788 ASSERT_EQ(static_cast<unsigned long>(getpagesize()), GetActualGuardSize(attributes)); in TEST()
793 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
796 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 32*1024)); in TEST()
798 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size)); in TEST()
799 ASSERT_EQ(32*1024U, guard_size); in TEST()
800 ASSERT_EQ(32*1024U, GetActualGuardSize(attributes)); in TEST()
805 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
808 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 32*1024 + 1)); in TEST()
810 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size)); in TEST()
811 ASSERT_EQ(32*1024U + 1, guard_size); in TEST()
812 ASSERT_EQ(roundup(32 * 1024U + 1, getpagesize()), GetActualGuardSize(attributes)); in TEST()
817 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
822 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 32*1024*1024)); in TEST()
824 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size)); in TEST()
825 ASSERT_EQ(32*1024*1024U, guard_size); in TEST()
826 ASSERT_EQ(32*1024*1024U, GetActualGuardSize(attributes)); in TEST()
831 ASSERT_EQ(0, pthread_attr_init(&attributes)); in TEST()
835 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &default_stack_size)); in TEST()
838 ASSERT_EQ(EINVAL, pthread_attr_setstacksize(&attributes, 128)); in TEST()
840 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size)); in TEST()
841 ASSERT_EQ(default_stack_size, stack_size); in TEST()
845 ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, 32*1024)); in TEST()
846 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size)); in TEST()
847 ASSERT_EQ(32*1024U, stack_size); in TEST()
851 ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, 32*1024 + 1)); in TEST()
852 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size)); in TEST()
853 ASSERT_EQ(32*1024U + 1, stack_size); in TEST()
858 ASSERT_EQ(GetActualStackSize(attributes), 32*1024U); in TEST()
864 ASSERT_EQ(0, pthread_rwlockattr_init(&attr)); in TEST()
868 ASSERT_EQ(0, pthread_rwlockattr_setpshared(&attr, pshared_value_array[i])); in TEST()
870 ASSERT_EQ(0, pthread_rwlockattr_getpshared(&attr, &pshared)); in TEST()
871 ASSERT_EQ(pshared_value_array[i], pshared); in TEST()
879 ASSERT_EQ(0, pthread_rwlockattr_setkind_np(&attr, kind_array[i])); in TEST()
881 ASSERT_EQ(0, pthread_rwlockattr_getkind_np(&attr, &kind)); in TEST()
882 ASSERT_EQ(kind_array[i], kind); in TEST()
886 ASSERT_EQ(0, pthread_rwlockattr_destroy(&attr)); in TEST()
892 ASSERT_EQ(0, pthread_rwlock_init(&lock2, nullptr)); in TEST()
893 ASSERT_EQ(0, memcmp(&lock1, &lock2, sizeof(lock1))); in TEST()
898 ASSERT_EQ(0, pthread_rwlock_init(&l, nullptr)); in TEST()
901 ASSERT_EQ(0, pthread_rwlock_rdlock(&l)); in TEST()
902 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
905 ASSERT_EQ(0, pthread_rwlock_rdlock(&l)); in TEST()
906 ASSERT_EQ(0, pthread_rwlock_rdlock(&l)); in TEST()
907 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
908 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
911 ASSERT_EQ(0, pthread_rwlock_wrlock(&l)); in TEST()
912 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
915 ASSERT_EQ(0, pthread_rwlock_trywrlock(&l)); in TEST()
916 ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l)); in TEST()
917 ASSERT_EQ(EBUSY, pthread_rwlock_tryrdlock(&l)); in TEST()
918 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
921 ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l)); in TEST()
922 ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l)); in TEST()
923 ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l)); in TEST()
924 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
925 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
928 ASSERT_EQ(0, pthread_rwlock_wrlock(&l)); in TEST()
929 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
932 ASSERT_EQ(0, pthread_rwlock_wrlock(&l)); in TEST()
933 ASSERT_EQ(EDEADLK, pthread_rwlock_rdlock(&l)); in TEST()
934 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
937 ASSERT_EQ(0, pthread_rwlock_wrlock(&l)); in TEST()
938 ASSERT_EQ(EDEADLK, pthread_rwlock_wrlock(&l)); in TEST()
939 ASSERT_EQ(0, pthread_rwlock_unlock(&l)); in TEST()
941 ASSERT_EQ(0, pthread_rwlock_destroy(&l)); in TEST()
963 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_INITIALIZED, arg->progress); in pthread_rwlock_wakeup_helper()
966 ASSERT_EQ(EBUSY, arg->trylock_function(&arg->lock)); in pthread_rwlock_wakeup_helper()
967 ASSERT_EQ(0, arg->lock_function(&arg->lock)); in pthread_rwlock_wakeup_helper()
968 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_RELEASED, arg->progress); in pthread_rwlock_wakeup_helper()
969 ASSERT_EQ(0, pthread_rwlock_unlock(&arg->lock)); in pthread_rwlock_wakeup_helper()
976 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, nullptr)); in test_pthread_rwlock_reader_wakeup_writer()
977 ASSERT_EQ(0, pthread_rwlock_rdlock(&wakeup_arg.lock)); in test_pthread_rwlock_reader_wakeup_writer()
984 ASSERT_EQ(0, pthread_create(&thread, nullptr, in test_pthread_rwlock_reader_wakeup_writer()
987 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress); in test_pthread_rwlock_reader_wakeup_writer()
990 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock)); in test_pthread_rwlock_reader_wakeup_writer()
992 ASSERT_EQ(0, pthread_join(thread, nullptr)); in test_pthread_rwlock_reader_wakeup_writer()
993 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_ACCESSED, wakeup_arg.progress); in test_pthread_rwlock_reader_wakeup_writer()
994 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock)); in test_pthread_rwlock_reader_wakeup_writer()
1003 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
1013 ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts)); in TEST()
1025 ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts)); in TEST()
1031 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
1043 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, nullptr)); in test_pthread_rwlock_writer_wakeup_reader()
1044 ASSERT_EQ(0, pthread_rwlock_wrlock(&wakeup_arg.lock)); in test_pthread_rwlock_writer_wakeup_reader()
1051 ASSERT_EQ(0, pthread_create(&thread, nullptr, in test_pthread_rwlock_writer_wakeup_reader()
1054 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress); in test_pthread_rwlock_writer_wakeup_reader()
1057 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock)); in test_pthread_rwlock_writer_wakeup_reader()
1059 ASSERT_EQ(0, pthread_join(thread, nullptr)); in test_pthread_rwlock_writer_wakeup_reader()
1060 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_ACCESSED, wakeup_arg.progress); in test_pthread_rwlock_writer_wakeup_reader()
1061 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock)); in test_pthread_rwlock_writer_wakeup_reader()
1070 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
1080 ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts)); in TEST()
1092 ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts)); in TEST()
1098 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
1110 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_INITIALIZED, arg->progress); in pthread_rwlock_wakeup_timeout_helper()
1113 ASSERT_EQ(EBUSY, arg->trylock_function(&arg->lock)); in pthread_rwlock_wakeup_timeout_helper()
1116 ASSERT_EQ(0, clock_gettime(arg->clock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1117 ASSERT_EQ(ETIMEDOUT, arg->timed_lock_function(&arg->lock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1119 ASSERT_EQ(EINVAL, arg->timed_lock_function(&arg->lock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1121 ASSERT_EQ(EINVAL, arg->timed_lock_function(&arg->lock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1124 ASSERT_EQ(ETIMEDOUT, arg->timed_lock_function(&arg->lock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1125 ASSERT_EQ(0, clock_gettime(arg->clock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1127 ASSERT_EQ(ETIMEDOUT, arg->timed_lock_function(&arg->lock, &ts)); in pthread_rwlock_wakeup_timeout_helper()
1128 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, arg->progress); in pthread_rwlock_wakeup_timeout_helper()
1135 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, nullptr)); in pthread_rwlock_timedrdlock_timeout_helper()
1136 ASSERT_EQ(0, pthread_rwlock_wrlock(&wakeup_arg.lock)); in pthread_rwlock_timedrdlock_timeout_helper()
1144 ASSERT_EQ(0, pthread_create(&thread, nullptr, in pthread_rwlock_timedrdlock_timeout_helper()
1147 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress); in pthread_rwlock_timedrdlock_timeout_helper()
1149 ASSERT_EQ(0, pthread_join(thread, nullptr)); in pthread_rwlock_timedrdlock_timeout_helper()
1150 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_TIMEDOUT, wakeup_arg.progress); in pthread_rwlock_timedrdlock_timeout_helper()
1151 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock)); in pthread_rwlock_timedrdlock_timeout_helper()
1152 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock)); in pthread_rwlock_timedrdlock_timeout_helper()
1203 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, nullptr)); in pthread_rwlock_timedwrlock_timeout_helper()
1204 ASSERT_EQ(0, pthread_rwlock_rdlock(&wakeup_arg.lock)); in pthread_rwlock_timedwrlock_timeout_helper()
1212 ASSERT_EQ(0, pthread_create(&thread, nullptr, in pthread_rwlock_timedwrlock_timeout_helper()
1215 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress); in pthread_rwlock_timedwrlock_timeout_helper()
1217 ASSERT_EQ(0, pthread_join(thread, nullptr)); in pthread_rwlock_timedwrlock_timeout_helper()
1218 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_TIMEDOUT, wakeup_arg.progress); in pthread_rwlock_timedwrlock_timeout_helper()
1219 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock)); in pthread_rwlock_timedwrlock_timeout_helper()
1220 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock)); in pthread_rwlock_timedwrlock_timeout_helper()
1295 ASSERT_EQ(0, pthread_create(&thread, nullptr, in CreateWriterThread()
1302 ASSERT_EQ(0, pthread_create(&thread, nullptr, in CreateReaderThread()
1309 ASSERT_EQ(0, pthread_rwlockattr_init(&attr)); in InitRwlock()
1310 ASSERT_EQ(0, pthread_rwlockattr_setkind_np(&attr, kind_type)); in InitRwlock()
1311 ASSERT_EQ(0, pthread_rwlock_init(&lock, &attr)); in InitRwlock()
1312 ASSERT_EQ(0, pthread_rwlockattr_destroy(&attr)); in InitRwlock()
1316 ASSERT_EQ(0, pthread_rwlock_destroy(&lock)); in DestroyRwlock()
1323 ASSERT_EQ(0, pthread_rwlock_wrlock(&helper->lock)); in WriterThreadFn()
1324 ASSERT_EQ(0, pthread_rwlock_unlock(&helper->lock)); in WriterThreadFn()
1332 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper->lock)); in ReaderThreadFn()
1333 ASSERT_EQ(0, pthread_rwlock_unlock(&helper->lock)); in ReaderThreadFn()
1342 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper.lock)); in TEST()
1352 ASSERT_EQ(0, pthread_join(reader_thread, nullptr)); in TEST()
1354 ASSERT_EQ(0, pthread_rwlock_unlock(&helper.lock)); in TEST()
1355 ASSERT_EQ(0, pthread_join(writer_thread, nullptr)); in TEST()
1364 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper.lock)); in TEST()
1376 ASSERT_EQ(0, pthread_rwlock_unlock(&helper.lock)); in TEST()
1377 ASSERT_EQ(0, pthread_join(writer_thread, nullptr)); in TEST()
1378 ASSERT_EQ(0, pthread_join(reader_thread, nullptr)); in TEST()
1391 ASSERT_EQ(0, pthread_once(&once_control, OnceFn)); in TEST()
1392 ASSERT_EQ(0, pthread_once(&once_control, OnceFn)); in TEST()
1393 ASSERT_EQ(1, g_once_fn_call_count); in TEST()
1412 ASSERT_EQ(0, pthread_once(&once_control_1, &Routine1)); in TEST()
1413 ASSERT_EQ("12", pthread_once_1934122_result); in TEST()
1427 ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1)); in TEST()
1428 ASSERT_EQ(0, pthread_atfork(AtForkPrepare2, AtForkParent2, AtForkChild2)); in TEST()
1436 ASSERT_EQ(12, g_atfork_child_calls); in TEST()
1439 ASSERT_EQ(12, g_atfork_parent_calls); in TEST()
1442 ASSERT_EQ(21, g_atfork_prepare_calls); in TEST()
1447 ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1)); in TEST()
1448 ASSERT_EQ(0, pthread_atfork(AtForkPrepare2, AtForkParent2, AtForkChild2)); in TEST()
1456 ASSERT_EQ(0, g_atfork_child_calls); in TEST()
1459 ASSERT_EQ(0, g_atfork_parent_calls); in TEST()
1460 ASSERT_EQ(0, g_atfork_prepare_calls); in TEST()
1466 ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1)); in TEST()
1467 ASSERT_EQ(0, pthread_atfork(AtForkPrepare2, AtForkParent2, AtForkChild2)); in TEST()
1475 ASSERT_EQ(0, g_atfork_child_calls); in TEST()
1478 ASSERT_EQ(0, g_atfork_parent_calls); in TEST()
1479 ASSERT_EQ(0, g_atfork_prepare_calls); in TEST()
1486 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
1489 ASSERT_EQ(0, pthread_attr_getscope(&attr, &scope)); in TEST()
1490 ASSERT_EQ(PTHREAD_SCOPE_SYSTEM, scope); in TEST()
1498 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock)); in TEST()
1499 ASSERT_EQ(CLOCK_REALTIME, clock); in TEST()
1502 ASSERT_EQ(0, pthread_condattr_getpshared(&attr, &pshared)); in TEST()
1503 ASSERT_EQ(PTHREAD_PROCESS_PRIVATE, pshared); in TEST()
1510 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_REALTIME)); in TEST()
1512 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock)); in TEST()
1513 ASSERT_EQ(CLOCK_REALTIME, clock); in TEST()
1515 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC)); in TEST()
1516 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock)); in TEST()
1517 ASSERT_EQ(CLOCK_MONOTONIC, clock); in TEST()
1519 ASSERT_EQ(EINVAL, pthread_condattr_setclock(&attr, CLOCK_PROCESS_CPUTIME_ID)); in TEST()
1527 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC)); in TEST()
1528 ASSERT_EQ(0, pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)); in TEST()
1531 ASSERT_EQ(0, pthread_cond_init(&cond_var, &attr)); in TEST()
1533 ASSERT_EQ(0, pthread_cond_signal(&cond_var)); in TEST()
1534 ASSERT_EQ(0, pthread_cond_broadcast(&cond_var)); in TEST()
1538 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock)); in TEST()
1539 ASSERT_EQ(CLOCK_MONOTONIC, clock); in TEST()
1541 ASSERT_EQ(0, pthread_condattr_getpshared(&attr, &pshared)); in TEST()
1542 ASSERT_EQ(PTHREAD_PROCESS_SHARED, pshared); in TEST()
1566 ASSERT_EQ(0, pthread_mutex_init(&mutex, nullptr)); in SetUp()
1571 ASSERT_EQ(0, pthread_condattr_init(&attr)); in InitCond()
1572 ASSERT_EQ(0, pthread_condattr_setclock(&attr, clock)); in InitCond()
1573 ASSERT_EQ(0, pthread_cond_init(&cond, &attr)); in InitCond()
1574 ASSERT_EQ(0, pthread_condattr_destroy(&attr)); in InitCond()
1581 ASSERT_EQ(0, pthread_create(&thread, nullptr, reinterpret_cast<void* (*)(void*)>(WaitThreadFn), in StartWaitingThread()
1593 ASSERT_EQ(0, clock_gettime(clock, &ts)); in RunTimedTest()
1601 ASSERT_EQ(0, pthread_cond_signal(&cond)); in RunTimedTest()
1614 ASSERT_EQ(0, pthread_join(thread, nullptr)); in TearDown()
1615 ASSERT_EQ(FINISHED, progress); in TearDown()
1616 ASSERT_EQ(0, pthread_cond_destroy(&cond)); in TearDown()
1617 ASSERT_EQ(0, pthread_mutex_destroy(&mutex)); in TearDown()
1622 ASSERT_EQ(0, pthread_mutex_lock(&test->mutex)); in WaitThreadFn()
1625 ASSERT_EQ(0, test->wait_function(&test->cond, &test->mutex)); in WaitThreadFn()
1627 ASSERT_EQ(SIGNALED, test->progress); in WaitThreadFn()
1629 ASSERT_EQ(0, pthread_mutex_unlock(&test->mutex)); in WaitThreadFn()
1639 ASSERT_EQ(0, pthread_cond_signal(&cond)); in TEST_F()
1648 ASSERT_EQ(0, pthread_cond_broadcast(&cond)); in TEST_F()
1711 ASSERT_EQ(0, pthread_mutex_init(&mutex, nullptr)); in pthread_cond_timedwait_timeout_helper()
1718 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC)); in pthread_cond_timedwait_timeout_helper()
1720 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock)); in pthread_cond_timedwait_timeout_helper()
1721 ASSERT_EQ(CLOCK_MONOTONIC, clock); in pthread_cond_timedwait_timeout_helper()
1723 ASSERT_EQ(0, pthread_cond_init(&cond, &attr)); in pthread_cond_timedwait_timeout_helper()
1725 ASSERT_EQ(0, pthread_cond_init(&cond, nullptr)); in pthread_cond_timedwait_timeout_helper()
1727 ASSERT_EQ(0, pthread_mutex_lock(&mutex)); in pthread_cond_timedwait_timeout_helper()
1730 ASSERT_EQ(0, clock_gettime(clock, &ts)); in pthread_cond_timedwait_timeout_helper()
1731 ASSERT_EQ(ETIMEDOUT, wait_function(&cond, &mutex, &ts)); in pthread_cond_timedwait_timeout_helper()
1733 ASSERT_EQ(EINVAL, wait_function(&cond, &mutex, &ts)); in pthread_cond_timedwait_timeout_helper()
1735 ASSERT_EQ(EINVAL, wait_function(&cond, &mutex, &ts)); in pthread_cond_timedwait_timeout_helper()
1738 ASSERT_EQ(ETIMEDOUT, wait_function(&cond, &mutex, &ts)); in pthread_cond_timedwait_timeout_helper()
1739 ASSERT_EQ(0, pthread_mutex_unlock(&mutex)); in pthread_cond_timedwait_timeout_helper()
1796 ASSERT_EQ(getpid(), syscall(__NR_gettid)); in TEST()
1800 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes)); in TEST()
1804 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size)); in TEST()
1805 ASSERT_EQ(0U, guard_size); // The main thread has no guard page. in TEST()
1810 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size)); in TEST()
1812 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2)); in TEST()
1841 ASSERT_EQ(0, getrlimit(RLIMIT_STACK, &rl)); in TEST()
1850 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl)); in TEST()
1858 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl)); in TEST()
1860 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes)); in TEST()
1861 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size)); in TEST()
1862 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2)); in TEST()
1865 ASSERT_EQ(1024U, stack_size); in TEST()
1872 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl)); in TEST()
1874 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes)); in TEST()
1875 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size)); in TEST()
1876 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2)); in TEST()
1879 ASSERT_EQ(6666U, stack_size); in TEST()
1894 ASSERT_EQ(SIGUSR1, sig); in getstack_signal_handler()
1898 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attr)); in getstack_signal_handler()
1901 ASSERT_EQ(0, pthread_attr_getstack(&attr, &stack_base, &stack_size)); in getstack_signal_handler()
1910 ASSERT_EQ(getstack_signal_handler_arg.main_stack_base, stack_base); in getstack_signal_handler()
1924 ASSERT_EQ(getpid(), syscall(__NR_gettid)); in TEST()
1935 ASSERT_EQ(0, sigaltstack(&ss, &oss)); in TEST()
1938 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attr)); in TEST()
1941 ASSERT_EQ(0, pthread_attr_getstack(&attr, &main_stack_base, &main_stack_size)); in TEST()
1950 ASSERT_EQ(true, getstack_signal_handler_arg.done); in TEST()
1952 ASSERT_EQ(0, sigaltstack(&oss, nullptr)); in TEST()
1953 ASSERT_EQ(0, munmap(sig_stack, sig_stack_size)); in TEST()
1973 ASSERT_EQ(0, pthread_create(&t, nullptr, in TEST()
1976 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
1994 ASSERT_EQ(gettid(), pthread_gettid_np(pthread_self())); in TEST()
2008 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
2010 ASSERT_EQ(t_gettid_result, t_pthread_gettid_np_result); in TEST()
2033 ASSERT_EQ(1U, cleanup_counter); in PthreadCleanupTester()
2048 ASSERT_EQ(0, pthread_create(&t, nullptr, PthreadCleanupStartRoutine, nullptr)); in TEST()
2049 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
2050 ASSERT_EQ(2U, cleanup_counter); in TEST()
2054 ASSERT_EQ(PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_DEFAULT); in TEST()
2059 ASSERT_EQ(0, pthread_mutexattr_init(&attr)); in TEST()
2063 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL)); in TEST()
2064 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type)); in TEST()
2065 ASSERT_EQ(PTHREAD_MUTEX_NORMAL, attr_type); in TEST()
2067 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK)); in TEST()
2068 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type)); in TEST()
2069 ASSERT_EQ(PTHREAD_MUTEX_ERRORCHECK, attr_type); in TEST()
2071 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)); in TEST()
2072 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type)); in TEST()
2073 ASSERT_EQ(PTHREAD_MUTEX_RECURSIVE, attr_type); in TEST()
2075 ASSERT_EQ(0, pthread_mutexattr_destroy(&attr)); in TEST()
2080 ASSERT_EQ(0, pthread_mutexattr_init(&attr)); in TEST()
2083 ASSERT_EQ(0, pthread_mutexattr_getprotocol(&attr, &protocol)); in TEST()
2084 ASSERT_EQ(PTHREAD_PRIO_NONE, protocol); in TEST()
2087 ASSERT_EQ(0, pthread_mutexattr_setprotocol(&attr, set_protocol)); in TEST()
2088 ASSERT_EQ(0, pthread_mutexattr_getprotocol(&attr, &protocol)); in TEST()
2089 ASSERT_EQ(protocol, set_protocol); in TEST()
2108 ASSERT_EQ(0, pthread_mutexattr_init(&attr)); in init()
2109 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, mutex_type)); in init()
2110 ASSERT_EQ(0, pthread_mutexattr_setprotocol(&attr, protocol)); in init()
2111 ASSERT_EQ(0, pthread_mutex_init(&lock, &attr)); in init()
2112 ASSERT_EQ(0, pthread_mutexattr_destroy(&attr)); in init()
2116 ASSERT_EQ(0, pthread_mutex_destroy(&lock)); in destroy()
2137 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in TestPthreadMutexLockNormal()
2139 ASSERT_EQ(EPERM, UnlockFromAnotherThread(&m.lock)); in TestPthreadMutexLockNormal()
2141 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockNormal()
2142 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockNormal()
2143 ASSERT_EQ(EBUSY, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockNormal()
2144 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockNormal()
2150 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2151 ASSERT_EQ(EPERM, UnlockFromAnotherThread(&m.lock)); in TestPthreadMutexLockErrorCheck()
2152 ASSERT_EQ(EDEADLK, pthread_mutex_lock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2153 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2154 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2156 ASSERT_EQ(EBUSY, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2158 ASSERT_EQ(EDEADLK, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2160 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2161 ASSERT_EQ(EPERM, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockErrorCheck()
2167 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in TestPthreadMutexLockRecursive()
2168 ASSERT_EQ(EPERM, UnlockFromAnotherThread(&m.lock)); in TestPthreadMutexLockRecursive()
2169 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in TestPthreadMutexLockRecursive()
2170 ASSERT_EQ(EPERM, UnlockFromAnotherThread(&m.lock)); in TestPthreadMutexLockRecursive()
2171 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockRecursive()
2172 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockRecursive()
2173 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockRecursive()
2174 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock)); in TestPthreadMutexLockRecursive()
2175 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockRecursive()
2176 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockRecursive()
2177 ASSERT_EQ(EPERM, pthread_mutex_unlock(&m.lock)); in TestPthreadMutexLockRecursive()
2202 ASSERT_EQ(0, pthread_mutexattr_init(&attr)); in TEST()
2203 ASSERT_EQ(0, pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT)); in TEST()
2209 ASSERT_EQ(0, pthread_mutex_init(&m, &attr)); in TEST()
2212 ASSERT_EQ(ENOMEM, pthread_mutex_init(&m, &attr)); in TEST()
2214 ASSERT_EQ(0, pthread_mutex_lock(&m)); in TEST()
2217 ASSERT_EQ(0, pthread_mutex_unlock(&m)); in TEST()
2220 ASSERT_EQ(0, pthread_mutex_destroy(&m)); in TEST()
2223 ASSERT_EQ(0, pthread_mutexattr_destroy(&attr)); in TEST()
2232 ASSERT_EQ(0, memcmp(&lock_normal, &m1.lock, sizeof(pthread_mutex_t))); in TEST()
2240 ASSERT_EQ(0, memcmp(&lock_errorcheck, &m2.lock, sizeof(pthread_mutex_t))); in TEST()
2245 ASSERT_EQ(0, memcmp(&lock_recursive, &m3.lock, sizeof(pthread_mutex_t))); in TEST()
2246 ASSERT_EQ(0, pthread_mutex_destroy(&lock_recursive)); in TEST()
2264 ASSERT_EQ(LOCK_INITIALIZED, helper->progress); in thread_fn()
2267 ASSERT_EQ(0, pthread_mutex_lock(&helper->m.lock)); in thread_fn()
2268 ASSERT_EQ(LOCK_RELEASED, helper->progress); in thread_fn()
2269 ASSERT_EQ(0, pthread_mutex_unlock(&helper->m.lock)); in thread_fn()
2279 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in test()
2284 ASSERT_EQ(0, pthread_create(&thread, nullptr, in test()
2288 ASSERT_EQ(LOCK_WAITING, progress); in test()
2291 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in test()
2293 ASSERT_EQ(0, pthread_join(thread, nullptr)); in test()
2294 ASSERT_EQ(LOCK_ACCESSED, progress); in test()
2349 ASSERT_EQ(LOCK_INITIALIZED, helper->progress); in thread_fn()
2350 ASSERT_EQ(0, setpriority(PRIO_PROCESS, gettid(), 1)); in thread_fn()
2351 ASSERT_EQ(21, GetThreadPriority(gettid())); in thread_fn()
2352 ASSERT_EQ(0, pthread_mutex_lock(&helper->m.lock)); in thread_fn()
2354 ASSERT_EQ(0, pthread_mutex_lock(&helper->start_thread_m.lock)); in thread_fn()
2356 ASSERT_EQ(0, pthread_mutex_unlock(&helper->start_thread_m.lock)); in thread_fn()
2358 ASSERT_EQ(LOCK_WAITING, helper->progress); in thread_fn()
2361 ASSERT_EQ(20, GetThreadPriority(gettid())); in thread_fn()
2363 ASSERT_EQ(21, GetThreadPriority(gettid())); in thread_fn()
2366 ASSERT_EQ(0, pthread_mutex_unlock(&helper->m.lock)); in thread_fn()
2375 ASSERT_EQ(0, pthread_mutex_lock(&start_thread_m.lock)); in test()
2377 ASSERT_EQ(20, GetThreadPriority(main_tid)); in test()
2382 ASSERT_EQ(0, pthread_create(&thread, nullptr, in test()
2386 ASSERT_EQ(LOCK_CHILD_READY, progress); in test()
2387 ASSERT_EQ(0, pthread_mutex_unlock(&start_thread_m.lock)); in test()
2389 ASSERT_EQ(0, pthread_mutex_lock(&m.lock)); in test()
2391 ASSERT_EQ(LOCK_RELEASED, progress); in test()
2392 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in test()
2393 ASSERT_EQ(0, pthread_join(thread, nullptr)); in test()
2411 ASSERT_EQ(1, fscanf(fp, "%ld", &pid_max)); in TEST()
2424 ASSERT_EQ(0, pthread_mutex_init(&m, nullptr)); in pthread_mutex_timedlock_helper()
2427 ASSERT_EQ(0, pthread_mutex_lock(&m)); in pthread_mutex_timedlock_helper()
2430 ASSERT_EQ(0, clock_gettime(clock, &ts)); in pthread_mutex_timedlock_helper()
2431 ASSERT_EQ(ETIMEDOUT, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2433 ASSERT_EQ(EINVAL, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2435 ASSERT_EQ(EINVAL, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2438 ASSERT_EQ(ETIMEDOUT, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2441 ASSERT_EQ(0, clock_gettime(clock, &ts)); in pthread_mutex_timedlock_helper()
2447 ASSERT_EQ(ETIMEDOUT, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2455 ASSERT_EQ(0, pthread_mutex_unlock(&m)); in pthread_mutex_timedlock_helper()
2457 ASSERT_EQ(0, clock_gettime(clock, &ts)); in pthread_mutex_timedlock_helper()
2459 ASSERT_EQ(0, lock_function(&m, &ts)); in pthread_mutex_timedlock_helper()
2461 ASSERT_EQ(0, pthread_mutex_unlock(&m)); in pthread_mutex_timedlock_helper()
2462 ASSERT_EQ(0, pthread_mutex_destroy(&m)); in pthread_mutex_timedlock_helper()
2504 ASSERT_EQ(0, lock_function(&m.lock, &ts)); in pthread_mutex_timedlock_pi_helper()
2528 ASSERT_EQ(0, pthread_create(&thread, nullptr, ThreadFn, &thread_args)); in pthread_mutex_timedlock_pi_helper()
2530 ASSERT_EQ(0, pthread_join(thread, &result)); in pthread_mutex_timedlock_pi_helper()
2531 ASSERT_EQ(ETIMEDOUT, reinterpret_cast<intptr_t>(result)); in pthread_mutex_timedlock_pi_helper()
2538 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock)); in pthread_mutex_timedlock_pi_helper()
2581 ASSERT_EQ(0, pthread_mutex_init(&m, nullptr)); in TEST_F()
2582 ASSERT_EQ(0, pthread_mutex_destroy(&m)); in TEST_F()
2639 ASSERT_EQ(0, pthread_mutex_init(mutex, nullptr)); in TEST()
2640 ASSERT_EQ(0, pthread_mutex_lock(mutex)); in TEST()
2641 ASSERT_EQ(0, pthread_mutex_unlock(mutex)); in TEST()
2642 ASSERT_EQ(0, pthread_mutex_destroy(mutex)); in TEST()
2646 ASSERT_EQ(0, pthread_cond_init(cond, nullptr)); in TEST()
2647 ASSERT_EQ(0, pthread_cond_signal(cond)); in TEST()
2648 ASSERT_EQ(0, pthread_cond_broadcast(cond)); in TEST()
2649 ASSERT_EQ(0, pthread_cond_destroy(cond)); in TEST()
2653 ASSERT_EQ(0, pthread_rwlock_init(rwlock, nullptr)); in TEST()
2654 ASSERT_EQ(0, pthread_rwlock_rdlock(rwlock)); in TEST()
2655 ASSERT_EQ(0, pthread_rwlock_unlock(rwlock)); in TEST()
2656 ASSERT_EQ(0, pthread_rwlock_wrlock(rwlock)); in TEST()
2657 ASSERT_EQ(0, pthread_rwlock_unlock(rwlock)); in TEST()
2658 ASSERT_EQ(0, pthread_rwlock_destroy(rwlock)); in TEST()
2674 ASSERT_EQ(EINVAL, pthread_mutex_lock(null_value)); in TEST()
2689 ASSERT_EQ(EINVAL, pthread_mutex_unlock(null_value)); in TEST()
2741 ASSERT_EQ(SIGUSR1, signo); in SignalHandlerOnAltStack()
2756 ASSERT_EQ(0, pthread_barrierattr_init(&attr)); in TEST()
2758 ASSERT_EQ(0, pthread_barrierattr_getpshared(&attr, &pshared)); in TEST()
2759 ASSERT_EQ(PTHREAD_PROCESS_PRIVATE, pshared); in TEST()
2760 ASSERT_EQ(0, pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)); in TEST()
2761 ASSERT_EQ(0, pthread_barrierattr_getpshared(&attr, &pshared)); in TEST()
2762 ASSERT_EQ(PTHREAD_PROCESS_SHARED, pshared); in TEST()
2763 ASSERT_EQ(0, pthread_barrierattr_destroy(&attr)); in TEST()
2791 ASSERT_EQ(0, result); in BarrierTestHelper()
2796 ASSERT_EQ(1, arg->data->serial_thread_count); in BarrierTestHelper()
2808 ASSERT_EQ(0, pthread_barrier_init(&data.barrier, nullptr, data.thread_count)); in TEST()
2814 ASSERT_EQ(0, pthread_create(&threads[i], nullptr, in TEST()
2818 ASSERT_EQ(0, pthread_join(threads[i], nullptr)); in TEST()
2820 ASSERT_EQ(data.iteration_count, data.finished_iteration_count); in TEST()
2821 ASSERT_EQ(0, pthread_barrier_destroy(&data.barrier)); in TEST()
2831 ASSERT_EQ(0, pthread_barrier_wait(arg->barrier)); in BarrierDestroyTestHelper()
2836 ASSERT_EQ(0, pthread_barrier_init(&barrier, nullptr, 2)); in TEST()
2841 ASSERT_EQ(0, pthread_create(&thread, nullptr, in TEST()
2844 ASSERT_EQ(EBUSY, pthread_barrier_destroy(&barrier)); in TEST()
2845 ASSERT_EQ(PTHREAD_BARRIER_SERIAL_THREAD, pthread_barrier_wait(&barrier)); in TEST()
2847 ASSERT_EQ(0, pthread_barrier_destroy(&barrier)); in TEST()
2848 ASSERT_EQ(0, pthread_join(thread, nullptr)); in TEST()
2850 ASSERT_EQ(EINVAL, pthread_barrier_destroy(&barrier)); in TEST()
2868 ASSERT_EQ(i, arg->array[j]); in BarrierOrderingTestHelper()
2878 ASSERT_EQ(0, pthread_barrier_init(&barrier, nullptr, THREAD_COUNT)); in TEST()
2887 ASSERT_EQ(0, pthread_create(&threads[i], nullptr, in TEST()
2892 ASSERT_EQ(0, pthread_join(threads[i], nullptr)); in TEST()
2898 ASSERT_EQ(EINVAL, pthread_barrier_init(&barrier, nullptr, 0)); in TEST()
2903 ASSERT_EQ(0, pthread_spin_init(&lock, 0)); in TEST()
2904 ASSERT_EQ(0, pthread_spin_trylock(&lock)); in TEST()
2905 ASSERT_EQ(0, pthread_spin_unlock(&lock)); in TEST()
2906 ASSERT_EQ(0, pthread_spin_lock(&lock)); in TEST()
2907 ASSERT_EQ(EBUSY, pthread_spin_trylock(&lock)); in TEST()
2908 ASSERT_EQ(0, pthread_spin_unlock(&lock)); in TEST()
2909 ASSERT_EQ(0, pthread_spin_destroy(&lock)); in TEST()
2914 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
2917 ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)); in TEST()
2918 ASSERT_EQ(0, pthread_attr_getdetachstate(&attr, &state)); in TEST()
2919 ASSERT_EQ(PTHREAD_CREATE_DETACHED, state); in TEST()
2921 ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)); in TEST()
2922 ASSERT_EQ(0, pthread_attr_getdetachstate(&attr, &state)); in TEST()
2923 ASSERT_EQ(PTHREAD_CREATE_JOINABLE, state); in TEST()
2925 ASSERT_EQ(EINVAL, pthread_attr_setdetachstate(&attr, 123)); in TEST()
2926 ASSERT_EQ(0, pthread_attr_getdetachstate(&attr, &state)); in TEST()
2927 ASSERT_EQ(PTHREAD_CREATE_JOINABLE, state); in TEST()
2935 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
2936 ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)); in TEST()
2959 ASSERT_EQ(0, munmap(pages[i], kPageSize)); in TEST()
2967 ASSERT_EQ(0, munmap(pages[i], kPageSize)); in TEST()
2973 ASSERT_EQ(EINVAL, pthread_setschedparam(pthread_self(), INT_MIN, &p)); in TEST()
2977 ASSERT_EQ(EINVAL, pthread_setschedprio(pthread_self(), INT_MIN)); in TEST()
2982 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
2985 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED)); in TEST()
2986 ASSERT_EQ(0, pthread_attr_getinheritsched(&attr, &state)); in TEST()
2987 ASSERT_EQ(PTHREAD_INHERIT_SCHED, state); in TEST()
2989 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)); in TEST()
2990 ASSERT_EQ(0, pthread_attr_getinheritsched(&attr, &state)); in TEST()
2991 ASSERT_EQ(PTHREAD_EXPLICIT_SCHED, state); in TEST()
2993 ASSERT_EQ(EINVAL, pthread_attr_setinheritsched(&attr, 123)); in TEST()
2994 ASSERT_EQ(0, pthread_attr_getinheritsched(&attr, &state)); in TEST()
2995 ASSERT_EQ(PTHREAD_EXPLICIT_SCHED, state); in TEST()
3000 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
3004 ASSERT_EQ(0, pthread_attr_setschedparam(&attr, ¶m)); in TEST()
3005 ASSERT_EQ(0, pthread_attr_setschedpolicy(&attr, SCHED_FIFO)); in TEST()
3006 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED)); in TEST()
3009 ASSERT_EQ(0, pthread_create(&t, &attr, IdFn, nullptr)); in TEST()
3010 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
3014 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)); in TEST()
3015 ASSERT_EQ(EINVAL, pthread_create(&t, &attr, IdFn, nullptr)); in TEST()
3026 ASSERT_EQ(0, rc); in TEST()
3029 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
3030 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED)); in TEST()
3034 ASSERT_EQ(0, pthread_create(&t, &attr, spin_helper.GetFunction(), nullptr)); in TEST()
3037 ASSERT_EQ(0, pthread_getschedparam(t, &actual_policy, &actual_param)); in TEST()
3038 ASSERT_EQ(SCHED_FIFO, actual_policy); in TEST()
3040 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
3047 ASSERT_EQ(0, rc); in TEST()
3050 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
3051 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)); in TEST()
3052 ASSERT_EQ(0, pthread_attr_setschedpolicy(&attr, SCHED_OTHER)); in TEST()
3056 ASSERT_EQ(0, pthread_create(&t, &attr, spin_helper.GetFunction(), nullptr)); in TEST()
3059 ASSERT_EQ(0, pthread_getschedparam(t, &actual_policy, &actual_param)); in TEST()
3060 ASSERT_EQ(SCHED_OTHER, actual_policy); in TEST()
3062 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
3069 ASSERT_EQ(0, rc); in TEST()
3072 ASSERT_EQ(0, pthread_attr_init(&attr)); in TEST()
3073 ASSERT_EQ(0, pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED)); in TEST()
3077 ASSERT_EQ(0, pthread_create(&t, &attr, spin_helper.GetFunction(), nullptr)); in TEST()
3080 ASSERT_EQ(0, pthread_getschedparam(t, &actual_policy, &actual_param)); in TEST()
3081 ASSERT_EQ(SCHED_FIFO | SCHED_RESET_ON_FORK, actual_policy); in TEST()
3083 ASSERT_EQ(0, pthread_join(t, nullptr)); in TEST()
3091 ASSERT_EQ( in TEST()
3124 ASSERT_EQ(0, pthread_join(t, &retval)); in TEST()
3125 ASSERT_EQ(nullptr, retval); in TEST()