tests: posix: headers: check some structs only when posix_api=y
Some POSIX header tests assumed that various structures would be declared even if POSIX_API=n. Actually most meaningful POSIX structures are guarded by feature test macros defined by the implementation (i.e. implementation conformance macros). So only run tests on those structures when CONFIG_POSIX_API=y. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
ddd49f32d9
commit
f4be0ee859
2 changed files with 114 additions and 114 deletions
|
@ -19,12 +19,12 @@
|
|||
*/
|
||||
ZTEST(posix_headers, test_dirent_h)
|
||||
{
|
||||
#ifdef CONFIG_POSIX_API
|
||||
zassert_not_equal((DIR *)-1, (DIR *)NULL);
|
||||
|
||||
zassert_not_equal(-1, offsetof(struct dirent, d_ino));
|
||||
zassert_not_equal(-1, offsetof(struct dirent, d_name));
|
||||
|
||||
if (IS_ENABLED(CONFIG_POSIX_API)) {
|
||||
/* zassert_not_null(alphasort); */ /* not implemented */
|
||||
zassert_not_null(closedir);
|
||||
/* zassert_not_null(dirfd); */ /* not implemented */
|
||||
|
@ -36,5 +36,5 @@ ZTEST(posix_headers, test_dirent_h)
|
|||
/* zassert_not_null(scandir); */ /* not implemented */
|
||||
/* zassert_not_null(seekdir); */ /* not implemented */
|
||||
/* zassert_not_null(telldir); */ /* not implemented */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
ZTEST(posix_headers, test_pthread_h)
|
||||
{
|
||||
#ifdef CONFIG_POSIX_API
|
||||
zassert_not_equal(-1, PTHREAD_BARRIER_SERIAL_THREAD);
|
||||
|
||||
zassert_not_equal(-1, PTHREAD_CANCEL_ASYNCHRONOUS);
|
||||
|
@ -60,7 +61,6 @@ ZTEST(posix_headers, test_pthread_h)
|
|||
pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; */ /* not implemented */
|
||||
|
||||
if (IS_ENABLED(CONFIG_POSIX_API)) {
|
||||
zassert_not_null(pthread_atfork);
|
||||
zassert_not_null(pthread_attr_destroy);
|
||||
zassert_not_null(pthread_attr_getdetachstate);
|
||||
|
@ -159,6 +159,6 @@ ZTEST(posix_headers, test_pthread_h)
|
|||
zassert_not_null(pthread_spin_trylock);
|
||||
zassert_not_null(pthread_spin_unlock);
|
||||
zassert_not_null(pthread_testcancel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue