Enhance test to validate a scenario where k_thread_name_set()
with NULL as thread ID should set thread name to current
thread.
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
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>
bat_commit is an old and obsolete tag that has not been maintained over
time and was supposed to serve a purpose that is obsolete now. Also
rename core tag with kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Building with !MULTITHREADING is designed for bootloaders and similar
minimal-functionality use cases. It's pathologically silly to combine
it with MMU drivers and address space partitioning, even though on
some architectures that technically works (on ARM, it seems not to).
The test intent was to disable this originally, but it turns out that
doesn't work. There is a TEST_USERSPACE kconfig symbol that also
needs to be explicitly turned off, otherwise it will reselect
USERSPACE against our wishes.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Add more stack for this test, it was failing and hidden by sanitycheck
(which needs to be fixed somewhere else).
Fixes#9664
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.
Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.
To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.
This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.
The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This adds two test cases to create dynamic threads, and one test
case to make sure permissions are set correctly.
Origin: Original
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Test to verify k_thread_user_mode_enter() when usermode is
not enabled or supported by architecture. The thread which calls
k_thread_user_mode_enter() with CONFIG_USERSPACE disabled or
architecture doesn't support usermode, should be marked
as usermode and if it is essential, then it has to be cleared.
This is added to improve code coverage.
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
Move k_thread_foreach() API test from tests/kernel/profiling to
tests/kernel/threads/thread_apis.
Fixes#7966
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This is a feature Ben added so you could use Zephyr's arch layer to
bootstrap things like bootloaders without sucking in the whole kernel.
And it's worked until now.
But we never had a test for it, and I just broke it with the scheduler
rework. Add a trivial test just to make sure this continues to link
and run. Longer term it would be nice to have some kind of size
metric here to guarantee that the feature stays lean and doesn't pull
in needless code.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
These tests had very small stacks, and the rbtree scheduler on
qemu_x86 (which does need a little extra stack room, though not much)
is bumping up against the limit. Increase by ~128 bytes in most
cases. In the case of the mbox_api test, there are other platforms
(which don't use the tree) which are right against the limit already
and will fail to link with a larger stack, so bump it for qemu_x86
only.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Remove unstructured and unused doxygen groups for tests. We will now add
doxygen comments per test function and follow a more structured
grouping.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
As k_thread_cancel() is deprecated, we need to test if delayed thread
which is in wait queue can be cancelled from k_thread_abort().
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
The only difference between this call and k_thread_abort() (beyond
some minor performance deltas) is that "cancel" will act as a noop in
cases where the thread has begun execution and will return an error.
"Abort" always succeeds, of course. That is inherently racy when used
as a "stop the thread" API: there's no way in general (or at all in
SMP situations) to know that you're calling this function "early
enough" to catch the thread before it starts.
Effectively, all k_thread_cancel() gives you that k_thread_abort()
doesn't is an indication about whether or not a thread has started.
There are many other ways to get that information that don't require
dangerous kernel APIs.
Deprecate this function. Zephyr's own code never used it except for
its own unit test.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The test validates the behavior of calling k_thread_start()
of thread which is already started. The thread has to start
execution only when its state is _THREAD_PRESTART.
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
The test verifies the API functionality of _thread_essential_clear(),
_thread_essential_set() and _is_thread_essential()
Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Two tests were on the knife-edge of their current stack limit and
were overflowing when UART system calls were added and userspace
enabled.
Test case stack sizes are often pulled out of thin air, the current
value of 256 was just a guess.
Kick these stacks up to 384; verified with sanitycheck --all that
this doesn't break anything.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
main.c and test_thread_init.c merged.
All tests which don't require cooperative priorities now running in
user mode.
Userspace tag added to testcase.yaml.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Some unnecessary k_thread_abort() removed.
userspace tag added to testcase.yaml.
Suspend/resume, spawn_forever, and spawn_priority tests remain in
supervisor mode due to the priority requests they make.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
It's now possible to instantiate a thread object, but delay its
execution indefinitely. This was already supported with K_THREAD_DEFINE.
A new API, k_thread_start(), now exists to start threads that are in
this state.
The intended use-case is to initialize a thread with K_USER, then grant
it various access permissions, and only then start it.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Arguments are not needed and in some cases are being set as unused in
the same function. The test_main function is called from ztest main
routine without any arguments.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>