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>
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>
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>
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>
Rather than pass an variable address to a `void *` in
`pthread_join()` and do nothing with it, just pass `NULL`.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The `test_pthread_descriptor_leak` test was causing a kernel
panic on some platforms. Initially, it was not clear why.
The usual cases were examined - race conditions, stack sizes,
etc. Still no luck.
As it turns out, recycling a thread stack (or at least the
`pthread_attr_t`) in-place does not work on some platforms,
and we need to reinitialize the `pthread_attr_t` and set
set the stack property again prior to calling
`pthread_create()`.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Verify that threads are actually schedulable for min and max
scheduler priority for both `SCHED_RR` (preemptive) and
`SCHED_FIFO` (cooperative).
Fixes#56729
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Previously, the `fnmatch()` function was available in `lib/util`
but it did not have any test coverage.
After moving it to `lib/posix`, add test coverage to the POSIX
testsuite.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Zephyr's `SCHED_RR` and `SCHED_FIFO` definitions were slightly
different than Newlib's. Additionally, the test had hard-coded
magic numbers instead of using symbolic values.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Define `PTHREAD_CREATE_DETACHED` and
`PTHREAD_CREATE_JOINABLE` to be compatible with the Newlib
definitions.
This is a temporary workaround for #51211 until Newlib
headers are pulled in.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
There was a second call to `pthread_attr_init()` that reallly had
no sense being there. Also, it seems that there was a call to
`pthread_attr_destroy()` out of perhaps paranoia.
The duplicate call and `pthread_attr_destroy()` can be removed.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Fix all line-length errors detected by yamllint:
yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
grep '(line-length)'
Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Previously, there was no test coverage for `sleep()` and
`usleep()`.
This change adds full test coverage.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Using `usleep()` for >= 10000000 microseconds results
in an error, so this test was kind of defective, having
explicitly called `usleep()` for seconds.
Also, check the return values of `clock_gettime()`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Add a test to ensure that `pthread_cond_t` can be used over
and over again and that there is no resource leakage with proper
usage.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Add a test to ensure that `pthread_mutex_t` can be used over
and over again and that there is no resource leakage with proper
usage.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Several other widely-used pthread implementations
abstract `pthread_t` as `uint32_t`. The benefit
there is that we avoid passing around a pointer to
an internal structure (implementation detail).
Additionally, this removes the alias from `k_tid_t`
to `pthread_t` inside of `struct pthread_mutex`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.
The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.
NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Partially revert commit 0028e97332.
Timeout for tests/posix/common must be still increased for slow
platforms (previously was 120 sec).
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
This commit disables the `tests/posix/common` test for the `qemu_leon3`
platform because of the alignment-related failure reported in the
GitHub issue zephyrproject-rtos/zephyr#48992.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>