This follows the same convention that has already been adopted by Intel
Alder Lake and Raptor Lake boards.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
extends the char buffer in the strsignal function to cover the
entire range of `int`
Had to use `-INT_MAX` as the compiler resolves
```
STRINGIFY(INT_MIN)
```
to:
```
(-2147483647 - 1)
```
instead of:
```
-2147483648
```
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
For platforms that select Kconfig option CONFIG_KERNEL_COHERENCE,
the receive buffer used in mq_timedreceive() must not be on the
stack. This is because the k_msgq that underlies the POSIX mqueue
will attempt to perform a direct to buffer copy from the sender
when there is a waiting reader.
Fixes#60796
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
A thread that has been previously detached using
`pthread_detach()` should not be able to be joined. A recent
change made it so that `pthread_join()` would always report
success (0), even when `ret` (return value) had an error.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The test is failing for (so far) unknown reasons, blocking several PRs.
Exclude it until a proper investigation finds the root cause.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Test names were changed recently to change
"test_posix_pthread_..." to "test_..." for brevity.
Make the same change to "test_posix_pthread_barrier".
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Most Zephyr testsuites do not break tests down to the level of
granularity that `nanosleep()` tests, and this change makes
reports less verbose.
This change makes the `nonosleep()` test cases
significantly less verbose.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The POSIX testsuite should be run with standard POSIX
header locations.
Additionally, reorder headers to follow the recommendation
in #41543.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
There were a number of tests that started with `test_posix_..`.
The `test_` prefix is necessary, but the `posix_` part is self-
evident, so it makes sense to shorten that.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Exercise the following (which rely mainly on existing Zephyr
utilities)
* `pthread_spin_init()`
* `pthread_spin_destroy()`
* `pthread_spin_lock()`
* `pthread_spin_trylock()`
* `pthread_spin_unlock()`
Additionally, ensure that we do not leak spinlock descriptors.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
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>
This commit adds tests for the stat command. Stat on the
root of the filesystem is not yet supported.
Signed-off-by: Vincent van Beveren <v.van.beveren@nikhef.nl>
Make sure that `poll(..., POLLIN)` executed from another thread returns
when `eventfd_write()` is called. Test also the same with `poll(...,
POLLOUT)` and `eventfd_read()` on eventfd with counter equal to
`UINT64_MAX - 1`.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
In some cases, when GitHub CI is running several Qemu processes,
each with heavy loads, SMP tests have shown some flakiness. This
exhibits itself as something like
```
... pthread_pressure on qemu_riscv32 failed (Timeout)
```
That is actually not at all limited to POSIX or any particular
architecture, but is mainly to do with the host scheduler and
perhaps memory barrier operations being lost in ISA translation
by Qemu.
Collectively, we can refer to these issues as "scheduler noise".
To reduce scheduler noise in the `pthread_pressure` testsuite,
enable `CONFIG_PTHREAD_CREATE_BARRIER` in `testcase.yaml`.
Note: end-users will likely not experience the need to enable
this in `prj.conf`. E.g. the following basic test demonstrates
0 failures locallly.
```
TEST=tests/posix/pthread_pressure
twister --build-only -T $TEST &>/dev/null
FAIL=0
for ((i=0; i < 100; i++)); do
echo "Run $((i+1))/100"
twister --test-only -T $TEST &>/dev/null
if [ $? -ne 0 ]; then
FAIL=$((FAIL+1))
echo "Failed $FAIL times"
fi
done
echo "Failure Rate: $((FAIL))/100"
```
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Previously pthread_barrier_t was implemented in terms of wait
queues and internal scheduler functions.
This introduced some obstacles and inconsistency. In order
to be more consistent, rely only on Zephyr's public API and
reuse as many concepts as possible.
Deprecate `PTHREAD_BARRIER_DEFINE()` since it's non-standard.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Recently, a race condition was discovered in `pthread_create()`
and `pthread_join()` that would trigger an assertion in
`kernel/sched.c` of the form below.
```
aborted _current back from dead
```
This was mainly observed in Qemu. Unfortunately, Qemu SMP
platforms exhibit a real and measurable "scheduler noise"
which makes testing rather difficult.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The `aborted _current back from dead` error may appear in this
particular test under Qemu (and in particular Qemu SMP) systems.
A small delay between `pthread_create()` and `pthread_join()`
is sufficient to mitigate the issue.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
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>
This test simply counts how many times `eventfd_read()`
and `eventfd_write()` can be called on an
`eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK)` file
descriptor.
Prior to the recent changes in `eventfd`, we were seeing
approximately < 1000 writes / s. However, the previous
`eventfd` implementation would fail this test with the
result that the number of successful reads was far greater
than the number of successful writes.
This should be impossible, and with the recent `eventfd`
changes that was fixed. Additionally, we are seeing an
increase in over 40x for non-blocking eventfd reads and
writes.
```
START - test_stress
I: BOARD: qemu_riscv64_smp
I: TEST_DURATION_S: 5
I: UPDATE_INTERVAL_S: 1
I: avg: 48537 reads/s
I: avg: 48575 writes/s
PASS - test_stress in 5.002 seconds
```
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Previously, the prototypical use case for `eventfd()` was not
possible in Zephyr due to a deadlock associated with the
`fdtable.c` `k_mutex`.
The prototypical use case for `eventfd()` is to make a
blocking call to `eventfd_read()` from one thread, and then
from another thread, call `eventfd_write()` to "wake up" the
reading thread.
This additional test case ensures that Zephyr supports the
prototypical `eventfd()` use case.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Set up a test fixture to reduce repetition and split
testsuite into blocking and nonblocking tests.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Include standard headers first, and then ensure that the
convention of `<zephyr/posix/...>` is followed for internal
POSIX sources.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
In order to reduce churn in CI, test only with the default libc.
Additionally, reduce Kconfig options in `prj.conf` to minimum.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
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>