Lines Matching full:fixture
53 zassert_equal(thrd_error, cnd_wait(NULL, &fixture->mutex)); in ZTEST_F()
54 zassert_equal(thrd_error, cnd_wait(&fixture->cond, NULL)); in ZTEST_F()
56 zassert_equal(thrd_error, cnd_timedwait(NULL, NULL, &fixture->time_point)); in ZTEST_F()
57 zassert_equal(thrd_error, cnd_timedwait(NULL, &fixture->mutex, NULL)); in ZTEST_F()
59 cnd_timedwait(NULL, &fixture->mutex, &fixture->time_point)); in ZTEST_F()
60 zassert_equal(thrd_error, cnd_timedwait(&fixture->cond, NULL, NULL)); in ZTEST_F()
62 cnd_timedwait(&fixture->cond, NULL, &fixture->time_point)); in ZTEST_F()
63 zassert_equal(thrd_error, cnd_timedwait(&fixture->cond, &fixture->mutex, NULL)); in ZTEST_F()
71 struct libc_cnd_fixture *const fixture = arg; in test_cnd_thread_fn() local
73 if (fixture->do_timedwait) { in test_cnd_thread_fn()
76 res = cnd_timedwait(&fixture->cond, &fixture->mutex, &time_point); in test_cnd_thread_fn()
78 res = cnd_wait(&fixture->cond, &fixture->mutex); in test_cnd_thread_fn()
81 if (fixture->is_broadcast) { in test_cnd_thread_fn()
83 zassert_equal(thrd_success, cnd_signal(&fixture->cond)); in test_cnd_thread_fn()
86 (void)mtx_unlock(&fixture->mutex); in test_cnd_thread_fn()
91 static void tst_cnd_common(struct libc_cnd_fixture *fixture, size_t wait_ms, bool th2, int exp1, in tst_cnd_common() argument
94 zassert_equal(thrd_success, mtx_lock(&fixture->mutex)); in tst_cnd_common()
96 zassert_equal(thrd_success, thrd_create(&fixture->thrd1, test_cnd_thread_fn, fixture)); in tst_cnd_common()
99 thrd_create(&fixture->thrd2, test_cnd_thread_fn, fixture)); in tst_cnd_common()
104 if (fixture->is_broadcast) { in tst_cnd_common()
105 zassert_equal(thrd_success, cnd_broadcast(&fixture->cond)); in tst_cnd_common()
107 zassert_equal(thrd_success, cnd_signal(&fixture->cond)); in tst_cnd_common()
110 zassert_equal(thrd_success, mtx_unlock(&fixture->mutex)); in tst_cnd_common()
112 zassert_equal(thrd_success, thrd_join(fixture->thrd1, &fixture->res1)); in tst_cnd_common()
114 zassert_equal(thrd_success, thrd_join(fixture->thrd2, &fixture->res2)); in tst_cnd_common()
117 zassert_equal(exp1, fixture->res1); in tst_cnd_common()
119 zassert_equal(exp2, fixture->res2); in tst_cnd_common()
125 tst_cnd_common(fixture, WAIT_TIME_MS / 2, false, thrd_success, DONT_CARE); in ZTEST_F()
130 fixture->do_timedwait = true; in ZTEST_F()
131 tst_cnd_common(fixture, WAIT_TIME_MS / 2, false, thrd_success, DONT_CARE); in ZTEST_F()
136 fixture->do_timedwait = true; in ZTEST_F()
137 tst_cnd_common(fixture, WAIT_TIME_MS * 2, false, thrd_timedout, DONT_CARE); in ZTEST_F()
142 fixture->is_broadcast = true; in ZTEST_F()
143 tst_cnd_common(fixture, WAIT_TIME_MS, true, thrd_success, thrd_success); in ZTEST_F()
153 struct libc_cnd_fixture *const fixture = arg; in before() local
155 *fixture = (struct libc_cnd_fixture){ in before()
160 zassert_equal(thrd_success, mtx_init(&fixture->mutex, mtx_plain)); in before()
161 zassert_equal(thrd_success, cnd_init(&fixture->cond)); in before()
166 struct libc_cnd_fixture *const fixture = arg; in after() local
168 cnd_destroy(&fixture->cond); in after()
169 mtx_destroy(&fixture->mutex); in after()