Commit graph

45 commits

Author SHA1 Message Date
Gaetan Perrot 0b51d37f35 posix: Implement test for isastream
Add tests for `isastream()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-13 20:23:34 -04:00
Gaetan Perrot 46f489da3a tests: posix: add tests for pthread_setschedprio()
Add tests for pthread_setschedprio()

Signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-04 10:25:53 -04:00
Chris Friedt 3c42daee9c tests: posix: headers: fix undefined ref to zsock_socketpair
Update prj.conf so that

subsys/net/lib/sockets/socketpair.c

is pulled into the build and zsock_socketpair() is
properly defined.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-04-03 07:09:16 -04:00
Gaetan Perrot aad1f6e47b test: posix: headers: check for pthread_rwlockattr_getpshared()
Check for the existence of
pthread_rwlockattr_getpshared()
and
pthread_rwlockattr_setpshared().

Signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-03 10:38:42 +03:00
Gaetan Perrot c877cd903d posix: Implement tests for set and get inheritsched APIs for pthread attr
Add tests for `pthread_attr_setinheritsched()`
and `pthread_attr_getinheritsched()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-01 11:04:35 +01:00
Chris Friedt fc725a7ce3 tests: posix: headers: uncomment check for sockatmark()
Uncomment the check for sockatmark() to ensure that the function
is declared in sys/socket.h, as a stub implementation was added
in the previous commit.

Signed-off-by: Chris Friedt <chrisfriedt@gmail.com>
2024-03-27 07:36:18 -04:00
Chris Friedt 6720c92f3e tests: posix: headers: uncomment netdb.h tests
Uncomment netdb.h tests now that we have an implementation and
can check for the existence of e.g. hostent, netent, protoent,
and servent structure fields, as well as associated accessor
functions.

Signed-off-by: Chris Friedt <chrisfriedt@gmail.com>
2024-03-27 07:36:18 -04:00
Chris Friedt 7b9bf85d9b tests: posix: headers: uncomment net/if.h tests
Uncomment net/if.h tests in tests/posix/headers since we now
have an implementation and can check for the existence of
structures, functions, etc.

Signed-off-by: Chris Friedt <chrisfriedt@gmail.com>
2024-03-27 07:36:18 -04:00
Gaetan Perrot 99f62a749c posix: Implement tests for set and get scope APIs for pthread attr
Add tests for `pthread_attr_setscope()`
and `pthread_attr_getscope()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-03-18 10:15:53 +01:00
Gaetan Perrot 45f907b9fd posix: Implement test for getmsg and getpmsg
Add tests for `getmsg()` and `getpmsg()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-03-11 14:25:26 +01:00
Gaetan Perrot a4ea4e294f posix: Implement test for fdetach and fattach
Add tests for `fdetach()` and `fattach()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-26 11:36:04 +00:00
Gaetan Perrot 6fe676f4e8 posix: sched: Implement tests for sched_rr_get_interval
Implement tests for `sched_rr_get_interval()` .
Function is actually placeholders and just return `ENOSYS`
since Zephyr does not yet support processes or process scheduling.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-02 12:42:50 +01:00
Gaetan Perrot 042b522506 tests: posix: add tests for pthread_testcancel()
Add tests for pthread_testcancel()

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-01 15:14:28 +01:00
Gaetan Perrot c6c99245f6 posix: sched: Implement tests for set APIs for scheduling parameters
Implement tests for `sched_setparam()` and `sched_setscheduler()` .
Both functions are actually placeholders and just return `ENOSYS`
since Zephyr does not yet support processes or process scheduling.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-01-31 11:16:26 +01:00
Abhinav Srivastava 52485876f0 posix: Add tests for stropts
Add tests, Fix config issues, Re-add Timer

Signed-off-by: Abhinav Srivastava <atg271@gmail.com>
2024-01-31 09:05:50 +01:00
Adam Wojasinski 31af5f8fe1 tests: posix: Add test case for sysconf()
Adds test cases for sysconf() basic implementation.
Test case does not cover scenario where invalid value is passed
to the name argument of the function.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-01-30 18:01:18 +01:00
Adam Wojasinski dfb6e5aa96 tests: posix: Add test cases for mq_notify()
Adds test cases testing following features:
- function error handling
- basic notification type
- thread notification type
- adding notification to non-empty queue

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-01-25 19:47:37 +01:00
Jai Arora ba7b7ffff2 posix: Adds test to check getpid() is not NULL
Adds test to check getpid() function is not NULL

Signed-off-by: Jai Arora <infolinesoni@gmail.com>
2024-01-20 12:41:28 +01:00
Christopher Friedt e223d01b67 tests: posix: shorten the filter in testcase.yaml
CONFIG_NATIVE_LIBC can be used in place of
CONFIG_NATIVE_BUILD and CONFIG_EXTERNAL_LIBC

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-17 04:59:16 -05:00
Dmitrii Golovanov 68d1a52417 posix: sched: Implement get APIs for scheduling parameters
Initial implementation of `sched_getparam()` and `sched_getscheduler()`
POSIX APIs as a part of PSE53 `_POSIX_PRIORITY_SCHEDULING` option group.
Both functions are actually placeholders and just return `ENOSYS`
since Zephyr does not yet support processes or process scheduling.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-01-15 09:57:44 +01:00
Yong Cong Sin 73da1e80f4 posix: signal: implement sigprocmask()
Implement `sigprocmask()` by simply redirecting call to the
`pthread_sigmask()` as they are identical.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-11 07:49:26 -05:00
Yong Cong Sin abb21d48d9 posix: semaphore: implement sem_open(), sem_unlink() & sem_close()
Implements `sem_open()`, `sem_unlink()` & `sem_close()`
functions and added tests for them.

Updated existing tests and POSIX docs.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-10 07:18:19 -05:00
Christopher Friedt 5c78c66fc2 tests: posix: headers: check for pthread get / set guardsize
Add checks to ensure that pthread_getguardsize() and
pthread_setguardsize() are callable.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Christopher Friedt 4153a396f8 tests: posix: headers: enable tests for signal.h entities
Enable existsence checks for newl(-ish)ly added signal.h
definitions.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-04 20:49:35 -05:00
Anas Nashif e11a71dea0 tests: posix: remove unrelated tags
Remove unrelated tags: net, socket.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-30 11:23:11 -05:00
Christopher Friedt c0f2038c26 tests: posix: headers: check for pthread_getconcurrency()
Check for the existence of pthread_getconcurrency() and
pthread_setconcurrency().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-27 08:26:31 -05:00
Christopher Friedt 5f64a47d52 tests: posix: headers: support pthread_setcancelstate() / type()
The function pthread_setcancelstate() has been supported for
some time already in Zephyr. For some reason, it was not being
checked in the "headers" testsuite.

Additionally, check for pthread_setcanceltype() since it was
added in a prior commit.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-26 05:55:08 -05:00
Christopher Friedt d2e729233d tests: posix: headers: add verification tests for more constants
Ensure that the "headers" test checks that the following constants
are defined:

* PTHREAD_PROCESS_SHARED
* PTHREAD_PROCESS_PRIVATE
* PTHREAD_COND_INITIALIZER
* PTHREAD_MUTEX_INITIALIZER
* PTHREAD_CANCELED

They were already defined by previous commits, but the test had not
been updated.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-25 06:29:16 -05:00
Christopher Friedt 505e9be2e1 tests: posix: headers: ensure pthread_condattr_getclock() exist
These calls were added some time ago, so ensure they are checked
for existence.

* pthread_condattr_getclock()
* pthread_condattr_setclock()

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-25 06:29:16 -05:00
Christopher Friedt 131220cb95 tests: posix: headers: check pthread_spin_lock() et al exist
The simple header test was not updated to verify that the
following functions were implemented even though they were
implemented some time ago.

* pthread_spin_destroy()
* pthread_spin_init()
* pthread_spin_lock()
* pthread_spin_trylock()
* pthread_spin_unlock()

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-25 06:29:16 -05:00
Christopher Friedt 41b7c17ac4 tests: posix: pthread: check that pthread_atfork() exists
Add a simple existence check that pthread_atfork() has
some kind of implementation. The function is mandatory
by all conforming POSIX systems.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-23 00:59:32 -05:00
Anas Nashif 345735d0a8 tests: remove CONFIG_ZTEST_NEW_API in all tests
Remove all usage of CONFIG_ZTEST_NEW_API from tests and sample as this
is now enabled by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Yong Cong Sin 335acf817d posix: signal: implement strsignal
Implementation and ztest for strsignal.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin ff4b81e5e5 posix: signal: implement sigismember
Implementation and ztest for sigismember.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin 88cd494430 posix: signal: implement sigdelset
Implementation and ztest for sigdelset.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin 8011449542 posix: signal: implement sigaddset
Implementation and ztest for sigaddset.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin b9720e27c0 posix: signal: implement sigfillset
Implementation and ztest for sigfillset.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin 6910eb4a9b posix: signal: implement sigemptyset
Implementation and ztest for sigemptyset.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin e3c49b9573 posix: signal: add initial header
Initial header for the signal APIs.
APIs to be implemented in later commit.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Alberto Escolar Piedras 4598d2b372 tests POSIX: Do not filter fully by POSIX arch but by type of build
Some POSIX arch targets support now the POSIX API.
Instead of filtering the architecture fully,
let's limit it to the type of build

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-05 07:01:19 -04:00
Declan Snyder 4c8b18920a tests: posix headers: RT1015 increase RAM
RT1015 needs more RAM to do this test, increase size of Zephyr SRAM
by switching zephyr,sram to the OCRAM allocation of the FLEXRAM.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-05 10:35:38 +02:00
Anas Nashif a543ba1f4d tests: use integration_platforms where applicable
Use integration_platforms where coverage is provided using one or few
targets instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-26 17:52:02 -04:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Guillaume Gautier 4f129551d4 tests: posix: headers: Add min_ram to fix nucleo_f103rb compilation error
Compilation of this test on nucleo_f103rb fails because "region 'RAM'
overflowed by 136 bytes". Since this board has a ram size of 20k, we set
the limit for this test at the next usual size 32k.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-02-06 10:06:45 +01:00
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