Commit graph

1715 commits

Author SHA1 Message Date
Anas Nashif e1e68c7af3 tests: uart: fixed filtering and make test global
Remove build_only and improved platform filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif f07d66fcef tests: rtc: fix dependencies
Depend on RTC driver being available on the device.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 5f34003da2 tests: integrate quark clock test in build test
This is just a build test, so integrate in the build_only test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 7aec3948ec tests: pwm: fix dependencies and use depends_on
We should only build and run on supported devices.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 8383fa65d1 tests: pinmux: depend on pinmux and support harness
Make sure we only build and run on supported platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif a67a407c5d tests: pci: fix tags
Add correct tag to the testcase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif f2dc220387 tests: ipm: fix testcase tags
Add correct tag to the testcase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif e9abafa5fb tests: integrate nsim test in build test
This is just a build test, so make it part of the overall build test
instead of having a special test case for it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif c859ebe02e tests: i2c: make test depend on i2c
Build only for platforms that have an I2C driver.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif a0ba239886 tests: gpio: make test depend on gpio capability
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 9e91d910e8 tests: remove standalone enc28j60 build test
We do already test building this driver somewhere else, this is a
duplicate.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif de4835902e tests: dma: use depends_on to whitelist platforms
Only build for those platforms that support DMA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 9bf53cb69c build: remove stray CMakeLists.txt
This file is in the wrong place and does nothing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif b886f3184b tests: rename AIO api test
Too much duplication in test structure, just call this api and being
under aio, explains that it is an API test for AIO.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 7440a7ff23 tests: move aio sample to tests
This is clearly a test and not a sample.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 8dafd72eb7 posix: enable benchmarks for other architectures
We can run the benchmarks on other architectures beside x86

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Anas Nashif 3d3ebe2ffb tests: crypto: fix call to memset
We are getting warnings when building with native port:
 used with length equal to number of elements without multiplication by
 element size

This fixes the call of memset.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 04c7620580 native: blacklisted 3 testcases
The following 3 testcases are blacklisted for the POSIX
arch / simple_process BOARD:
* tests/drivers/ipm : won't compile due to missing
   __stdout_hook_install()  [part of minimal libc]
  (POSIX arch uses the native libc)
* tests/kernel/mem_protect/stackprot : will crash
  "natively" when trying to corrupt the stack and therefore
  will fail the testcase. The current understanding is that
  the POSIX arch should let the native OS handle faults,
  so they can be debugged with the native tools.
* samples/cpp_synchronization : it is not possible
  to build cpp code yet on top of the posix arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 4494fc93f0 tests: kernel/threads/scheduling fix for native arch
A couple of infinite wait loops fixed for posix arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 59423b2435 test: kernel/critical fix for posix arch
Added small delay in each iteration of the critical_loop
loop for the posix arch:
For this arch this loop and critical_rtn would otherwise
run in 0 time and therefore the test would never finish.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras ccae2bbcd6 test: timer use k_busy_wait()
test/timer/timer_api use k_busy_wait to implement the
tests' busy_wait_ms, for archs which require a different
type of busy waiting

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 8c9118c2ab test: sleep: fix for posix arch
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 6f0facc29d test: kernel/tickless fix for native
tests/kernel/tickless/tickless_concept fix in
infinite wait loops for POSIX ARCH

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras ebd87d872d tests: kernel/common : fix for native
fix in busy waits in test/kernel/common for the POSIX
arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras c0a5aa6aa3 test: workq : fix for native arch
replaced manual busy wait loop in test with
k_busy_wait()

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 5f18271ba7 test: sprintf fix for POSIX arch
POSIX arch is not limited to 200 chars in sprintf

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 6e05640ff4 native: test: exit as soon as test is done
terminate process as soon as the testcase is done

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 309b000eab test: kernel/fatal changes for POSIX
For the POSIX arch we rely on the native OS to handle
segfaults, and stack overflows.
So that we can debug them with normal native tools.
Therefore these 2 are ifdef'ed for this arch in this test

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 83978989c1 tests: kernel/context posix arch support
allow to compile with posix arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Anas Nashif 72fe097bc0 testing: add option to generate coverage reports
With the native port we are able to generate coverage reports, add the
needed options to the compliler and add a kconfig option to enable this
on the supported architectures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 15f9c94ee7 tests: benchmark: fix for too fast archs
benchmark/app_kernel test was giving a float exception
if the operations were performed faster than the
system timer resolution.
Added a safety macro in all divisions to avoid the fault

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 3fe00d91d8 native: test timestamp_serialize for POSIX
added missing define for posix arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -05:00
Anas Nashif 274ad46a84 kernel: move posix header to posix/
Having posix headers in the default include path causes issues with the
posix port. Move to a sub-directory to avoid any conflicts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Nirmala Devi 02d3f2e3a8 tests: power: Fix compiler definition flag
Enabled compiler definition flag TEST_CASE_SLEEP_SUCCESS
which was missing on migrating to cmake.

Signed-off-by: Nirmala Devi <nirmala.devix.m@intel.com>
2017-12-19 16:54:45 -05:00
Mariusz Skamra 3e8a5bc72f Bluetooth: tester: Add Core Unregister Service command
This adds stubs for Core Unregister Service command implementation.
It will be used to clean up the stack and tester after test case
execution.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-19 15:43:43 +01:00
Mariusz Skamra 16fbf25ceb Bluetooth: tester: Add Mesh Health Model related commands
This adds Mesh Health Model related commands implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-19 12:12:00 +01:00
Mariusz Skamra 2f5d1f7a30 Bluetooth: tester: Add Mesh Network Received event
This adds implementation of Mesh Network receive event.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-18 12:43:23 +01:00
Mariusz Skamra c5a04fad64 Bluetooth: tester: Add Mesh Network Send command
This adds Mesh Network Send command implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-18 09:37:31 +01:00
Anas Nashif e2122cbf89 lib: move ring_buffer from misc/ to lib/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 20:02:01 -05:00
Anas Nashif 6daf046e8f lib: move crc from drivers to lib/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 20:02:01 -05:00
Ramakrishna Pallala eace9ede03 tests: boards: add SysID test app for altera_max10 board
Add test application to demonstrate the usage of Nios-II
System ID soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-12-15 18:12:00 -05:00
Anas Nashif be61a66e14 boards: remove panther board
This board was never released and is similar in many ways to the
quark_se_c1000_devboard.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 18:09:34 -05:00
Mariusz Skamra 244e9564ac Bluetooth: tester: Add Mesh IV Update related commands
This adds Mesh IV Update related command handlers implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-15 11:10:54 +02:00
Anas Nashif f3fbf0380d tests/booting/stub: disable banner
The stub is supposed to be there to bring up a CPU that needs to be
brought up because the platform requires so, but it needs to be as
practically quiet in terms of printing to the serial port as possible.

Thus, disable  printing the boot banner by default.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-14 13:11:04 -05:00
Stephen Smalley e3fe3ebb3f tests/kernel/mem_protect/userspace: test access to other thread stack
Add tests of the ability to read or write the stack of another thread.
Use semaphores for explicit synchronization of the start and end of the
other thread to ensure that the attempted stack access occurs while the
thread is alive.  This ensures that the MMU/MPU has been configured at
least once to allow userspace access to the stack, and that any
removal of access upon thread termination has not yet occurred.  This
therefore should exercise changing the MMU/MPU configuration to remove
access to the other thread's stack when switching back to our
thread.

Tested on qemu_x86 (pass) and on frdm_k64f (with and without the ARM
userspace patches; with them, the tests pass; without, they fail as
expected).  Also, as with most of the other tests, if you replace
ztest_user_unit_test() with ztest_unit_test(), then the tests fail as
expected.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-12-14 09:08:19 -08:00
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Mariusz Skamra c20af89020 Bluetooth: tester: Fix not checking btp2bt_uuid return value
btp2bt_uuid might return BTP_STATUS_FAILED. Procedure shall be aborted
in this case.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 11:18:32 +02:00
Mariusz Skamra 78aa543d6f Bluetooth: tester: Fix attribute uuid type check
This chack shall be performed on attribute uuid type, not uuid provided
in Gatt Get Attributes command paramteres.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 11:18:32 +02:00
Mariusz Skamra 1e8b9766dc Bluetooth: tester: Add implementation of Mesh LPN related BTP commands
This adds implementation of Mesh LPN and Mesh LPN Poll commands.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 10:07:46 +02:00
Mariusz Skamra 4dd2ae56f2 Bluetooth: btp: Introduce Health Generate/Clear Faults commands
Those commands will be used for qualification purposes to verify
the functionality of Mesh Health Model.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra e7a6b2d047 Bluetooth: btp: Add Mesh Network receive event
This event is needed for qualification purposes to verify functionality
of Mesh Network layer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 581d6c3158 Bluetooth: btp: Add BTP Mesh Network Send command
This command will be used to verify functionality of the network
layer against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 090444829f Bluetooth: BTP: Add BTP MESH IV Update related commands
This commands will be used while testing IV Update procedure
against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 589a5dad17 Bluetooth: tester: Add initial support for BTP Mesh service
This adds initial implementation of BTP Mesh service.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-12 12:44:21 +02:00
Mariusz Skamra 48465c5eaf Bluetooth: btp: Add Mesh LPN related commands
Extend BTP with Mesh LPN related commands.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-12 10:29:20 +02:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Andy Gross c242c78ec0 tests: kernel: mem_protect: Adjust priv exec tests
This patch removes the extraneous priv_insn test as it is a duplicate
of the following test that writes to the control register.  For ARM,
unprivileged contexts which access control registers does not result
in a fault.  It results in no modification of the register, so we have
to check that a modification occurred.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-12-11 10:53:12 -08:00
Andy Gross 6ffdb84b86 tests: kernel: mem_protect: Fix stack size calc
This patch fixes the calculation of the privileged stack portion.  The
ztest threads have a stack size of 2048.  The privileged area resides in
the lowest 512 bytes.  So use the definition of the stack size to get to
the right area.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-12-11 10:53:12 -08:00
ravishankar karkala Mallikarjunayya 5be0d4a706 tests/drivers/uart/uart_basic_api : Added build only tag
Testcase yaml requires some interactive inputs to be provided for
execution and hence fails on automation. Hence making it as build
only

Signed-off-by: ravishankar karkala Mallikarjunayya <ravix.shankar.km@intel.com>
2017-12-11 09:33:09 -05:00
Paul Sokolovsky 898c88f908 tests: net: mld: Update after solicited-node mcast refactor.
1. MLD events now can happen before the test starts to run, (at iface
initialization time), so use static initialization of test semaphore.
2. Don't use a well-known multicast group like ff02::1 (all nodes),
as they are managed by the underlying stack. Use a dedicated test
address (ff10::1 here).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-11 09:09:48 -05:00
Mariusz Skamra da68167331 Bluetooth: btp: Add events indicating provisioning link state
This introduced two BTP events to indicate provisioning link state.
This is needed for testing purposes, since PTS requests tester to
confirm link state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-11 13:52:05 +02:00
Anas Nashif f46c0c2472 kconfig: remove deprecated DEBUG_TRACING_KERNEL_OBJECTS
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-09 08:48:51 -06:00
Mariusz Skamra 85f16efbeb Bluetooth: tester: Add Get Attribute Value command implementation
This procedure will be used to query GATT Server for attribute value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra c168769b95 Bluetooth: btp: Add GATT Get Attribute Value command
This procedure will be used to query GATT Server for attribute value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra 444b2ad21e Bluetooth: tester: Add Get Attributes command implementation
This procedure is used query local GATT Server for attributes
based on given search pattern. Attributes can be searched using
Attribute Handle range and Attribute Type.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra 55fe397853 Bluetooth: btp: Add GATT Get Attributes command
This will be used for verification in GATT test cases.
This procedure is used query local GATT Server for attributes
based on given search pattern. Attributes can be searched using
Attribute Handle range and Attribute Type.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Adithya Baglody a54c1f516f tests: mem_pool: Fixed memory pool test case failure on quark d2000.
Due to insufficient ISR stack memory the irq offload was
corrupting the memory.

GH-4766

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-12-08 07:29:17 -05:00
Anas Nashif abbaac9189 cleanup: remove nanokernel/nano leftovers
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-05 09:44:23 -06:00
Anas Nashif 9ab8a959ec tests: remove unused and obsolete test header
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-05 09:44:23 -06:00
Kumar Gala 6b38f57225 Add missing license and copyright headers
The following files didn't have any copyright or license headers on them
when they got contributed.  So add the SPDX Apache license and
appropriate copyright info:

boards/arm/stm32l476g_disco/pinmux.c
samples/basic/threads/src/main.c
tests/net/socket/tcp/src/main.c

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-12-05 08:21:05 -06:00
Sebastian Bøe abbdd88683 cmake: Fix EXTRA_LDFLAGS feature
It is supported to add give extra flags to the linker from the
commandline like this:

cmake -DEXTRA_LDFLAGS=-Lmy_dir path

But unfortunately this was broken during the CMake
migration. Interestingly, the reason that it was broken is that KBuild
was also partially broken. KBuild would pass on EXTRA_LDFLAGS when
object files were linked together into built-in.o files, but it would
not use EXTRA_LDFLAGS for the final link into an elf file.

This patch fixes EXTRA_LDFLAGS.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-05 08:39:43 -05:00
Akhilesh Kumar Upadhyay 149c341ec6 tests: kernel: x86 : App to validate x86 specific boot time page table
Testcase developed to validate x86 specific boot time page table faults.

Signed-off-by: Akhilesh Kumar Upadhyay <akhilesh.kumarx.upadhyay@intel.com>
2017-12-05 08:12:45 -05:00
Akhilesh Kumar Upadhyay 3d612b7a8b x86: mmu: kernel: Validate existing APIs
Testcase developed x86mmu specific, to validate
existing  APIs. This checks for the PDE/PTE set
on the address and returns if some violation occurs or not.

Signed-off-by: Akhilesh Kumar Upadhyay <akhilesh.kumarx.upadhyay@intel.com>
2017-12-04 11:26:39 -05:00
Piotr Mienkowski e4dac28bb3 tests: Add i2s driver test
Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-30 10:30:33 -05:00
Kumar Gala a2caf36103 kernel: Remove deprecated k_mem_pool_defrag code
Remove references to k_mem_pool_defrag and any related bits associated
with mem_pool defrag that don't make sense anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-28 15:23:22 -05:00
Stephen Smalley 24076abc6d tests/kernel/mem_protect/userspace: test that _k_neg_eagain is in rodata
Explicitly test that _k_neg_eagain is in rodata.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-11-28 12:29:13 -05:00
Stephen Smalley 2055d7545e tests/kernel/mem_protect/userspace: Add userspace protection tests
This is still work-in-progress, but putting it up in case it is
helpful to people working in this area and for early comments.

Add a set of tests to validate the expected security properties
of threads created with K_USER when CONFIG_USERSPACE=y.  This can
be used as a regression test for architectures that already implement
this support and as a validation test for others.

I considered incorporating these tests into the existing protection
test, but decided against it since protection does not enable or rely
upon CONFIG_USERSPACE for its existing tests and passes on everything
that provides MPU or MMU support, even without full userspace support.

I also considered incorporating these tests into the existing
obj_validation test, but decided against it since obj_validation only
tests the object validation/permission logic, does not run any user
mode threads (or strictly depend on that support), and passes
on both x86 and arm today, unlike these tests.  That said, I have no
strong objections if it would be preferable to fold these into it
(and perhaps rename it to be more general).

The current tests implemented in this test program verify the following
for a thread created with K_USER:

is_usermode: is running in usermode
priv_insn: cannot invoke privileged insns directly
write_control: cannot write to control registers
disable_mmu_mpu: cannot disable memory protections (MMU/MPU)
read_kernram: cannot read from kernel RAM
write_kernram: cannot write to kernel RAM
write_kernro: cannot write to kernel rodata
write_kerntext: cannot write to kernel text
read_kernel_data: cannot read __kernel-marked data
write_kernel_data: cannot write __kernel-marked data
read_kernel_stack: cannot read the kernel/privileged stack
write_kernel_stack: cannot write the kernel/privileged stack
pass_user_object: cannot pass a non-kernel object to a syscall
pass_noperms_object: cannot pass an object to a syscall without a grant
start_kernel_thread: cannot start a kernel (non-user) thread

Some of the tests overlap and could possibly be dropped, but it
seems harmless to retain them.  The particular targets of read/write
tests are arbitrary other than meeting the test criteria and can be
changed (e.g. in data, rodata, or text) if desired to avoid coupling
to kernel implementation details that may change in the future.

On qemu_x86, all of the tests pass.  And, if you replace all
occurrences of ztest_user_unit_test() with ztest_unit_test(), then
all of the tests fail (i.e. when the tests are run in kernel mode,
they all fail as expected).  On frdm_k64f presently (w/o the arm
userspace patches), all of the tests fail except for write_kernro and
write_kerntext, as expected.

ToDo:
- Verify that a user thread cannot access data in another memory domain.
- Verify that a user thread cannot access another thread's stack.
- Verify that a user thread cannot access another thread's kobject.
- Verify that k_thread_user_mode_enter() transitions correctly.
- Verify that k_object_access_revoke() is enforced.
- Verify that syscalls return to user mode upon completion.
- Verify that a user thread cannot abuse other svc calls (ARM-specific).
- Other suggested properties we should be testing?

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-11-28 12:29:13 -05:00
Johan Hedberg 7909c3d3fa Bluetooth: Mesh: Introduce option for Node ID timeout
Some PTS test cases only work when we're advertising using Network
Identity. Using the default timeout of 60 seconds for Node Identity
will cause this test cases to fail (i.e. the PTS gives up before
Zephyr transitions to advertising from Node Identity to Network
Identity).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-28 17:17:48 +02:00
Stephen Smalley 48475ef69b tests/kernel/mem_protect/protection: fix test_main arguments
test_main() takes no arguments, so this was causing a fault
after returning from test_main due to the stack canary checking.

Before, the test run ends with:
PROJECT EXECUTION SUCCESSFUL
***** CPU Page Fault (error code 0x00000011)
Supervisor thread executed address 0x00400000
PDE: 0x027 Present, Writable, User, Execute Enabled
PTE: 0x80000000267 Present, Writable, User, Execute Disable
Current thread ID = 0x00401080
Faulting segment:address = 0x0008:0x00400000
eax: 0x00000000, ebx: 0x00000000, ecx: 0x0040b19c, edx: 0x000056df
esi: 0x00000000, edi: 0x00000000, ebp: 0x000051c0, esp: 0x0040b1d8
eflags: 0x246
Caught system error -- reason 6

After, the test run ends with:
PROJECT EXECUTION SUCCESSFUL

Reported-by: Joshua Domagalski <jedomag@tycho.ncsc.mil>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-11-27 13:11:42 -08:00
Johan Hedberg 48aecd1513 Bluetooth: Mesh: Add IV Update test mode API
This makes it possible to pass all IV Update tests without having to
build a custom configuration for some of the tests. We also disable
the feature in all sample configurations, but leave it on in the
tests.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-27 10:17:54 +02:00
Johan Hedberg 7ef5e53e28 Bluetooth: Mesh: Add skeleton for Health Client model
Add a skeleton for the Health Client model.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-23 14:49:55 +02:00
Vinayak Kariappa Chettimada 021bda962c Bluetooth: tests: Fix config option dependencies
With the introduction of controller's advanced features
Kconfig option, some of the dependent options where not
enabled in the init tests build. Fixed by enabling the
advanced features Kconfig options.

Also, updated conf files to reflect latest set of Kconfig
options supported by the Bluetooth controller subsystem.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-11-22 18:48:05 -05:00
Tomasz Bursztyka b52c0f24a6 net/ieee802154: Make RAW mode generic
- Renaming NET_L2_RAW_CHANNEL to NET_RAW_MODE
- Create a generic IEEE 802.15.4 raw mode for drivers
- Modify the IEEE 802.15.4 drivers so it passes the packet unmodified,
up to code using that mode to apply the necessary changes on the
received net_pkt according to their needs
- Modify wpanusb/wpan_serial relevantly

Fixes #5004

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-11-22 10:10:09 -05:00
Jukka Rissanen 425d9fb43a tests: net: context: Fix timeout test
Fix unreachable code issue when handling test timeout.

Coverity-CID: 178788
Fixes #4786

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-11-22 07:44:10 -05:00
Johan Hedberg 5e7c5815af Bluetooth: tests/mesh_shell: Tweak configuration a little bit
The generic Bluetooth shell was never intended to be enabled. Also
make the default advertised name a bit nicer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-22 13:31:58 +02:00
Johan Hedberg 5633ec0413 Bluetooth: tests/mesh_shell: Fix main stack size for qemu
The qemu main() seems to require more stack than the arm equivalent.
Increase the stack size to 320 to avoid crashes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-22 12:53:54 +02:00
Johan Hedberg 9c0b00195c Bluetooth: tests/mesh: Fix model publication
The app was declaring model publication contexts but missing buffers
for the publication messages.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-22 12:53:54 +02:00
Johan Hedberg 8f1541184f Bluetooth: Mesh: Fix non-periodic Model Publication
The only generally available model supporting publication that's
convenient to be used for testing is the Health Server Model.
Unfortunately since this model supports period publication, the
non-periodic side got less attention and had some bugs.

The first thing that needs to be done is to verify that the period
returned by bt_mesh_model_pub_period_get() is positive. If it's zero
then no periodic publication should take place.

Another thing that this patch cleans up is the naming of the callback
used for periodic publishing. There's no need do require the callback
to call bt_mesh_model_publish() since this must happen no matter what,
so instead rename the callback from 'func' to 'update' and have the
access layer call bt_mesh_model_publish() if the callback was
successful.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-22 12:53:54 +02:00
Paul Sokolovsky d775ab5c26 tests: socket: Make runnable with sanitycheck
Relies on loopback network interface added recently and being able
to run QEMU without connecting to host networking.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-11-21 06:54:01 -05:00
Johan Hedberg 9a5fd64a31 Bluetooth: tests/shell: Move mesh into its own configuration
Trying to always include mesh support resulted in the app not fitting
on some boards (e.g. nrf51_pca10028). Put the mesh-specific
configuration in a separate configuration file instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-20 15:00:29 +02:00
Johan Hedberg 07befaa2fe Bluetooth: tests: Add new mesh_shell app
Having a dedicated Mesh shell app instead of extending the existing
shell app will let us fine-tune board-specific configurations for Mesh
in the future (not to mention that extending the shell app already
resulted in it not fitting on some boards).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-20 15:00:29 +02:00
Johan Hedberg e7bb76e2b6 Bluetooth: Mesh: Fix model publication
Model publication was broken in a couple of ways:

 - The Publish Retransmit State was not taken into account at all
 - Health Server used a single publish state for all elements

To implement Publish Retransmit properly, one has to use a callback to
track when the message has been sent. The problem with the transport
layer sending APIs was that giving a callback would cause the
transport layer to assume that segmentation (with acks) is desired,
which is not the case for Model Publication (unless the message itself
is too large, of course). Because of this, the message sending context
receives a new send_rel ("Send Reliable") boolean member that an app
can use to force reliable sending.

Another challenge with the Publish Retransmit state is that a buffer
is needed for storing the AppKey-encrypted SDU once it has been sent
out for the first time.To solve this, a new new net_buf_simple member
is added to the model publication context. The separate 'msg' input
parameter of the bt_mesh_model_publish() API is removed, since the
application is now expected to pre-fill pub->msg instead.

To help with the publishing API change, the Health Server model gets a
new helper macro for initializing the publishing context with a
right-sized publishing message.

The API for creating Health Server instances is also redesigned since
it was so far using a single model publishing state, which would
result in erratic behavior in case of multiple elements with the
Health Server Model. Now, the application needs to provide a unique
publishing context for each Health Server instance.

The changes are heavily intertwined, so it's not easily possible to
split them into multiple patches, hence the large(ish) patch.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-20 15:00:29 +02:00
Aska Wu 718b3cd7d0 net: sockets: Support ipv6 wildcard and loopback address
Add in6addr_any and in6addr_loopback which are defined in RFC2553 Basic
Socket Interface Extensions for IPv6.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-11-20 13:42:38 +02:00
Nishikant c1d9cb72f1 tests/crypto/mbedtls: Disabling this test for ESP32
Currently Zephyr is running from RAM, and the space where
instructions can be executed from is quite small.once Flash
cache is enabled in ESP32 port we can remove this check.

Signed-off-by: Nishikant Nayak <nishikantax.nayak@intel.com>
2017-11-18 07:48:30 -05:00
Johan Hedberg a18a22524f Bluetooth: Mesh: shell: Add mod-pub command
Add a command for getting and setting the model publication. We also
have to adjust the app's configuration, since both the Model
Publication Set and Status messages are segmented messages, meaning we
need two TX and RX segment contexts.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-16 15:35:10 +02:00
Sebastian Bøe 421e5b5d32 unittest: Support EXTRA_*_FLAGS
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-15 19:47:44 -05:00
Punit Vara c7fd8e6343 tests: sleep: convert legacy test to ztest
This patch do following things :
- fix checkpatch warnings
- replace conditions with ztest apis wherever necessary

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-15 09:27:07 -05:00
Punit Vara 9c1622a64a tests: tickless: Make use of ztest framework
Add appropriate ztest APIs to make this legacy test case to
use ztest framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-15 09:25:17 -05:00
Punit Vara 21510d4350 tests: pending: Make use of ztest framework
Add appropriate ztest APIs to make this legacy test case to
use ztest framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-15 09:25:17 -05:00
Punit Vara 33bd43b468 tests: mutex: convert legacy test to ztest
Make legacy test case use of ztest apis to support
ztest framework.

Reduce ztest stack size to 512 otherwise region 'SRAM'
will overflow for nucleo board.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-15 09:23:42 -05:00