tests: posix: existence tests for standard POSIX includes

Add a trivial suite that simply ensures headers exist and that
they supply standard symbols and constants.

These tests are intended to be ordered exactly as the respective
feature appears in the respective specification at

https://pubs.opengroup.org/onlinepubs/9699919799

Over time, as POSIX support improves, we can enable additional
checks.

If `CONFIG_POSIX_API=n`, then we simply ensure that the header
can be included, that constants and structures exist, including
the existence of required fields in each structure.

We check that a constant exist, by comparing its value against
an arbitrary number. If the constant does not exist, it would
of course be a compile error.

```
zassert_not_equal(-1, POLLIN);
```

We check that a structure contains required fields by
comparing the field offset with an arbitrary number. If
the field does not exist, of course, there would be a
compile error.

```
zassert_not_equal(-1, offsetof(struct pollfd, fd));
```

For non-scalar constants, we simply attempt to assign
a value to the specific type:

```
struct in6_addr any6 = IN6ADDR_ANY_INIT;
```

If `CONFIG_POSIX_API=y`, then we additionally check that required
functions are non-NULL (limited to what is currently supported in
Zephyr).

```
zassert_not_null(pthread_create);
```

Note: functional verification tests should be done outside of this
test suite.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
This commit is contained in:
Chris Friedt 2022-10-27 15:47:04 -04:00 committed by Marti Bolivar
parent 6ac402bb3a
commit ab6102f70f
23 changed files with 1574 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(posix_headers)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -0,0 +1,20 @@
CONFIG_POSIX_API=y
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
# for POSIX_FS
CONFIG_FILE_SYSTEM=y
# for select to work
CONFIG_NET_TEST=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_SOCKETS=y
CONFIG_NETWORKING=y
# for when CONFIG_POSIX_API is not selected
CONFIG_PTHREAD_IPC=y
CONFIG_POSIX_FS=y
CONFIG_POSIX_CLOCK=y
CONFIG_POSIX_MQUEUE=y
CONFIG_EVENTFD=y
CONFIG_GETOPT=y

View file

@ -0,0 +1,13 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/ztest.h>

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
ZTEST_SUITE(posix_headers, NULL, NULL, NULL, NULL, NULL);

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <arpa/inet.h>
#else
#include <zephyr/posix/arpa/inet.h>
#endif
/**
* @brief existence test for `<arpa/inet.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html">arpa/inet.h</a>
*/
ZTEST(posix_headers, test_arpa_inet_h)
{
zassert_not_equal(-1, htonl(0));
zassert_not_equal(-1, htons(0));
zassert_not_equal(-1, ntohl(0));
zassert_not_equal(-1, ntohs(0));
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(inet_addr); */ /* not implemented */
/* zassert_not_null(inet_ntoa); */ /* not implemented */
zassert_not_null(inet_ntop);
zassert_not_null(inet_pton);
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <dirent.h>
#else
#include <zephyr/posix/dirent.h>
#endif
/**
* @brief existence test for `<dirent.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html">dirent.h</a>
*/
ZTEST(posix_headers, test_dirent_h)
{
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 */
/* zassert_not_null(fdopendir); */ /* not implemented */
zassert_not_null(opendir);
zassert_not_null(readdir);
/* zassert_not_null(readdir_r); */ /* not implemented */
/* zassert_not_null(rewinddir); */ /* not implemented */
/* zassert_not_null(scandir); */ /* not implemented */
/* zassert_not_null(seekdir); */ /* not implemented */
/* zassert_not_null(telldir); */ /* not implemented */
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <mqueue.h>
#else
#include <zephyr/posix/mqueue.h>
#endif
/**
* @brief existence test for `<mqueue.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html">mqueue.h</a>
*/
ZTEST(posix_headers, test_mqueue_h)
{
zassert_not_equal((mqd_t)-1, (mqd_t)NULL);
zassert_not_equal(-1, offsetof(struct mq_attr, mq_flags));
zassert_not_equal(-1, offsetof(struct mq_attr, mq_maxmsg));
zassert_not_equal(-1, offsetof(struct mq_attr, mq_msgsize));
zassert_not_equal(-1, offsetof(struct mq_attr, mq_curmsgs));
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(mq_close);
zassert_not_null(mq_getattr);
/* zassert_not_null(mq_notify); */ /* not implemented */
zassert_not_null(mq_open);
zassert_not_null(mq_receive);
zassert_not_null(mq_send);
zassert_not_null(mq_setattr);
zassert_not_null(mq_timedreceive);
zassert_not_null(mq_timedsend);
zassert_not_null(mq_unlink);
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <net/if.h>
#else
#include <zephyr/posix/net/if.h>
#endif
/**
* @brief existence test for `<net/if.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html">net/if.h</a>
*/
ZTEST(posix_headers, test_net_if_h)
{
/* zassert_not_equal(-1, offsetof(struct if_nameindex, if_index)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct if_nameindex, if_name)); */ /* not implemented */
/* zassert_not_equal(-1, IF_NAMESIZE); */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(if_freenameindex); */ /* not implemented */
/* zassert_not_null(if_indextoname); */ /* not implemented */
/* zassert_not_null(if_nameindex); */ /* not implemented */
/* zassert_not_null(if_nametoindex); */ /* not implemented */
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <netdb.h>
#else
#include <zephyr/posix/netdb.h>
#endif
/**
* @brief existence test for `<netdb.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html>netdb.h</a>
*/
ZTEST(posix_headers, test_netdb_h)
{
/* zassert_not_equal(-1, offsetof(struct hostent, h_name)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct hostent, h_aliases)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct hostent, h_addrtype)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct hostent, h_length)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct hostent, h_addr_list)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct netent, n_name)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct netent, n_aliases)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct netent, n_addrtype)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct netent, n_net)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct protoent, p_name)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct protoent, p_aliases)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct protoent, p_proto)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct servent, s_name)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct servent, s_aliases)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct servent, s_port)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct servent, s_proto)); */ /* not implemented */
/* zassert_equal(IPPORT_RESERVED, UINT16_MAX); */ /* not implemented */
zassert_not_equal(-1, offsetof(struct addrinfo, ai_flags));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_family));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_socktype));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_protocol));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_addrlen));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_addr));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_canonname));
zassert_not_equal(-1, offsetof(struct addrinfo, ai_next));
zassert_not_equal(-1, AI_PASSIVE);
zassert_not_equal(-1, AI_CANONNAME);
zassert_not_equal(-1, AI_NUMERICHOST);
zassert_not_equal(-1, AI_NUMERICSERV);
zassert_not_equal(-1, AI_V4MAPPED);
zassert_not_equal(-1, AI_ALL);
zassert_not_equal(-1, AI_ADDRCONFIG);
zassert_not_equal(-1, NI_NOFQDN);
zassert_not_equal(-1, NI_NUMERICHOST);
zassert_not_equal(-1, NI_NAMEREQD);
zassert_not_equal(-1, NI_NUMERICSERV);
/* zassert_not_equal(-1, NI_NUMERICSCOPE); */ /* not implemented */
zassert_not_equal(-1, NI_DGRAM);
zassert_not_equal(-1, EAI_AGAIN);
zassert_equal(-1, EAI_BADFLAGS);
zassert_not_equal(-1, EAI_FAIL);
zassert_not_equal(-1, EAI_FAMILY);
zassert_not_equal(-1, EAI_MEMORY);
zassert_not_equal(-1, EAI_NONAME);
zassert_not_equal(-1, EAI_SERVICE);
zassert_not_equal(-1, EAI_SOCKTYPE);
zassert_not_equal(-1, EAI_SYSTEM);
zassert_not_equal(-1, EAI_OVERFLOW);
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(endhostent); */ /* not implemented */
/* zassert_not_null(endnetent); */ /* not implemented */
/* zassert_not_null(endprotoent); */ /* not implemented */
/* zassert_not_null(endservent); */ /* not implemented */
zassert_not_null(freeaddrinfo);
zassert_not_null(gai_strerror);
zassert_not_null(getaddrinfo);
/* zassert_not_null(gethostent); */ /* not implemented */
zassert_not_null(getnameinfo);
/* zassert_not_null(getnetbyaddr); */ /* not implemented */
/* zassert_not_null(getnetbyname); */ /* not implemented */
/* zassert_not_null(getnetent); */ /* not implemented */
/* zassert_not_null(getprotobyname); */ /* not implemented */
/* zassert_not_null(getprotobynumber); */ /* not implemented */
/* zassert_not_null(getprotoent); */ /* not implemented */
/* zassert_not_null(getservbyname); */ /* not implemented */
/* zassert_not_null(getservbyport); */ /* not implemented */
/* zassert_not_null(getservent); */ /* not implemented */
/* zassert_not_null(sethostent); */ /* not implemented */
/* zassert_not_null(setnetent); */ /* not implemented */
/* zassert_not_null(setprotoent); */ /* not implemented */
/* zassert_not_null(setservent); */ /* not implemented */
}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <netinet/in.h>
#else
#include <zephyr/posix/netinet/in.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
/**
* @brief existence test for `<netinet/in.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html">netinet/in.h</a>
*/
ZTEST(posix_headers, test_netinet_in_h)
{
zassert_equal(sizeof(in_port_t), sizeof(uint16_t));
zassert_equal(sizeof(in_addr_t), sizeof(uint32_t));
zassert_not_equal(-1, offsetof(struct in_addr, s_addr));
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_family));
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_port));
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_addr));
zassert_not_equal(-1, offsetof(struct in6_addr, s6_addr));
zassert_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t));
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family));
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port));
/* not implemented */
/* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr));
/* not implemented */
/* zassert_not_equal(-1, offsetof(struct sockaddr_in6, scope_id)); */
zassert_not_null(&in6addr_loopback);
struct in6_addr any6 = IN6ADDR_ANY_INIT;
struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT;
/* not implemented */
/* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); */
/* not implemented */
/* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_interface)); */
zassert_not_equal(-1, IPPROTO_IP);
zassert_not_equal(-1, IPPROTO_IPV6);
zassert_not_equal(-1, IPPROTO_ICMP);
zassert_not_equal(-1, IPPROTO_RAW);
zassert_not_equal(-1, IPPROTO_TCP);
zassert_not_equal(-1, IPPROTO_UDP);
zassert_not_equal(-1, INADDR_ANY);
/* zassert_not_equal(-1, INADDR_BROADCAST); */ /* not implemented */
zassert_equal(INET_ADDRSTRLEN, 16);
zassert_equal(INET6_ADDRSTRLEN, 46);
/* zassert_not_equal(-1, IPV6_JOIN_GROUP); */ /* not implemented */
/* zassert_not_equal(-1, IPV6_LEAVE_GROUP); */ /* not implemented */
/* zassert_not_equal(-1, IPV6_MULTICAST_HOPS); */ /* not implemented */
/* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */
/* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */
/* zassert_not_equal(-1, IPV6_UNICAST_HOPS); */ /* not implemented */
zassert_not_equal(-1, IPV6_V6ONLY);
/* IN6_IS_ADDR_UNSPECIFIED(&any6); */ /* not implemented */
/* IN6_IS_ADDR_LOOPBACK(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MULTICAST(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_LINKLOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_SITELOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_V4MAPPED(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MC_NODELOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MC_LINKLOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MC_SITELOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MC_ORGLOCAL(&lo6); */ /* not implemented */
/* IN6_IS_ADDR_MC_GLOBAL(&lo6); */ /* not implemented */
}
#pragma GCC diagnostic pop

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <netinet/tcp.h>
#else
#include <zephyr/posix/netinet/tcp.h>
#endif
/**
* @brief existence test for `<netinet/tcp.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html">netinet/tcp.h</a>
*/
ZTEST(posix_headers, test_netinet_tcp_h)
{
zassert_not_equal(-1, TCP_NODELAY);
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <poll.h>
#else
#include <zephyr/posix/poll.h>
#endif
/**
* @brief existence test for `<poll.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html">poll.h</a>
*/
ZTEST(posix_headers, test_poll_h)
{
zassert_not_equal(-1, offsetof(struct pollfd, fd));
zassert_not_equal(-1, offsetof(struct pollfd, events));
zassert_not_equal(-1, offsetof(struct pollfd, revents));
/* zassert_true(sizeof(nfds_t) <= sizeof(long)); */ /* not implemented */
zassert_not_equal(-1, POLLIN);
/* zassert_not_equal(-1, POLLRDNORM); */ /* not implemented */
/* zassert_not_equal(-1, POLLRDBAND); */ /* not implemented */
/* zassert_not_equal(-1, POLLPRI); */ /* not implemented */
zassert_not_equal(-1, POLLOUT);
/* zassert_not_equal(-1, POLLWRNORM); */ /* not implemented */
/* zassert_not_equal(-1, POLLWRBAND); */ /* not implemented */
zassert_not_equal(-1, POLLERR);
zassert_not_equal(-1, POLLHUP);
zassert_not_equal(-1, POLLNVAL);
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(poll);
}
}

View file

@ -0,0 +1,162 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <pthread.h>
#else
#include <zephyr/posix/pthread.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
/**
* @brief existence test for `<pthread.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html">pthread.h</a>
*/
ZTEST(posix_headers, test_pthread_h)
{
zassert_not_equal(-1, PTHREAD_BARRIER_SERIAL_THREAD);
/* zassert_not_equal(-1, PTHREAD_CANCEL_ASYNCHRONOUS); */ /* not implemented */
zassert_not_equal(-1, PTHREAD_CANCEL_ENABLE);
/* zassert_not_equal(-1, PTHREAD_CANCEL_DEFERRED); */ /* not implemented */
zassert_not_equal(-1, PTHREAD_CANCEL_DISABLE);
/* zassert_not_equal(-1, PTHREAD_CANCELED); */ /* not implemented */
zassert_not_equal(-1, PTHREAD_CREATE_DETACHED);
zassert_not_equal(-1, PTHREAD_CREATE_JOINABLE);
/* zassert_not_equal(-1, PTHREAD_EXPLICIT_SCHED); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_INHERIT_SCHED); */ /* not implemented */
zassert_not_equal(-1, PTHREAD_MUTEX_DEFAULT);
zassert_not_equal(-1, PTHREAD_MUTEX_ERRORCHECK);
zassert_not_equal(-1, PTHREAD_MUTEX_ERRORCHECK);
zassert_not_equal(-1, PTHREAD_MUTEX_RECURSIVE);
/* zassert_not_equal(-1, PTHREAD_MUTEX_ROBUST); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_MUTEX_STALLED); */ /* not implemented */
pthread_once_t once = PTHREAD_ONCE_INIT;
/* zassert_not_equal(-1, PTHREAD_PRIO_INHERIT); */ /* not implemented */
zassert_not_equal(-1, PTHREAD_PRIO_NONE);
/* zassert_not_equal(-1, PTHREAD_PRIO_PROTECT); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_PROCESS_SHARED); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_PROCESS_PRIVATE); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_SCOPE_PROCESS); */ /* not implemented */
/* zassert_not_equal(-1, PTHREAD_SCOPE_SYSTEM); */ /* not implemented */
/* pthread_cond_t cond = PTHREAD_COND_INITIALIZER; */ /* not implemented */
/* pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER; */ /* not implemented */
/* pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(pthread_atfork); */ /* not implemented */
zassert_not_null(pthread_attr_destroy);
zassert_not_null(pthread_attr_getdetachstate);
/* zassert_not_null(pthread_attr_getguardsize); */ /* not implemented */
/* zassert_not_null(pthread_attr_getinheritsched); */ /* not implemented */
zassert_not_null(pthread_attr_getschedparam);
zassert_not_null(pthread_attr_getschedpolicy);
/* zassert_not_null(pthread_attr_getscope); */ /* not implemented */
zassert_not_null(pthread_attr_getstack);
zassert_not_null(pthread_attr_getstacksize);
zassert_not_null(pthread_attr_init);
zassert_not_null(pthread_attr_setdetachstate);
/* zassert_not_null(pthread_attr_setguardsize); */ /* not implemented */
/* zassert_not_null(pthread_attr_setinheritsched); */ /* not implemented */
zassert_not_null(pthread_attr_setschedparam);
zassert_not_null(pthread_attr_setschedpolicy);
/* zassert_not_null(pthread_attr_setscope); */ /* not implemented */
zassert_not_null(pthread_attr_setstack);
zassert_not_null(pthread_attr_setstacksize);
zassert_not_null(pthread_barrier_destroy);
zassert_not_null(pthread_barrier_init);
zassert_not_null(pthread_barrier_wait);
zassert_not_null(pthread_barrierattr_destroy);
/* zassert_not_null(pthread_barrierattr_getpshared); */ /* not implemented */
zassert_not_null(pthread_barrierattr_init);
/* zassert_not_null(pthread_barrierattr_setpshared); */ /* not implemented */
zassert_not_null(pthread_cancel);
zassert_not_null(pthread_cond_broadcast);
zassert_not_null(pthread_cond_destroy);
zassert_not_null(pthread_cond_init);
zassert_not_null(pthread_cond_signal);
zassert_not_null(pthread_cond_timedwait);
zassert_not_null(pthread_cond_wait);
zassert_not_null(pthread_condattr_destroy);
/* zassert_not_null(pthread_condattr_getclock); */ /* not implemented */
/* zassert_not_null(pthread_condattr_getpshared); */ /* not implemented */
zassert_not_null(pthread_condattr_init);
/* zassert_not_null(pthread_condattr_setclock); */ /* not implemented */
/* zassert_not_null(pthread_condattr_setpshared); */ /* not implemented */
zassert_not_null(pthread_create);
zassert_not_null(pthread_detach);
zassert_not_null(pthread_equal);
zassert_not_null(pthread_exit);
/* zassert_not_null(pthread_getconcurrency); */ /* not implemented */
/* zassert_not_null(pthread_getcpuclockid); */ /* not implemented */
zassert_not_null(pthread_getschedparam);
zassert_not_null(pthread_getspecific);
zassert_not_null(pthread_join);
zassert_not_null(pthread_key_create);
zassert_not_null(pthread_key_delete);
/* zassert_not_null(pthread_mutex_consistent); */ /* not implemented */
zassert_not_null(pthread_mutex_destroy);
/* zassert_not_null(pthread_mutex_getprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutex_init);
zassert_not_null(pthread_mutex_lock);
/* zassert_not_null(pthread_mutex_setprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutex_timedlock);
zassert_not_null(pthread_mutex_trylock);
zassert_not_null(pthread_mutex_unlock);
zassert_not_null(pthread_mutexattr_destroy);
/* zassert_not_null(pthread_mutexattr_getprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutexattr_getprotocol);
/* zassert_not_null(pthread_mutexattr_getpshared); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_getrobust); */ /* not implemented */
zassert_not_null(pthread_mutexattr_gettype);
zassert_not_null(pthread_mutexattr_init);
/* zassert_not_null(pthread_mutexattr_setprioceiling); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_setprotocol); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_setpshared); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_setrobust); */ /* not implemented */
zassert_not_null(pthread_mutexattr_settype);
zassert_not_null(pthread_once);
zassert_not_null(pthread_rwlock_destroy);
zassert_not_null(pthread_rwlock_init);
zassert_not_null(pthread_rwlock_rdlock);
zassert_not_null(pthread_rwlock_timedrdlock);
zassert_not_null(pthread_rwlock_timedwrlock);
zassert_not_null(pthread_rwlock_tryrdlock);
zassert_not_null(pthread_rwlock_trywrlock);
zassert_not_null(pthread_rwlock_unlock);
zassert_not_null(pthread_rwlock_wrlock);
zassert_not_null(pthread_rwlockattr_destroy);
/* zassert_not_null(pthread_rwlockattr_getpshared); */ /* not implemented */
zassert_not_null(pthread_rwlockattr_init);
/* zassert_not_null(pthread_rwlockattr_setpshared); */ /* not implemented */
zassert_not_null(pthread_self);
/* zassert_not_null(pthread_setcancelstate); */ /* not implemented */
/* zassert_not_null(pthread_setcanceltype); */ /* not implemented */
/* zassert_not_null(pthread_setconcurrency); */ /* not implemented */
zassert_not_null(pthread_setschedparam);
/* zassert_not_null(pthread_setschedprio); */ /* not implemented */
zassert_not_null(pthread_setspecific);
/* zassert_not_null(pthread_spin_destroy); */ /* not implemented */
/* zassert_not_null(pthread_spin_init); */ /* not implemented */
/* zassert_not_null(pthread_spin_lock); */ /* not implemented */
/* zassert_not_null(pthread_spin_unlock); */ /* not implemented */
/* zassert_not_null(pthread_testcancel); */ /* not implemented */
}
}
#pragma GCC diagnostic pop

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sched.h>
#else
#include <zephyr/posix/sched.h>
#endif
/**
* @brief existence test for `<sched.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html">sched.h</a>
*/
ZTEST(posix_headers, test_sched_h)
{
zassert_not_equal(-1, offsetof(struct sched_param, sched_priority));
zassert_not_equal(-1, SCHED_FIFO);
zassert_not_equal(-1, SCHED_RR);
/* zassert_not_equal(-1, SCHED_SPORADIC); */ /* not implemented */
/* zassert_not_equal(-1, SCHED_OTHER); */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(sched_get_priority_max);
zassert_not_null(sched_get_priority_min);
/* zassert_not_null(sched_getparam); */ /* not implemented */
/* zassert_not_null(sched_getscheduler); */ /* not implemented */
/* zassert_not_null(sched_rr_get_interval); */ /* not implemented */
/* zassert_not_null(sched_setparam); */ /* not implemented */
/* zassert_not_null(sched_setscheduler); */ /* not implemented */
zassert_not_null(sched_yield);
}
}

View file

@ -0,0 +1,36 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <semaphore.h>
#else
#include <zephyr/posix/semaphore.h>
#endif
/**
* @brief existence test for `<semaphore.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html">semaphore.h</a>
*/
ZTEST(posix_headers, test_semaphore_h)
{
/* zassert_not_equal(SEM_FAILED, (sem_t *)42); */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(sem_close); */ /* not implemented */
zassert_not_null(sem_destroy);
zassert_not_null(sem_getvalue);
zassert_not_null(sem_init);
/* zassert_not_null(sem_open); */ /* not implemented */
zassert_not_null(sem_post);
zassert_not_null(sem_timedwait);
zassert_not_null(sem_trywait);
/* zassert_not_null(sem_unlink); */ /* not implemented */
zassert_not_null(sem_wait);
}
}

View file

@ -0,0 +1,191 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <signal.h>
#else
#include <zephyr/posix/signal.h>
#endif
/**
* @brief existence test for `<signal.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html">signal.h</a>
*/
ZTEST(posix_headers, test_signal_h)
{
/* zassert_not_equal(-1, SIG_DFL); */ /* not implemented */
/* zassert_not_equal(-1, SIG_ERR); */ /* not implemented */
/* zassert_not_equal(-1, SIG_HOLD); */ /* not implemented */
/* zassert_not_equal(-1, SIG_IGN); */ /* not implemented */
/* zassert_not_equal((sig_atomic_t)-1, (sig_atomic_t)0); */ /* not implemented */
/* zassert_not_equal((sigset_t)-1, (sigset_t)0); */ /* not implemented */
/* zassert_not_equal((pid_t)-1, (pid_t)0); */ /* not implemented */
zassert_not_equal(-1, offsetof(struct sigevent, sigev_notify));
zassert_not_equal(-1, offsetof(struct sigevent, sigev_signo));
zassert_not_equal(-1, offsetof(struct sigevent, sigev_value));
zassert_not_equal(-1, offsetof(struct sigevent, sigev_notify_function));
zassert_not_equal(-1, offsetof(struct sigevent, sigev_notify_attributes));
zassert_not_equal(-1, SIGEV_NONE);
zassert_not_equal(-1, SIGEV_SIGNAL);
zassert_not_equal(-1, SIGEV_THREAD);
zassert_not_equal(-1, offsetof(union sigval, sival_int));
zassert_not_equal(-1, offsetof(union sigval, sival_ptr));
/* zassert_not_equal(-1, RTSIG_MAX); */ /* not implemented */
/* zassert_true(SIGRTMIN >= 0); */ /* not implemented */
/* zassert_true(SIGRTMAX >= SIGRTMIN); */ /* not implemented */
/* zassert_true(SIGRTMAX - SIGRTMIN >= RTSIG_MAX); */ /* not implemented */
/* zassert_not_equal(-1, SIGABRT); */ /* not implemented */
/* zassert_not_equal(-1, SIGALRM); */ /* not implemented */
/* zassert_not_equal(-1, SIGBUS); */ /* not implemented */
/* zassert_not_equal(-1, SIGCHLD); */ /* not implemented */
/* zassert_not_equal(-1, SIGCONT); */ /* not implemented */
/* zassert_not_equal(-1, SIGFPE); */ /* not implemented */
/* zassert_not_equal(-1, SIGHUP); */ /* not implemented */
/* zassert_not_equal(-1, SIGILL); */ /* not implemented */
/* zassert_not_equal(-1, SIGINT); */ /* not implemented */
/* zassert_not_equal(-1, SIGKILL); */ /* not implemented */
/* zassert_not_equal(-1, SIGPIPE); */ /* not implemented */
/* zassert_not_equal(-1, SIGQUIT); */ /* not implemented */
/* zassert_not_equal(-1, SIGSEGV); */ /* not implemented */
/* zassert_not_equal(-1, SIGSTOP); */ /* not implemented */
/* zassert_not_equal(-1, SIGTERM); */ /* not implemented */
/* zassert_not_equal(-1, SIGTSTP); */ /* not implemented */
/* zassert_not_equal(-1, SIGTTIN); */ /* not implemented */
/* zassert_not_equal(-1, SIGTTOU); */ /* not implemented */
/* zassert_not_equal(-1, SIGUSR1); */ /* not implemented */
/* zassert_not_equal(-1, SIGUSR2); */ /* not implemented */
/* zassert_not_equal(-1, SIGTRAP); */ /* not implemented */
/* zassert_not_equal(-1, SIGURG); */ /* not implemented */
/* zassert_not_equal(-1, SIGXCPU); */ /* not implemented */
/* zassert_not_equal(-1, SIGXFSZ); */ /* not implemented */
/* zassert_not_equal(-1, SIG_BLOCK); */ /* not implemented */
/* zassert_not_equal(-1, SIG_UNBLOCK); */ /* not implemented */
/* zassert_not_equal(-1, SIG_SETMASK); */ /* not implemented */
/* zassert_not_equal(-1, SA_NOCLDSTOP); */ /* not implemented */
/* zassert_not_equal(-1, SA_ONSTACK); */ /* not implemented */
/* zassert_not_equal(-1, SA_RESETHAND); */ /* not implemented */
/* zassert_not_equal(-1, SA_RESTART); */ /* not implemented */
/* zassert_not_equal(-1, SA_SIGINFO); */ /* not implemented */
/* zassert_not_equal(-1, SA_NOCLDWAIT); */ /* not implemented */
/* zassert_not_equal(-1, SA_NODEFER); */ /* not implemented */
/* zassert_not_equal(-1, SS_ONSTACK); */ /* not implemented */
/* zassert_not_equal(-1, SS_DISABLE); */ /* not implemented */
/* zassert_not_equal(-1, MINSIGSTKSZ); */ /* not implemented */
/* zassert_not_equal(-1, SIGSTKSZ); */ /* not implemented */
/* mcontext_t mctx = {0}; */ /* not implemented */
/* zassert_not_equal(-1, offsetof(ucontext_t, uc_link)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(ucontext_t, uc_sigmask)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(ucontext_t, uc_stack)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(ucontext_t, uc_mcontext)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(stack_t, ss_sp)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(stack_t, ss_size)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(stack_t, ss_flags)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_signo)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_code)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_errno)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_pid)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_uid)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_addr)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_status)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_band)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(siginfo_t, si_value)); */ /* not implemented */
/* zassert_not_equal(-1, ILL_ILLOPC); */ /* not implemented */
/* zassert_not_equal(-1, ILL_ILLOPN); */ /* not implemented */
/* zassert_not_equal(-1, ILL_ILLADR); */ /* not implemented */
/* zassert_not_equal(-1, ILL_ILLTRP); */ /* not implemented */
/* zassert_not_equal(-1, ILL_PRVOPC); */ /* not implemented */
/* zassert_not_equal(-1, ILL_PRVREG); */ /* not implemented */
/* zassert_not_equal(-1, ILL_COPROC); */ /* not implemented */
/* zassert_not_equal(-1, ILL_BADSTK); */ /* not implemented */
/* zassert_not_equal(-1, FPE_INTDIV); */ /* not implemented */
/* zassert_not_equal(-1, FPE_INTOVF); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTDIV); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTOVF); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTUND); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTRES); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTINV); */ /* not implemented */
/* zassert_not_equal(-1, FPE_FLTSUB); */ /* not implemented */
/* zassert_not_equal(-1, SEGV_MAPERR); */ /* not implemented */
/* zassert_not_equal(-1, SEGV_ACCERR); */ /* not implemented */
/* zassert_not_equal(-1, BUS_ADRALN); */ /* not implemented */
/* zassert_not_equal(-1, BUS_ADRERR); */ /* not implemented */
/* zassert_not_equal(-1, BUS_OBJERR); */ /* not implemented */
/* zassert_not_equal(-1, TRAP_BRKPT); */ /* not implemented */
/* zassert_not_equal(-1, TRAP_TRACE); */ /* not implemented */
/* zassert_not_equal(-1, CLD_EXITED); */ /* not implemented */
/* zassert_not_equal(-1, CLD_KILLED); */ /* not implemented */
/* zassert_not_equal(-1, CLD_DUMPED); */ /* not implemented */
/* zassert_not_equal(-1, CLD_TRAPPED); */ /* not implemented */
/* zassert_not_equal(-1, CLD_STOPPED); */ /* not implemented */
/* zassert_not_equal(-1, CLD_CONTINUED); */ /* not implemented */
/* zassert_not_equal(-1, POLL_IN); */ /* not implemented */
/* zassert_not_equal(-1, POLL_OUT); */ /* not implemented */
/* zassert_not_equal(-1, POLL_MSG); */ /* not implemented */
/* zassert_not_equal(-1, POLL_ERR); */ /* not implemented */
/* zassert_not_equal(-1, POLL_PRI); */ /* not implemented */
/* zassert_not_equal(-1, POLL_HUP); */ /* not implemented */
/* zassert_not_equal(-1, SI_USER); */ /* not implemented */
/* zassert_not_equal(-1, SI_QUEUE); */ /* not implemented */
/* zassert_not_equal(-1, SI_TIMER); */ /* not implemented */
/* zassert_not_equal(-1, SI_ASYNCIO); */ /* not implemented */
/* zassert_not_equal(-1, SI_MESGQ); */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(kill); */ /* not implemented */
/* zassert_not_null(killpg); */ /* not implemented */
/* zassert_not_null(psiginfo); */ /* not implemented */
/* zassert_not_null(psignal); */ /* not implemented */
/* zassert_not_null(pthread_kill); */ /* not implemented */
/* zassert_not_null(pthread_sigmask); */ /* not implemented */
/* zassert_not_null(raise); */ /* not implemented */
/* zassert_not_null(sigaction); */ /* not implemented */
/* zassert_not_null(sigaddset); */ /* not implemented */
/* zassert_not_null(sigaltstack); */ /* not implemented */
/* zassert_not_null(sigdelset); */ /* not implemented */
/* zassert_not_null(sigemptyset); */ /* not implemented */
/* zassert_not_null(sigfillset); */ /* not implemented */
/* zassert_not_null(sighold); */ /* not implemented */
/* zassert_not_null(sigignore); */ /* not implemented */
/* zassert_not_null(siginterrupt); */ /* not implemented */
/* zassert_not_null(sigismember); */ /* not implemented */
/* zassert_not_null(signal); */ /* not implemented */
/* zassert_not_null(sigpause); */ /* not implemented */
/* zassert_not_null(sigpending); */ /* not implemented */
/* zassert_not_null(sigprocmask); */ /* not implemented */
/* zassert_not_null(sigqueue); */ /* not implemented */
/* zassert_not_null(sigrelse); */ /* not implemented */
/* zassert_not_null(sigset); */ /* not implemented */
/* zassert_not_null(sigsuspend); */ /* not implemented */
/* zassert_not_null(sigtimedwait); */ /* not implemented */
/* zassert_not_null(sigwait); */ /* not implemented */
/* zassert_not_null(sigwaitinfo); */ /* not implemented */
}
}

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sys/eventfd.h>
#else
#include <zephyr/posix/sys/eventfd.h>
#endif
/**
* @brief existence test for `<sys/eventfd.h>`
*
* @note the eventfd API is not (yet) a part of POSIX.
*
* @see <a href="https://man7.org/linux/man-pages/man2/eventfd.2.html">sys/eventfd.h</a>
*/
ZTEST(posix_headers, test_sys_eventfd_h)
{
/* zassert_not_equal(-1, EFD_CLOEXEC); */ /* not implemented */
zassert_not_equal(-1, EFD_NONBLOCK);
zassert_not_equal(-1, EFD_SEMAPHORE);
zassert_not_equal((eventfd_t)-1, (eventfd_t)0);
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(eventfd);
zassert_not_null(eventfd_read);
zassert_not_null(eventfd_write);
}
}

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sys/ioctl.h>
#else
#include <zephyr/posix/sys/ioctl.h>
#endif
/**
* @brief existence test for `<sys/ioctl.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html">ioctl</a>
* @see <a href="https://man7.org/linux/man-pages/man2/ioctl.2.html">ioctl(2)</a>
*/
ZTEST(posix_headers, test_sys_ioctl_h)
{
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(ioctl);
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sys/select.h>
#else
#include <zephyr/posix/sys/select.h>
#endif
/**
* @brief existence test for `<sys/select.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html">sys/select.h</a>
*/
ZTEST(posix_headers, test_sys_select_h)
{
fd_set fds = {0};
zassert_not_equal(-1, FD_SETSIZE);
FD_CLR(0, &fds);
FD_ISSET(0, &fds);
FD_SET(0, &fds);
FD_ZERO(&fds);
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(pselect); */ /* not implemented */
zassert_not_null(select);
}
}

View file

@ -0,0 +1,123 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sys/socket.h>
#else
#include <zephyr/posix/sys/socket.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
/**
* @brief existence test for `<sys/socket.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html">sys/socket.h</a>
*/
ZTEST(posix_headers, test_sys_socket_h)
{
struct cmsghdr cmsg = {0};
struct msghdr mhdr = {0};
zassert_true(sizeof(socklen_t) >= sizeof(uint32_t));
zassert_true((sa_family_t)-1 >= 0);
zassert_not_equal(-1, offsetof(struct sockaddr, sa_family));
/*
* FIXME: in zephyr, we define struct sockaddr in <zephyr/net/net_ip.h>
* The sa_data field is defined (incorrectly) as data.
* Fixing that is a (possibly breaking) tree-wide change.
*/
/* zassert_not_equal(-1, offsetof(struct sockaddr, sa_data)); */ /* not implemented */
zassert_not_equal(-1, offsetof(struct sockaddr_storage, ss_family));
zassert_equal(offsetof(struct sockaddr, sa_family),
offsetof(struct sockaddr_storage, ss_family));
zassert_not_equal(-1, offsetof(struct msghdr, msg_name));
zassert_not_equal(-1, offsetof(struct msghdr, msg_namelen));
zassert_not_equal(-1, offsetof(struct msghdr, msg_iov));
zassert_not_equal(-1, offsetof(struct msghdr, msg_iovlen));
zassert_not_equal(-1, offsetof(struct msghdr, msg_control));
zassert_not_equal(-1, offsetof(struct msghdr, msg_controllen));
zassert_not_equal(-1, offsetof(struct msghdr, msg_flags));
zassert_not_equal(-1, offsetof(struct cmsghdr, cmsg_len));
zassert_not_equal(-1, offsetof(struct cmsghdr, cmsg_level));
zassert_not_equal(-1, offsetof(struct cmsghdr, cmsg_type));
CMSG_DATA(&cmsg);
CMSG_NXTHDR(&mhdr, &cmsg);
CMSG_FIRSTHDR(&mhdr);
zassert_not_equal(-1, offsetof(struct linger, l_onoff));
zassert_not_equal(-1, offsetof(struct linger, l_linger));
zassert_not_equal(-1, SOCK_DGRAM);
zassert_not_equal(-1, SOCK_RAW);
/* zassert_not_equal(-1, SOCK_SEQPACKET); */ /* not implemented */
zassert_not_equal(-1, SOCK_STREAM);
zassert_not_equal(-1, SO_ACCEPTCONN);
zassert_not_equal(-1, SO_BROADCAST);
zassert_not_equal(-1, SO_DEBUG);
zassert_not_equal(-1, SO_DONTROUTE);
zassert_not_equal(-1, SO_ERROR);
zassert_not_equal(-1, SO_KEEPALIVE);
zassert_not_equal(-1, SO_LINGER);
zassert_not_equal(-1, SO_OOBINLINE);
zassert_not_equal(-1, SO_RCVBUF);
zassert_not_equal(-1, SO_RCVLOWAT);
zassert_not_equal(-1, SO_RCVTIMEO);
zassert_not_equal(-1, SO_REUSEADDR);
zassert_not_equal(-1, SO_SNDBUF);
zassert_not_equal(-1, SO_SNDLOWAT);
zassert_not_equal(-1, SO_SNDTIMEO);
zassert_not_equal(-1, SO_TYPE);
zassert_not_equal(-1, SOMAXCONN);
/* zassert_not_equal(-1, MSG_CTRUNC); */ /* not implemented */
/* zassert_not_equal(-1, MSG_DONTROUTE); */ /* not implemented */
/* zassert_not_equal(-1, MSG_EOR); */ /* not implemented */
/* zassert_not_equal(-1, MSG_OOB); */ /* not implemented */
/* zassert_not_equal(-1, MSG_NOSIGNAL); */ /* not implemented */
zassert_not_equal(-1, MSG_PEEK);
zassert_not_equal(-1, MSG_TRUNC);
zassert_not_equal(-1, MSG_WAITALL);
zassert_not_equal(-1, AF_INET);
zassert_not_equal(-1, AF_INET6);
zassert_not_equal(-1, AF_UNIX);
zassert_not_equal(-1, AF_UNSPEC);
zassert_not_equal(-1, SHUT_RD);
zassert_not_equal(-1, SHUT_RDWR);
zassert_not_equal(-1, SHUT_WR);
if (IS_ENABLED(CONFIG_POSIX_API)) {
zassert_not_null(accept);
zassert_not_null(bind);
zassert_not_null(connect);
zassert_not_null(getpeername);
zassert_not_null(getsockname);
zassert_not_null(listen);
zassert_not_null(recv);
zassert_not_null(recvfrom);
/* zassert_not_null(recvmsg); */ /* not implemented */
zassert_not_null(send);
zassert_not_null(sendmsg);
zassert_not_null(sendto);
zassert_not_null(setsockopt);
zassert_not_null(shutdown);
/* zassert_not_null(sockatmark); */ /* not implemented */
zassert_not_null(socket);
zassert_not_null(socketpair);
}
}
#pragma GCC diagnostic pop

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <sys/time.h>
#else
#include <zephyr/posix/sys/time.h>
#endif
/**
* @brief existence test for `<sys/time.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html">sys/time.h</a>
*/
ZTEST(posix_headers, test_sys_time_h)
{
zassert_not_equal(-1, offsetof(struct timeval, tv_sec));
zassert_not_equal(-1, offsetof(struct timeval, tv_usec));
/* zassert_not_equal(-1, offsetof(struct itimerval, it_interval)); */ /* not implemented */
/* zassert_not_equal(-1, offsetof(struct itimerval, it_value)); */ /* not implemented */
/* zassert_not_equal(-1, ITIMER_REAL); */ /* not implemented */
/* zassert_not_equal(-1, ITIMER_VIRTUAL); */ /* not implemented */
/* zassert_not_equal(-1, ITIMER_PROF); */ /* not implemented */
if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(getitimer); */ /* not implemented */
zassert_not_null(gettimeofday);
/* zassert_not_null(setitimer); */ /* not implemented */
/* zassert_not_null(utimes); */ /* not implemented */
}
}

View file

@ -0,0 +1,389 @@
/*
* Copyright (c) 2022 Meta
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "_common.h"
#ifdef CONFIG_POSIX_API
#include <unistd.h>
#else
#include <zephyr/posix/unistd.h>
#endif
/**
* @brief existence test for `<unistd.h>`
*
* @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html">unistd.h</a>
*/
ZTEST(posix_headers, test_unistd_h)
{
/* zassert_not_equal(-1, _POSIX_VERSION); */ /* not implemented */
/* zassert_not_equal(-1, _POSIX2_VERSION); */ /* not implemented */
/* zassert_not_equal(-1, _XOPEN_VERSION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_ADVISORY_INFO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_ASYNCHRONOUS_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_BARRIERS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_CHOWN_RESTRICTED); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_CPUTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_FSYNC); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_IPV6); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_JOB_CONTROL); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MAPPED_FILES); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MEMLOCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MEMLOCK_RANGE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MEMORY_PROTECTION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MESSAGE_PASSING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_MONOTONIC_CLOCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_NO_TRUNC); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_PRIORITIZED_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_PRIORITY_SCHEDULING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_RAW_SOCKETS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_READER_WRITER_LOCKS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_REALTIME_SIGNALS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_REGEXP); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SAVED_IDS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SHARED_MEMORY_OBJECTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SHELL); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SPAWN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SPIN_LOCKS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SPORADIC_SERVER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SYNCHRONIZED_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_ATTR_STACKADDR); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_ATTR_STACKSIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_CPUTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_PRIO_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_PRIO_PROTECT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_PRIORITY_SCHEDULING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_PROCESS_SHARED); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_ROBUST_PRIO_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_ROBUST_PRIO_PROTECT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_SAFE_FUNCTIONS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREAD_SPORADIC_SERVER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_THREADS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TIMEOUTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TIMERS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TRACE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TRACE_EVENT_FILTER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TRACE_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TRACE_LOG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_TYPED_MEMORY_OBJECTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V6_ILP32_OFF32); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V6_ILP32_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V6_LP64_OFF64); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V6_LPBIG_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V7_ILP32_OFF32); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V7_ILP32_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V7_LP64_OFF64); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_V7_LPBIG_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_C_BIND); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_C_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_CHAR_TERM); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_FORT_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_FORT_RUN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_LOCALEDEF); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS_ACCOUNTING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS_CHECKPOINT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS_LOCATE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS_MESSAGE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_PBS_TRACK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_SW_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_UPE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_CRYPT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_ENH_I18N); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_REALTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_REALTIME_THREADS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_SHM); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_STREAMS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_UNIX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _XOPEN_UUCP); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_ASYNC_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_PRIO_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_SYNC_IO); */ /* not implemented */
/* zassert_not_equal(-1, _POSIX_TIMESTAMP_RESOLUTION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX2_SYMLINKS); */ /* not implemented */
/* zassert_not_equal(-1, F_OK); */ /* not implemented */
/* zassert_not_equal(-1, R_OK); */ /* not implemented */
/* zassert_not_equal(-1, W_OK); */ /* not implemented */
/* zassert_not_equal(-1, X_OK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_PATH); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFF32_CFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFF32_LDFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFF32_LIBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_ILP32_OFFBIG_LIBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LP64_OFF64_CFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LP64_OFF64_LDFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LP64_OFF64_LIBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_LPBIG_OFFBIG_LIBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_THREADS_CFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_THREADS_LDFLAGS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _CS_V7_ENV); */ /* not implemented */
/* zassert_not_equal(-1, F_LOCK); */ /* not implemented */
/* zassert_not_equal(-1, F_TEST); */ /* not implemented */
/* zassert_not_equal(-1, F_TLOCK); */ /* not implemented */
/* zassert_not_equal(-1, F_ULOCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_2_SYMLINKS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_ALLOC_SIZE_MIN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_ASYNC_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_CHOWN_RESTRICTED); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_FILESIZEBITS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_LINK_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_MAX_CANON); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_MAX_INPUT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_NO_TRUNC); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_PATH_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_PIPE_BUF); */ /* not imp``lemented */
/* zassert_not_equal(INT_MIN, _PC_PRIO_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_REC_INCR_XFER_SIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_REC_MAX_XFER_SIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_REC_MIN_XFER_SIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_REC_XFER_ALIGN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_SYMLINK_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_SYNC_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_TIMESTAMP_RESOLUTION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _PC_VDISABLE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_C_BIND); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_C_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_CHAR_TERM); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_FORT_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_FORT_RUN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_LOCALEDEF); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS_ACCOUNTING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS_CHECKPOINT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS_LOCATE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS_MESSAGE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_PBS_TRACK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_SW_DEV); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_UPE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_2_VERSION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_ADVISORY_INFO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_AIO_LISTIO_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_AIO_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_AIO_PRIO_DELTA_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_ARG_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_ASYNCHRONOUS_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_ATEXIT_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_BARRIERS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_BC_BASE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_BC_DIM_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_BC_SCALE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_BC_STRING_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_CHILD_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_CLK_TCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_CLOCK_SELECTION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_COLL_WEIGHTS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_CPUTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_DELAYTIMER_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_EXPR_NEST_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_FSYNC); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_GETGR_R_SIZE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_GETPW_R_SIZE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_HOST_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_IOV_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_IPV6); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_JOB_CONTROL); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_LINE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_LOGIN_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MAPPED_FILES); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MEMLOCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MEMLOCK_RANGE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MEMORY_PROTECTION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MESSAGE_PASSING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MONOTONIC_CLOCK); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MQ_OPEN_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_MQ_PRIO_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_NGROUPS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_OPEN_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_PAGE_SIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_PAGESIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_PRIORITIZED_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_PRIORITY_SCHEDULING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_RAW_SOCKETS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_RE_DUP_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_READER_WRITER_LOCKS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_REALTIME_SIGNALS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_REGEXP); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_RTSIG_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SAVED_IDS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SEM_NSEMS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SEM_VALUE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SEMAPHORES); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SHARED_MEMORY_OBJECTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SHELL); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SIGQUEUE_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SPAWN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SPIN_LOCKS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SPORADIC_SERVER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SS_REPL_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_STREAM_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SYMLOOP_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_SYNCHRONIZED_IO); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_ATTR_STACKADDR); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_ATTR_STACKSIZE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_CPUTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_DESTRUCTOR_ITERATIONS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_KEYS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_PRIO_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_PRIO_PROTECT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_PRIORITY_SCHEDULING); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_PROCESS_SHARED); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_ROBUST_PRIO_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_ROBUST_PRIO_PROTECT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_SAFE_FUNCTIONS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_SPORADIC_SERVER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_STACK_MIN); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREAD_THREADS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_THREADS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TIMEOUTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TIMER_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TIMERS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_EVENT_FILTER); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_EVENT_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_INHERIT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_LOG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_SYS_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TRACE_USER_EVENT_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TTY_NAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TYPED_MEMORY_OBJECTS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_TZNAME_MAX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V7_ILP32_OFF32); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V7_ILP32_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V7_LP64_OFF64); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V7_LPBIG_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V6_ILP32_OFF32); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V6_ILP32_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V6_LP64_OFF64); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_V6_LPBIG_OFFBIG); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_VERSION); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_CRYPT); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_ENH_I18N); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_REALTIME); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_REALTIME_THREADS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_SHM); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_STREAMS); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_UNIX); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_UUCP); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _SC_XOPEN_VERSION); */ /* not implemented */
/* zassert_equal(STDERR_FILENO, 2); */ /* not implemented */
/* zassert_equal(STDIN_FILENO, 0); */ /* not implemented */
/* zassert_equal(STDOUT_FILENO, 1); */ /* not implemented */
/* zassert_not_equal(INT_MIN, _POSIX_VDISABLE); */ /* not implemented */
/*
* FIXME: this should really use IS_ENABLED()
* When CONFIG_POSIX_API is n-selected (i.e. POSIX headers can only be
* included with <zephyr/posix/...>, i.e. are namespaced), then there
* should be no reason to conditionally declare standard posix
* function prototypes.
*/
#ifdef CONFIG_POSIX_API
/* zassert_not_null(access); */ /* not implemented */
/* zassert_not_null(alarm); */ /* not implemented */
/* zassert_not_null(chdir); */ /* not implemented */
/* zassert_not_null(chown); */ /* not implemented */
zassert_not_null(close);
/* zassert_not_null(confstr); */ /* not implemented */
/* zassert_not_null(crypt); */ /* not implemented */
/* zassert_not_null(dup); */ /* not implemented */
/* zassert_not_null(dup2); */ /* not implemented */
zassert_not_null(_exit);
/* zassert_not_null(encrypt); */ /* not implemented */
/* zassert_not_null(execl); */ /* not implemented */
/* zassert_not_null(execle); */ /* not implemented */
/* zassert_not_null(execlp); */ /* not implemented */
/* zassert_not_null(execv); */ /* not implemented */
/* zassert_not_null(execve); */ /* not implemented */
/* zassert_not_null(execvp); */ /* not implemented */
/* zassert_not_null(faccessat); */ /* not implemented */
/* zassert_not_null(fchdir); */ /* not implemented */
/* zassert_not_null(fchown); */ /* not implemented */
/* zassert_not_null(fchownat); */ /* not implemented */
/* zassert_not_null(fdatasync); */ /* not implemented */
/* zassert_not_null(fexecve); */ /* not implemented */
/* zassert_not_null(fork); */ /* not implemented */
/* zassert_not_null(fpathconf); */ /* not implemented */
/* zassert_not_null(fsync); */ /* not implemented */
/* zassert_not_null(ftruncate); */ /* not implemented */
/* zassert_not_null(getcwd); */ /* not implemented */
/* zassert_not_null(getegid); */ /* not implemented */
/* zassert_not_null(geteuid); */ /* not implemented */
/* zassert_not_null(getgid); */ /* not implemented */
/* zassert_not_null(getgroups); */ /* not implemented */
/* zassert_not_null(gethostid); */ /* not implemented */
/* zassert_not_null(gethostname); */ /* not implemented */
/* zassert_not_null(getlogin); */ /* not implemented */
/* zassert_not_null(getlogin_r); */ /* not implemented */
zassert_not_null(getopt);
/* zassert_not_null(getpgid); */ /* not implemented */
/* zassert_not_null(getpgrp); */ /* not implemented */
/* zassert_not_null(getpid); */ /* not implemented */
/* zassert_not_null(getppid); */ /* not implemented */
/* zassert_not_null(getsid); */ /* not implemented */
/* zassert_not_null(getuid); */ /* not implemented */
/* zassert_not_null(isatty); */ /* not implemented */
/* zassert_not_null(lchown); */ /* not implemented */
/* zassert_not_null(link); */ /* not implemented */
/* zassert_not_null(linkat); */ /* not implemented */
/* zassert_not_null(lockf); */ /* not implemented */
zassert_not_null(lseek);
/* zassert_not_null(nice); */ /* not implemented */
/* zassert_not_null(pathconf); */ /* not implemented */
/* zassert_not_null(pause); */ /* not implemented */
/* zassert_not_null(pipe); */ /* not implemented */
/* zassert_not_null(pread); */ /* not implemented */
/* zassert_not_null(pwrite); */ /* not implemented */
zassert_not_null(read);
/* zassert_not_null(readlink); */ /* not implemented */
/* zassert_not_null(readlinkat); */ /* not implemented */
/* zassert_not_null(rmdir); */ /* not implemented */
/* zassert_not_null(setegid); */ /* not implemented */
/* zassert_not_null(seteuid); */ /* not implemented */
/* zassert_not_null(setgid); */ /* not implemented */
/* zassert_not_null(setpgid); */ /* not implemented */
/* zassert_not_null(setpgrp); */ /* not implemented */
/* zassert_not_null(setregid); */ /* not implemented */
/* zassert_not_null(setreuid); */ /* not implemented */
/* zassert_not_null(setsid); */ /* not implemented */
/* zassert_not_null(setuid); */ /* not implemented */
zassert_not_null(sleep);
/* zassert_not_null(swab); */ /* not implemented */
/* zassert_not_null(symlink); */ /* not implemented */
/* zassert_not_null(symlinkat); */ /* not implemented */
/* zassert_not_null(sync); */ /* not implemented */
/* zassert_not_null(sysconf); */ /* not implemented */
/* zassert_not_null(tcgetpgrp); */ /* not implemented */
/* zassert_not_null(tcsetpgrp); */ /* not implemented */
/* zassert_not_null(truncate); */ /* not implemented */
/* zassert_not_null(ttyname); */ /* not implemented */
/* zassert_not_null(ttyname_r); */ /* not implemented */
zassert_not_null(unlink);
/* zassert_not_null(unlinkat); */ /* not implemented */
zassert_not_null(write);
#endif
}

View file

@ -0,0 +1,44 @@
common:
arch_exclude: posix
tags: posix net socket
tests:
portability.posix.headers.with_posix_api:
extra_configs:
- CONFIG_POSIX_API=y
portability.posix.headers.without_posix_api:
extra_configs:
- CONFIG_POSIX_API=n
portability.posix.headers.picolibc.with_posix_api:
tags: picolibc
filter: CONFIG_PICOLIBC_SUPPORTED
extra_configs:
- CONFIG_POSIX_API=y
- CONFIG_PICOLIBC=y
portability.posix.headers.picolibc.without_posix_api:
tags: picolibc
filter: CONFIG_PICOLIBC_SUPPORTED
extra_configs:
- CONFIG_POSIX_API=n
- CONFIG_PICOLIBC=y
portability.posix.headers.newlib.with_posix_api:
tags: newlib
filter: TOOLCHAIN_HAS_NEWLIB == 1
extra_configs:
- CONFIG_POSIX_API=y
- CONFIG_NEWLIB_LIBC=y
portability.posix.headers.newlib.without_posix_api:
filter: TOOLCHAIN_HAS_NEWLIB == 1
extra_configs:
- CONFIG_POSIX_API=n
- CONFIG_NEWLIB_LIBC=y
portability.posix.headers.arcmwdtlib.with_posix_api:
toolchain_allow: arcmwdt
extra_configs:
- CONFIG_POSIX_API=y
- CONFIG_ARCMWDT_LIBC=y
portability.posix.headers.arcmwdtlib.without_posix_api:
toolchain_allow: arcmwdt
extra_configs:
- CONFIG_POSIX_API=n
- CONFIG_ARCMWDT_LIBC=y