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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
close in error handling attempts to close incorrect file descriptor.
Fixes#27327
Coverity-CID: 211585
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
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>
When there were multiple writes to eventfd, then poll() + read() should
start behaving as just initialized. Test that by verifying poll() will
timeout first and later be notified properly when eventfd is written
once again from the other thread.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Test is configured with CONFIG_POSIX_API=y, so there is no reason to
check for it being enabled in C. Additionally when CONFIG_POSIX_API=n a
much "bigger" posix/sys/socket.h was included instead of net/socket.h,
which should be rather opposite.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Introduce new test for eventfd, which will test it in only basic
scope. The real reason why this is introduced is to have a test with
minimal set of configuration dependencies, such as disabled
pthreads (compared to full tests/posix/eventfd/ variant). This allows to
test eventfd mechanism with both POSIX_API=n and POSIX_API=y.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
... because it is (required).
This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.
In this particular case, REQUIRED turns this harmless looking log
statement:
-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
Cannot specify sources for target "app" which is not built by
this project.
... into this louder, clearer, faster and (last but not least) final
error:
CMake Error at CMakeLists.txt:5 (find_package):
Could not find a package configuration file provided by "Zephyr" with
any of the following names:
ZephyrConfig.cmake
zephyr-config.cmake
Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
"Zephyr_DIR" to a directory containing one of the above files. If
"Zephyr" provides a separate development package or SDK, be sure it
has been installed.
-- Configuring incomplete, errors occurred!
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Before calling clock_gettime() 2 times in row, issue k_usleep(1)
to align code execution to timer interrupt to prevent (well,
minimize) possibility of getting different ticks values.
Suggested by @andyross.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This implements a file descriptor used for event notification that
behaves like the eventfd in Linux.
The eventfd supports nonblocking operation by setting the EFD_NONBLOCK
flag and semaphore operation by settings the EFD_SEMAPHORE flag.
The major use case for this is when using poll() and the sockets that
you poll are dynamic. When a new socket needs to be added to the poll,
there must be some way to wake the thread and update the pollfds before
calling poll again. One way to solve it is to have a timeout set in the
poll call and only update the pollfds during a timeout but that is not
a very nice solution. By instead including an eventfd in the pollfds,
it is possible to wake the polling thread by simply writing to the
eventfd.
Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
Using find_package to locate Zephyr.
Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.
Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.
It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Recently added test for pthread_getname_np()/pthread_setname_np()
functions used uninitialized array value. As we can't check behavior
for arbitrary uninitialized value, but at most NULL value, make the
test calls to explicitly use NULL, to make the test intent clear
(instead of for example initializing the original array with zeros).
Also, these test cases use variable names not consistent with Zephyr
codestyle, and named to generically to cause confuse when used in a
general context of the test_posix_pthread_execution() function, so
rename them to be specific. (And alternative would be to separate
pthread_getname_np()/pthread_setname_np() tests into a separate
function, but it was indeed practical to piggyback them on existing
test_posix_pthread_execution()).
Fixes: #23473
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Adding the ability to set and get pthread names by defining
some non-standard extension functions that were first
introduced by Glibc.
Similar to zephyr thread naming, these allow for thread
tracking and debugging even when using the more portable
posix API.
Though Glibc was the originator, the current POSIX functions
have return codes based on Oracle's adopted spec, so these
functions follow suit. The Oracle and Glibc function
prototypes match.
Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.
Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.
Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some test cases have the same test case name.
To get rid of it, I decided to change test cases names
contained same names.
Please check my logic, how I give them names.
Usually trying to give name same as a directory folder.
There are still more test cases which necessary to change,
but I will make changes by small steps.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
This test seems a little confused.
Adjust the calibration to allow 110ms sleeps to avoid error
during automated testing.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
Use the INT_TO_POINTER() and companion macros to silence compiler
warnings about casting between pointers and ints of different sizes.
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
Remove bunch of TC_PRINT's with too verbose logging of test operations.
The only logging required is in case of failures, and improve that in
a couple of cases by using zassert_*(), and log errno.
In particular, this allows to reuse existing testcase functions to
create more complex testcases.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This is no longer needed after using
zephyr_interface_library_named cmake directive in the POSIX subsys
source itself.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Per POSIX, open() is defined in <fcntl.h>. fcntl.h in turn comes from
the underlying libc, either newlib, or minimal libc.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This test seems a little confused. It does a POSIX usleep() for 90ms,
then checks the time taken, and verifies that it was no less
than... 91ms!
On existing platforms, tick alignment makes sure that we always take a
little longer, so this passes. But on high tick rate configurations we
get it exactly right. And fail.
Adjust the calibration to allow (exactly) 90ms sleeps. Also fixed a
comment that described the wrong units.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move fs.h to fs/fs.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Delete CONFIG_TEST_USERSPACE=n no-ops because it's the default
since commit 7b1ee5cf13
- Some tests have a "userspace" tag pretending to TEST_USERSPACE but
don't and vice versa: fix missing or spurious "userspace" tags in
testcase.yaml files.
Tests have a _spurious_ "userspace" tag when they PASS this command
cause none should pass:
./scripts/sanitycheck --tag=userspace -p qemu_x86 \
--extra-args=CONFIG_TEST_USERSPACE=n \
--extra-args=CONFIG_USERSPACE=n | tee userspace.log
All tests run by this command must either fail to build or fail to run
with some userspace related error. Shortcut to look at all test
failures:
zephyr_failure_logs() {
awk '/see.*log/ {print $2}' "$@"
}
Tests _missing_ "userspace" tag FAIL to either build or to run with some
userspace related error when running this:
./scripts/sanitycheck --exclude=userspace -p qemu_x86 \
--extra-args=CONFIG_TEST_USERSPACE=n \
--extra-args=CONFIG_USERSPACE=n | tee excludeuserspace.log
Note the detection methods above are not 100% perfect because some
flexible tests like tests/kernel/queue/src/main.c evade them with #ifdef
CONFIG_USERSPACE smarts. Considering they never break, it is purely the
test author's decision to include or not such flexible tests in the
"userspace" subset.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
According to POSIX, that's the header which defines this function.
Similarly, nothing in POSIX indicates that <time.h> should have
access to struct timeval, so it's removed (it's made accessible
to <sys/time.h> via <sys/_timeval.h> introduced earlier).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>