zephyr/tests/posix
Chris Friedt ab6102f70f 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>
2023-01-23 09:57:31 -08:00
..
common tests: posix: common: avoid direct pthread_attr_t field access 2023-01-10 09:02:21 +09:00
eventfd test: fix more legacy #include paths 2022-08-02 16:41:41 +01:00
eventfd_basic test: fix more legacy #include paths 2022-08-02 16:41:41 +01:00
fs yamllint: fix all yamllint line-length errors 2023-01-04 01:16:45 +09:00
getopt posix: getopt: move declarations to unistd.h 2022-12-04 14:51:52 +01:00
headers tests: posix: existence tests for standard POSIX includes 2023-01-23 09:57:31 -08:00