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>
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>
... 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>
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>
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>
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>
- 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>
The NSIM emulator has severe performance issues when
the MPU registers are reprogrammed on context switch.
Disable runtime reprogramming of the MPU for these
platforms on these two tests, which have a lot of context
switch thrashing. This is done by ensuring userspace
and hardware stack overflow detection via guard areas
is disabled.
I have assurances from the ARC team that the tests run fine
on real hardware and this is an emulation issue.
For 1.15, this will be completely resolved by optimizing
MPU region gap-filling to not take place during context
switch time, which will drastically reduce the number of
MPU registers poked during context switch on nsim_sem.
Meanwhile, for 1.14 we ensure that no runtime reprogramming
of the MPU is done for these tests.
Fixes: #14642
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Exactly one caller of pthread_barrier_wait() should receive a return
value of PTHREAD_BARRIER_SERIAL_WAIT; all others should receive zero
(or an error code). Added a test to match.
Fixes: #9953
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
(Chunk 3 of 3 - this patch was split across pull requests to address
CI build time limitations)
Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)
About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default. Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off. There's still plenty
of SMP coverage in the remaining cases.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Add a build variant of the posix tests with newlib enabled. Since the
interation of posix is greatly related to the libc we should have these
tests build with and without newlib support.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This test is breaking CI, we need a fix first before we go and enable
tests.
This reverts commit dc39a9adcf.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a build variant of the posix tests with newlib enabled. Since the
interation of posix is greatly related to the libc we should have these
tests build with and without newlib support.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
For now we are disabling support for POSIX lib on native posix arch. We
need to cleanup and support POSIX lib cleanly for hardware targets.
Once that is working properly we can look to support the feature on
native posix arch.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Some tests instantiate a lot of thread objects. These
were not tagged with __kernel, and
CONFIG_APPLICATION_MEMORY was enabled, so the kernel was
not adding them to the kernel object database.
However, with CONFIG_APPLICATION_MEMORY disabled, this
overflowed the default max number of thread objects (16).
Increase the max to 32 for these particular tests.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This is intended to be a value set by the platform to adjust the size
of stacks created by tests. This test was setting it explicitly, and
failing to honor it when creating its own stacks.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Move to latest cmake version with many bug fixes and enhancements.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.
This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.
Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Initialize an otherwise unitialized array which was causing random
failures in tests/posix/common.
Fixes#10508
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Grouped the five pthread tests into two -
pthread execution and pthread termination;
removed redundant tests.
Added the refactored tests and pthread_key
tests into the common folder.
Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
Enhance semaphore test to validate sem_timedwait()
and sem_trywait(). This is intended to improve
code coverage.
Also modify ztest check with zassert_equal with
return value instead of zassert_false for better
understandability.
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>