Commit c080d1cb authored by Benjamin Cabé's avatar Benjamin Cabé Committed by Benjamin Cabé
Browse files

tests: posix: add test for pthread_cond_init with existing condattr

Introduce new test for pthread_cond_init verifying successful
initialization with a valid pre-initialized condattr.

Signed-off-by: default avatarBenjamin Cabé <benjamin@zephyrproject.org>
parent 0c1dca52
Loading
Loading
Loading
Loading
+16 −0
Changes for tests/posix/common/src/cond.c: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -69,4 +69,20 @@ ZTEST(cond, test_pthread_condattr)
	zassert_ok(pthread_condattr_destroy(&att));
}

/**
 * @brief Test pthread_cond_init() with a pre-existing initialized attribute.
 */
ZTEST(cond, test_cond_init_existing_initialized_condattr)
{
	pthread_cond_t cond;
	pthread_condattr_t att = {0};

	zassert_ok(pthread_condattr_init(&att));
	zassert_ok(pthread_cond_init(&cond, &att), "pthread_cond_init failed with valid attr");

	/* Clean up */
	zassert_ok(pthread_cond_destroy(&cond));
	zassert_ok(pthread_condattr_destroy(&att));
}

ZTEST_SUITE(cond, NULL, NULL, NULL, NULL, NULL);