Commit Graph

147 Commits

Author SHA1 Message Date
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
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>
2022-09-05 16:31:47 +02:00
Manuel Arguelles 7f26c1c25c tests: samples: revert timeout change for FVP BaseR
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>
2022-08-16 15:51:38 +02:00
Stephanos Ioannidis c19fbce9d1 tests: posix: common: Disable for qemu_leon3
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>
2022-08-12 10:35:19 +01:00
Fabio Baltieri def230187b test: fix more legacy #include paths
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>
2022-08-02 16:41:41 +01:00
Christopher Friedt fe8dcdf4a3 tests: posix: eventfd: make min_ram a common test parameter
Some platforms with insufficient ram were incorrectly included
in this test since #47288.

Fixes #47734

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-13 11:56:42 -04:00
Christopher Friedt d37350bc19 tests: posix: pthread: test for pthread descriptor leaks
Add a simple test to ensure that we can create and join a
single thread `CONFIG_MAX_PTHREAD_COUNT` * 2 times. If
there are leaks, then `pthread_create()` should
eventually return `EAGAIN`. If there are no leaks, then
the test should pass.

Fixes #47609

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-12 10:16:02 +02:00
Manuel Arguelles f2ae4b67b2 tests: samples: bump timeout for FVP BaseR board
Timeout must be increased for fvp_baser_aemv8r_aarch32 board. Enabling
MPU on this board makes simulation slower.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-07-11 11:17:02 +02:00
Christopher Friedt 5874b8424c tests: posix: increase coverage for picolibc
This change adds coverage for picolibc in
* tests/posix/eventfd
* tests/posix/eventfd_basic
* tests/posix/getopt

Fixes #47288

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-05 12:53:49 -04:00
Christopher Friedt 0583ef71f5 tests: posix: additional tests against newlib
Add test permutations that run against the newlib
libc against
* tests/posix/eventfd
* tests/posix/eventfd_basic
* tests/posix/getopt

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-05 12:53:49 -04:00
Christopher Friedt 2bf3b45cbb tests: posix: consistent naming and tagging for posix tests
* ensure test permutations are prefixed with `portability.posix`
* ensure test permutations include the `posix` tag
* ensure consistent order of `arch_exclude` and `tags`

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-05 12:53:49 -04:00
Christopher Friedt f51b0f9883 tests: posix: getopt: remove unnecessary filter
Since `CONFIG_GETOPT=y` is specified in `prj.conf`,
it does not make sense to filter for `CONFIG_GETOPT`.

Additionally, we should run a permutation explicitly
with newlib, for consistency.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-05 12:53:49 -04:00
Reto Schneider 7a6c5710ff cmake: Update cmake_minimum_required to 3.20.0
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-07-04 10:18:45 +02:00
Keith Packard bea139f0f4 tests/posix/common: Let picolibc pick a malloc heap size
Now that picolibc's malloc arena configuration always allocates
some space, we don't need explicit allocations for tests.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-30 10:33:24 +02:00
Christopher Friedt d0f497c821 tests: posix: use new ztest api
* Convert test suite declaration to `ZTEST_SUITE()`
  and test case declaration to `ZTEST()`.
* add `CONFIG_ZTEST_NEW_API=y` to prj.conf

Fixes #46793

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-28 11:07:12 +02:00
Keith Packard d0a788669e tests: Add picolibc tests
This adds picolibc-specific configurations for a couple of tests

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Rico Ganahl 1cf7361f44 tests/posix/fs: extend readdir test
Test Zephyr POSIX readdir implementation for native POSIX behavior.

Signed-off-by: Rico Ganahl <rico.ganahl@bytesatwork.ch>
2022-05-13 11:10:04 -07:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Anas Nashif 2d97bdd85d samples: add module requirement into samples
Do not build those samples if the needed modules are not available in
the workspace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-19 09:38:55 -04:00
Christopher Friedt ddf3c57a39 tests: posix: test support for pthread_attr_setstacksize
Tests for `pthread_attr_setstacksize(3)` and
`pthread_attr_getstacksize(3)`.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-04-12 22:02:04 +09:00
Jaxson Han 0e1ff84fe7 posix: Fix pthread_once has incorrect behavior
As described in
https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_once.html.
The behavior of pthread_once() is undefined if once_control has
automatic storage duration or is not initialized by PTHREAD_ONCE_INIT

However, in Zephyr, the implementation is incorrect. If the init value
is PTHREAD_ONCE_INIT, the program will never run the init_func.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-04-05 10:38:30 -07:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Hake Huang 574e166e13 test: portability.posix.common.newlib: exclude lpcxpresso55s06
exclude newlib for posix testing as the MAX_HEAP_SIZE will be
too small if enabled NEWLIBC

fixing: #43873

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-17 20:47:47 -04:00
Carles Cufi e83a13aabf kconfig: Rename the TEST_EXTRA stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Christopher Friedt ec0d878019 tests: pthread: cond: check return from pthread_cond_wait()
The expectation is that this call succeeeds in order for
the test to pass.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-02-09 22:16:45 -05:00
Jakub Rzeszutko 2caf587095 tests: lib: getopt
Add tests for the getopt library.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Anas Nashif 05ecd46a84 tests: fix typos and misnamed platforms
Various obsolote and misnamed platfomrs in test filters theat went
undetected for a while.

Fixes #41222

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-17 12:24:37 -05:00
Gerard Marull-Paretas a6a296d050 tests: posix: common: increase main stack for TLS tests
Increase main stack size (in 128 bytes) to make these tests run
successfully on qemu_x86 platform.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Henrik Brix Andersen 265cdf8dc6 cmake: use find_package() instead of literal include in tests and samples
Convert remaining tests and samples to using find_package() instead of
literally including the CMake boilerplate code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04:00
Christopher Friedt 51030e4ccf tests: posix: common: clock: remove poorly conditioned tests
The test assumed initial equality between CLOCK_MONOTONIC and
CLOCK_REALTIME and also assumed coarse granularity for each clock.
Neither of those assumptions are solid.

Furthermore, the test failed on multiple vendor boards which caused
some concern.

Remove the poorly conditioned tests and remove some comments
/ printks.

Fixes #35703

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-09 21:20:27 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Evgeniy Paltsev ce47512c09 tests: posix: common: add option to build with arcmwdt libc
Add testcase to tests/posix/common with ARC MWDT libc usage.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-13 13:43:19 -05:00
Jennifer Williams 7e6e05c5e4 tests: posix: common: clock: exclude ehl_crb from test posix realtime
The ehl_crb board has hardware issue that prevents this test from
being able to pass this otherwise-correct test. So exclude ehl_crb
from the testcase.yaml.

Fixes #33544.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-06-02 08:49:45 -05:00
Jennifer Williams bd365cc42e tests: posix: common: clock.c: rephrase comment on tick alignment
This k_usleep(1) is a tick alignment, not a workaround. Simple
reword to avoid confusion.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-27 15:56:15 -05:00
David Leach 507a06fa82 tests: posix: Fix unchecked return coverity error
New test cases did not check return value of pthread_attr_init()

Fixes #33809

Signed-off-by: David Leach <david.leach@nxp.com>
2021-04-01 04:52:10 -04:00
Jian Kang 064d450ae0 tests: posix: Add new testcases for posix APIs
Add error condition to test pthread. Like use pthread with
uninitialize stack or stack size is 0, and verify the result
is as expected.

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2021-03-25 14:07:35 +01:00
Johann Fischer 5070186f63 tests/boards/samples: fixup after sdmmc driver relocation
Fixup configuration.
Remove obsolete SDHC SPI configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Adam Jeliński 9919c14175 m2gl025_miv: Double the test timeouts
The `m2gl025_miv` board needs more time to complete these tests with
Renode.

Signed-off-by: Adam Jeliński <ajelinski@antmicro.com>
2021-02-09 19:41:27 -05:00
Watson Zeng 0bc64a7946 tests: tls: add toolchain filter
tls rely on both arch has tls and toolchain support tls, add filter:
CONFIG_TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE for
some tests enabled tls.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-12-15 11:22:38 +01:00
Daniel Leung e95d14ae9b tests: posix/{common,fs}: enable testing TLS
Enable additional test cases for thread local storage,
as these tests use errno.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-10-24 10:52:00 -07:00
Rafał Kuźnia d897bd1e74 tests: posix: eventfd: increase test coverage with polling
This commit adds the following tests:
* check eventfd with initval != 0
* check write counter overflow
* check if eventfd is blocked after read
* check if writing zero does not unblock
* check if nonblocking eventfd poll() behaviour is identical to blocking

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2020-10-02 11:34:19 +02:00
Christopher Friedt 75b9292a30 tests: posix: nanosleep: round up to the nearest microsecond
Here, we include some addtional tests for durations that have
sub-microsecond components.

1ns => k_busy_wait(0). Round to 1us.
1us + 1ns => k_busy_wait(1us). Round to 2us.
1s + 1ns => k_busy_wait(1000000us). Round to 1000001us.
1s + 1us + 1ns => k_busy_wait(1000001us). Round to 1000002us.

Fixes #28483

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-10-02 11:31:43 +02:00
Alexandre Bourdiol 2b4457347d tests: posix: common: move printk() out of k_usleep() tick alignment
Move printk() out of k_usleep() tick alignment,
for a better tick synchro.

Fixes #25453

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-18 22:07:19 -04:00
peng1 chen bcf1aed311 tests: fix potential integer overflow
fixed coverity issue #28413.

Signed-off-by: peng1 chen <peng1.chen@intel.com>
2020-09-17 07:09:29 -04:00
Peter Bigot 2534b18bb1 tests: posix: common: remove sub-microsecond nanosleep test
Beyond the complexities of tick resolution on QEMU, this test is
invalid because POSIX nanosleep as currently implemented uses
k_busy_wait(ns / 1000) which means it's measuring the duration of
k_busy_wait(0) in ticks, which has no reasonable relation to 1 ns
regardless of tolerance.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-16 12:04:04 +02:00
Peter Bigot 3c6eaa5468 tests: posix: fix nanosleep tests for clock slew
Use the technique from portability/cmsis_rtos_v1 to compensate for
systems where times are being measured with different clocks.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-14 17:01:41 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Dominik Ermel 97ca27797f tests/posix/fs: Fix missing close in error paths
Missing close in error paths trigger Coverity to issue "Resource Leak"
errors.

Fixes #27328
Coverity-CID: 211586

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-08-05 08:04:29 -04:00
Dominik Ermel e606801664 tests/posix/fs: Fix close of bad file descriptor
close in error handling attempts to close incorrect file descriptor.

Fixes #27327
Coverity-CID: 211585

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-08-05 08:04:29 -04:00
Dominik Ermel b9054bfcf7 tests/posix/fs: Add tests for open flags
Add new tests that will utilize open mode flags with the open
function.

A few test functions which assumed O_CREAT behavior are updated
to specify it explicitly.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-30 16:33:18 +02:00