Commit graph

13345 commits

Author SHA1 Message Date
Kumar Gala 3700a46632 sensor: hp206c: Convert to DTS
Convert hp206c sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala c2aa25b358 sensor: isl29035: Convert to DTS
Convert isl29035 sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala ddddbf9f84 sensor: max44009: Convert to DTS
Convert max44009 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 30ea840eb1 sensor: mcp9808: Convert to DTS
Convert mcp9808 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 03c7cb4f46 sensor: sx9500: Convert to DTS
Convert sx9500 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala c7fae66952 sensor: tmp007: Convert to DTS
Convert tmp007 sensor driver to utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala b388b178a0 sensor: tmp112: Convert to DTS
Convert tmp112 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Kumar Gala 0e9e67297e sensor: th02: Convert to DTS
Convert th02 sensor driver and sample app to utilize device tree.

Introduce a dts board overlay on the frdm_k64f board to ensure we at
least have a single platform in which the sample gets built.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-08 07:44:54 -06:00
Andy Ross 8892406c1d kernel/sys_clock.h: Deprecate and convert uses of old conversions
Mark the old time conversion APIs deprecated, leave compatibility
macros in place, and replace all usage with the new API.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-11-08 11:08:58 +01:00
Andy Ross a63a3e2e48 tests/kernel/timer/timer_api: Add tests for the new conversion routines
The new conversion API has a ton of generated utilities.  Test it via
enumerating each one of them and throwing a selection of both
hand-picked and random numbers at it.  Works by using slightly
different math to compute the expected result and assuming that we
don't have symmetric bugs in both.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-11-08 11:08:58 +01:00
Andrew Boie 4f77c2ad53 kernel: rename z_arch_ to arch_
Promote the private z_arch_* namespace, which specifies
the interface between the core kernel and the
architecture code, to a new top-level namespace named
arch_*.

This allows our documentation generation to create
online documentation for this set of interfaces,
and this set of interfaces is worth treating in a
more formal way anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-07 15:21:46 -08:00
Vincent Wan 525c556e43 tests: spi_loopback: add support for cc1352r1_launchxl
Adding a configuration file for the cc1352r1_launchxl to allow the test
to run on this board.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-11-07 15:55:21 -06:00
Vincent Wan bbc5871bcd tests: spi_loopback: add option for LOOP mode
Adding a Kconfig option for this test to configure the SPI in LOOP
mode. This saves physical wiring for hardware that support it.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-11-07 15:55:21 -06:00
Vincent Wan 11540d73a2 tests: spi_loopback: make CONFIG_SPI_ASYNC optional
Making CONFIG_SPI_ASYNC optional allows the test to be run on devices
where the feature is not yet supported in the driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-11-07 15:55:21 -06:00
Henrik Brix Andersen 1266860dcf tests: drivers: eeprom: add tests for the EEPROM API
Add EEPROM API test suite.

The test suite is written to run in userspace but it is currently only
whitelisted for native_posix and native_posix_64 boards which do not
support userspace.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-07 16:32:15 -05:00
Henrik Brix Andersen 2b9d65f4ff tests: drivers: build_all: add EEPROM build configuration
Add Atmel AT2x driver to build_all build configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-07 16:32:15 -05:00
Henrik Brix Andersen e72e4aa813 tests: board_shell: enabled EEPROM shell
Enable EEPROM shell commands in the board_shell test application.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-07 16:32:15 -05:00
Henrik Brix Andersen 2375b10a7e tests: drivers: i2c_slave_api: update overlays to match new dts bindings
Update the board overlays used in the i2c_slave_api tests to match the
new device tree bindings for atmel,at24 I2C EEPROMs.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-07 16:32:15 -05:00
Ioannis Glaropoulos 40fbff6c8f tests: kernel: mem_protect: run tests with ARMV8-M MPU gap filling
We add a new test-case for the mem_protect and userspace tests,
to test the ARMv8-M MPU driver without the skipping of full SRAM
partitioning (i.e. gap filling).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-07 09:41:54 -08:00
Andrew Boie ec3aafbf78 printk: print pointers on 64-bit properly
Needs a min-width of 16, not 8, for 64-bit.
Some indentation oddities fixed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-06 17:50:34 -08:00
Stephanos Ioannidis 2d7460482d headers: Refactor kernel and arch headers.
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.

The refactoring strategy used in this commit is detailed in the issue

This commit introduces the following major changes:

1. Establish a clear boundary between private and public headers by
  removing "kernel/include" and "arch/*/include" from the global
  include paths. Ideally, only kernel/ and arch/*/ source files should
  reference the headers in these directories. If these headers must be
  used by a component, these include paths shall be manually added to
  the CMakeLists.txt file of the component. This is intended to
  discourage applications from including private kernel and arch
  headers either knowingly and unknowingly.

  - kernel/include/ (PRIVATE)
    This directory contains the private headers that provide private
   kernel definitions which should not be visible outside the kernel
   and arch source code. All public kernel definitions must be added
   to an appropriate header located under include/.

  - arch/*/include/ (PRIVATE)
    This directory contains the private headers that provide private
   architecture-specific definitions which should not be visible
   outside the arch and kernel source code. All public architecture-
   specific definitions must be added to an appropriate header located
   under include/arch/*/.

  - include/ AND include/sys/ (PUBLIC)
    This directory contains the public headers that provide public
   kernel definitions which can be referenced by both kernel and
   application code.

  - include/arch/*/ (PUBLIC)
    This directory contains the public headers that provide public
   architecture-specific definitions which can be referenced by both
   kernel and application code.

2. Split arch_interface.h into "kernel-to-arch interface" and "public
  arch interface" divisions.

  - kernel/include/kernel_arch_interface.h
    * provides private "kernel-to-arch interface" definition.
    * includes arch/*/include/kernel_arch_func.h to ensure that the
     interface function implementations are always available.
    * includes sys/arch_interface.h so that public arch interface
     definitions are automatically included when including this file.

  - arch/*/include/kernel_arch_func.h
    * provides architecture-specific "kernel-to-arch interface"
     implementation.
    * only the functions that will be used in kernel and arch source
     files are defined here.

  - include/sys/arch_interface.h
    * provides "public arch interface" definition.
    * includes include/arch/arch_inlines.h to ensure that the
     architecture-specific public inline interface function
     implementations are always available.

  - include/arch/arch_inlines.h
    * includes architecture-specific arch_inlines.h in
     include/arch/*/arch_inline.h.

  - include/arch/*/arch_inline.h
    * provides architecture-specific "public arch interface" inline
     function implementation.
    * supersedes include/sys/arch_inline.h.

3. Refactor kernel and the existing architecture implementations.

  - Remove circular dependency of kernel and arch headers. The
   following general rules should be observed:

    * Never include any private headers from public headers
    * Never include kernel_internal.h in kernel_arch_data.h
    * Always include kernel_arch_data.h from kernel_arch_func.h
    * Never include kernel.h from kernel_struct.h either directly or
     indirectly. Only add the kernel structures that must be referenced
     from public arch headers in this file.

  - Relocate syscall_handler.h to include/ so it can be used in the
   public code. This is necessary because many user-mode public codes
   reference the functions defined in this header.

  - Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
   necessary to provide architecture-specific thread definition for
   'struct k_thread' in kernel.h.

  - Remove any private header dependencies from public headers using
   the following methods:

    * If dependency is not required, simply omit
    * If dependency is required,
      - Relocate a portion of the required dependencies from the
       private header to an appropriate public header OR
      - Relocate the required private header to make it public.

This commit supersedes #20047, addresses #19666, and fixes #3056.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-06 16:07:32 -08:00
Peter Bigot 8bb99dc9ce tests: fcb: initialize buffers to avoid processing uninitialized values
Running the test under valgrind identified three places where an
uninitialized stack buffer was used as the source of data over which a
CRC was incidently calculated, causing an uninitialized value warning
in the CRC calculation.  Zero out the source buffers before using them
as a data source.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-06 16:58:57 -06:00
Alexander Wachter 9eacd1725c tests: can: api: Add MCP2515 DT label to the device name list
Add DT_INST_0_MICROCHIP_MCP2515_LABEL to the list of possible
device labels.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-11-06 21:43:40 +01:00
Alexander Wachter d558fd055a drivers: CAN: Limit the DLC to 8
This commit limits the data length code to eight.
DLC > 8 returns a newly introduced CAN_TX_EINVAL error code.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-11-06 21:00:45 +01:00
Kumar Gala f8db0fa2eb watchdog: Remove CONFIG_WDT_0_NAME usage
Replace CONFIG_WDT_0_NAME with DT_ALIAS_WATCHDOG_0_LABEL in samples and
test code.  Now that all drivers are DT aware we don't ever set the
Kconfig option.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-06 13:51:20 -06:00
Kumar Gala 7185055b38 sensor: lis3mdl-magn: Convert GPIO INT to device tree
Update lis3mdl-magn dts binding to include GPIO interrupt pin and change
driver code to get the GPIO pin and controller info from DT instead of
Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-06 17:10:49 +01:00
Anas Nashif 87591958cf tests: benchmarks: parse output on passing benchmark
Parse output of test to verify success, this was previously treated as a
test and now it is using the console handler, so we need to verify
success using regex.

Fixes: #20177

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-11-06 10:54:34 -05:00
Song Qiang 85a0cc8f9a boards: arm: 96b_argonkey: Update dma defconfig for tests
Previous defconfig for dma is DMA_STM32F4X in this board, while the new
generic driver uses DMA_STM32 to enable DMA support, and also dma driver
of stm32 now needs HEAP_MEM_POOL_SIZE to be big enough to hold dma
stream instances.

Additional .conf files are added for also adding HEAP_MEM_POOL_SIZE
configuration to two test cases.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-11-06 14:14:39 +01:00
Peter Bigot 9003d6c3a3 tests: arch: arm: increase main stack size for no-opt interrupt test
Tests fail with the default 512 byte main stack size.  Increase it
just as the idle stack size has been increased over default.

Closes #20202

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-05 15:45:22 -06:00
Henrik Brix Andersen d0a382b44a tests: board_shell: enable PWM shell
Enable the PWM shell commands in the board_shell test application.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-05 15:10:21 -06:00
David Leach 1bb1b3e6a0 subsys/random: Add cryptographically secure random test cases
Updated tests/crypto/rand32/ to include cryptographic test cases.
Added config file for rand32_ctr_drbg generator.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-05 19:36:42 +01:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Kumar Gala 4cc91fdd00 sample/tests: replace DT_ define filters with dt_ functions
convert sample and test yaml filters that utilize a DT_ define to
instead use a dt_ function.  The intent is to remove the Kconfig
generated DT defines and just make directy queries into the device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-04 09:02:14 -05:00
Mario Noseda 1acea13767 tests: benchmark: boot_time: fixed kernel clock value
Using a device with a kernel clock below 1MHz (e.g. nRF52) resulted in
a division by zero. Added support for such devices by multiplying
before dividing.

Signed-off-by: Mario Noseda <mario.noseda@zhaw.ch>
2019-11-04 08:51:58 -05:00
Andrzej Puzdrowski 858db136c9 tests/subsys/setting: cleanup deletion tests
Some cleanup in tests code as after duplicates filtering
was introduced there is no need to interpret 0-length readout in
settings h_set handler

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-11-01 17:53:35 +01:00
Jan Van Winkel 626f96ec30 cpp: Added option to disable Zephyrs cpp implementation
Added a Kconfig option to disable Zephyrs cpp implementation for
operator new, delete, pure virtual functions and vtables.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-31 15:02:03 +01:00
Peter A. Bigot 4ccf4f4ccb tests/application_development/libcxx: add test of basic smart pointer use
Confirm that std::make_unique<> functions as intended.  This is an
indirect test of new/delete using best-practices API.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-10-30 10:57:42 +01:00
Wayne Ren f8edd95422 tests: Fix the compile warning for arc
the following compile warning will fail the CI:

/zephyr/tests/kernel/fp_sharing/generic/src/float_regs_arc_gcc.h:
41:8: error: /unused variable 'temp' [-Werror=unused-variable]

/zephyr/tests/kernel/fp_sharing/generic/src/float_regs_arc_gcc.h:
75:8: error: /unused variable 'temp' [-Werror=unused-variable]

cc1: all warnings being treated as errors

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-10-30 09:28:28 +01:00
Ulf Magnusson 5bb149e414 drivers: i2c: kconfig: Remove unused I2C_EEPROM_SLAVE_0/1 symbols
Unused since commit f3f8f96842 ("tests: i2c_slave_spi: update to
proposed DT compatible naming").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-29 06:15:55 +01:00
Max van Kessel 6ece516d7b tests: add test for invalid zcan_frame
To prevent invalid use of the union id in the zcan_frame struct

Signed-off-by: Max van Kessel <max_van_kessel@msn.com>
2019-10-28 12:57:10 +02:00
Daniel Leung b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Maksim Masalski 21d866e3e9 tests: remove duplicate names for the peripheral tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-25 00:29:00 -04:00
Maksim Masalski 464c795949 tests: remove duplicate names for the filesystem tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-25 00:16:31 -04:00
Ioannis Glaropoulos 4424356c3b tests: arch: arm: add a test for fatal errors in interrupts
This commit adds a new test suite in tests/arch/arm that
intends to testing system faults inside interrupts.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-24 10:12:08 -07:00
Sebastian Bøe 8435be81f8 rand32: cmake: Fix invalid build scripts
The build scripts for the tests/crypto/rand32 test has been invoking
'zephyr_include_directories' in an invalid way. They have presumably
been trying to modify the 'app' library, but have in effect being
modifying the global environment, in an invalid way nonetheless.

This patch fixes the build script to modify the 'app' library only.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-10-24 08:28:15 -05:00
Maksim Masalski 11d6385ebe tests: remove duplicate names for the net tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:31:48 -04:00
Maksim Masalski 432bb69bab tests: remove duplicate names for the boards tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:31:06 -04:00
Maksim Masalski e9d7565d66 tests: remove duplicate names for the bluetooth tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:29:17 -04:00
Maksim Masalski b2bf7e76d0 tests: remove duplicate names for the libraries tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:27:30 -04:00
Maksim Masalski 6882d97531 tests: new updated names for the kernel tests
After run Sanitycheck script I found out that some test cases
have the same test case name in the test result .xml file.
To get rid of it, I decided to change test cases names
for the kernel tests.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:25:53 -04:00
Maksim Masalski 2c5be79e25 tests: remove duplicate names for the shell tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:24:49 -04:00
Maksim Masalski 813ef68554 tests: updated names for the tests
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>
2019-10-23 23:15:41 -04:00
Maksim Masalski d85b45b072 tests: updated names for the arch interrupt tests
Test case arch.interrupt have same test case name
for different architectures. To get rid of it,
I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-23 23:13:13 -04:00
peng1 chen f20084ff1c Code Coverage: Fix the issue of function code coverage in thread.c
The k_thread_state_str is a new function added into
kernel/thread.c recently which was used to return
the human friendly thread state, so it hasn't been
called by other existing code.
In order to improve the function code coverage, we
just replace the "th->base.thread_state & _THREAD_PENDING"
code by using k_thread_state_str function in
tests/kernel/sched/preempt/src/main.c, because
k_thread_state_str function is realized by judging
the thread_state member to return the thread state.

Signed-off-by: peng1 chen <peng1.chen@intel.com>
2019-10-23 19:16:24 -07:00
Kumar Gala 9599c2d510 tests: boards: altera_max10: Use DT define for I2C device name
Move to using DT define instead of a Kconfig param, also remove unused
I2C Kconfig params for this test.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-10-23 11:31:32 -05:00
Maksim Masalski 11faaacd1e tests/posix/common: Fix miscalibrated timing test
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>
2019-10-23 14:45:40 +02:00
Andrei Gansari b5ed5af8c8 tests: schedule_api adapt to slow ticks
This test case is has a tolerance of 1ms, but systems with a tick slower
than 1000 ticks/sec may spil outside the 1ms tolerance.
Tolerance adapts to system's ticks/sec, e.g. QEMU targets have
100ticks/sec -> tolerance is 10ms.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-10-22 23:06:41 -04:00
Andrei Gansari 65fbfbbbff tests: scheduler_api removed MPS2 workaround
CONFIG_SOC_SERIES_MPS2 specific test workaround is removed
to use systick drives as tickless.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-10-22 23:06:41 -04:00
Steven Wang 3cb03efd9c tests: move test timeutil into "unit" directory.
We don't have to build an image for running test timeutil. We
can just build a native app to test it. So move it into "unit"
directory.

Also, add 64-bit support for unit testing framework.

Signed-off-by: Steven Wang <steven.l.wang@linux.intel.com>
2019-10-22 23:05:34 -04:00
Maksim Masalski 9f26f7d3d4 tests: updated names for the kernel tests
After run Sanitycheck script I found out that test cases
had the same test case name in the test result .xml file.
For board itodk in .xml file was duplicated kernel.common test.
To get rid of it, I decided to change test cases names
for the kernel tests, contained name kernel.common.
Now only one test has kernel.common test name,
and will be no duplicated test cases names in the future.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-22 22:55:35 -04:00
Stephanos Ioannidis 5806787ae1 tests: kernel: Fix incorrect interrupt controller type inference.
The current implementation of kernel interrupt tests incorrectly
infers NVIC, which is specific to Cortex-M, from CONFIG_ARM.

This commit fixes such incorrect NVIC inferences by using
CONFIG_CPU_CORTEX_M instead of CONFIG_ARM.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-10-22 15:07:52 -07:00
Ulf Magnusson 79d82f6805 xtensa: kconfig: Remove unused XTENSA_OMIT_HIGH_INTERRUPTS symbol
Unused since commit 6fd6b7e50a ("xtensa: remove legacy arch
implementation").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 14:31:46 -05:00
Andrzej Puzdrowski 9ac3755612 settings: (NVS) fetch sector size from driver
NVS back-end initialization should fetch size of the flash erase blocks
from the flash API instead of DT. This allows to work well when used
storage partition is not located in embedded memory.

NVS back-end sector multiplier configuration was set to 8K as
DT value for native posix targets
flash sector sizes is 1 B, while its flash driver supports 8k.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-22 10:52:36 -05:00
Ulf Magnusson 9d46779ca7 net: ieee802154: kconfig: Remove unused fragmentation debugging symbol
Unused after commit a76814bfb6 ("net: Convert core IP stack to use log
levels").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:10:52 +03:00
Marc Herbert fa84cb7e5b tests/subsys/settings: build common code as zephyr_libraries
Stops leaking very long source paths in build directories; makes them
deterministic. Finishes what was started in commit b4282bf72d, see
rationale and code reviews there.

See also CMake issue https://gitlab.kitware.com/cmake/cmake/issues/19475
for more details.

Use the opportunity to remove the most obvious duplication.

Test with: sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Marc Herbert 5990ce3805 tests/subsys/settings/functional: de-duplicate zephyr_include_
... and move it next to zephyr_library_sources()

Follow up to commit b4282bf72d.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Jukka Rissanen 1f97946358 tests: net: icmpv6: Increase the TX buf counts
If the ICMPv6 test is run in real hw, we need a bit more buffers
to pass the test.

Fixes #19915

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-22 09:12:24 +03:00
Wayne Ren 482b993b88 tests: add the case for ARC in yaml
* add the case for ARC in yaml after dynamic and direct irq are
  supported
* fix the bug that index in sw_isr_table should have a offset of
  CONFIG_GEN_IRQ_START_VECTOR

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-10-21 09:06:17 -07:00
Radoslaw Koppel daff5e93f9 Test: Settings: Fix FCB delete test
This commit fixes the FCB delete test after PR #19541.
Now the entity callback is not called on deleted element.

Issue: #19963

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-21 08:51:57 -04:00
Jukka Rissanen feb6cf56f4 tests: net: shell: Increase the main stack size
Stack size might be too small when running the test in real
board like sam-e70.

Fixes #19914

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-21 09:58:56 +03:00
Peter Bigot fff0cfc32d tests/drivers/build_all: add FLAG definition for all gpios
Work in topic-gpio to convert drivers to properly use devicetree flag
settings requires that these be defined so sanitycheck can find them.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-18 08:07:00 -05:00
Maksim Masalski 03e6d3bb41 tests: updated names for the dns tests
After run Sanitycheck script I found out that
some test cases have a same test case name
in the test result .xml file.
For boards mimxrt1050_evk, qemu_x86, sam_e70_xplained
in .xml files that cases were dublicated.
Problem happened only with cases net.dns.no_ipv6.init
and net.dns.init. Only that cases were dublicated.
To solve it, I decided to change test cases names for the dns tests.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-18 15:30:06 +03:00
Ioannis Glaropoulos 6ce1f843cb tests: arch: arm_irq_vector_table: enable test for nRF51x platforms
This commit enables running the test in CI for nRF51-based
platforms, which require special IRQ lines for the IRQs
used in the test. An additional customization is needed
for QEMU_CORTEX_M0, which uses a different system timer
based on TIMER0 peripheral.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-18 10:16:32 +02:00
Ioannis Glaropoulos 391d6da190 tests: arch: arm_irq_vector_table: enable test for ARMv6-M CPUs
This commit enables running the test in CI for Cortex-M Baseline
architecture. As STIR register is not present in Baseline cores,
we need a minor modification in the test code so it uses NVIC
intrisics instead of setting the STIR for ARMv6-M.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-18 10:16:32 +02:00
Ioannis Glaropoulos 1084e5b652 tests: arch: arm_irq_vector_table: no explicit const array size
We do not need to explicitly define the size of the const
array elements for the customized IRQ vector, used in the
test. The compiler should be able to infer the actual size
by counting the provided entries.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-18 10:16:32 +02:00
Ulf Magnusson 2d8bd31b37 tests: net: Remove CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS assignment
This symbol is not user-configurable (has no prompt), so assignments in
prj.conf have no effect on it.

(It has no defaults either, and isn't selected/implied, so nothing in
vanilla Zephyr will ever enable it.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-18 09:13:49 +02:00
Johan Hedberg 5537181e1a Bluetooth: Fix missing includes for hci.h
With the changes in PR #19836 applications now need to explicitly
include hci.h to use defines from it. Fix two sample/tests apps which
were missing this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-10-17 19:05:33 +03:00
Jukka Rissanen d500ac87c4 tests: net: tls: Increasing stack size
The default main stack is too small for some boards so increasing
it to 2048. The issue was seen with sam_e70_xplained.

Fixes #19762

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-17 17:01:23 +03:00
Francisco Munoz 88dfb884ba tests: drivers: kscan: Add simple API tests
Introduce API tests for kscan driver

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2019-10-16 13:29:21 -07:00
Iosif Macesanu 24508a777d drivers: sensor: Add OPT3001 light sensor driver
Add OPT3001 light sensor driver

Signed-off-by: Iosif Macesanu <iosif@actinius.com>
2019-10-16 14:51:07 -05:00
Iosif Macesanu 884485667d drivers: sensor: Add SI7060 temperature sensor driver
Add SI7060 temperature sensor driver

Signed-off-by: Iosif Macesanu <iosif@actinius.com>
2019-10-16 14:48:12 -05:00
Ioannis Glaropoulos 9375aaebe6 tests: kernel: fatal: add a test-case for arbitrary error reason
We add a test-case in kernel/fatal test suite, to test that
the application developer can induce a SW-generated exception
with any 'reason' value.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-16 11:22:48 +02:00
Ioannis Glaropoulos 04c334ad1b tests: kernel: userspace: replace inline assembly with C code
We replace an inline assembly block of code with CMSIS
functions, to make it portable to ARMv6-M architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-15 10:06:48 -07:00
Andrew Boie 3b9bcbb23f tests: x86_mmu_api: don't include 32bit cpu header
kernel.h already does the right thing.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-15 09:00:49 -07:00
Kamil Piszczek 7cd1a1bd7b tests: settings: functional: nvs: adding posix targets
Added native_posix and native_posix_64 targets to the functional tests
of NVS.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Kamil Piszczek ce413d1412 tests: settings: functional: nvs: removing duplicated config
Removed duplicated configuration for qemu_x86 which matches the default
one.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Jukka Rissanen 6188185c57 tests: net: tcp: Initialize TCP header properly
When constructing TCP packet, make sure the TCP header is
initialized.

Fixes #19775

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-15 11:01:20 +03:00
Andrew Boie b7d41a2a94 tests: move boot_page_table test
This is x86-specific.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-14 11:49:39 -07:00
Andrew Boie 06d3e958a7 tests: move x86_mmu_api test
This is x86-specific.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-14 11:49:39 -07:00
Andrew Boie 31620b90e2 x86: refactor mmustructs.h
The struct definitions for pdpt, pd, and pt entries has been
removed:

 - Bitfield ordering in a struct is implementation dependent,
   it can be right-to-left or left-to-right
 - The two different structures for page directory entries were
   not being used consistently, or when the type of the PDE
   was unknown
 - Anonymous structs/unions are GCC extensions

Instead these are now u64_t, with bitwise operations used to
get/set fields.

A new set of inline functions for fetcing various page table
structures has been implemented, replacing the older macros.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-14 11:49:39 -07:00
Andrew Boie ab4d647e6d x86: mmu: get rid of x86_page_entry_data_t typedef
This hasn't been necessary since we dropped support for 32-bit
non-PAE page tables. Replace it with u64_t and scrub any
unnecessary casts left behind.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-14 11:49:39 -07:00
Andrew Boie e3ab43580c x86: move mmustructs.h
This will be used for both 32-bit and 64-bit mode.
This header gets pulled in by x86's arch/cpu.h, so put
it in include/arch/x86/.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-14 11:49:39 -07:00
Radoslaw Koppel 687a02a02d settings: file: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Radoslaw Koppel 0b0f375190 settings: fcb: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Jose Alberto Meza 3b67130334 tests: adc: MEC15 modular board test definitions
Use same adc definitions from mec15xxevb for mec1501 modular card

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-10-13 07:16:07 -07:00
Anas Nashif 1b8d161cb5 benchmarks: capture benchmark data in a file
Record benchmark data in file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-11 07:28:19 -07:00
Kamil Piszczek 92d9e30527 tests: migrating to NVS backend with settings
Bluetooth tests now use the NVS backend for Settings.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-11 14:55:24 +02:00
Andrzej Puzdrowski cfffd1f782 tests/subsys/settings/nffs: fix not initialized variables issues
A few settings module variables were not initialized before used.
Normally these variable are initialized in the back-end
initialization call which couldn't be done in affected unit tests.

This path initialize these variable via assignments in test code.

fixes #19722

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-11 13:30:36 +02:00
Nicolas Pitre 923a909db8 tests/mem_pool_threadsafe: use actual minimum mempool block size
On 64-bit targets, the minimum possible mempool block size is not 8
but 16. With a max block size of 32, the mempool allocator cannot
split it into 4 sub-blocks, reducing the available memory allocations
to that original 32-byte block only.

To get the same allocation patterns and test behavior whether it is
built for a 32-bit or 64-bit architecture, let's define BLK_SIZE_MIN
and BLK_SIZE_MAX in terms of _MPOOL_MINBLK instead of literal values.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-10-09 17:45:40 -05:00
Nicolas Pitre 0125cabec7 test_pipe_contexts: don't free memory blocks handed to k_pipe_block_put
Documentation for k_pipe_block_put() says:

  This routine writes the data contained in a memory block to pipe.
  Once all of the data in the block has been written to the pipe,
  it will free the memory block.

Therefore it is wrong to free the memory block within the test code.
When the mempool allocator is instrumented to detect double-free
instances, this case is signaled right away.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-10-09 11:15:46 -07:00
Peter Bigot e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Peter Bigot 6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Peter Bigot 3423d8b2a4 coccinelle: standardize k_mbox_data_block_get call with timeout
Re-run with updated script to convert integer literal delay arguments to
k_mbox_data_block_get to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Krzysztof Chruscinski ab288a8e9e tests: drivers: counter: Add test suite for nrf rtc fixed top value feature
Added test suite which performs sanity check on instances with
fixed-top feature enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-09 13:25:36 +02:00
Krzysztof Chruscinski 1d6ba06ea7 tests: drivers: counter: Enable ppi-wrap feature on one instance
Enable ppi-wrap feature to test it on at least one instance.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-09 13:25:36 +02:00
Krzysztof Chruscinski eaa4962673 tests: drivers: counter: Add test for late setting and short relative
Added tests which verifies that:
- driver will detect when absolute alarm is set too late.
- short relative alarm is supported
- canceled alarm is not triggering user callback

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-09 13:25:36 +02:00
Krzysztof Chruscinski a3ff7f54ab drivers: counter: nrf_rtc: Add detection of late alarm request
Implemented latest extensions to the counter API related to
detection of alarms being set too late and short relative alarms.
Implementation could not be realized on nrfx_rtc driver thus
driver has been reimplemented based on nrf_rtc hal.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-09 13:25:36 +02:00
Charles E. Youse 12287985fb tests/kernel/smp: make 64-bit clean
Just housekeeping around the casting between void * arguments to
thread functions and integer types.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-10-07 19:46:55 -04:00
Charles E. Youse 8d97750eef arch/x86: (Intel64) add z_arch_curr_cpu() to enable CONFIG_SMP=y
And set qemu_x86_long board to build with CONFIG_SMP=y by default.
Apparently two benchmark tests - latency_measure and sys_kernel -
do not work with the SMP scheduler, so those tests are disabled.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-10-07 19:46:55 -04:00
Marc Herbert b4282bf72d tests/subsys/settings/functional: make common code a zephyr_library()
Stops leaking very long source paths in build directories; makes them
deterministic.

Besides satisfying a CMake requirement, the new empty_file.c provide a
clue that the actual test code is not in the directory of the test case.

See https://github.com/zephyrproject-rtos/hal_nordic/pull/6 and
https://gitlab.kitware.com/cmake/cmake/issues/19475 for more details.

- Test with a simple:

 sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/functional/

- Before:

CMakeFiles
├── app.dir
│   ├── HOME
│   │   └── JOHN
│   │       └── zephyrproject
│   │           └── zephyr
│   │               └── tests
│   │                   └── subsys
│   │                       └── settings
│   │                           └── functional
│   │                               └── src
│   │                                   └── settings_basic_test.c.obj

- After:

func_test_bindir/
├── CMakeFiles
│   └── settings_func_test.dir
│       └── settings_basic_test.c.obj
│
├── libsettings_func_test.a

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-06 19:03:22 -07:00
Andy Ross d042a3dac7 tests/kernel/mp: Update the MP test to run on emulated platforms
This was a very early test and got bitrotten inside a esp32-only
whitelist.  Make it run generically.

SMP must be forced off by the test (it's commonly a platform default).

Add a build-time failure when the configuration is single-CPU, for
clarity.

Filter the test likewise so it runs on all supported systems.

Also, the key argument to the CPU startup function is vestigial and
the test was being too strict by requiring it to be non-zero.

Finally, the qemu command line needs to predicate the "-smp" argument
on CONFIG_MP_NUM_CPUS and not just CONFIG_SMP so we have an extra CPU
to test against.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-10-06 12:53:28 -04:00
Andy Ross 6214f81fed tests/kernel/spinlock: No need to use MP API anymore
This test was written very early.  Spinlocks are required for SMP
implementation.  They couldn't be tested in terms of it, so the test
used the low level MP API instead.  But of course that breaks if SMP
is actually working and the CPU is already started.

No need for that now.  Just spawn a thread like any other, and filter
the test to run only on SMP systems.

Fixes #19319

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-10-06 12:53:28 -04:00
Anas Nashif 41a72e4c00 tests: smp: do not whitelist, use filter
Whitelisting is bad, new platforms with this capability would be
missed..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-05 16:13:36 -07:00
Ioannis Glaropoulos 6093f0acc0 tests: arm thread swap: increase Idle Stack size for no-opt test-case
Executing the ARM thread swap test with NO_OPTIMIZATIONS
option set, leads to Idle thread stack overflow in certain
platforms. We increase the size of the Idle thread stack to
address this.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-04 18:49:50 -07:00
Andrew Boie f0ddbd7eee x86: abstract toplevel page table pointer
This patch is a preparatory step in enabling the MMU in
long mode; no steps are taken to implement long mode support.

We introduce struct x86_page_tables, which represents the
top-level data structure for page tables:

- For 32-bit, this will contain a four-entry page directory
  pointer table (PDPT)
- For 64-bit, this will (eventually) contain a page map level 4
  table (PML4)

In either case, this pointer value is what gets programmed into
CR3 to activate a set of page tables. There are extra bits in
CR3 to set for long mode, we'll get around to that later.

This abstraction will allow us to use the same APIs that work
with page tables in either mode, rather than hard-coding that
the top level data structure is a PDPT.

z_x86_mmu_validate() has been re-written to make it easier to
add another level of paging for long mode, to support 2MB
PDPT entries, and correctly validate regions which span PDPTE
entries.

Some MMU-related APIs moved out of 32-bit x86's arch.h into
mmustructs.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-04 15:53:49 -07:00
Ioannis Konstantelias 556cf41021 drivers: sensor: Add TMP116
Added driver for TI's TMP116. This driver does not use the Alert
functionality.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-10-04 15:31:56 -05:00
Peter Bigot 66c8756956 coccinelle: standardize kernel API timeout arguments
Re-run with updated script to detect missed cases.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-04 16:23:57 -04:00
Krzysztof Chruscinski 4b59690330 tests: bluetooth: mesh: Fix RAM shortage failure for bbc_microbit
Test for bbc_microbit was failing due to RAM usage. Reduced main
stack size and turned off temperature algorithm to fit.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Krzysztof Chruscinski 42a1e19a7d tests: drivers: clock_control: Add test for nRF clock calibration
Added test for LF clock calibration when RC source is used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Krzysztof Chruscinski 488d74f125 tests: drivers: clock_control: Add test suite
Added test suite for clock control driver. It covers latest API update
for starting clock asynchronously and getting status.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Piotr Zięcik 19d8349aa5 kernel: Introduce k_work_poll
This commit adds new k_work_poll interface. It allows to
submit given work to a workqueue automatically when one of the
watched pollable objects changes its state.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-10-04 17:15:17 +02:00
Jukka Rissanen 8a4fa570ac tests: net: hostname: Set MAC address properly to all interfaces
The test creates two network interfaces, but does not set MAC
address of one of them correctly (MAC address is all zeros).
This is not good and the issue fixed in commit 9468cb6eb1
could have been revealed earlier.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-04 17:42:14 +03:00
Ioannis Glaropoulos ea4aacb4cb tests: arch: arm_thread_swap: enable running on Cortex-M Baseline
Update the .yaml file of the test suite, so it enables
building and running the test for Cortex-M Baseline
architecture. Update the test README accordingly.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-04 13:38:48 +02:00
Ioannis Glaropoulos ce960744af tests: arch: arm_thread_swap: minor fixes
Some fixes to the ARM Thread Swap test:
- replace a mempcy with memset (this did not have an
  effect, as we basically wanted to randomize the
  callee-saved registers)
- fix two inline comments so they correspond to the
  z_assert_ expressions.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-04 13:38:48 +02:00
Ioannis Glaropoulos a4049773ac tests: arch: arm_thread_swap: extend the test for Cortex-M Baseline
We rework the arm_thread_swap test, so it can build
and run for Cortex-M Basline architecture (Cortex-M0,
Cortex-M0+, and Cortex-M23). In most cases, this rework
involved re-implementing the code blocks for storing
and loading the callee-saved registers to and from
memory. In addition, we skip the verification of
BASEPRI, and replace it with verifying PRIMASK.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-04 13:38:48 +02:00
Andrew Boie 8c98a97581 arm: arch code naming cleanup
This patch re-namespaces global variables and functions
that are used only within the arch/arm/ code to be
prefixed with z_arm_.

Some instances of CamelCase have been corrected.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-04 10:46:23 +02:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Andy Ross bbd910b2e2 tests/kernel/sched/schedule_api: Filter for MULTIQ platforms
This test requires more than 32 static priorities by default, and
doesn't run with the multiq scheduler without a special configuration.
That used to be specified per-platform, but got moved to a separate
test case a while back.

This broke non-default platforms like qemu_cortex_m3 which use
SCHED_MULTIQ as their default backend.  Put a filter in place instead
of going back to per-platform changes.

Fixes #19437

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-10-03 07:26:10 -04:00
Stephanos Ioannidis b3d6ac2e37 tests: timer_api: Fix duplicate timestamp update.
Remove duplicate "tdata.timestamp" update in duration_expire; this
value is already updated by k_uptime_delta.

Besides simply removing duplicate value update, this commit also
addresses the intermittent assertion failure that is caused by
updating "tdata.timestamp" at a later time than the actual execution
of the k_uptime_delta function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-10-02 21:07:49 -04:00
Ioannis Glaropoulos 85afd0f797 boards: arm: qemu_cortex_m0: filter out a couple of failing tests
We filter out the following kernel tests
- tickless_concept
- timer_api
from the set of tests running on QEMU Cortex-M0 platform,
as the tests consistently fail on QEMU. In addition, we
add a workaround for kernel/interrupt test, so it can
successfully execute on QEMU Cortex-M0.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-10-02 21:06:54 -04:00
Jan Van Winkel 631a90cd42 tests: gui: Pass image pointer to fs_write
Pass image pointer to fs_write in function setup_fs of lvgl tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-02 08:18:16 -04:00
Jan Van Winkel 9468cb6eb1 tests: net: hostname: Corrected unique hostname conversion
Replaced net_bytes_from_str in hostname_get test by a new function that
converts the unique part of the hostname in a byte array.

net_bytes_from_str can not be used as it assumes that the string input
is of the format "xx:xx:xx:xx:xx:xx" where as the unique part of the
hostname is a MAC address string without colons. If net_bytes_from_str
is used this could result in buffer overrun on the input string.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-02 12:52:16 +03:00
Peter Bigot 49d6837bec samples: move board overlay files into boards directory
Application board.overlay files tend to be paired with
boards/board.conf files that extend the functionality of a board.
Move the overlay files to the same location as the config files that
they work with.

A few overlay files that are paired with a prj_board.conf file in the
application root directory are left in place.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-01 20:38:24 -07:00
Jan Van Winkel 7c07093f66 kernel: tests: Increased TX/RX buf size in pipe test
Increased TX/RX buffer size by one in pipe test to prevent buffer
overrun.

Some test will transfer one byte more then the number of bytes
supported by the pipe, in case the buffer size is the same as the
size of the pipe this will result in a buffer overrun.
Tools such as address sanitizer would detect this overrun and fail the
test.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-01 17:56:02 -04:00
Anas Nashif 6add267377 tests: tinycrypt: build only on native_posix
Move tinycrypt related header into test and make those tests only build
on native_posix. The tests are unit tests, ie. testing tinycrypt
functionality only without any dependency on the underlying system.

Long term we should move those to be true unit tests and create
functional and integration tests that use tinycrypt in the context of
Zephyr and for real use-cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-01 10:42:19 -07:00
Carles Cufi f8da57a93e tests: bluetooth: shell: Revert back to default logging settings
Disable the CONFIG_TEST_LOGGING_DEFAULTS Kconfig option which forces
immedate logging, since that is not compatible with Bluetooth and its
tests.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-01 19:11:16 +02:00
Jan Van Winkel b3ce7cb1c8 kernel: tests: Added header with common declarations
Added header file containing common declarations for tstack,
tstack_size and tdata.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-01 09:16:01 -04:00
Anas Nashif cb5e6b234d tests: rtc: rename test.yaml to testcase.yaml
testcase file wrongly named test.yaml.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-30 17:20:22 -04:00
Anas Nashif 965aac39b6 tests: board_shell: rename test.yaml to testcase.yaml
testcase file wrongly named test.yaml.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-30 17:20:22 -04:00
Anas Nashif 2d4837061a tests: fix identifiers
Fix identifier and rename plain 'test' to something more appropriate.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-30 17:20:22 -04:00
Andrew Boie 2c1fb971e0 kernel: rename __swap
This is part of the core kernel -> architecture API and
has been renamed to z_arch_swap().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrew Boie fe031611fd kernel: rename main/idle thread/stacks
The main and idle threads, and their associated stacks,
were being referenced in various parts of the kernel
with no central definition. Expose these in kernel_internal.h
and namespace with z_ appropriately.

The main and idle threads were being defined statically,
with another variable exposed to contain their pointer
value. This wastes a bit of memory and isn't accessible
to user threads anyway, just expose the actual thread
objects.

Redundance MAIN_STACK_SIZE and IDLE_STACK_SIZE defines
in init.c removed, just use the Kconfigs they derive
from.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrew Boie e6654103ba kernel: rename boot time globals
These are renamed to z_timestamp_main and z_timestamp_idle,
and now specified in kernel_internal.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrew Boie e1ec59f9c2 kernel: renamespace z_is_in_isr()
This is part of the core kernel -> architecture interface
and is appropriately renamed z_arch_is_in_isr().

References from test cases changed to k_is_in_isr().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrew Boie 9e1dda8804 timing_info: rename globals
Global variables related to timing information have been
renamed to be prefixed with z_arch, with naming arranged
in increasing order of specificity.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrei Emeltchenko a6eb2ae299 adc: Trivial style cleanup
Cleanup adc header and API test.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-09-30 12:20:39 -05:00
Andrei Emeltchenko ad0c6688ff tests: adc: Correct tags
Removed unused peripheral tag and add drivers to
include test to drivers sanity check run.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-09-30 12:20:39 -05:00
Anas Nashif 2051ad1846 tests: convert util test to a unit test
Merge tests/misc/util with existing util unit test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-30 07:09:42 -04:00
Charles E. Youse dc8b3b1094 samples/board/x86_info: move to tests directory
This application's primary purpose is to provide some useful data to
the author of an x86 board support package for Zephyr-- it's not a
good sample.  It's not a good test either, but as a test it at least
prevents regressions in multiboot/ACPI builds.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-29 12:30:34 -07:00
Charles E. Youse ce46e0df4d cmake: samples/tests: update cmake_minimum_required() to 3.13.1
Some samples/tests are still referring to 3.8.x versions.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-27 23:09:24 -04:00
Anas Nashif 96ad532b58 tests: move Bluetooth at tests under tests/bluetooth
this is not a unit test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 50d5e37b8a tests: move util test to be unit tests
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 1caab558a1 tests: move intmath test to be unit tests
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif e9156e04b4 tests: move list test to be unit tests
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif cd60bd96ac tests: cleanup test_build
- Kconfig test does not really need to build on all platforms
- nmi test is already in tests/arch/arm/arm_runtime_nmi
- we have plenty of tests with newlib enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 9be0f1d251 tests: move xtensa_asm2 tests to tests/arch
This is a test, so move it under tests/arch/..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 04024aefa1 tests: move cmsis_rtos_v2 into portability
just to keep same class of tests under the same umbrella, otherwise
those tests do not belong in the top level tests/ directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 8070643663 tests: move cmsis_rtos_v1 into portability
just to keep same class of tests under the same umbrella, otherwise
those tests do not belong in the top level tests/ directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 9004eb68dc tests: make rbtree tests unit tests
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif abf1d36ed9 tests: move crc to a unit test
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 48c335486f tests: move base64 to a unit test
Move to a unit test, no need to build this for every platform we have.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 522ca62960 tests: remove useless stub test
Was used by the test system to flash inactive cores.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 32a9435ea4 tests: tracing: add tests for tracing features
Mostly build tests now, will be extended to verify CTF output once we
have this feature in sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 14:42:22 -04:00
Kamil Piszczek e11248baa6 tests: subsys: settings: nvs: intergrating tests with nvs backed
Integrated Settings module tests with the NVS backend. The batch of
tests is shared with other backends.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek ef0e91aa8a tests: subsys: settings: functional: test name change for fcb & nvs
Changed the name of functional tests for NVS and FCB in the test
configuration file to avoid duplication with other test suites.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek 43943b94d7 tests: subsys: settings: tightening scope of common test functions
Limited the scope of helper functions that are used in the common test
source. Now it is easier to identify which functions are intended to be
used in the test suite.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Andy Ross d1200d2155 tests: Never disable SMP
Disabling SMP mode for certain tests was a one-release thing, done to
avoid having to triage every test independently (MANY are not
SMP-safe), and with the knowledge that it was probably hiding bugs in
the kernel.

Turn it on pervasively.  Tests are treated with a combination of
flagging specific cases as "1cpu" where we have short-running tests
that can be independently run in an otherwise SMP environment, and via
setting CONFIG_MP_NUM_CPUS=1 where that's not possible (which still
runs the full SMP kernel config, but with only one CPU available).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-26 16:54:06 -04:00
Andy Ross 49398cfbf6 tests/kernel/sched/schedule_api: Relax preemption order constraints
This test was testing for an undocumented and somewhat hyperspecific
behavior: when a process reaches a reschedule point and yields to a
higher priority thread, and there is another equal priority thread
active, which thread gets to run when the higher priority thread
finishes its work?  The original scheduler (because it leaves the
older thread in place in the list) implements the preemption like an
interrupt and returns to the original thread, despite the fact that
this then resets is time slice quantum unfairly.  In SMP mode, where
the current threads cannot live in the active list, the thread gets
added back to the end of the queue and the other thread runs.  In
effect, in UP mode "yield" and "reschedule" mean very slightly
different things where in SMP they act the same.

We don't document either behavior, as it happens.  Relax the test
constraints by adding a single deliberate k_yield() to unify behavior.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-26 16:54:06 -04:00
Andrei Emeltchenko dba3555ffb tests: pwm: Fix missing unit test
Add missing unit test.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-09-26 16:52:58 -04:00
Armando Visconti 44f373e806 driver/sensor: lis2mdl: make use of STdC definitions
Port the lis2mdl sensor driver on top of the lis2mdl_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-26 13:42:59 -07:00
Erwan Gouriou 3a7c37ab29 tests/arch: arm_thread_swap: Increase no_optim case flash requirement
On most targets, application flash size for no_optimization test
configuration is slightly higher than 128 Kbytes.
Updating requirement to the next upper flash size.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-09-26 23:06:38 +03:00
Paul Sokolovsky ae5a7bb579 tests: subsys: jwt: Remove unneeded CONFIG_PTHREAD_IPC option
As it stands, this option leads to conflict between Newlib and POSIX
headers. (Which needs to be resolved separately.)

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-09-25 20:56:29 -07:00
Anas Nashif fc4cb492b5 tests: build kernel/common on all platforms, always
To catch more potential issues with PRs, build common kernel tests
in addition to the synchronization sample which does not run any tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-25 12:56:32 -04:00
Krzysztof Chruscinski bd8e241733 tests: misc: util: Add test for Z_MAX and Z_MIN
Added tests for new macros in util.h

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-09-25 17:41:03 +02:00
Kim Sekkelund 0450263393 Bluetooth: Host: Remove printk dependency from settings
Some modules use snprintk to format the settings keys. Unfortunately
snprintk is tied with printk which is very large for some embedded
systems.
To be able to have settings enabled without also enabling printk
support, change creation of settings key strings to use bin2hex, strlen
and strcpy instead.
A utility function to make decimal presentation of a byte value is
added as u8_to_dec in lib/os/dec.c
Add new Kconfig setting BT_SETTINGS_USE_PRINTK

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
2019-09-25 17:36:39 +02:00
Mariusz Skamra 9828b0fae8 Bluetooth: tester: Adapt to BTP Get Attribute Value API change
Adapt the gatt_get_attribute_value_cmd to recent changes in API.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-09-25 17:36:05 +02:00
Daniel Leung 6fae2eae4e tests/adc_api: add parameters for mec15xxevb_assy6853
This adds the parameters needed to get the test to build
and to run.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-09-25 06:12:52 -04:00
Sean Nyekjaer aa464c6f9e tests/drivers: adc: add config for NXP Freedom K22F board
Add the configuration block for NXP Freedom K22F board for
the adc_api test.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2019-09-25 02:18:38 -07:00
Tom Burdick 45c7783b1e boards: arm: Add support for NXP FRDM-K22F board
This adds support for NXP's Freedom K22 board.

Co-authored-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Co-authored-by: Tom Burdick <thomas.burdick@gmail.com>
Signed-off-by: Tom Burdick <thomas.burdick@gmail.com>
2019-09-25 02:18:38 -07:00
Marc Herbert fb4b932b72 tests/lib/fdtable/prj.conf: remove hardcoded CONFIG_COVERAGE=y
There is absolutely no other test in the entire codebase that hardcodes
this setting. I found no comment or any other explanation why this test
should be unique. So it really looks like just a glitch introduced when
this test was added by PR #17618 / commit f1afb4c24d.

This was discovered in three different ways:

- COVERAGE=y adds the absolute and non-deterministic source path in
  .rodata sections
- it adds .gnco files in the build directory
- it makes (some) tests run 10 times slower:

qemu_x86_64   lib/fdtable/libraries.os.fdtable PASSED (qemu 2.086s)
qemu_x86_long lib/fdtable/libraries.os.fdtable PASSED (qemu 2.316s)
qemu_xtensa   lib/fdtable/libraries.os.fdtable PASSED (qemu 2.033s)
mps2_an385    lib/fdtable/libraries.os.fdtable PASSED (qemu *31.286s*)
qemu_x86      lib/fdtable/libraries.os.fdtable PASSED (qemu *31.862s*)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-09-25 05:04:30 -04:00
Radoslaw Koppel 6c2add5445 settings: Direct loading functionality
This commit allows loading data from settings permanent storage
directly to the given callback function.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-09-24 14:15:38 +02:00
Krzysztof Chruscinski 19b535f8e6 tests: drivers: counter: Minor comment improvement in test
Improved message on failed assertion.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-09-24 09:01:22 +02:00
Peter Bigot d2ad8fca48 tests: exclude platforms with limited flash
Platforms with limited flash are now failing to link.  Add or increase
flash requirements for test cases to exclude the ones that will fail.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-23 17:49:46 -07:00
Ioannis Glaropoulos 44f3b79b6f tests: arch: arm: fix bug in z_assert expression
The commit fixes two assert expressions in the test,
which evaluate the return value of _swap(.) function
and the value of the thread's swap return variable.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-22 23:30:37 +02:00
Ioannis Glaropoulos be2eb2a19f tests: arch: arm thread swap: fix r0 preservation in the test
We use inline assembly to store the return value of _swap(..)
function directly into r0 (in order to ensure that r4-r11
registers are not touched at this point). But we need to store
the r0 into some global memory, to retain the value until we
check it later in an assert expression, otherwise the
compiler may overwrite r0 in subsequent instructions.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-22 23:30:37 +02:00
Charles E. Youse 78c9e8f8cc tests/benchmarks/boot_time: disable on inapplicable targets
Minnowboard and ACRN do not use the new APIC timer, so the
benchmark code will not run on them (yet).

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse 223ac780d3 tests/benchmarks/boot_time: disable on QEMU targets
These all currently use the HPET timer, and thus can't build with
BOOT_TIME_MEASUREMENT enabled, so disable for now. This test is
basically a build-only test, so we're covered with the other x86
targets (gpmrb, up_squared) for now.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse 3036faf88a tests/benchmarks: fix BOOT_TIME_MEASUREMENT
The boot time measurement sample was giving bogus values on x86: an
assumption was made that the system timer is in sync with the CPU TSC,
which is not the case on most x86 boards.

Boot time measurements are no longer permitted unless the timer source
is the local APIC. To avoid issues of TSC scaling, the startup datum
has been forced to 0, which is in line with the ARM implementation
(which is the only other platform which supports this feature).

Cleanups along the way:

As the datum is now assumed zero, some variables are removed and
calculations simplified. The global variables involved in boot time
measurements are moved to the kernel.h header rather than being
redeclared in every place they are referenced. Since none of the
measurements actually use 64-bit precision, the samples are reduced
to 32-bit quantities.

In addition, this feature has been enabled in long mode.

Fixes: #19144

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse efcecea6aa subsys/debug: eliminate PEFORMANCE_METRICS and CPU_CLOCK_FREQ_MHZ
Neither of these options is actually used; CPU_CLOCK_FREQ_MHZ appears
to have been part of x86 BOOT_TIME_MEASUREMENT at some point, and
PERFORMANCE_METRICS is the stillborn cousin of EXECUTION_BENCHMARKS.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Jukka Rissanen 49a4144ac5 tests: net: hostname: Add tests for hostname set/get
Add tests that set or get system network hostname.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-20 11:42:51 +03:00
Andrew Boie c91b9b37d0 tests: net: stop whitelisting
This is bad practice and may conceal issues on platforms
not in the whitelist.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-20 09:21:11 +03:00
Peter A. Bigot 55ace13c32 lib/timeutil: avoid implementation-defined behavior
The algorithm for converting broken-down civil time to seconds in the
POSIX epoch time scale would produce undefined behavior on a toolchain
that uses a 32-bit time_t in cases where the referenced time could not
be represented exactly.

However, there are use cases in Zephyr for civil time conversions
outside the 32-bit representable range of 1901-12-13T20:45:52Z through
2038-01-19T03:14:07Z inclusive.

Add new API that specifically returns a 64-bit signed seconds count, and
revise the existing API to detect out-of-range values and convert them
to a diagnosible error.

Closes #18465

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-09-19 20:49:51 -04:00
Vincent Wan 669c66b551 tests: arm: fix arm_irq_vector_table to plug rtc_isr for CC13x2/CC26x2
Given the RTC is used for system clock, we need to plug its interrupt
to avoid an exception that would occur if it is left unhandled.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-09-19 13:43:10 -05:00
Vincent Wan 2930d000ff tests/kernel/sleep: relax upper bound for TI CC13X2/CC26X2 RTC
The RTC on TI CC13X2/CC26X2 is a 32 KHz clock for which the minimum
compare delay is 3 ticks. When using it as the system clock, we need
to relax the upper bound to ensure the test succeeds.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-09-19 13:43:10 -05:00
Luiz Augusto von Dentz 03b9ce487c Bluetooth: GATT: Add support to setting permission on CCCD
This adds support to set different permissions to CCCD so security can
be checked when enabling notification which conforms to:

BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2360:

  '3.3.3.3 Client Characteristic Configuration

   Authentication and authorization may be required by the server to
   write the configuration descriptor.'

In addition to that also ensure that notification are not re-enabled
until the proper security level is reached to conform to the following
statement:

  '10.3.1.1 Handling of GATT indications and notifications

   A client “requests” a server to send indications and notifications
   by appropriately configuring the server via a Client Characteristic
   Configuration Descriptor. Since the configuration is persistent
   across a disconnection and reconnection, security requirements must
   be checked against the configuration upon a reconnection before
   sending indications or notifications. When a server reconnects to a
   client to send an indication or notification for which security is
   required, the server shall initiate or request encryption with the
   client prior to sending an indication or notification. If the client
   does not have an LTK indicating that the client has lost the bond,
   enabling encryption will fail.'

Fixes #17983

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-09-19 21:12:39 +03:00
Takumi Ando 3759aa5aa2 tests: degu_evk: add adc test
Add degu_evk to ADC test

Signed-off-by: Takumi Ando <takumi.ando@atmark-techno.com>
2019-09-19 12:06:56 -05:00
Jan Van Winkel fbcbe0f11b tests: cmsis_v2: Put/Get msg in queue instead of u32_t
Send and receive messages from message queue instead of using u32_t
stack variables to prevent stack overrun.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-19 09:33:03 -05:00
Jan Van Winkel 75677c6dac tests: cxx: Enable exceptions
Added test run with exceptions enabled.

Boards colibri_imx7d_m4, warp7_m4 and pico_pi_m4 have been excluded
from test run as they do not have sufficient ROM.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-19 09:26:42 -05:00
Anas Nashif 7912f24bf3 tests: timer_api: exclude qemu_x86_coverage
Test keeps failing when coverage is enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-19 09:22:09 -04:00
Anas Nashif 27ff3f15f6 drivers: counter: remove qmsi counter driver
No users of this driver after dropping quark platforms.

COUNTER_0_NAME was only defined by the QMSI driver and was defined but
not used in DTS fixup files of ateml_sam0 SoCs. Removing those leftover
defines as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-18 11:06:18 -05:00
Anas Nashif 5cde4ea245 drivers: dma: remove qmsi DMA driver
No users of this driver after dropping quark platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-18 11:06:18 -05:00
Vincent Wan d2edfa2347 tests: fatal: allocate timer outside of stack
In stack_sentinel_timer(), the timer should not be allocated on the
stack. If it gets added to the list of timeouts by k_timer_start,
then an unexpected exception may occur when the timer expires since it
may have been overwritten.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-09-18 13:27:30 +08:00
Jukka Rissanen a077bdd417 tests: net: shell: Add some simple tests for net-shell
Make sure net-shell is started properly and it does not crash.
The purpose of this test is to catch issues described in #19178
where UART was not working which was seen as net-shell crashing
at startup.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-17 22:41:56 +08:00
Charles E. Youse 3038209695 drivers/timer/hpet.c: migrate to devicetree
This driver was still using CONFIG_* values to determine its address,
IRQ, etc. Add a binding for an "intel,hpet" device and migrate this
driver to devicetree.

Fixes: #18657

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-17 22:37:09 +08:00
Johann Fischer feef83d864 drivers: amg88xx: rework sensor driver to use DT
Rework sensor driver to use DT.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-17 06:27:21 -05:00
Jan Van Winkel 0ae378e92e tests: kernel: Suppress warnings in intmath tests
Suppress integer overflow warning generated by the check macros
NEG_CHECK and ROLLOVER_CHECK in intmath tests

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-17 11:27:19 +02:00
Torstein Grindvik d888e012ed subsys/testsuite: make tc_util overridable
A Kconfig boolean is added to allow users to provide their own
output strings when running tests via ztest.
This allows changing e.g. the PASS/FAIL/SKIPPED strings,
add counters, change separators, and similar.

A test using the feature and relevant documentation is added.

Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
2019-09-17 07:11:33 +08:00
Jan Van Winkel c983c85d8f tests: gui: Added tests for LVGL glue logic
Added test for LVGL library glue logic

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-16 16:08:36 -05:00
Jan Van Winkel 7a70fa8488 usb: tests: Pass correct lengths to hexdump in usb bos test
Pass correct length to hexdump in usb bos test to prevent overun
of global data.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-16 15:33:10 -05:00
Armando Visconti 871d132577 driver/sensor: add IIS3DHHC accelerometer sensor
Add support to STM IIS3DHHC the ultra-low noise, high-stability
three-axis linear accelerometer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-16 14:07:56 -05:00
Charles E. Youse f914669075 tests/posix/common: restructure to eliminate casts
Restructure code to reduce the number of obnoxious casts.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Charles E. Youse 097c30c863 tests/subsys/logging/log_core: increase log buffer size
The test needs to cram at least 8 messages into the log buffer, but
with 64-bit pointers only 5 fit, so make the buffer a bit bigger.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Charles E. Youse 2e788040d8 tests/posix/common: make 64-bit clean
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>
2019-09-15 11:33:47 +08:00
Charles E. Youse 0f98cdd457 arch/x86: tests/cmsis: disable some CMSIS tests in 64-bit mode
The CMSIS layer doesn't like large stacks, and x86 in long mode
requires large stacks, so we disable these tests for now (as was
previously done on the x86_64 port for the same reasons).

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Charles E. Youse 65b1f62ee3 arch/x86: disable inapplicable tests for Intel64
In long mode, x86 does not support static IDTs or OpenOCD,
so disable the tests related to these features.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Kumar Gala 29e55d74e8 rtc: Remove old rtc functionality
Remove the old rtc functionality as its been deprecated for 2 releases
now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-14 07:33:38 -05:00
Kumar Gala 69ba9dafcb tests/subsys/settings/fcb: Fix ifdef in ztest_test_suite
We don't allow an ifdef in ztest_test_suite because its a macro.  We
usually handle this by defining multiple blocks and ifdef around them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-13 10:27:49 -05:00
Jukka Rissanen 8e6aaaf919 tests: net: socket: Test that non-blocking accept() works
Mark socket non-blocking and make sure that accept() will return
immediately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-13 10:41:33 +03:00
Jukka Rissanen f6c5ea6c81 tests: net: dhcpv4: Increase the buffer count
Test requires more network buffers to work properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 17:33:44 +03:00
Erwan Gouriou 555936f771 dts/Kconfig: Remove unused HAS_DTS_SPI
Symbol is always "and'ed" with the symbol that
selects it, so no effect. Clean it up.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-09-12 08:16:42 -05:00
Armando Visconti b7944510a4 dts/bindings: sensors: remove '-magn' extension from lis2mdl name
The LIS2MDL is not a combo device, but pure magnotemeter.
Hence, '-magn' extension is not adding information and can
be removed from dts compatible name as well as binding filename.

Instead specify '-i2c' or '-spi' to distinguish between the names.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-09-12 07:58:34 -05:00
Andrew Boie 2192499fe0 tests: enable log in immediate mode by default
Fatal error reporting now only dumps to the log mechanism,
so enable it in immediate mode for all tests to ensure
that fatal errors are visible and no messages are lost.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Andrew Boie c4befd50ab tests: increase min_ram for two tests
These two tests were right at the knife edge of 16kb
on riscv64, and were not building with logging enabled
on that platform.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Andrew Boie df434592d6 tests: bluetooth: mesh: adjust microbit config
Disable logging defaults for this test, enabling logging
causes this test to not fit in RAM.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Andrew Boie 7819a5a9a8 tests: profiling_api: increase idle stack size
This test for some reason wants to validate that
k_stack_analyze() works when called from the idle thread,
but with a default idle stack size of 256 this just results
in crashes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Jukka Rissanen 117d385de8 tests: net: socket: register: Fix unit tests when proto == 0
Make sure the tests pass properly if the socket() is called
with proto 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 11:22:45 +03:00
Andy Ross 4723def90d tests/kernel/mem_protect/syscalls: Add cases to test 64 bit arguments
Add some simple tests of the new code generation for syscalls with 64
bit arguments.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Andy Ross 6564974bae userspace: Support for split 64 bit arguments
System call arguments, at the arch layer, are single words.  So
passing wider values requires splitting them into two registers at
call time.  This gets even more complicated for values (e.g
k_timeout_t) that may have different sizes depending on configuration.
This patch adds a feature to gen_syscalls.py to detect functions with
wide arguments and automatically generates code to split/unsplit them.

Unfortunately the current scheme of Z_SYSCALL_DECLARE_* macros won't
work with functions like this, because for N arguments (our current
maximum N is 10) there are 2^N possible configurations of argument
widths.  So this generates the complete functions for each handler and
wrapper, effectively doing in python what was originally done in the
preprocessor.

Another complexity is that traditional the z_hdlr_*() function for a
system call has taken the raw list of word arguments, which does not
work when some of those arguments must be 64 bit types.  So instead of
using a single Z_SYSCALL_HANDLER macro, this splits the job of
z_hdlr_*() into two steps: An automatically-generated unmarshalling
function, z_mrsh_*(), which then calls a user-supplied verification
function z_vrfy_*().  The verification function is typesafe, and is a
simple C function with exactly the same argument and return signature
as the syscall impl function.  It is also not responsible for
validating the pointers to the extra parameter array or a wide return
value, that code gets automatically generated.

This commit includes new vrfy/msrh handling for all syscalls invoked
during CI runs.  Future commits will port the less testable code.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Ioannis Konstantelias 1846fc600f tests: drivers: watchdog: Update testcase
After the window watchdog introduction, the boards that support it over
independent watchdog fail to pass this test. This patch adds specific
tests for the nucleo_{f401re, l496zg} boards supporting WWDG.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-09-11 22:13:36 -05:00
Andrew Boie 9df9994572 x86: fix XIP SOC support and defaults
XIP support in x86 was something of a mess. This
patch does the following:

- Generic ia32 SOC no longer defines a "flash" region
  as generic X86 devices don't have a microcontroller-
  like concept of flash. The same has been done for apollo_lake.
- Generic ia32 and apollo_lake SOCs starts memory at 1MB.
- Generic ia32 SOC may optionally have CONFIG_XIP enabled.
  The board definition must provide a flash region definition
  that gets exposed as DT_PHYS_LOAD_ADDR.
- Fixed definitions for RAM/ROM source addresses in ia32's
  linker.ld when XIP is turned off.
- Support for enabling XIP on apollo_lake SOC removed, there's
  no use-case.
- acrn and gpmrb boards have flash and XIP related definitions
  removed.
- qemu_x86 has a fake flash region added, immediately after system
  RAM, for use when XIP is enabled. This used to be in the ia32 SOC.
  However, the default for qemu_x86 is to now have XIP disabled.
- Fixed tests/kernel/xip to run by default on boards that enable
  XIP by default, plus an additional test to exercise XIP on
  qemu_x86 (which supports it but has XIP switched off by default)

The overall effect of this patch is to:

- Remove XIP configuration for SOC/boards where it does not make
  any sense to have it
- Support testing XIP on qemu_x86 via tests/kernel/xip, but leave
  it off by default for other tests, to ensure it doesn't bit-rot
  and that the system works in both scenarios.
- XIP remains an available feature for boards that need it.

Fixes: #18956

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-11 21:11:38 -04:00
Jukka Rissanen b14856589e tests: net: getaddrinfo: Logging was missing log_strdup() call
A call to log_strdup() was missing which caused tests to fail if
logging was enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen 8108f06113 tests: net: getaddrinfo: Resolve using wrong address family
Make sure that resolving IPv4 address but returning IPv6 address
(and vice versa) is failing and we catch that scenario.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen 8fa6dfbe5a tests: net: tcp: Test connection cleanup after receiving SYN
Make sure the net_context is properly removed if done after
receiving SYN.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 22:53:12 +03:00
Jukka Rissanen b73a3de4ed tests: net: poll: Increase the poll timeout value
Got several sanity failures with this information

Assertion failed at tests/net/socket/poll/src/main.c:76: \
  test_poll: (tstamp >= 30U && tstamp <= 30 + FUZZ is false)

In one of the failed tests, the tstamp was 50. Dunno what is
wrong here but in order to proceed with this, increasing the
timeout temporarily. This commit can be removed if the root
cause for this timeout is figured out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Jukka Rissanen a76b786eb6 tests: net: poll: Moving config options from yaml to conf file
Moving Kconfig options from testcase.yaml file to prj.conf so
that we can run the test app easily from command line and without
sanitycheck.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Charles E. Youse 4a166f4913 drivers/pci: remove legacy PCI implementation
This has been subsumed by the new implementation in drivers/pcie.
We remove the legacy subsystem, related tests, shell module, and
outdated documentation/config references.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Charles E. Youse cda625b726 drivers/ethernet/eth_dw: remove DesignWare Ethernet driver
This was only used on the Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Andrzej Puzdrowski 94a022c954 fcb: start using errno codes
Switch form using privater FCB error codes to
errno codes. FCB private codes convention were compatible
with <errno.h> codes:
- 0 mean success
- negative values mean errors
- similar error types.
There was no sense to kept private FCB error codes.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-09-08 12:42:53 +02:00
Jan Van Winkel 4539c4bee1 tests: littlefs: Added support for native posix
Added support for native posix boards to littlefs tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:35:39 +02:00
Kamil Piszczek c05b0c74a3 tests: subsys: settings: functional: nvs & fcb split for CI
Splitted configuration for NVS & FCB so it is possible for the CI to
pick it up.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek 03c79fa10e tests: subsys: settings: functional: fix for nvs backend
Fixed build failure for the Settings NVS backend.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Ioannis Glaropoulos ee74098450 tests: exclude twr_ke18f platform from several user mode tests
Several user mode tests cannot run on twr_ke18f because
either the platform does not have a sufficient number of
MPU regions required for the tests, or, the tests also
require HW stack protection (which has been, by default,
excluded in user mode tests for twr_ke18f board). We
excluded the board from all those tests.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-03 16:44:22 +02:00
Ioannis Glaropoulos 31f8b6f17d tests: kernel: replace CONFIG_USERSPACE with CONFIG_TEST_USERSPACE
This commit replaces several CONFIG_USERSPACE=y
settings with CONFIG_TEST_USERSPACE=y. This allows
the test sub-system Kconfig structure to control
the settings of USERSPACE and HW_STACK_PROTECTION
in the various tests suites.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-03 16:44:22 +02:00
Luiz Augusto von Dentz 51ffabfa56 Bluetooth: UUID: Add test for bt_uuid_create
This adds test for bt_uuid_create APIs using a byte array in LE/BE
format as it is expected and then proceed to compare with matching and
unmatching UUID declared in host byte order.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-09-03 16:41:00 +02:00
Andrzej Puzdrowski 6bae22d290 tests/subsys/fs/nvs: extend entry delete test
Extended case for testing deletion of the first entry while
it is the most recent one.
This extension allow to reproduce issue #18813 and shows that
the bugfix works well.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-09-02 12:31:42 +02:00
Carles Cufi 6f5dc33ef4 nvs: Fix deletion of the last entry added
Make sure that the last entry added is deleted correctly by storing the
fact that one was found in a local variable.

Fix by Laczen JMS <laczenjms@gmail.com>

Fixes #18813.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-09-02 12:31:42 +02:00
Carles Cufi 351bef1dd2 tests: settings: Fix coverity issue CID 203623
Mask the value passed to memset() to avoid an error from Coverity.

Fixes #18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-30 12:30:59 +02:00
Wentong Wu a58d730dae tests/drivers/ipm: Enable on x86_64
this case isn't designed for SMP, setting CONFIG_MP_NUM_CPUS=1 to
run the full SMP kernel config, but with only one CPU available.

Fixes: #12478.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-08-29 16:33:27 +02:00
Ioannis Glaropoulos c18ff87c69 tests: kernel: interrupt: stop excluding ARM platforms
As we have re-worked the test code, and the test-case can run
on Cortex-M platforms on any available and implemented NVIC
IRQ lines, we do not need to exclude these ARM boards anymore.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-29 13:05:12 +02:00
Ioannis Glaropoulos e128f3c5d9 tests: kernel: interrupt: make test work with any available NVIC IRQ
This commit re-works the test for the ARM architecture,
so that it can work with any available NVIC IRQ, not
bound to use the last 2 NVIC lines. It makes use of
the dynamic IRQ feature.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-29 13:05:12 +02:00
Jukka Rissanen 7c2f063625 tests: kernel: Add unit test for sys_put|get_le64()
Make sure sys_put|get_le64() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen 753600fa71 tests: kernel: Add unit test for sys_put|get_le32()
Make sure sys_put|get_le32() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen 6b1e44a3ed tests: kernel: Add unit test for sys_put|get_le16()
Make sure sys_put|get_le16() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen a7a5e6912f tests: kernel: Add unit test for sys_put|get_be16()
Make sure sys_put|get_be16() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen 0587b7ecb5 tests: kernel: Add unit test for sys_put|get_be32()
Make sure sys_put|get_be32() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen 0dcc637e7d tests: kernel: Add unit test for sys_put_be64()
Make sure sys_put_be64() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Jukka Rissanen bbac6e5ca0 tests: kernel: Add unit test for sys_get_be64()
Make sure sys_get_be64() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-28 09:39:56 +02:00
Paul Sokolovsky 967fbb1656 tests: posix: fs: Add test for (no) leak of file descriptors
Repeatedly open/close a file number of time larger than underlying
descriptor tables.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-08-27 10:34:54 -04:00
Paul Sokolovsky 9de5e9954b tests: posix: test_fs_file: Cut down on noise output
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>
2019-08-27 10:34:54 -04:00
Wentong Wu 9d1da7866c tests: kernel: fix unhandled return values.
Fix unhandled return values as most other places handled in this
file, fix coverity issue 203507.

Fixes: #18445.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-08-27 10:01:38 -04:00
Wentong Wu de4dcb5731 tests: kernel: fix unhandled return values.
Fix unhandled return values as most other places handled in this
file, fix coverity issue 203454.

Fixes: #18443.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-08-27 10:01:38 -04:00
Joakim Andersson 3e9888105e Bluetooth: Host: Rename API function to initiate bluetooth security.
Rename bt_conn_security to bt_conn_set_security, this makes the API
naming more consistent.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Joakim Andersson 1c48757d94 Bluetooth: Host: Rename security level enum
Rename security level enum, using level and number instead of low,
medium, high and fips.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Ioannis Glaropoulos 571b42e74e tests: net: dns_addremove: increase main stack size
We need to increase the stack size of the main thread, to
avoid stack overflow, when executing the tests on various
platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-27 11:02:18 +02:00
Vincent Wan fdf0af3b5a tests: net: trickle: use separate semaphore for second trickle timer
A second semaphore is used for the second trickle timer, so that if the
first timer expires twice before the second one, the test would still
wait before proceeding to check on cb_2_called.

Fixes #18598.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-08-26 12:57:56 +02:00
Jan Van Winkel 029189cb68 tests: mqtt Corrected memcmp in mqtt pubsub tests
Corrected payload memcmp in function publish_handler of mqtt pusub
tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-08-26 11:29:53 +02:00
Ioannis Glaropoulos 3486709d2e tests: arm: zero latency irqs: fix the derivation of free NVIC line
The commit fixes the way we determine an available
NVIC IRQ line to perform the zero-latency IRQ test.
The test can now run properly on SOCs that do not
have a continous set of implemented NVIC IRQ lines.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-25 21:18:32 +02:00
Andrzej Puzdrowski 93702e2daf tests/subsys/settings/fcb_int: add storage preparation
The test assumes that storage is clear before it runs. This
might be not true as lot of devices are only partially erased by
'west flash'.

Patch introduce procedure for testing whether test runs the first
time and clear storage if so.

The procedure uses mark which is stored inside SoC embedded program
flash. It will not work one devices on which read/write to it is
impossible.

fixes #16463

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-24 00:58:41 +02:00
Peter Bigot 243ea2a1e1 tests/kernel/sleep: relax upper bound to support additional delays
Nordic platforms measure ticks in cycles of a 32 KiHz clock for which
the minimum compare delay is 2 ticks.  The test assumed an upper bound
of four ticks delay per loop iteration, resulting from alignment at
various layers.  This delay is met on Nordic for tick rates at or below
16384, but is too short for the default 32768 Hz tick rate.

Instrumentation confirms that the usleep test loop body on Nordic at 32
KiHz ticks takes 3 ticks as the optimum delay, only when a debug probe
is active.  In other circumstances it can take either 5 or 6 ticks,
depending on timer alignment and stability.

Relax the upper bound for platforms using this system timer at the
highest rate.

Closes #17965.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-23 14:43:31 +02:00
Andy Ross b5908fd89d tests/kernel/interrupt: Add a simple dynamic interrupt test
Platforms which use the GEN_SW_ISR mechanism for interrupt handling
can make use of a really simple whitebox trick for verifying that it
worked (i.e. that the pointer and argument get placed in the table
correctly).

Easy and simple way to get some coverage for dynamic IRQs, which is
currently entirely missing.  Long term we'll want to replace this with
a test that uses the API directly and chooses an arch-specific vector
to set, and triggers it using arch-specific code, but that's quite a
bit more effort and for now we need to land patches to
z_irq_connect_dynamic() which show test coverage.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-08-22 17:53:51 -04:00
Andrew Boie db48d3e22a sys_sem: add build time definition macros
We need a SYS_SEM_DEFINE() that works just like
K_SEM_DEFINE().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-08-22 07:38:56 -05:00
Luiz Augusto von Dentz 5f3595e47c Bluetooth: GATT: Fix using variable size storage for CCC
This removes the necessity of registering the storage for CCC and make
it part of the declaration itself.

Fixes #18547

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-22 15:14:39 +03:00
Andy Ross 8cdbd1cd0b tests/kernel/common: Fix dead code in sflist test
An inverted comparison typo led to the final loop in the sflist being
skipped.  Fix so that it actually runs.

(Odd that it took a static analysis tool to detect this, the loop
expressions are all constants, I'm surprised gcc didn't see it while
doing unrolling analysis).

Fixes #18437

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-08-22 07:07:31 -04:00
Andy Ross ca82230780 tests/kernel/fp_sharing: Fix static analysis warning
Can't use a volatile variable in something that the tool thinks is an
optional assert, because the read is treated as a side effect.

Fixes #18438
Fixes #18439

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-08-22 07:07:31 -04:00
Andy Ross 28fc46ee09 tests/kernel/sched/schedule_api: Fix static analysis volatile warning
We were testing the value of a volatile variable inside a zassert,
which static analysis doesn't like.  In principle, it might be
volatile because it's an MMIO register or something and the read is a
side effect, and an assertion will be optionally compiled.  (Except
here the value is just regular memory marked volatile for
threadsafety, and zassert will never be elided in a test, but the tool
doesn't know that).

Refactor a little so we always read the variable in a way the tool can
detect is consistent.

Fixes #18446

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-08-21 15:53:50 +02:00
Marc Herbert a3da6389df tests/ /gen_inc_file: convert 4,5,6,7 enumeration to an interval
It's shorter and may get rid of false Coverity positives 203489 and
203498 and fix #18424 and duplicate #18425.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-08-21 07:27:22 -05:00
Peter Bigot aded6a5334 tests: add C++ 17 standard library test
Confirms build (and run) of C++17 applications that make use of STL
containers and other features.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-20 12:51:16 -05:00
Andrzej Puzdrowski bf4c969b62 tests/subsys/settings/fcb: deletion test
Add test for check whether deleted entry is recognized properly
after settings reload.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-20 13:18:38 +02:00
Andrew Boie f31e492440 tests: fatal: increase robustness
We now verify, for every crash, that the expected thread
crashed with the expected reason.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-08-19 15:38:51 -05:00
Tomasz Bursztyka 7ea5ec8baf tests: net: Fix for coverity CID 203499
Adding an assertion on returned allocation.

Coverity-CID: 203499
Fixes #18454

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Luiz Augusto von Dentz 6c8eebe046 Bluetooth: GATT: Fix dereference after NULL check
This fixes the coverity problem which which in fact is a non-issue as
the code would assert before reaching that line which makes the NULL
pointer check useless so this removes it.

Fixes #18431

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-19 13:09:26 +02:00
Ioannis Glaropoulos 6815143fcb tests: arch: arm_thread_swap: fix ASSERT statements on volatile vars
Fix ASSERT expressions with volatile variables in
arch/arm/arm_thread_swap test suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos 0d0ca080b6 tests: arch: arm_thread_swap: correct type in memset function call
Fix a memset function call so the sizeof() argument is
evaluated using the appropriate struct type.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos 2f0525066d tests: arch: arm ramfunc: fix ASSERT expressions
Fix ASSERT expression with volatile test variables
in arch/arm/arm_ramfunc test suite. Fix, also, an
logical expression in an if-statement in the test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos 2fc5e4305d tests: arch: zero_latency_irqs: fix ASSERT expressions with volatile
Fix expressions with volatile variables in ASSERT
statements in arch/arm/arm_zero_latency_irq test
suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Peter Bigot 204c9971ab subsys/fs/littlefs: fix Coverity issues
Closes #18392 by asserting and returning an error if the block size is
not positive.

Closes #18458.  The diagnosis here was not relevant as an in-range EOS
is written before the buffer is used, but using the non-terminated
length is slightly more clear about intent and may avoid a read overrun
of the mount point.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-19 08:34:17 +02:00
Alexander Wachter b81d59d4f2 tests: drivers: can: Add test for TX callback
No test verifies a TX callback for successful transfers.
This commit adds a test for those callbacks.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-18 15:14:30 +02:00
Ioannis Glaropoulos 2cf4ce4774 tests: lib: sprintf: filter-out MCIMX7_M4 platform
Apparently the tests/lib/sprintf test requires more than 34kB
of code size, when building in MCIMX7_M4-based platforms. Such
platforms, however, only have 32kB of code memory, therefore,
we exclude them from this test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-16 17:35:04 +02:00
Kumar Gala deae969de3 tests: net: lib: dns: dns_addremove: Increase stack size for FRDM-K64F
CONFIG_MAIN_STACK_SIZE was originally 1344 in this test.  The following
commit removed setting the stack size in the test:

commit 7b3cd7d371
Author: Cami Carballo <cami.carballo@intel.com>
Date:   Fri Jul 26 10:59:16 2019 -0400

    tests: net: increase stack size

However getting the default stack size on FRDM-K64F of 512 causes the
following panic:

FATAL: ***** BUS FAULT *****
FATAL:   Stacking error
FATAL:   Imprecise data bus error
FATAL:   NXP MPU error, port 3
FATAL:     Mode: Supervisor, Data Address: 0x20002ff0
FATAL:     Type: Write, Master: 0, Regions: 0x8200
FATAL: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
FATAL:  xpsr:  0x200002f4
FATAL: Faulting instruction address (r15/pc): 0x00000000
FATAL: >>> ZEPHYR FATAL ERROR 2: Stack overflow
FATAL: Current thread: 0x2000182c (main)
FATAL: Halting system

Bump stack back to original 1344 fixes the issue.

Fixes #18292

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 09:20:45 +02:00
Carles Cufi ac442203bb tests: kernel: mutex: Require 32kB RAM when building with USERSPACE
The sys_mutex test doesn't seem to fit in 24kB of RAM anymore,
when building with user mode support (CONFIG_USERSPACE=y). We,
therefore, restrict it to platforms that have 32KB or more of
RAM. We also filter the test with ARCH_HAS_USERSPACE explicitly.

The alternative setup of the sys_mutex test, i.e. without user
mode support (CONFIG_TEST_USERSPACE=n) continues to build for
platforms with less than 32k of RAM.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 20:01:05 -05:00
Jukka Rissanen 7da78796de tests: net: udp: We need to reserve enough space for the data
We are trying to pass 64-bit value to the driver, but we only
allocate space for an integer. This will not work and will cause
invalid memory access.

Fixes #18205

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-14 09:15:34 +03:00
Maureen Helm 9346ded0af tests: pwm_api: Use smaller pwm period cycles on k64-based boards
The mcux pwm drivers use period cycles as a divisor to calculate the pwm
frequency in hertz. This operation can underflow easily with large
values of period cycles relative to the pwm clock source, causing the
driver to return an error code and the pwm_api test to fail.

Updates the test to use the smaller set of period and pulse cycles on
k64-based boards, fixing the test for frdm_k64f and hexiwear_k64 boards.

The test is not changed for i.mx rt boards because the pwm clock source
on these boards is much faster than on k64 boards, and thus the same pwm
frequency operation does not underflow.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-08-13 09:33:31 -05:00
Wayne Ren c78be56f0f tests: enable hsdk and nsim_hs_smp for smp test
ARC now supports SMP, enable the kernel/smp test
for arc platforms

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-08-11 21:18:38 +02:00
Vinayak Kariappa Chettimada e8b776a9b0 Bluetooth: mesh_shell: Disable controller filter
Disable controller filtering feature not used on mesh stack.
This reduces some RAM usage.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Wendy Liang 4ef9d4b6bf timer: Add Xilinx ZynqMP PS ttc timer
Add Xilinx PS ttc timer for Xilinx ZynqMP platform.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-08-09 22:50:50 +02:00
Wayne Ren 73df065616 tests: remove the exception for arc
the tested feature is supported now, remove the exception

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-08-09 20:11:58 +02:00
Joakim Andersson 513244afe2 Bluetooth: Shell: Add whitelist commands to shell
Add shell commands to add and remove devices from the shell.
Add commands and options to use whitelist for advertising, scanning,
and creating connections.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-09 16:26:10 +02:00
Nicolas Pitre 7f74825958 riscv: add a qemu_riscv64 board
This emulates a RISC-V in 64-bit mode on a SiFive FE310 dev board.
Memory is tight so a few tests had to be disabled due to the extra
memory usage compared to qemu_riscv32.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-09 09:11:45 -05:00
Cami Carballo 7b3cd7d371 tests: net: increase stack size
fixes issues with tests/net when code coverage is enabled in qemu_x86

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-08-08 13:50:32 -07:00
Jukka Rissanen ed10c9068e tests: net: sendmsg: Verify that connected UDP sock works
Add new tests that make sure that sendmsg() works when using
connected UDP socket and when not setting msghdr destination
address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-08 23:13:51 +03:00
Ioannis Glaropoulos 8dc83c1d94 tests: several tweaks for passing tests on qemu
This commit includes tweaks in several tests, so
that the tests can be passing on ARM QEMU targets,
mps2_an385 and mps2_an521 with Qemu 4.x release.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-08 21:56:45 +02:00
Andrzej Puzdrowski 27109e6378 tests/subsys/settings/fcb: add check for target compatibility
Added tests of flash driver compatibility with fcb-backend.

For flash drivers which support write-block-size bigger than 1 B
test of unaligned data access uses native write-block-size
as it is dedicated to check whether settings works well on platform
which has 1 B access which is native on the current DUT.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 08:47:44 -05:00
Paul Sokolovsky 16c1db9b8f tests: posix: No longer use target_include_directories
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>
2019-08-08 14:31:35 +02:00
Alexander Wachter 35f01673ac net: l2: 6LoCAN implementation
This commit is an implementation of 6LoCAN, a 6Lo adaption layer for
Controller Area Networks. 6LoCAN is not yet standardised.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Alexander Wachter c8c5f3bbf3 net: canbus: Rename canbus to canbus_raw
Rename the socket_can implementation from CANBUS to CANBUS_RAW.
This is a preperation for 6LoCAN which is a CANBUS L2 for IPv6.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Andrzej Puzdrowski f46cf1d6d2 tests/subsys/fs/nvs: entry delete test
Added test for check behavior on deleting existent entry,
nonexistent entry and already deleted entry.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 11:07:48 +02:00
Andrzej Puzdrowski 84d657c217 tests/subsys/fs/nvs: init on full storage test
Added test for check wheter initialization works well when nvs
storage is full filled. Test also check weheter can delet any
entry from full filled NVS.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 11:07:48 +02:00
Mariusz Skamra 5a7a520ea1 Bluetooth: GATT: Add BTP Discover All Primary Services command handler
This will handle BTP Discover All Primary Services command.

Related TC: GATT/CL/GAD/BV-01-C
Fixes: #17861
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-08-07 18:07:45 +02:00
Nicolas Pitre af1510d3bb tests: fatal: make sure the illegal insn occupies a full word
... and is properly aligned. This may make a difference on
64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-07 08:12:56 -05:00
Andrew Boie f2422f1f19 tests: clean up fatal error handlers
- k_sys_fatal_error_handler() can return on all platforms,
  indicating that the faulting thread should be aborted.
- Hang the system for unexpected faults instead of trying
  to keep going, we have no idea whether the system is even
  runnable.

Prevents infinite crash loops during tests.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-08-06 19:32:22 -07:00
Vaishali Pathak 0923ae4172 drivers: sensors: Add Si7006 temperature/humidity sensor driver
Adds driver for Silicon Labs Si7006 chip.

Signed-off-by: Vaishali Pathak <vaishali@electronut.in>
2019-08-06 15:05:25 -05:00
Peter A. Bigot 167eb53e74 subsys/fs/littlefs: allow customization of file system configuration
There's desire to be able to customize parameters on a per-filesystem
basis, which means we need a way to override the Kconfig defaults which
are global.  This also means the littlefs data structure cannot own the
cache and lookahead buffers.

Switch to using a macro to define the littlefs data structure.  The
default version uses the Kconfig constants.  A custom one takes
arguments providing the most likely partition-specific parameters.
Finally the user is free to bypass the helper macros and set any
parameters desired, though validation is limited and only present when
CONFIG_DEBUG is enabled.

Extend the test suite with a performance module, which confirms that
these settings have an impact proportional to the log of changes to the
cache or IO sizes.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Peter A. Bigot a8b7a21524 subsys/fs: remove ambiguity in readdir results
Existing file system implementations do not provide the special "."
(current) and ".." (parent) directory entries in the readdir results.
littlefs does.

Remove these entries in the abstraction layer.  This simplifies code in
higher level consumers that aren't prepared to see them.  Consumers like
FUSE that need them can put them back without having to worry about
conflicts.

Closes issue #17951

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Peter A. Bigot 979fb85d50 tests/subsys/fs/littlefs: add tests
Verify all FS API calls using the nRF52840 development kit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Yasushi SHOJI 1fe8269399 test: kernel: sched: Add a test for nested scheduler lock
Add a new test for unlocking nested scheduler lock.  Make sure that
k_sched_unlock() isn't unconditionally a preemption point.

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
2019-08-06 10:19:50 +02:00
Yaël Boutreux 57a166aced boards: arm: stm32mp157c_dk2: Add SPI support
Add SPI support for stm32mp157c_dk2 board. If SPI is selected, SPI4
(Arduino connector compatible SPI) and SPI5 (on front 2x20 GPIO
expander) will be enable by default on stm32mp157c_dk2 board.

Signed-off-by: Yaël Boutreux <yael.boutreux@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
2019-08-05 13:52:34 -05:00
Jukka Rissanen fc79a789c7 tests: net: context: Let the net_context cb to run first
An issue was seen after changes introduced in #17933.
The net_context callback was run after we checked that it
was run ok. This test failed of course in that case. Simple
solution is to k_yield() which will make sure that the
callback gets called before we continue. This works for this
test as our threads have suitably selected priorities.
There is also no need to use K_NO_WAIT here so replacing the
timeout with K_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-05 16:25:18 +03:00
Andrew Boie 8014e075f4 x86: use per-thread page tables
Previously, context switching on x86 with memory protection
enabled involved walking the page tables, de-configuring all
the partitions in the outgoing thread's memory domain, and
then configuring all the partitions in the incoming thread's
domain, on a global set of page tables.

We now have a much faster design. Each thread has reserved in
its stack object a number of pages to store page directories
and page tables pertaining to the system RAM area. Each
thread also has a toplevel PDPT which is configured to use
the per-thread tables for system RAM, and the global tables
for the rest of the address space.

The result of this is on context switch, at most we just have
to update the CR3 register to the incoming thread's PDPT.

The x86_mmu_api test was making too many assumptions and has
been adjusted to work with the new design.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-08-05 13:25:50 +02:00
Joakim Andersson c1a754f665 Bluetooth: Host: Print error codes in hex
Error codes are listed in header files and in the core spec as hex
values. Always print them in hex in debug for easier error code
checking.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-05 12:18:17 +02:00
Nicolas Pitre 1f4b5ddd0f riscv32: rename to riscv
With the upcoming riscv64 support, it is best to use "riscv" as the
subdirectory name and common symbols as riscv32 and riscv64 support
code is almost identical. Then later decide whether 32-bit or 64-bit
compilation is wanted.

Redirects for the web documentation are also included.

Then zephyrbot complained about this:

"
New files added that are not covered in CODEOWNERS:

dts/riscv/microsemi-miv.dtsi
dts/riscv/riscv32-fe310.dtsi

Please add one or more entries in the CODEOWNERS file to cover
those files
"

So I assigned them to those who created them. Feel free to readjust
as necessary.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-02 13:54:48 -07:00
Nicolas Pitre 7deca2e0b4 tests/cmsis_rtos_v2: exclude m2gl025_miv due to tick rate conflict
Commit ee4c23cc1f ("CMSIS v2: Work around time unit confusion")
enforced CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 on this test, but the
m2gl025_miv platform has some issues with it. Let's exclude it for now.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-02 12:47:41 +02:00
Nicolas Pitre 40aa42eef4 tests/cmsis_rtos_v1: relax timing check a bit
Commit  33c64c2578 ("tests/cmsis_rtos_v1: Correct timing assumptions")
introduced a stricter criteria where time spent has to match the clock
within 1% discrepancy. It is zassert_true(diff < max && diff > min)
meaning _less than_ 1%.

The test uses a 1-second delay. When SYS_CLOCK_TICKS_PER_SEC=100 that
means a single tick discrepancy would overflow the test.

Let's be inclusive and allow up to 1% instead. That allows for this
test to pass on m2gl025_miv when using 100 ticks per sec.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-02 12:47:41 +02:00
Wayne Ren 8b04c7de13 arch: arc: optimize the float support
* enable float support
* implement z_arch_float_disable
* add arc support in fp_sharing test

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-08-01 18:09:35 -07:00
Peter A. Bigot 8420f43b86 libc: minimal: add strspn and strcspn support
These functions are useful for determining prefixes, as with file system
paths.  They are required by littlefs.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-31 09:22:49 -07:00
Armando Visconti 9e5c97edae driver/sensor: add STTS751 temperature sensor
Add support to STM STTS751 temperature sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-31 10:32:10 -04:00
Rick Conrey aed522da76 tests: nucleo_wb55rg: add adc test
Add nucleo_wb55rg to ADC test

Signed-off-by: Rick Conrey <rick.conrey@witiproducts.com>
2019-07-31 05:38:25 -04:00
Peter A. Bigot b8af1a6a4e libc/minimal: fix reproducibility of gmtime
struct tm has fields that were not being set by the implementation,
causing the test to fail when the uninitialized values were compared
with a static initialized result.  Zero the structure before filling it.

Closes #17794

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-31 11:48:18 +03:00
Kumar Gala 4e7863dc41 dts: Make instance defines consistent
We generated a define for each instance to convey its existance of the
form:
	#define DT_<COMPAT>_<INSTANCE> 1

However we renamed all other instance defines to be of the form
DT_INST_<INSTANCE>_<FOO>.  To make things consistent we now generate a
define of the form:

	#define DT_INST_<INSTANCE>_<COMPAT> 1

We also now deprecate the DT_<COMPAT>_<INSTANCE> form and fixup all uses
to use the new form.

Fixes: #17650

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-30 17:10:31 -05:00
Cami Carballo 2e6504b6bc tests: base64: add tests for error paths
line coverage was only at 72.7% due to untested error paths

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-07-30 10:14:41 -07:00
Ioannis Glaropoulos 1b97691713 tests: kernel: userspace: fix test skipping for ARC
This commit is a hotfix. It makes sanitycheck happy by fixing
the way we can temporarily exclude some tests in the userspace
test suite for the ARC architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-30 10:12:47 -07:00
Mieszko Mierunski 4d658ca440 tests: drivers: Fix coverity issue 198873
Fix coverity issue 198873

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-07-30 13:47:37 +03:00
Anas Nashif 578ae40761 boards: remove quarl_se_c1000
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Anas Nashif ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Anas Nashif a597c86c30 boards: remove galileo board
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Andrew Boie 55fce980d7 tests: z_except_reason() policy from usermode
User mode should be able to successfully induce a kernel
oops, or stack check fail fatal error. The latter is
required by compiler stack canaries.

User mode should not be able to induce a kernel panic, or
fake some other kind of exception.

Currently supported on ARM and x86 platforms.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-29 11:08:49 -07:00
Carles Cufi 34ffda3d23 tests: mesh_shell: Optimize prj.conf to fit in nrf51
Disable various LL features to be able to fit in RAM for the
nrf51_pca10028.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-07-29 19:08:05 +02:00
Alexander Wachter 7dbbd8ad02 tests: boards: board_shell: Activate CAN shell
Activate the CAN shell for build testing.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-29 10:27:54 +03:00
Jukka Rissanen d09248219d tests: net: ppp: Add unit tests for PPP driver
Make sure that we are able to parse incoming PPP data
correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Andrew Boie 504dffa38c tests: uart_basic_api: fix configuration
These additional configs should have been put in prj.conf
and not here. Makes the tests simpler to build correctly
outside of sanitycheck.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-27 18:05:43 +03:00
Andrew Boie 96571a8c40 kernel: rename NANO_ESF
This is now called z_arch_esf_t, conforming to our naming
convention.

This needs to remain a typedef due to how our offset generation
header mechanism works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-25 15:06:58 -07:00
Andrew Boie fe8d75acbf arm: fix exception reason code for bad syscall
ARM was reporting as a CPU exception and not a kernel
oops.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-25 15:06:58 -07:00
Andrew Boie 71ce8ceb18 kernel: consolidate error handling code
* z_NanoFatalErrorHandler() is now moved to common kernel code
  and renamed z_fatal_error(). Arches dump arch-specific info
  before calling.
* z_SysFatalErrorHandler() is now moved to common kernel code
  and renamed k_sys_fatal_error_handler(). It is now much simpler;
  the default policy is simply to lock interrupts and halt the system.
  If an implementation of this function returns, then the currently
  running thread is aborted.
* New arch-specific APIs introduced:
  - z_arch_system_halt() simply powers off or halts the system.
* We now have a standard set of fatal exception reason codes,
  namespaced under K_ERR_*
* CONFIG_SIMPLE_FATAL_ERROR_HANDLER deleted
* LOG_PANIC() calls moved to k_sys_fatal_error_handler()

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-25 15:06:58 -07:00
Paul Sokolovsky b7bb48eeac posix: unistd.h: open() doesn't belong here
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>
2019-07-25 13:50:58 -04:00
Rick Conrey b87ba9c95f tests: spi: enable SPI on STM32WB
configure SPI loopback test to work with nucleo_wb55rg

Signed-off-by: Rick Conrey <rick.conrey@witiproducts.com>
2019-07-25 10:49:58 -04:00
Alexander Wachter 62ded2ded4 tests: net: 6Lo: Add test criterion HDR diff
This commit adds a test criterion that checks how many bytes
are compressed.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter 0f8c2acece tests: net: 6lo: Adapt tests to deal with headers in multiple frames
The testcases are adapted to handle more than one net buffer in
a net_pkt. After the IPHC optimization it is possible that IP header
is not in the same buffer than the UDP header.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Wentong Wu d4e580c6c9 tests: add test cases for sys_sem
add test cases for sys_sem data structure.

Fixes: #15139.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-07-24 10:12:25 -07:00
Peter A. Bigot c59bac35db tests/subsys/settings/functional: test external flash
Use the external flash on the Particle Xenon to confirm basic
functionality on a spi-nor device.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 33b10aa76a tests/subsys/settings/functional: ensure settings area is cleared
The test assumes that the settings area is empty.  This happens
naturally when the area is in the SOC flash and the chip flash is
entirely erased when the test is programmed.  The test will fail if the
programmed board is reset and the test run again.

The test cannot pass by reprogramming when the storage area is in an
external flash device.

Make things repeatable for FCB by erasing the storage partition before
running the test.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Piotr Zięcik 5f6cae38db tests: benchmarks: Do not use CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
On some SoCs the frequency of the system clock is obtained at run time
as the exact configuration of the hardware is not known at compile time.
On such platforms using CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC define
directly introduces timing errors.

This commit replaces CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC by the call
to inline function sys_clock_hw_cycles_per_sec() which always returns
correct frequency of the system clock.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Jukka Rissanen c470fff3c9 tests: net: txtime: Add tests for SO_TXTIME and SCM_TXTIME
Make sure that SO_TXTIME socket option can be set and get.
Verify also that TX time is passed properly to network device
driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen 4a8154f6c1 tests: net: udp: Add tests for sendmsg() call
Make sure we are able to pass ancillary data using the
sendmsg() API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Piotr Zięcik 285bfa7f62 tests: work_queue_api: Fix k_delayed_work_remaining_get() test
Existing test checking value returned by k_delayed_work_remaining_get()
verified two cases:

1) The k_delayed_work_remaining_get() should return 0 for non-submitted
   work.

2) The k_delayed_work_remaining_get() should return value greater or
   equal to the timeout value of just submitted work.

Unfortunately, the second check is not correct. The value returned
by the k_delayed_work_remaining_get() just after submitting delayed
work should be:

- Equal to timeout of the submitted work if no timer interrupt was
  executed between submitting work and checking remaining time.

  OR

- Less than timeout of the submitted work if a timer interrupt was
  executed between submitting work and checking remaining time.

This commit changes the test accordingly taking under account the
error caused by back and forth conversion between ms and ticks.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-23 13:54:39 +02:00
Wolfgang Puffitsch f62fe1551a tests: Bluetooth: Add test case for settings in the controller.
Test case to set and change Company Id and Subversion Number.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-23 10:58:03 +02:00
Cami Carballo f1afb4c24d tests: fdtable: add tests
added tests for lib/os/fdtable.c

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-07-22 16:36:15 -07:00
Vinayak Kariappa Chettimada fb8166ad26 Bluetooth: mesh: Use legacy LL for microbit build
Use legacy LL until RAM utilization is optimized in the new
LL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Vinayak Kariappa Chettimada f4eb03c538 Bluetooth: controller: Rename BT_LL_SW to BT_LL_SW_LEGACY
Rename the controller Kconfig option BT_LL_SW to
BT_LL_SW_LEGACY in preparation towards switch to new Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Mariusz Skamra 8b27af58eb Bluetooth: tester: Change RPA timeout
This changes RPA timeout so that the address is changed every 60
seconds. This change is needed to speed up privacy related test cases.
Currently, the new RPA was initiated on request that was a bit hackish
and could be done via BT_RPA_TIMEOUT Kconfig option.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 16:28:13 +03:00
Ioannis Glaropoulos 6c4fdc61ef tests: kernel: fp_sharing: increase robustness of float_disable test
This commit make the float_disable test suite more robust
for fast CPUs, by replacing k_sleep(1) with k_yield(), as
the mechanism to trigger thread swap-out during the test
execution. In the wake of using k_yield(), the test, now,
fixes the priorities of all testing threads to 0, making
the test behavior more deterministic with respect to
thread scheduling. The patch doesn't change the functional
behavior of the test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-19 12:11:38 +02:00
Mariusz Skamra 1074efd3cd Bluetooth: tester: Update to recent conn param related changes in BTP
This updates tester application to recent changes in BTP related
to Connection Parameters Update.
Connected event has been extended with connection parameters.
Connection Parameters Update command and event have beend added to
initiate and track current connection parameters.
Needed to automate qualification test GAP/CONN/CPUP/BV-06-C

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 11:24:11 +02:00
Mariusz Skamra d4f1a5aba6 Bluetooth: tester: Enable GAP writable device name
This enables support for GAP writable device name in tester application
for testing purposes.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:36:30 +02:00
Mariusz Skamra 35dcab988e Bluetooth: tester: Enable Mesh Friend support
Enable Mesh Friend support in tester application.

Fixes: #17600
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:35:40 +02:00
Andrzej Puzdrowski 428c281bc6 drivers/flash/flash_simulator: fix flash size calculation
Flash size calculation was don with assumption that flash page size
is always 1 KB and flash size was parameterized with such granularity.

This patch correct this bug.

Flash pages number under statistic can't be calculated via preprocessor
anymore - thus are parameterized via Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Andrzej Puzdrowski 891ccdc182 drivers/flash/flash_simulator: switch to use DT_FLASH_SIM labels
It Need to start using DT_FLASH_SIM_xxx labels after sim_flash was
un-chosen as zephyr,flash.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Andrew Boie 15b1196e58 tests: force stack canaries off for two user tests
Stack canaries require that the z_libc_partition be added to
the memory domain, otherwise user thread access to the
stack canary value will result in an MPU/MMU fault.

These tests define their own domains to test specific userspace
features. Adding another partition to them would be invasive,
would potentially break some platforms with a limited number
of MPU regions, and these tests are not designed to validate
stack canaries anyway, we have other tests for that.

Fixes: #17595

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-17 09:32:07 -07:00
Peter A. Bigot 7251d8c380 tests/lib/timeutil: add tests for time conversions
This verifies gmtime and timeutil_timegm against each other and
reference data for a wide range of instances.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-17 14:04:44 +02:00
Wolfgang Puffitsch 845064bb31 Bluetooth: controller: hci: Add user hooks.
Add hooks for processing of HCI user events on the controller side.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-17 13:53:13 +02:00
Peter A. Bigot 765c06376c Revert "sys/util.h: helper macro to perform pointer difference"
This reverts commit 755cc644cc.

This approach is problematic in several ways.  First, `intptr_t` could
cause undefined behavior in the subtraction when the pointer converts to
a negative value.  Except in weird cases where the sign of the pointer
identifies a memory domain (like kernel vs userspace) I'm unaware of any
valid use of `intptr_t`.

Second, this macro was created to address a special need that cannot
rely on defined behavior: i.e. to ensure that data definitions are
placed in contiguous space and access is provided through linker-defined
symbols, for which the language required alignment and continuity is not
guaranteed.

A macro that calculates the span between linker symbols has very
different semantics than one that calculates the difference between
pointers.  Replace the global PTR_DIFF with a documented local macro
that tests what's necessary without risking integer overflow.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-17 03:44:03 -04:00
Nicolas Pitre 6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Joakim Andersson 7a93e948a9 kernel: lib: Add convert functions for hex strings and binary arrays
Move duplicate hex2bin and add bin2hex function so that application can
use the functions and avoid code duplication.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-16 12:44:18 +02:00
Marc Herbert c429051380 tests/net/: samples/net/: add a few 'userspace' tags
See commit message 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-15 09:05:10 -04:00
Nicolas Pitre 3c0cc08657 prf.c: handle denormals properly
Denormals need to be normalized to be displayed properly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre 53169743d2 prf.c: properly format INF/NAN/zero with prefix
The space or plus prefix must appear when requested even with INF and
NAN. And no zero-padding in that case.

Also, 0.0 and -0.0  are distinct values. It is necessary to display
the minus sign with a negative zero.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre 90ec5360be prf.c: fix wrong results with %g conversion
The precision parameter to the %g conversion indicates the maximum
number of significant digits and not the number of digits to appear
after the radix character. Here's a few examples this patch fixes:

                                expected        before
----------------------------------------------------------
printf("%.3g", 150.12)          150             150.12
printf("%.2g", 150.1)           1.5e+02         150.1
printf("%#.3g", 150.)           150.            150.000
printf("%#.2g", 15e-5)          0.00015         0.00
printf("%#.4g", 1505e-7)        0.0001505       0.0002
printf("%#.4g", 1505e-8)        1.505e-05       1.5050e-05

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre f286eda6f0 prf.c: remove arbitrary large stack buffer usage
The on-stack work buffer occupies 201 bytes by default. Now that we've
made the code able to cope with virtually unlimited width and precision
values, we can reduce stack usage to its strict minimum i.e. 25 bytes.

This allows for some additional sprintf tests exercizing wide results.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre 33312cfd98 prf.c: remove buffer limitation on field width and string copy
The z_prf() function currently allocates a 200-byte buffer on the
stack to copy strings into, and then perform left/right alignment
and padding. Not only this is a pretty large chunk of stack usage,
but this imposes limitations on field width and string length. Also
the string is copied not only once but _thrice_ making this code
less than optimal.

Let's rework the code to get rid of both the field width limit and
string length limit, as well as the two extra memory copy instances.

While at it, let's fixes printf("%08s", "abcd") which used to
produce "0000abcd".

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Henrik Brix Andersen 4a50e1f8b3 tests: board_shell: enable ADC shell
Enable the ADC shell in the board_shell test.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2019-07-14 05:06:38 -07:00
Ioannis Glaropoulos 524300a98b tests: arch: arm_thread_swap: add README file
The commit adds a README file with a description of the test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-14 04:53:14 -07:00
Ioannis Glaropoulos 0f7e485e76 tests: arch: arm: enhance swap test for FP sharing
We add a test-case for arch/arm/thread_swap, so the
test is executed with CONFIG_FLOAT/CONFIG_FP_SHARING
being enabled, if an FPU is available. We execute the
test extension with/without enabling compiler optimizations.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-14 04:53:14 -07:00
Ioannis Glaropoulos a87f25e12e tests: arch: arm: contribute a test for arm swap
This commit contributes a test for the ARM swap, i.e. the
context-switch mechanism for the ARM architecture. The test
verifies that the thread state variables are set and checked
properly when performing a thread swap-out and swap-in.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-14 04:53:14 -07:00
Nicolas Pitre 9fac66ca54 tests: usb: make 64-bit compatible
Let's use the PTR_DIFF() helper which performs pointer difference in a
64-bit compatible way, and use %zu for printing sizeof() results.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-12 17:39:43 -07:00
Anas Nashif 2338fcf9da tests: pinmux: remove whitelisting
Remove whitelisting and enable broader testing on all boards with needed
features.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif e7b615e436 tests: i2c: remove whitelisting
Remove whitelisting and make the test more generic. This test was only
building on 1 board basically, now with the new filters it builds on 24.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif 5c485208bf tests: gpio: remove whitelisting
Remove whitelisting and enable broader testing on all boards with needed
features.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif 5f24b419bb tests: pwm_api: remove whitelisting
Remove whitelisting and enable broader testing on all boards with needed
features.
Add pwm to board yaml where it applies.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif ba31f4fc35 tests: bluetooth: shell: remove whitelisting on arduino_101
Not a primary bluetooth testing platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif 04503127b3 tests: build_all: remove whitelisting on arduino_101
Whitelisting was not needed, we can build this for other boards.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Nicolas Pitre 0aa796cbaa print format: adjust specifiers to be compatible with a 64-bit build
The size_t type is either compatible with an int on 32-bit target, or
a long on 64-bit targets. It could even be a long even on some 32-bit
targets. Let's use the z qualifier in the printf format to be compatible
with whatever flavor in use.

In case of pointers, let's just use %p with pointers directly and
avoid casts altogether.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-11 20:12:26 -07:00
Ioannis Glaropoulos 3b28297003 tests: kernel: critical: alternative test-case for SAM SoCs with WDT
In SAM SoCs Watchdog is selected by default and runs
with some default configuration, unless the build sets
CONFIG_WDT_DISABLE_AT_BOOT. As the tests/kernel/critical
takes relatively large amount of time to complete, the
watchdog (that is never fed in the test) will eventually
trigger a reset. As a result the test keeps restarting
continuously and never completes. We want to run the
test on SAM SoCs, so we do the following:
- filter our the SAM SoCs with the SAM WDT from the
  default build
- introduce an alternative test-case for these SoCs
  with the additional CONFIG_WDT_DISABLE_AT_BOOT
  option set.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-11 11:26:01 -05:00
Peter A. Bigot 388460ac14 drivers: eth_enc28j60: update for dts change to local-mac-address
uint8_array values are now generated as structure initializers.  Update
the code accordingly.  The implementation assumes that existing
devicetree source does not provide the correct OUI so preserves the
in-driver override of the value provided by devicetree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-11 06:50:27 -04:00
Joakim Andersson 029a66a195 Bluetooth: services: Move Heart rate service
This commit moves the BLE GATT heart rate service from
samples/bluetooth/gatt to subsys/bluetooth/services and adds a Kconfig
entry to enable and configure the service.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-11 13:21:14 +03:00
Emanuele Di Santo 30d65809fc Bluetooth: services: battery service enhancements
This commit moves the BLE GATT Battery service
from /samples/bluetooth/gatt to /subsys/bluetooth/services and
adds a Kconfig entry to enable and configure the service;
when enabled, it will register itself automatically.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-11 13:21:14 +03:00
Nicolas Pitre d7e49ee3e7 tests: subsys: settings: fix pointer mismatch on 64-bit targets
This fixes the following error:
passing argument 5 of ‘fsutil_read_file’ from incompatible pointer type

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-11 09:40:20 +02:00
Ioannis Glaropoulos 4476ae00d2 tests: kernel: fp_sharing: add test for k_float_disable
This commit contributes the basic testing for
k_float_disable() API, for ARM and x86 ARCHes.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-10 13:44:02 -07:00
Ioannis Glaropoulos 3d3a8c554f tests: kernel: fp_sharing: move fp_sharing test
Make fp_sharing a 'parent' test suite directory, and
rename the original fp_sharing test into
tests/kernel/fp_sharing/generic. In this
way more FP-related tests can be grouped
together in the same test directory.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-10 13:44:02 -07:00
Jukka Rissanen 600c1d6fa7 tests: net: trickle: Adjust config options to avoid error prints
Noticed this error print when running in mps2_an385 platform.

   <err> net_if: There is no network interface to work with!

Adding CONFIG_NET_LOOPBACK=y removes this error. After this
the CONFIG_NET_IPV6_MLD=n needed to be added in order to avoid
crashes when IPv6 MLD is done which is not needed for this test.

Removed also the whitelisting as that is not really needed and
we want to run these in as many platforms as possible.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-10 18:55:37 +03:00
Krzysztof Chruscinski a37fce6171 drivers: counter: Add optional flags to alarm configuration structure
Flags in alarm configuration structure will allow further extention
without breaking API. Initially, existing absolute flag was added
as the only flag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-07-10 07:42:12 -05:00
Kamil Piszczek 2222d14549 tests: settings: adding nvs backend configuration to functional tests
Added the NVS backend configuration to functional tests of the Settings
module.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-07-10 10:57:22 +02:00
Jukka Rissanen 3da2985b28 tests: clib: Make sure ssize_t type is signed
Add a test that verifies that ssize_t type is signed which is
expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-09 21:55:05 +03:00
Ioannis Glaropoulos 3717c6b3dc tests: arch: x86: move static_idx under tests/arch/x86
Move the x86-specific static_idx test under
tests/arch/x86 subdirectory.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-09 09:53:44 -07:00
Ioannis Glaropoulos 14797354c4 tests: kernel: move arm-specific kernel tests under tests/arch/arm
This commit moves the arm-specific tests in 'tests/arch/arm'
subdirectory.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-09 09:53:44 -07:00
Jamie McCrae 3e734ddbce tests: net: lib: dns: dns_addremove
Adds test code for new net_mgmt events relating to adding and
removing DNS servers

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2019-07-09 17:04:55 +03:00
Jukka Rissanen 0d8b0c6714 tests: net: dhcpv4: Make sure we get DNS add/del events
Verify that DNS server add/del event is received properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-09 17:04:55 +03:00
Andrew Boie eb07943b2d tests: crc: convert to regular test case
The special 'unittest' target has largely been supersesed by
native_posix, and converting this to a regular test will allow
us to see code coverage for the CRC functions in our coverage
reports.

Fixes: #16943

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-06 00:31:04 +02:00
Nicolas Pitre 6455ddbd4e test/usb: fix pointer type mismatch
The 4th argument of usb_dc_ep_write() should be a u32_t* not a size_t*.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-05 14:16:50 -04:00
Nicolas Pitre d19a5f9119 net: socket: mgmt: use uintptr_t for the nm_pid field
This may contain a pointer so make sure it is sufficiently wide
on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-05 10:06:23 -04:00
Johann Fischer ab8bcd2044 tests: usb: do not set device address
Forced attempt to set the device address is unpredictable
and also should not be done during testing.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-07-04 21:36:07 +02:00
Jukka Rissanen ac56fd8d27 tests: net: Increase stack sizes for coverage testing
We need to increase the stack sizes if user enables CONFIG_COVERAGE
option. You can test this by this command

    sanitycheck --coverage -p qemu_x86 -T tests/net/udp \
                -T tests/net/mgmt  -T tests/net/mld

This is partial fix for issues described in #17323

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 09:42:44 -07:00
Anas Nashif 528a2de290 tests: schedule_api: minor cleanup
rename test function and move #if to the start of the line.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-04 10:04:27 -04:00
Andrew Boie ab9a1c9f61 tests: ipm: remove superfluous configs
These weren't needed, and in some cases counter-
productive.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-04 07:25:44 -04:00
Nicolas Pitre 70e77becb1 shell_history_test: make the test succeed on 64-bit targets
A buffer size of 128 bytes is just not quite big enough on 64-bit
targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-04 07:24:56 -04:00
Jukka Rissanen 06136e5670 tests: net: socket: register: Do not close invalid fd
If the socket descriptor is invalid (fd < 0), there is no
need to try to close it.

Coverity-CID: 198949
Fixes #16785

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 07:23:50 -04:00
Nicolas Pitre 922c7ec546 test/msgq: adjust overflow test for 64-bit targets
This is testing size_mul_overflow() in z_impl_k_msgq_alloc_init() so
make sure OVERFLOW_SIZE_MSG is large enough even on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-04 07:22:43 -04:00
Marc Herbert 5acb622171 tests/net/ptp/clock: add 'userspace' tag
... because this test does use userspace, as seen in the source or
demonstrated by the failure of this command:

  sanitycheck --extra-args=CONFIG_TEST_USERSPACE=n

See commit message of 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-04 11:44:11 +03:00
Nicolas Pitre 2dc6eea143 test/bluetooth: sizeof() is not strlen()
sizeof(value) returns the size of the pointer, not the pointed string.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
tests/bluetooth/gatt/src/main.c
2019-07-04 10:25:41 +03:00
Charles E. Youse b4316fef48 arch/x86: eliminate arch/x86/include/asm_inline.h
Over time, this has been reduced to a few functions dealing solely
with floating-point support, referenced only from core/ia32/float.c.
Thus they are moved into that file and the header is eliminated.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-07-03 20:01:17 -04:00
Charles E. Youse 7c2d7d7b69 arch/x86: move arch/x86/include/mmustructs.h to ia32/mmustructs.h
For now, only the 32-bit subarchitecture supports memory protection.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-07-03 20:01:17 -04:00
Nicolas Pitre 39cd2ebef7 malloc: make sure returned memory is properly aligned
The accounting data stored at the beginning of a memory block used by
malloc must push the returned memory address to a word boundary. This
is already the case on 32-bit systems, but not on 64-bit systems where
e.g. struct k_mem_block_id still has a size of 4.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-03 14:17:29 -07:00
Armando Visconti 72ae24d8d5 driver/sensor: lsm6dso: Add support
Add support to STM LSM6DSO 6-axis IMU sensor driver.
This driver supports communication with device though both
I2C and SPI bus and both polling and drdy trigger mode.

This driver supports also the sensorhub mode with the possibility
to connect a maximum of two external devices, typically a
magnetometer and an environmental sensor, currently selected among
following devices: lis2mdl magnetometer, lps22hh or lps22hb
pressure and temperature sensors, HTS221 humidity sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-03 12:17:43 -05:00
Armando Visconti 9dbdd81abe driver/sensor: add LPS22HH sensor support
Add support to STM LPS22HH pressure and temperature sensor.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-07-03 11:59:17 -05:00
Andrew Boie 3c8fa37a10 tests: fp_sharing: properly dump coverage data
This was dumping coverage before the test code even ran.
Ideally, this gets re-written to use ztest, but meanwhile
place a dummy main thread which sleeps forever, and dump
coverage once the test succeeds.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-03 07:19:49 -07:00
Jukka Rissanen 4bb57c481e tests: net: tx_timestmp: Fix the tests
Fix tests because of changes in TX timestamping options.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-03 09:42:45 +03:00
Andrew Boie 65e658b578 tests: fatal: test failed assertion
Covers assert_post_action() which was previously uncovered.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-02 22:57:14 -04:00
Andrew Boie 4dd0b7c9a3 tests: json: improve code coverage
Adds coverage for the uncovered json_calc_encoded_len()
and covers a bunch more error cases.

This gets us up to 90.1% line coverage and 100% function
coverage.

Fixes: #16944
Partial fix for: #16011

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-02 22:56:53 -04:00
Andy Ross ee4c23cc1f CMSIS v2: Work around time unit confusion
The current CMSIS v2 implementation is clearly assuming that timeout
arguments being passed to e.g. osDelay() are in units of Zephyr ticks,
not milliseconds as specified by ARM or (inconsistently) assumed by
our test code.

Most tests work with the ~100 Hz default tick rate, but they tend to
fail on precision issues at higher tick rates.  Force the CMSIS v2
applications to be 1000 Hz for now as a workaround, and detect the
mismatch as a build failure.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross 33c64c2578 tests/cmsis_rtos_v1: Correct timing assumptions
This test was written to assume that k_busy_wait() and CMSIS
osKernelSysTick() (which is just k_cycle_get_32()) were perfectly
synchronized.  On nRF, they aren't (one is the 32 kHz RTC timer, the
other is a calibrated spin loop using the CPU frequency).

When ticks were being reported at 100 Hz granularity, there wasn't
enough precision to detect the mismatch.  Now there is.  Rework the
test to require that the clocks match to within 1%.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross ffb9e0977d tests/posix/common: Adjust miscalibrated timing test
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>
2019-07-02 22:52:29 -04:00
Andy Ross 03164a7802 tests/kernel/workq/work_queue: Fix for fast/non-standard tick rates
This test was written to properly align its millisecond-measured wait
time and assumed that there would be no other overhead.  In fact on
fast tick rate systems (or even ones where the alignment computation
doesn't provide the needed padding as "slop") that's not quite enough
time to complete the full test.  There are cycles between the sleep
calls that need to be accounted for, and aren't.

Just give it one extra work item of time before failing.  We aren't
testing work queue timing precision here, just evaluation semantics.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross 5238f5b97e tests/kernel/early_sleep: Fix for fast ticks
"50" ticks is fine with 100 Hz timer precision but way too short to
survive the conversion to milliseconds on fast, non-decimal tick
rates.  Make it half a second, which was the original intent.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross fc392a2c75 tests/kernel/tickless/tickless_concept: Force 100 Hz ticks
This test was written to assume ~100 Hz ticks in ways that are
difficult to fix.  It wants to sleep for periods on the order of the
TICKLESS_IDLE_THRESH kconfig, which is extremely small on high tick
rate systems and (on nRF in particular) does not have a cleanly
divisible representation in milliseconds.

Fixing precision issues by cranking the idle threshold up on a
per-system basis seems like an abuse, as that is what we want to be
testing in the first place.  Just let the test run at the tick rate it
has always expected.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross b1280108a2 tests/kernel/sleep: Fix usleep test for fast ticks
The logic about minimal sleep sizes due to "tick" aliasing was
correct, but drivers also have similar behavior with "cycle" aliasing
too.  When cycles are 3-4 orders of magnitude faster than ticks, it's
undetectable noise.  But now on nRF they're exactly the same and we
need to correct for that, essentially doubling the number of ticks a
usleep() might wait for.

The logic here was simply too strict, basically.  Fast tick rates
can't guarantee what the test promised.

Note that this relaxes the test bounds on the other side of the
equation too: it's no longer an error to usleep() for only one tick
(i.e. an improved sleep/timeout implementation no longer gets detected
as a test failure).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross f4803bf117 tests/kernel/context: Fix sleep test for fast ticks
The sleep test was checking that the sleep took no longer than "2
ticks" longer than requested.  But "2 ticks" for fast tick rate
configurations can be "zero ms", and for aliasing reasons it's always
possible to delay for 1 unit more than requested (becuase you can
cross a millisecond/tick/whatever boundary in your own code on either
side of the sleep).  So that "slop" value needs to be no less than
1ms.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross 8bd8663bb3 tests/kernel/common: Fix uptime delta test for fast ticks
The test for the k_uptime_delta utilities was calling it in a loop and
waiting for the uptime to advance.  But the code was specifically
wanting it to advance 5ms or more at one go, which clearly isn't going
to work for a tick rate above 200 Hz.

The weird thing is that the test knew this and even commented about
the limitation.  Which seems silly: it's perfectly fine for the clock
to advance just a single millisecond.  That's correct behavior too.
Let's test for that, and it will work everywhere.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross e019dac776 tests/kernel/sched/schedule_api: Fix slice time test for fast ticks
When ticks are sub-millisecond, the math produces minimum and maximum
values for the slice duration test that are equal.  But because of
aliasing across tick boundaries, it's always possible (for any time
period, nothing specific to time slicing here) to measure one tick
more than an intended duration.  So make sure there's always at least
a range of 1ms.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross f288d1e4a7 tests: samples: Apps shouldn't set tick rate
Tick rate is becoming a platform tunable in the tickless world.  Some
apps were setting it due to requirements of drivers or subsystems (or
sometimes for reasons that don't make much sense), but the dependency
goes the other way around now: board/soc/arch level code is
responsible for setting tick rates that work with their devices.

A few tests still use hard-configured tick rates, as they have
baked-in assumptions (like e.g. "a tick will be longer than a
millisecond") that need to be addressed first.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Andy Ross b696c3e469 tests/kernel/mem_pool: Fix timeout units
This code was clearly written to assume that the timeout argument to
k_mem_pool_alloc() was in ticks and not ms.  Adjust to what appears to
have been the intent.  It was working as intended (i.e waiting one or
1/10th of a second) only on systems where the default tick rate was
100 Hz.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-07-02 22:52:29 -04:00
Nicolas Pitre ace11bbefd mempool: make sure max block size isn't smaller than minimum allowed
If maxsize is smaller than _MPOOL_MINBLK, then Z_MPOOL_LVLS() will be 0.
That means the loop in z_sys_mem_pool_base_init() that initializes the
block free list for the nonexistent level 0 will corrupt whatever memory
at the location the zero-sized struct sys_mem_pool_lvl array was
located. And the corruption happens to be done with a perfectly legit
memory pool block address which makes for really nasty bugs to solve.

This is more likely on 64-bit systems due to _MPOOL_MINBLK being twice
the size of 32-bit systems.

Let's prevent that with a build-time assertion on maxsize when defining
a memory pool, and adjust the affected test accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-02 19:41:20 -07:00
Charles E. Youse 930e6af999 arch/x86: move include/arch/x86/segmentation.h to ia32/segmentation.h
This header is currently IA32-specific, so move it into the subarch
directory and update references to it.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-07-02 19:30:00 -04:00
Charles E. Youse dff016b53c arch/x86: move include/arch/x86/arch.h to ia32/arch.h
Making room for the Intel64 subarch in this tree. This header is
32-bit specific and so it's relocated, and references rewritten
to find it in its new location.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-07-02 19:30:00 -04:00
Charles E. Youse 6f3009ecf0 arch/x86: move include/arch/x86/asm.h to include/arch/x86/ia32/asm.h
This file is 32-bit specific, so it is moved into the ia32/ directory
and references to it are updated accordingly.

Also, SP_ARG* definitions are no longer used, so they are removed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-07-02 19:30:00 -04:00
Andrew Boie b52abfe225 tests: schedule_api: cover priority checks
Some cases, such as for the idle thread, were uncovered.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-02 18:44:11 -04:00
Jukka Rissanen efd99e6634 tests: net: ip-addr: Avoid possible null pointer dereference
Check return value of net_if_ipv6_get_ll() before accessing it.

Coverity-CID: 199437
Fixes #17201

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-02 11:37:05 +03:00
Andrew Boie 38129ce1a6 kernel: fix CONFIG_THREAD_NAME from user mode.
This mechanism had multiple problems:

- Missing parameter documentation strings.
- Multiple calls to k_thread_name_set() from user
  mode would leak memory, since the copied string was never
  freed
- k_thread_name_get() returns memory to user mode
  with no guarantees on whether user mode can actually
  read it; in the case where the string was in thread
  resource pool memory (which happens when k_thread_name_set()
  is called from user mode) it would never be readable.
- There was no test case coverage for these functions
  from user mode.

To properly fix this, thread objects now have a buffer region
reserved specifically for the thread name. Setting the thread
name copies the string into the buffer. Getting the thread name
with k_thread_name_get() still returns a pointer, but the
system call has been removed. A new API k_thread_name_copy()
is introduced to copy the thread name into a destination buffer,
and a system call has been provided for that instead.

We now have full test case coverge for these APIs in both user
and supervisor mode.

Some of the code has been cleaned up to place system call
handler functions in proximity with their implementations.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 16:29:45 -07:00
Andrew Boie 6d3566a0b8 tests: mem_alloc: don't set main thread size
This test uses ztest, there is no need to set this and it
was breaking builds with CONFIG_COVERAGE=y

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 14:30:48 -07:00
Jukka Rissanen 3b3844a921 tests: net: socket: mgmt: Add tests for get|setsockopt()
Test AF_NET_MGMT API getsockopt() and setsockopt() functions that
they work properly when called from kernel or from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 40ec4bc15c tests: net: socket: mgmt: Add unit tests for net_mgmt sockets
Almost the same as the net_mgmt socket sample but can be run by
sanitychecker.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 8cf4d59180 tests: net: utils: Add userspace tests for net_addr_ntop/pton()
Add unit tests to net_addr_ntop() and net_addr_pton() in order to
verify that the functions can be called from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen eb018f8109 tests: net: mgmt: Verify that info_length is correct
If info is sent by net_mgmt, make sure it contains correct data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 02b3826fa0 net: mgmt: Add info length to event wait API
The info parameter is difficult to use if the caller does not
get information how long the info struct is. So add info_length
parameter to net_mgmt_event_wait_on_iface() and
net_mgmt_event_wait() APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Ioannis Glaropoulos f3f3dc8768 tests: kernel: fatal: run test for ARMv8-M with MPU stack guards
HW stack protection in ARMv8-M is implemented by default
with the built-in stack guard mechanism. Therefore, by
default all tests for ARMv8-M will use the built-in stack
overflow mechanism (CONFIG_BUILTIN_STACK_GUARD is set in
tests). However, we would like have some coverage on the
MPU stack guard mechanism for ARMv8-M. The added test case
manually disables BUILTIN_STACK_GUARD and enables the
MPU_STACK_GUARD option, to provide that test coverage.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-01 12:54:20 -07:00
Ioannis Glaropoulos e8f2d86d94 tests: remove redundant CONFIG_HW_STACK_PROTECTION=y setting
CONFIG_TEST_HW_STACK_PROTECTION is set by default in tests,
and that one selects HW_STACK_PROTECTION option. Therefore,
we do not need to set that one explicitly in the test project
configuration files. We clean up some redundant occurrences of
CONFIG_HW_STACK_PROTECTION=y from the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-01 12:54:20 -07:00
Andrew Boie 058ebe69c3 tests: common: add tests for extra sflist APIs
sflists have a couple APIs related to sfnodes that aren't
present for slists. There were uncovered, write some tests
for them.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 08:25:25 -07:00
Andrew Boie a744501a7d kernel: test coverage for sflist
We were testing all the slist APIs, but not the sflist
variant. Make a copy of the slist tests for sflist,
with the names properly changed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 08:25:25 -07:00
Andrew Boie b6e4f91069 lib: os: fix slist code coverage
Some of the slist APIs were only being indirectly exercised;
add to the slist test case to cover everything explicitly.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 08:25:25 -07:00
Andrew Boie 8753becbe1 kernel: delete k_futex_init()
There's no need for a system call for this; futexes live in
user memory and the initialization bit is ignored.

It's sufficient to just do an atomic_set().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-01 08:15:10 -07:00
Johan Hedberg 0d9dab300e Bluetooth: Introduce separate pool for discardable events
Introduce a separate buffer pool for events which the HCI driver
considers discardable. Examples of such events could be e.g.
Advertising Reports. The benefit of having such a pool means that the
if there is a heavy inflow of such events it will not cause the
allocation for other critical events to block and may even eliminate
deadlocks in some cases.

Also update all mesh samples not to specify explicit RX buffer counts
anymore. Instead, create appropriate defaults in Kconfig so that we
only need to override this in the app for cases like the bbc:microbit
with limited memory.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-07-01 16:36:15 +03:00
Johan Hedberg fc2fcd10cf Bluetooth: Add dedicated pool for HCI_Num_Completed_Packets HCI event
This event is a priority one, so it's not safe to have it use the RX
buffer pool which may be depleted due to non-priority events (e.g.
advertising events). Since the event is consumed synchronously it's
safe to have a single-buffer pool for it. Also introduce a new
bt_buf_get_evt() API for HCI drivers to simplify the driver-side code,
this effectively also deprecates bt_buf_get_cmd_complete() which now
has no in-tree HCI driver users anymore.

Fixes #16864

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-07-01 16:36:15 +03:00
Jukka Rissanen 7063921e87 net: if: Add userspace support to IPv4 gateway set function
Allow application to call net_if_ipv4_set_gw_by_index()
and set the gateway if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 813ae63f6b net: if: Add userspace support to IPv4 netmask set function
Allow application to call net_if_ipv4_set_netmask_by_index()
and set the netmask if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 01fa8a6fe2 tests: net: if: Test userspace support in net_if
Add more tests to test userspace enabled APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Kumar Gala 284bc9d964 dts: Rename SW._GPIO_* -> DT_ALIAS_SW._GPIOS_*
We use the following commands to rename any
SW._GPIO_{CONTROLLER,PIN,FLAGS} to
DT_ALIAS_SW._GPIOS_{CONTROLLER,PIN,FLAGS}

git grep -l SW._GPIO_CONTROLLER | xargs sed -i 's/SW\(.\)_GPIO_CONTROLLER/DT_ALIAS_SW\1_GPIOS_CONTROLLER/g'
git grep -l SW._GPIO_PIN | xargs sed -i 's/SW\(.\)_GPIO_PIN/DT_ALIAS_SW\1_GPIOS_PIN/g'
git grep -l SW._GPIO_FLAGS | xargs sed -i 's/SW\(.\)_GPIO_FLAGS/DT_ALIAS_SW\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-01 07:14:36 -05:00
Jukka Rissanen f3b0b441ed tests: net: dns: Add tests for dns_unpack_answer()
Make sure that dns_unpack_answer() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 09:44:29 +03:00
Andrew Boie 06d7746cd2 kernel: cover k_array_index_sanitize()
Needed an explicit test for this function for code
coverage purposes; we were relying indirectly on
other code using it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-30 09:22:09 -04:00
Andrew Boie e8092894a1 tests: futex: improve coverage
Error cases weren't being tested; bring up coverage for
kernel/futex.c up to 100% file/function/branch.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-30 09:18:47 -04:00
Andrew Boie 0b0294d682 kernel: cover k_usleep() from user mode
No test was exercising the k_usleep() system call, run
the test case as a user thread to fix code coverage.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-29 20:55:07 -07:00
Andrew Boie ca3549d9f5 tests: sys_mutex: improve code coverage
Test error cases and alternative implementation to bring code
coverage up to 100% file / 100% line.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-29 13:31:14 -07:00
Anas Nashif 5b0aa794b2 cleanup: include/: move misc/reboot.h to power/reboot.h
move misc/reboot.h to power/reboot.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>
2019-06-27 22:55:49 -04:00
Anas Nashif efb8df5366 cleanup: include/: move misc/stack.h to debug/stack.h
move misc/stack.h to debug/stack.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>
2019-06-27 22:55:49 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 536dd5a71f cleanup: include/: move misc/slist.h to sys/slist.h
move misc/slist.h to sys/slist.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 1859244b64 cleanup: include/: move misc/rb.h to sys/rb.h
move misc/rb.h to sys/rb.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif 0c9e280547 cleanup: include/: move misc/mutex.h to sys/mutex.h
move misc/mutex.h to sys/mutex.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 08ee8b09ba cleanup: include/: move misc/mempool.h to sys/mempool.h
move misc/mempool.h to sys/mempool.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 6ecadb03ab cleanup: include/: move misc/math_extras.h to sys/math_extras.h
move misc/math_extras.h to sys/math_extras.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>
2019-06-27 22:55:49 -04:00
Anas Nashif ee9dd1a54a cleanup: include/: move misc/dlist.h to sys/dlist.h
move misc/dlist.h to sys/dlist.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 7435e5e089 cleanup: include/: move ring_buffer.h to sys/ring_buffer.h
move ring_buffer.h to sys/ring_buffer.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>
2019-06-27 22:55:49 -04:00
Anas Nashif d1b2718687 cleanup: include/: move uart.h to drivers/uart.h
move uart.h to drivers/uart.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>
2019-06-27 22:55:49 -04:00
Anas Nashif bd70f6f1ed cleanup: include/: move spi.h to drivers/spi.h
move spi.h to drivers/spi.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>
2019-06-27 22:55:49 -04:00
Anas Nashif fd359c21e9 cleanup: include/: move rtc.h to drivers/rtc.h
move rtc.h to drivers/rtc.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 5843884887 cleanup: include/: move pwm.h to drivers/pwm.h
move pwm.h to drivers/pwm.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>
2019-06-27 22:55:49 -04:00
Anas Nashif a8167ab17d cleanup: include/: move pinmux.h to drivers/pinmux.h
move pinmux.h to drivers/pinmux.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>
2019-06-27 22:55:49 -04:00
Anas Nashif afa85cdc0f cleanup: include/: move led_strip.h to drivers/led_strip.h
move led_strip.h to drivers/led_strip.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 6524925753 cleanup: include/: move ipm.h to drivers/ipm.h
move ipm.h to drivers/ipm.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>
2019-06-27 22:55:49 -04:00
Anas Nashif f2e35134b0 cleanup: include/: move i2s.h to drivers/i2s.h
move i2s.h to drivers/i2s.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 8f692c7d38 cleanup: include/: move i2c.h to drivers/i2c.h
move i2c.h to drivers/i2c.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>
2019-06-27 22:55:49 -04:00
Anas Nashif f901e26de9 cleanup: include/: move hwinfo.h to drivers/hwinfo.h
move hwinfo.h to drivers/hwinfo.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.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>
2019-06-27 22:55:49 -04:00
Anas Nashif fe051a9055 cleanup: include/: move flash.h to drivers/flash.h
move flash.h to drivers/flash.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 969f8f1c68 cleanup: include/: move entropy.h to drivers/entropy.h
move entropy.h to drivers/entropy.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 46a5d1e5cb cleanup: include/: move dma.h to drivers/dma.h
move dma.h to drivers/dma.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 7e7a9bdf88 cleanup: include/: move counter.h to drivers/counter.h
move counter.h to drivers/counter.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.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>
2019-06-27 22:55:49 -04:00
Anas Nashif c0c9396d44 cleanup: include/: move can.h to drivers/can.h
move can.h to drivers/can.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 8007266e6a cleanup: include/: move aio_comparator.h to drivers/aio_comparator.h
move aio_comparator.h to drivers/aio_comparator.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>
2019-06-27 22:55:49 -04:00
Anas Nashif f4709f2c2f cleanup: include/: move adc.h to drivers/adc.h
move adc.h to drivers/adc.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>
2019-06-27 22:55:49 -04:00
Anas Nashif d4d20677ac cleanup: include/: move watchdog.h to drivers/watchdog.h
move watchdog.h to drivers/watchdog.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 4be2e9ebb6 cleanup: include/: move zephyr/jwt.h to data/jwt.h
move zephyr/jwt.h to data/jwt.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 0abdacf3a4 cleanup: include/: move json.h to data/json.h
move json.h to data/json.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 190e368275 cleanup: include/: move power.h to power/power.h
move power.h to power/power.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>
2019-06-27 22:55:49 -04:00
Anas Nashif f641d099cc cleanup: include/: move disk_access.h to disk/disk_access.h
move disk_access.h to disk/disk_access.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 4e48e87fd2 cleanup: include/: move crc.h to sys/crc.h
move crc.h to sys/crc.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>
2019-06-27 22:55:49 -04:00
Anas Nashif bd977d06f8 cleanup: include/: move base64.h to sys/base64.h
move base64.h to sys/base64.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>
2019-06-27 22:55:49 -04:00
Anas Nashif e1e05a2eac cleanup: include/: move atomic.h to sys/atomic.h
move atomic.h to sys/atomic.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 52e0efac97 cleanup: include/: move stats.h to stats/stats.h
move stats.h to stats/stats.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>
2019-06-27 22:55:49 -04:00
Anas Nashif f048792888 cleanup: include/: move nvs/nvs.h to fs/nvs.h
move nvs/nvs.h to fs/nvs.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>
2019-06-27 22:55:49 -04:00
Anas Nashif d918c98e1d cleanup: include/: move fcb.h to fs/fcb.h
move fcb.h to fs/fcb.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>
2019-06-27 22:55:49 -04:00
Anas Nashif 656f4dfdac cleanup: include/: move fs.h to fs/fs.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif 83508a5677 cleanup: include/: move flash_map.h to storage/flash_map.h
move flash_map.h to storage/flash_map.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>
2019-06-27 22:55:49 -04:00
Ioannis Glaropoulos bceca79804 tests: kernel: fatal: check stack overflow of FP capable threads
Test the HW stack protection feature for threads that are
pre-tagged as FPU users, when building with support for FP
shared registers mode (CONFIG_FP_SHARING=y).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-27 18:07:03 -07:00
Ioannis Glaropoulos 1dd2796b6f tests: kernel: add simple test for the ramfunc feature
This commit contributes a simple test for
the ARM RAMFUNC feature.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-27 12:44:20 -07:00
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
	DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)

Used the following commands to make these conversions:

git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-27 13:02:34 -05:00
Charles E. Youse ad409f4bce tests/kernel/context: add case for CONFIG_APIC_TIMER
Test needs trivial modification to account for new APIC timer code.
Eventually CONFIG_APIC_TIMER_IRQ, CONFIG_LOAPIC_TIMER_IRQ, etc. will
be consolidated into one CONFIG_TIMER_IRQ to reduce the noise a bit.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-27 07:20:54 -04:00
Johann Fischer abaeaed2af usb: sort usb config data by section
USBD_CFG_DATA_DEFINE macro has not consider that a class
could have more than one set of usb_cfg_data struct.
If a class has more than one set of usb_cfg_data
then they should be sorted the same way like by
USBD_DEVICE_DESCR_DEFINE macro.

Fixes: #16240

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-27 12:18:05 +02:00
Armando Visconti ab4f280661 driver/sensor: lis2dw12: make use of STdC definitions
Port the lis2dw12 sensor driver on top of the lis2dw12_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-06-26 15:41:40 -04:00
Ioannis Glaropoulos 1e29d40e87 tests: kernel: arm runtime nmi: add arm tag
Add the arm tag to tests/kernel/arm_runtime_nmi test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:55:13 -04:00
Ioannis Glaropoulos e5c0e3caa1 tests: kernel: submit a simple test for zero-latency irqs
The commit contributes a simple test for the Zero-Latency
IRQ feature (CONFIG_ZERO_LATENCY_IRQS=y) for ARM platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:55:13 -04:00
Nicolas Pitre 659fa0d57d lifo/fifo: first word is not always first 4 bytes
The first word is used as a pointer, meaning it is 64 bits on 64-bit
systems. To reserve it, it has to be either a pointer, a long, or an
intptr_t. Not an int nor an u32_t.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-26 09:08:42 -04:00
Andy Ross c0630346c8 Revert "tests: tickless_concept: Fix slicing time measurement"
Unfortunately this seems to have introduced spurious failures on (at
least) qemu_x86 and qemu_xtensa.

The change limits the timeslice tolerance to +/- 1ms, which isn't
necessarily correct when the tick rate is less than 1ms (though it
will probably work on deterministic hardware as long as the system is
hitting the target at exactly the right tick), and isn't even
theoretically achievable on emulation environments where timing
granularity is limited by the host scheduling quantum.

What this needs to do is check the deadline is off by at most one
tick, and trust the platform integration to have set the tick rate
appropriately.

(I do worry that the earlier version of the test was trying to set the
limit at half the TICKLESS_IDLE_THRESHOLD, though -- that seems weird,
and hints that maybe the test is trying to do something more
elaborate?)

Fixes #17063.

This reverts commit 62c71dc4d8.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-06-26 09:59:47 +02:00
Andrew Boie 643f86f1f2 tests: thread_apis: exercise some system calls
We had no system call coverage for k_thread_suspend
and k_thread_resume.

Some unnecessary cleanup tasks in the test case have
been removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 22:45:09 -04:00
Andrew Boie ffd182a04b tests: device: cover device_get_binding()
We had no coverage for invoking this from a system call.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 22:44:14 -04:00
Andrew Boie 848221812f tests: userspace: cover z_object_recycle()
We didn't have code coverage for this function anywhere
except indirectly through some network tests; exercise it
in the suite of userspace tests.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 17:28:19 -07:00
Andrew Boie d053ba59ac tests: dynamic_thread: cover thread_idx_free()
Address a coverage gap in kernel/userspace.
Unfortunately, in the process of fixing this, a bug was
discovered, see #17023.

This test is user mode specific, filter the testcase
on whether userspace is available instead of ifdefing
the code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 17:28:19 -07:00
Andrew Boie 777336ef38 tests: userspace: cover missing/bad syscalls
We were missing code coverage for bad or unimplemented
system call IDs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 17:28:19 -07:00
Andrew Boie 31c4cc54fa tests: common: cover k_cycle_get_32() syscall
We had plenty of coverage for k_cycle_get(), but not its
32-bit variant. Run a case in user mode so that the system
call handler gets covered.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 17:22:52 -07:00
Jukka Rissanen c9aaab74db net: ptp: clock: Add usermode support to ptp_clock_get()
It is useful that the ptp_clock_get() function can be called from
the userspace. Create also unit test for calling that function
from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-25 15:22:51 +03:00
Jukka Rissanen 95e8498c27 net: ptp: Add usermode support to net_eth_get_ptp_clock_by_index()
Make net_eth_get_ptp_clock_by_index() clock API to work with user space.
Create also unit test for testing this user mode support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-25 15:22:51 +03:00
Charles E. Youse 3dc7c7a6ea drivers/interrupt_controller/mvic.c: remove MVIC interrupt controller
The Quark D2000 is the only x86 with an MVIC, and since support for
it has been dropped, the interrupt controller is orphaned. Removed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-25 08:06:43 -04:00
Charles E. Youse ca4910827b boards/x86/quark_d2000_crb: drop support for Quark D2000 dev board
Remove the board directory as well as references in tests and samples.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-25 08:06:43 -04:00
Piotr Zięcik 69406e0f9c counter: Update counter API in order to provide more flexibility
This commit introduces new top_value setting configuration structure
with flag for controlling resetting of the counter during change of
top value.

Such change allows for #12068 implementation on hardware which
does not provide alarms.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-06-25 11:05:45 +02:00
Wentong Wu a30162be35 tests: add futex test cases
add futex test cases.

Fixes: #14493.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-06-24 15:38:21 -07:00
Luiz Augusto von Dentz 4e6e2e3e85 Bluetooth: tests: Add tests for GATT
This adds initial test for GATT APIs that don't require a connection
thus can be run without any extra setup.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-06-24 22:36:59 +02:00
Luiz Augusto von Dentz 2dc2d9cf00 Bluetooth: tests: Add tests for L2CAP
This adds initial test for L2CAP APIs that don't require a connection
thus can be run without any extra setup.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-06-24 22:36:59 +02:00
Luiz Augusto von Dentz 72b05f3e17 Bluetooth: tests: Add tests for UUID APIs
This adds initial test for UUID APIs.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-06-24 22:36:59 +02:00
Luiz Augusto von Dentz 5846a36e9c Bluetooth: hci_prop_evt: Don't set NO_QEMU_SERIAL_BT_SERVER
It should no longer be needed to set NO_QEMU_SERIAL_BT_SERVER manually
when setting CONFIG_BT_NO_DRIVER.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-06-24 22:36:59 +02:00
Ioannis Glaropoulos 0180b94afd tests: kernel: fatal: add explicit test case for ARM and FP Sharing mode
For the ARM architecture we would like to test the HW
Stack Protection feature when building with support for
FP shared registers mode (CONFIG_FP_SHARING=y), as a
means of increasing coverage.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-24 13:26:47 -07:00
Henrik Brix Andersen 70c47cba04 tests: drivers: can: stm32: determine CAN device at compile-time
Determine the CAN device (CAN_0 or CAN_1) at compile-time.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-06-24 14:33:46 -05:00
Henrik Brix Andersen d2f5a2c1dc tests: drivers: can: api: add support for CAN_0
Add support for using CAN_0 interface in the CAN API tests.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-06-24 14:33:46 -05:00
Ioannis Glaropoulos 723aae9503 tests: kernel: mem_protect: use correct define for MEM_REGION_ALLOC
For ARM architecture, use Z_THREAD_MIN_STACK_ALIGN to define
MEM_REGION_ALLOC in tests/kernel/mem_protect/mem_protect/.
STACK_ALIGN takes into account MPU stack guard alignment
requirements. However, application memory partitions do not
require MPU stack guards, therefore, the alignment requirements
are not applicable here.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-24 10:16:57 -07:00
Kumar Gala 0a99f53c80 sensor: lis2dh: Use general DT_<COMPAT>_BUS_<BUS> define.
Match what other drivers are doing and use the general BUS define.
Change DT_ST_LIS2DH_0_BUS_SPI to DT_ST_LIS2DH_BUS_SPI

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-24 07:28:19 -05:00
Nicolas Pitre 1fd379da44 log_msg test: rework test_log_std_msg() to better cope with 64-bit builds
Remove #ifdef's and use a loop to avoid duplicating the code.

Suggested by Krzysztof Chruscinski.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-24 08:58:52 +02:00
Nicolas Pitre 6987937582 log facility: make its records 64-bit compatible
Log records may store either data or pointers to more records. In both
cases they must have the same size. With 64-bit pointers, the amount
of data that can occupy the same space as a pointer has to be adjusted.
And storage alignment has to accommodate actual pointers not u32_t.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-24 08:58:52 +02:00
Nicolas Pitre 0567f161d8 log facility: make its arguments 64-bit compatible
Log arguments were hardcoded to u32_t values. On 64-bit systems, this
is rather restrictive. To make things clear, arguments now have their
own type, log_arg_t, which now can be adjusted in only one location
if need be.  It is currently defined as unsigned long whose effective
width is equivalent to u32_t on 32-bit systems, and u64_t on 64-bit
systems.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-24 08:58:52 +02:00
Kumar Gala 2910b5eac1 tests/kernel/context: Fix TICK_IRQ define for RV32M1 lptmr_timer
We missed converting DT_OPENISA_RV32M1_LPTMR_SYSTEM_LPTMR_IRQ to
DT_OPENISA_RV32M1_LPTMR_SYSTEM_LPTMR_IRQ_0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-21 16:17:05 -05:00
Marc Herbert 3f9151dae6 tests: minor FCB re-ordering not to leave a random flash.bin behind
The last FCB test to run (fcb_test_last_of_n) uses uninitialized
test_data[] and leaves behind a flash.bin with random content. Pick
another one (fcb_test_reset) that leaves a deterministic flash.bin
behind and run that last instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-06-21 13:44:40 +02:00
Jukka Rissanen 2c4b2a16a5 tests: net: getaddrinfo: Make sure we receive two queries
If user supplies AF_UNSPEC, we need to do two queries, one for
IPv4 A record and one for IPv6 AAAA record.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-20 14:45:43 +03:00
Håkon Øye Amundsen 05cd3420ac net: mqtt: add mqtt_readall_publish_payload()
This function uses mqtt_read_publish_payload_blocking to perform a
blocking read of the specified number of bytes.

When reading out a payload, the normal use case is to read the
entire payload. This function facilitates that use case.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2019-06-20 13:06:08 +03:00
Charles E. Youse 13b4c17bf7 tests/drivers/counter: add test for counter_cmos.c
Add a simple test to verify that the CMOS counter counts at 1Hz.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-19 15:23:47 -07:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Ioannis Glaropoulos 8004082389 tests: kernel: fatal: add explicit no user-mode test case
We would like to test the HW stack protection feature in ARM
builds with no user-mode support, i.e. CONFIG_USERSPACE=n. For
that we add a new test-case in tests/kernel/fatal test suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-19 09:07:57 -07:00
Andrew Boie 6020a50092 tests: schedule_api: skip test assert if COVERAGE
This test case is so timing sensitive that gathering code
coverage data screws up the results.

Since this is an abnormal execution environment anyway,
just skip the assertions if CONFIG_COVERAGE=y.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 08:42:50 -04:00
Andrew Boie 03f22773c5 tests: schedule_api: test syscalls from usermode
We didn't have any coverage of the system call handlers for
k_wakeup() and k_is_preempt().

Increase RAM requirements due to stack alignment constraints
on MPU platforms when user mode is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 08:42:50 -04:00
Andrew Boie b5d3ba4634 tests: schedule_api: exercise SCHED_MULTIQ
This option should work on any arch, don't reserve
this just for native_posix.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 08:42:50 -04:00
Andrew Boie a3eb8c4ade tests: schedule_api: fix extern tstacks
Fix how the tstacks array was declared extern so this
actually compiles on all platforms with user mode enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 08:42:50 -04:00
Ulf Magnusson eba81c6e54 yaml: Remove redundant document separators
YAML document separators are needed e.g. when doing

  $ cat doc1.yaml doc2.yaml | <parser>

For the bindings, we never parse concatenated documents. Assume we don't
for any other .yaml files either.

Having document separators in e.g. base.yaml makes !include a bit
confusing, since the !included files are merged and not separate
documents (the merging is done in Python code though, so it makes no
difference for behavior).

The replacement was done with

    $ git ls-files '*.yaml' | \
        xargs sed -i -e '${/\s*\.\.\.\s*/d;}' -e 's/^\s*---\s*$//'

First pattern removes ... at the end of files, second pattern clears a
line with a lone --- on it.

Some redundant blank lines at the end of files were cleared with

    $ git ls-files '*.yaml' | xargs sed -i '${/^\s*$/d}'

This is more about making sure people can understand why every part of a
binding is there than about removing some text.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-19 10:40:10 +02:00
Andrew Boie 86586b2d8d tests: getaddrinfo: set newlib heap size
Some MPU systems require region power-of-two alignment
and can't automatically use remaining RAM for the newlib
heap. Set it for this case. Fixes this test on mps2_an385.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 10:57:33 +03:00
Laczen JMS 36edf92ca8 subsys/settings: change processing to const char
The settings module processes the variable name by splitting it up in
a set of variables. This PR removes the splitting up and keeps the
variable name as one string.

It is an alternative to #16609

The possibility is introduced to register handler including a
separator, or to register a handler for each variable.

The ability is introduced to load a subtree from flash or even to load
a single item.

Two ways to operate on variable and settings_handler names are provided:

settings_name_steq(const char *name, const char *key, const char **next)
which checks if name starts with key, returns 1/0 if it does/does not
the remaining part of name is in next.

settings_name_split(const char *name, char *argv, const char **next)
which splits up name in a part before "/"" that is found in argv and
the remaining part that is in next.

A mutex is added to make settings thread-safe

The settings_handlers list is stored in reverse alphabetical order, this
allows registration of e.g. bt and bt/mesh in separate handlers, the bt
handler itself should not contain any handling of bt/mesh.

A settings_deregister() method is added. Settings_handlers can now be
added/removed when required. This saves RAM when settings_handlers are
not needed.

Tests have been updated to reflect changes in the settings api.

Updates after meeting:
1. Removed settings_deregister

2. Changed settings_name_split() in settings_name_next:

int settings_name_next(const char *name, const char **next): returns
the number of characters before the first separator. This can then be
used to read the correct number of characters from name using strncpy
for processing.

3. New functional test added

Update in settings.h: settings_name_next() changed position -> index

Added some comments in settings.h (settings_name_steq())

Updated tests to reflect change to settings_name_next() and pointer
value comparison. The functional test can now also run on qemu_x86.

Corrected some documentation in header.

Changed registration of handlers to be non ordered.

Changed handler lookup to handle non ordered list of handlers, this
improves handler matching in case different length names are compared
and also makes it easier to add rom based handlers as they will not be
ordered.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2019-06-18 17:57:08 +02:00
Andrew Boie 94b9640a9c tests: poll: expand userspace coverage
The syscall handler for k_poll() returns error values
instead of killing the caller for various bad arguments,
cover these cases.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-18 09:08:01 -04:00
Andrew Boie 682a53db28 tests: queue: test k_queue_alloc_*pend()
These were never getting called anywhere from user mode,
except for k_queue_alloc_append(), but only by virtue of
some workqueue tests.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-18 09:08:01 -04:00
Andrew Boie d87a90e4b9 tests: mutex_api: run in user mode
Addresses coverage gaps. Some changes were made so that exited
threads do not have k_thread_abort() called on them.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-18 09:08:01 -04:00
Nicolas Pitre 2b32059a61 printk: make it 64-bit compatible
On 64-bit systems the most notable difference is due to longs and
pointers being 64-bit wide. Therefore there must be a distinction
between ints and longs. Similar to the prf.c case, this patch properly
implements the h, hh, l, ll and z length modifiers as well as some small
cleanups.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-17 10:28:44 -07:00
Ioannis Glaropoulos f4f2b13126 tests: kernel: fatal: add HW stack check for priv stack
This commit adds a test in tests/kernel/fatal test-suite, which checks
that the HW stack overflow detection works as expected during a user
thread system call.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 10:27:52 -07:00
Ioannis Glaropoulos 02a3c52084 tests: kernel: userspace: correct address of thread priv stack start
In ARM architecture z_priv_stack_find() returns the start of a
thread's privilege stack; we do not need to subtract the length
of a (possible) stack guard. This commit corrects the assigning
of the start address of a thread privilege stack in
test/kerne/mem_protect/mem_protect/userspace.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 09:47:21 -07:00
Ioannis Glaropoulos ac8e810d94 tests: benchmarks: timing_info: add user space tag
Adding userspace tag for benchmark.timing.userspace test-case.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 09:30:24 -04:00
Krzysztof Chruscinski 10074fc477 tests: drivers: counter: Add device name to zassert strings
Prefix strings printed on zassert failure with device name.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-06-17 10:06:13 +02:00
Kumar Gala d4a0c3a2aa dts: Convert new/missed DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Ulf Magnusson a84ded74ea dts: Replace status = "ok" with status = "okay"
The DT spec. only has "okay" and not "ok". The Linux kernel has around
12k "okay"s and 300 "ok"s.

The scripts/dts scripts only check for "disabled", so should be safe re.
those at least.

The replacement was done with

    git ls-files | xargs sed -i 's/status\s*=\s*"ok"/status = "okay"/'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-14 19:51:13 -05:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Charles E. Youse c2c85a2a48 arch/x86/Kconfig: remove CONFIG_ISA_IA32
This option is set iff CONFIG_X86 is set, thus it provides no useful
information. Remove the option and replace references with CONFIG_X86.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-14 05:49:13 -04:00
Nicolas Pitre 3d51f7c266 k_stack: make it 64-bit compatible
The k_stack data type cannot be u32_t on a 64-bit system as it is
often used to store pointers. Let's define a dedicated type for stack
data values, namely stack_data_t, which can be adjusted accordingly.
For now it is defined to uintptr_t which is the integer type large
enough to hold a pointer, meaning it is equivalent to u32_t on 32-bit
systems and u64_t on 64-bit systems.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-14 05:46:29 -04:00
Ioannis Glaropoulos 9f8044e6b5 tests: kernel: fp_sharing: call k_float_disable() for ARM
We can now invoke k_float_disable(.) for ARM platforms,
too, since we introduced the function as a cross-arch
system call.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-12 09:17:45 -07:00
Nicolas Pitre 6311766d9a pointer-type args: cast appropriately to be 64-bit compatible
Using void pointers as universal arguments is widely used. However, when
compiling a 64-bit target, the compiler doesn't like when an int is
converted to a pointer and vice versa despite the presence of a cast.
This is due to a width mismatch between ints (32 bits) and pointers
(64 bits). The trick is to cast to a widening integer type such as
intptr_t and then cast to
void*.

When appropriate, the INT_TO_POINTER macro is used instead of this
double cast to make things clearer. The converse with POINTER_TO_INT
is also done which also serves as good code annotations.

While at it, remove unneeded casts to specific pointer types from void*
in the vicinity, and move to typed variable upon function entry to make
the code cleaner.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-12 08:20:52 -07:00
Nicolas Pitre 1f35774407 memslab/mempool: make tests 64-bit compatible
Minimum block size is 2x larger on 64-bit systems, so let's simply
double all size params. This won't change the validity of those tests
on 32-bit systems. Alignment tests are also adjusted for wider pointers.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-11 09:38:06 -07:00
Johann Fischer 44bc1eca1d tests: build_all: add TI HDC sensor
Add TI HDC sensor to build_all.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-06-11 10:17:11 -05:00
Jukka Rissanen 194893d52d tests: net: udp: Add tests for SO_PRIORITY and setsockopt
Verify that user is able to set SO_PRIORITY socket option.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-09 12:54:05 +03:00
Nicolas Pitre 9bd9b7586d Kconfig: introduce CONFIG_64BIT
This is the generic symbol to select or otherwise test for when 64-bit
compilation is desired. Two trivial usages of this symbol are also
included.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-07 17:48:47 -04:00
Henrik Brix Andersen 98627ccc20 tests: drivers: adc_api: add support for the twr_ke18f board
Add ADC configuration for the NXP TWR-KE18F development board.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-06-07 14:30:59 -05:00
Andrew Boie 324ae6fd56 tests: tickless_concept: disable for coverage
This test is already flaky, but becomes even flakier when
coverage is enabled.

Disable until we put a stake through the QEMU timing issues
being worked on in #14173.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-06 09:29:12 -07:00
Piotr Zięcik a45ce52253 tests: timer_api: Fix timer synchronization
The test_timer_periodicity waits for first timer expiration
in order to extract timer firing time. The wait is performed
using k_timer_status_sync() API call, which blocks thread
until timer expiration. However if the timer expired before
call the this function, it will return immediately, triggering
test failure.

This commit adds the second call to the k_timer_status_sync()
to ensure that the following part of the test will be executed
as soon as possible after timer expiration.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-06-06 09:31:26 -04:00
Anas Nashif 2fb19fcbdd style: samples/tests: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Asger Munk Nielsen 912e117e9e Bluetooth: Controller: Test for user extensions
With pull request #16208 and #16404 hooks for calling user defined
code was implemented. These user extensions are gated by a number of
Kconfigs. The test in this pull request tests that code compiles when
these Kconfigs are enabled.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-06-06 12:38:13 +02:00
Jukka Rissanen 1cbda7d4ac tests: net: socket: register: Close socket after test
The file descriptor was not closed after the test which caused
Coverity to complain about resource leak.

Coverity-CID: 198640
Fixes #16493

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-06 17:49:01 +08:00
Anas Nashif 69fc29de4d tests: mesh: fix function prototype and match declaration
Match function declaration of board_output_number. Use u32_t instead of
uint32_t.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-05 23:31:26 -04:00
Benjamin Valentin def743efda tests: drivers: uart: depend on SERIAL_SUPPORT_ASYNC for ASYNC test
Only build the async testcase for platforms
that support async operation.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-06-05 07:45:27 -04:00
Andy Ross ed5185ba12 tests/kernel/fatal: Fix wait-for-interrupt delay in stack check test
Contrary to the comment in code, this test is NOT, in fact, compiled
with a traditional ticked kernel.  Spinning won't work reliably
because interrupts won't necessarily be delivered when you expect.
This test case would fail spuriously as I moved things around when
debugging.

Doing it right (using a k_timer in this case) is actually less code
anyway.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-06-03 12:03:48 -07:00
Andy Ross e6af0f8caa arch/*: Add z_arch_irq_unlocked() predicate and test
It's useful to be able to inspect the key returned from
z_arch_irq_unlock() to see if interrupts were enabled at the point
where z_arch_irq_lock() was called.  Architectures tend to represent
this is a simple way that doesn't require platform assembly to
inspect.

Adds a simple test to kernel/common that validates this predicate with
a nested lock.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-06-03 12:03:48 -07:00
Radoslaw Koppel d1681d83ca subsys/testsuite/ztest: change zassert_mem_equal to macro
This commit changes zassert_mem_equal as a macro instead
of a function implementation.
In the previous implementation when an assertion fails
the location inside ztest_assert.h file was displayed.
This modification displays the location where zassert_mem_equal
was used.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-06-03 09:39:37 -04:00
Nicolas Pitre bd001081fc tests: cmsis_rtos_v1: remove cast abuses
Casting the tid variable from a void* into an u32_t just to cast it
back to a pointer is pointless. Let's make it a osThreadId variable
upfront and get rid of those casts around it. This also makes it
64-bit compatible.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-01 10:21:13 -04:00
Henrik Brix Andersen 09749bbeb0 tests: benchmarks: latency_measure: use 0.1s sys clk tick for twr_ke18f
Use a system clock tick of 0.1 sec when running on the NXP TWR-KE18F
development board.

Fixes #16234.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-31 10:39:26 -05:00
Bosch Sensortec 86643ecec3 dts : bindings : sensor : bme680 Added support for BME680
Added support to the dts for the BME680 Environmental sensor

Signed-off-by: Bosch Sensortec <github@bosch-sensortec.com>
2019-05-31 10:27:13 -05:00
Henrik Brix Andersen 03bbbb917e tests: drivers: spi_loopback: add twr_ke18f configuration
Add SPI loopback test configuration for the NXP TWR-KE18F development
board.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-31 09:54:03 -05:00
Henrik Brix Andersen fd3d4156d6 tests: flash_map: configure MPU to allow flash writes on twr_ke18f
Configure the NXP MPU to allow flash writes when running the flash_map
test.

This fixes #16224.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-31 09:50:36 -05:00
Maureen Helm c8ae05dd80 tests: flash_map: Configure mpu to allow flash write
On boards that have the arm or nxp mpu, configure the mpu to allow flash
writes. Otherwise this test will fail with an mpu fault.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-05-30 17:13:13 -04:00
Ioannis Glaropoulos 13a587756c tests: kernel: userspace: explicitly declare function for the test
In the wake of moving the internal API header arm_core_mpu_dev.h
into arch/arm/cortex_m/mpu, we need to explicitly declare the
arm_core_mpu_disable() function in the userspace test. Note that
arm_core_mpu_disable() (as any other function in this internal
API) is not supposed to be called directly by kernel/application
functions; an exception is allowed in this test suite, so we are
able to test the MPU disabling functionality.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-30 09:00:05 -05:00
Krzysztof Chruscinski 3555c81111 tests: shell: shell_history: Add more tests
Extended test suite with more tests for shell_history module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski c2cb60f613 shell: Refactor shell_history to use less RW memory
Shell history module reworked to use ring buffer for storing
commands. Dedicated buffer is used to story all command lineary.
History capacity is in bytes not in number of entries, e.g.
many short commands can be stored or few long (depending on
CONFIG_SHELL_HISTORY_BUFFER).

Removed implicit command null termination from shell_history and
added it to shell after fetching command line from the history.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski 0e8517e1b6 tests: lib: ring_buffer: Test for ring_buf_reset, ring_buf_capacity_get
Added tests for new API calls.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski 80f8481feb tests: subsys: shell: Add shell_history test
Add test suite for shell_history module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Marc Herbert 4afcc0f8af sanitycheck: CONFIG_TEST_USERSPACE / userspace tag cleanup
- 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>
2019-05-30 08:45:39 -04:00
Sebastian Bøe 72177da74b latency_measure: Fix bug where the wrong prj.conf file was used
Fix a bug in the latency_measure sample where, when the board was
specified through the environment, the wrong prj.conf file was
selected.

This change is not a pure refactoring, as it is believed that there
have been some copy-paste mistakes where prj_small_freq_divider.conf
and prj.conf have become out-of-sync over time. These assumed mistakes
are not carried over in the new organization.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-05-30 08:27:47 -04:00
Sebastian Bøe 6db7968c63 latency_measure: Remove commented-out code
Remove commented-out code in the latency_measure sample. Commented out
code should not be committed to version control.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-05-30 08:27:47 -04:00
Tomasz Bursztyka c3c6dfaaeb tests/net: Fix IPv6 and UDP test as UDP got stricter on checking header
Now length of the UDP header is checked, and obviously these test were
avoiding setting it properly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-30 13:01:30 +08:00
Nicolas Pitre 4d4cd7e3c8 test/net: fix PTP clock test code
The various ptp_clock_driver_api methods receive a struct ptp_context
not a struct eth_context, and the later must be obtained from a
reference stored in the former. Failing to do so by directly
interpreting driver_data as a struct eth_context instance does end up
corrupting memory past the actual struct ptp_context storage. The test
may still pass as ptp_clock_get() reads from the same out-of-bounds
memory as the previous ptp_clock_set() and therefore the content
matches, and with luck the corrupted memory is not essential to the
completion of the test. But that wasn't my case which allowed me to
find this issue.

Fix this by properly obtaining a reference to the struct eth_context
instance via the actual struct ptp_context, and adding a test like
the one found in eth_tx() to make sure we got the right memory.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 10:53:24 +08:00
Radoslaw Koppel 974231ee6e subsys/settings: Add const modifier to the value pointer
This commit adds const modifier for value pointer in
settings_save_one function.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-05-29 10:11:12 -04:00
Krzysztof Chruscinski 93fb695244 tests: subsys: logging: Test for detection of missed log_strdup
Added test to validate algorithm for missed log_strdup() call.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-29 13:52:31 +02:00
Paul Sokolovsky 4d8941a91d tests: net: getaddrinfo: Add cases for numeric IPv4 addr
And also for AI_NUMERICHOST flag.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-29 17:46:56 +08:00
Jan Van Winkel afdbc20364 tests: Added native POSIX to flash based tests
Added native POSIX boards as target for flash related tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-28 21:14:19 -04:00
Radoslaw Koppel 617c6fdb24 drivers/flash/flash_simulator: Allow unaligned read
This commit adds the default configuration to the flash_simualtor
to allow unaligned reads.
Disable this option when testing to increase test coverage.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-05-28 11:24:48 +02:00
Andrei Emeltchenko 5970b66311 tests: usb: device: Refactor device api test
Refactor device api test using standard placement for descriptor table
and configuration data.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-27 09:25:06 -04:00
Andrei Emeltchenko 3880a42375 usb: Align legacy and composite interface
Remove duplicated execution path for composite configuration, USB
device stack initialization is done inside stack for both cases.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-27 09:25:06 -04:00
Aurelien Jarno 819e749ccd usb: move the request handler buffer to the USB device code
In order to unify the legacy and composite code, move the class and
vendor request handler buffer into the USB device code, just like in
composite mode. The option is renamed from USB_COMPOSITE_BUFFER_SIZE
into USB_REQUEST_BUFFER_SIZE and also replaces the USB_DFU_MAX_XFER_SIZE
and USB_HID_MAX_PAYLOAD_SIZE options.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-27 09:25:06 -04:00
Derek Hageman 5d65ee1383 tests: drivers: uart: Explicitly test incremental receive length
Add an explict test for the length of the receive event when
doing incremental receives.  This was not tested anywhere in the
normal code path (only implicitly in the abort, which wasn't
exercised on the only current implementation, nrfx).  So add an
explicit check for it during the chained reads, so that the
test can catch the case where multiple receive events do not set
the length correctly on events past the first.

Tested on nrf52840_pca10056.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-27 09:23:39 -04:00
Derek Hageman 02d6ea0feb Revert "tests: drivers: uart: Fix async write abort test"
This reverts commit d09b91f5.  I was incorrect in my interpretation
of the async API: the number of bytes received is relative
to the previous event, so it does "reset" between calls.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-27 09:23:39 -04:00
Kamil Piszczek cbc2ff6631 tests: fs: nvs: unittest with corrupted sector close op
Added a test case with corner case scenario, in which sector closing
operation is interrupted (e. g. due to power-down).

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Kamil Piszczek 302dc9878e tests: fs: nvs: moving nvs_clear to setup method
Flash clearing operation is now moved to the setup method inside the
NVS unit test.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Henrik Brix Andersen c3ccbbbdc3 tests: kernel: common: add missing userspace tag
Add missing userspace tag to the kernel/common test suite.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-26 08:56:08 -04:00
Erwan Gouriou bddb343b09 stm32: Remove redundant I2C variant Kconfig symbols definitions
I2C_STM32_V1 and I2C_STM32_V2 are Kconfig symbols used to
select STM32 I2C driver variant based on I2C IP available on a
given STM32 SoC.
Being SoC dependent, they are automatically selected in soc/
if CONFIG_I2C is set. Then there is no need to define them at board
level, nor for a specific application like this is done in
some sample or test applications. Remove these definitions when
this is the case.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-05-24 22:29:51 -04:00
Andrzej Puzdrowski 2d48f4337d tests/fs/nvs: GC full round test
Added a test for testing full round GC on 3-sectors
configuration. In this case all kind off sector can
appeared so this test covers well more numerous
sectors configurations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-05-24 11:13:59 +02:00
Jakub Rzeszutko 4828dab9ca shell: add test for new built-in command
Add shell tests for newly added select command.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-05-24 11:04:42 +02:00
Piotr Zięcik ba4eae14dd tests: test_sched_timeslice_reset: Fix slice time measurement
The time measurement based on k_uptime_delta() might be not accurate
for some values of CONFIG_SYS_CLOCK_TICKS_PER_SEC. This commit
introduces measurement based on k_cycle_get_32(), which is more
precise.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-05-23 09:28:58 -04:00
Piotr Zięcik 62c71dc4d8 tests: tickless_concept: Fix slicing time measurement
The time measurement based on k_uptime_delta() might be not accurate
for some values of CONFIG_SYS_CLOCK_TICKS_PER_SEC. This commit
introduces measurement based on k_cycle_get_32(), which is more
precise.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-05-23 09:28:58 -04:00
Piotr Zięcik 86f012d27c tests: timer_api: Fix test for SYS_CLOCK_TICKS_PER_SEC != 100
This commit changes the timer_api test in order to take under account
fact that timeouts used in the test might not be aligned to tick
boundary.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-05-23 09:28:58 -04:00
Paul Sokolovsky 563b89f90b tests: benchmarks: mbedtls: Fix printf args
As printf() is now used directly instead of printf proxy function,
there's warning-as-error that long long is passed where %lu
expected, so cast it explicitly.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-23 09:27:59 -04:00
Paul Sokolovsky bf070716d1 tests: mbedtls: Call mbedtls_platform_set_printf() only if needed
It exists only if MBEDTLS_PLATFORM_PRINTF_ALT is defined, whcih we
no longer do, but make the call condiitonal in case we'll need to
make it configurable later.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-23 09:27:59 -04:00
Marc Herbert 704b460b0d tests/bluetooth/tester: remove spurious CONFIG_GPIO=y
This tries to build gpio without any driver which fails at cmake time
like this:

CMake Error at ../../../cmake/extensions.cmake:378 (add_library):
  No SOURCES given to target: drivers__gpio
  Call Stack (most recent call first):
  ../../../cmake/extensions.cmake:355 (zephyr_library_named)
  ../../../drivers/gpio/CMakeLists.txt:3 (zephyr_library)

Remove TEST_USERSPACE workaround added in commit 3b53e69249 which
added gpio_handlers.c to the SOURCES.

Fixes #15232.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-22 10:54:40 -04:00
Kamil Piszczek b76edc1a1d tests: fs: nvs: garbage collector test
Added a simple test for the NVS Garbage Collector.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-22 10:22:53 +02:00
Kamil Piszczek 35a9299a76 tests: fs: nvs: test cases clean up flash on completion
Modified tests for the NVS to clean up the flash memory at the end of
their execution.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-22 10:22:53 +02:00
Charles E. Youse 9ab293b919 tests/kernel/sleep: add tests for k_usleep() API
Test that k_usleep() allows sleep durations near the limit of what
the platform's tick rate will allow.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 23:09:16 -04:00
Ioannis Glaropoulos 9a31f28b80 tests: benchmarks: timing_info: fix start of swap time
In all architectures, except x86, __start_swap_time is directly
updated by function read_timer_start_of_swap(), and it shall not
be registered via __temp_start_swap_time.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-21 08:29:25 -04:00
Yannis Damigos bf74f5410f tests/subsys/usb/device: Fix comment and message
Fix comment and message.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-05-20 09:04:08 -04:00
Thomas Ebert Hansen c3de368e47 tests: bluetooth: Test vendor-specific events
Add test for a proprietary HCI Vendor-Specific event.

In the test the controller is replaced with a small stub controller,
with limited support of the initialization flow from the host.

After initialization, a HCI prop event callback is registered and an
prop event is triggered and sent to the host. It is then verified that
the registered callback is called.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2019-05-20 13:33:36 +02:00
Andrei Emeltchenko 6378e1e4a2 tests: usb: desc_sections: Fix coverity issue
Move increment out of zassert_*().

Fixes #15770

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-17 08:06:28 -07:00
Andrei Emeltchenko 875d5a2bf6 tests: usb: desc_sections: Fix coverity issue
Coverity thinks that zassert_*() is debug stuff so move out increment.

Fixes #16163

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-17 08:06:28 -07:00
Wentong Wu fc3270d09c tests: kernel: increase stack buffer when code coverage enabled
increase stack buffer when code coverage enabled.

Fixes: #15794.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-05-16 09:29:55 -07:00
Mieszko Mierunski c4d90aabba tests: uart: Add long tranfer test to UART_ASYNC_API.
Add test where transfer time is longer than rx timeout.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-05-16 13:47:07 +02:00
Filip Kokosinski c0c3cdfc57 drivers: timer: add LiteX timer driver
Add LiteX timer driver with bindings for this device.

Signed-off-by: Filip Kokosinski <fkokosinski@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2019-05-15 12:52:16 -05:00
Benoit Leforestier 472ea92e79 Build: Build with newlib-nano c library
Add an option for building with newlib-nano library.
The newlib-nano library for ARM embedded processors is a part of the
GNU Tools for ARM Embedded Processors.
Add mem_alloc tests with newlib nano.

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2019-05-15 10:46:44 -05:00
Krzysztof Chruscinski 6d4a5200bc drivers: counter: Move nRF TIMER and RTC configuration to device tree
Reduced Kconfig for counter with nRF TIMER and RTC. Added overlays
for TIMER and RTC configuration in the counter test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-15 10:11:02 +02:00
Jakob Olesen 0e65aab703 misc: Always test the portable version of the math_extras.h functions.
The implementation of the <misc/math_extras.h> functions will use the
portable C code when PORTABLE_MISC_MATH_EXTRAS is defined before
including the header.

Use this feature macro to make sure that the unit test always tests the
portable functions in addition to the ones using builtins for the
current compiler.

Signed-off-by: Jakob Olesen <jolesen@fb.com>
2019-05-14 19:53:30 -05:00
Jakob Olesen e66c0da0c1 misc: Portable math_extras.h implementations.
Add a <misc/math_extras.h> header file with portable implementations of
a number of commonly used math and bit counting operations that are not
available in the C programming language.

The math_extras functions fall into two groups:

1. Unsigned integer arithmetic with overflow detection. Addition and
   multiplication are provides for the u32_t, u64_t, and size_t types.
   This commit doesn't include subtraction and division, and there are
   no signed operations. These could be added later if there is a need.

2. Bit-counting operations like clz, ctz, and ffs. These are provided
   for u32_t and u64_t only. I don't see a need for size_t operations,
   but they could be added if needed.

A follow-on commit will add more efficient implementations using
compiler builtins for those compilers that support it.

Another commit will replace other uses of "naked" compiler builtins with
calls to these functions.

Signed-off-by: Jakob Olesen <jolesen@fb.com>
2019-05-14 19:53:30 -05:00
Ryan QIAN 46289bed0c tests: change the min_ram for mbedtls and mem_protect
- Change the min_ram to 36K, since they can't be built on RT1015 which
has 32K ram.

Signed-off-by: Ryan QIAN <jianghao.qian@nxp.com>
2019-05-14 12:23:42 -05:00
Carles Cufi 52ab40cb0d tests: counter: Enable nRF52810 testing
Enable the counter capability in the board and add a .conf file for the
nRF52810 running on the PCA10040 board.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-05-14 10:45:12 +02:00
Jakub Rzeszutko d9c18ff05e boards: arm: Add Nordic nRF52811 board
This commit adds support for board: nrf52811_PCA10056.

The nRF52840 DK: PCA10056 is the recommend development kit, it emulates
the nRF52811, and can be used as a starting point for development
before moving over to a custom board.

Please note that this development kit does not support Bluetooth
Direction Finding. What is more it cannot be used with most of Arduino
shields because of PCA10056 PIN layout.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-05-14 09:52:57 +02:00
Kamil Piszczek e81090cff6 tests: fs: nvs: added basic unittests for nvs
Added basic tests for the NVS file system. One of the tests covers power
down during the flash write operation.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-13 17:07:28 +02:00
Alexander Wachter acf40cabf9 tests: drivers: can: Make CAN dev global
Get the device binding only once and write it to a global variable.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-05-12 16:54:49 -04:00
Alexander Wachter 6b9a6f2465 tests: drivers: can: Add testcases for attach_workq
Add testcases for the new attach_workq API.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-05-12 16:54:49 -04:00
Alexander Wachter f1b89eda8e tests: drivers: can: api: define DT_CAN_1_NAME if not defined
Define DT_CAN_1_NAME as an empty string if it is not defined.
This is useful for buildtest where no HW is available.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-05-12 16:54:49 -04:00
Alexander Wachter b3b43b8921 drivers: can: Extend can_send with void *arg and pass it to the isr cb
This commit extends the CAN api can_send function by an argument
that is passed to the isr callback.
With this extension it is possible to distinguish between sent masseges
when they use the same callback.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-05-12 16:54:49 -04:00
Alexander Wachter 1b93522304 drivers: can: Extend attach_isr with void *arg and pass to the isr cb
This commit extends the CAN api attach_isr function by an argument
that is passed to the isr callback.
With this extension it is possible to distinguish between filter matches
when they use the same callback.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-05-12 16:54:49 -04:00
Derek Hageman d09b91f5fa tests: drivers: uart: Fix async write abort test
During the write abort test, a second write is started then quickly
aborted.  This means that the number of bytes sent is relative
to that second write.  So when comparing it against the number
of bytes received which is NOT reset, the first (completed)
send of five bytes has to be accounted for.  The current
nrfx implementations abort quick enough that no bytes are reported
sent, so this wasn't currently being exercised (i.e. the short
circuit of zero bytes sent was taken).

Tested on nrf52840_pca10056.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-12 12:48:33 -04:00
Jukka Rissanen 0c639a8a9a tests: net: socket: Add tests for socket family registration
Make sure that socket registration does something sane.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-10 22:43:27 +03:00
Song Qiang 8bda26bd13 test: driver: adc: add some nucleo boards support for adc test cases
Some configuration for the boards have to be added into test_adc.c file
so user can test driver with the test cases. Several nucleo boards are
added including F091RC/F103RB/F207ZG/F302R8/F401RE/F746ZG/L073RZ/L476RG.

And also ADC dts and pinmux configuration are added into boards own
pinmux.c and dts file.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-05-07 23:15:58 -04:00
Paul Sokolovsky 81fa697f32 posix: Move gettimeofday declaration to <sys/time.h>
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>
2019-05-07 22:18:09 -04:00
Robert Lubos b8494d9a51 net: lib: mqtt: Enable blocking PUBLISH payload readout
It is convenient to have a blocking version of
`mqtt_read_publish_payload` function, for cases when it is called from
the event handler. Therefore, extend the 'mqtt_read_publish_payload'
argument list with information whether the call should block or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-05-07 22:08:30 -04:00
Derek Hageman 26693830e6 tests: drivers: adc: Add SAM0 support
This adds generic support for any board using the SAM0 ADC driver.
The test selects the internal input from the scaled I/O voltage,
which is always available on the ADC.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-07 08:41:27 -04:00
Tomasz Bursztyka b2b21412ae net/connection: Removing cache feature
There were various flaws in it that motivated its removal:

- No hash collision handling mechanism. In case that would happen, the
behavior of the network connection would be unknown. This is the main
drawback
- The lookup is not that much more efficient than the default one. The
only difference of gain is in connection comparison (a u32t comparison
vs a full connection compare). But the list handling is the same. It's
made worse by the presence of a negatives match array which can be
easily filled in and becomes then fully usless, appart from consuming
CPU. As well as adding a new connection: it requires the whole cache
to be cleared which is unefficient.
- Not memory efficient, even compared to a proper hash table.
Two arrays instead of one etc...

All of this could be fixed by using a proper hash table, though it
remains to be seen if such object could fit in Zephyr core.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Maksim Masalski f1f1a9f38a tests: fix unchecked return value in test_net_pkt_basics_of_rw
Inside function test_net_pkt_basics_of_rw result of function call
net_pkt_read_be16 is not checked which might result performance
of the program and cause errors.

Coverity-CID 198003
Fixes #15776

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-05-07 15:27:31 +03:00
Paul Sokolovsky b2bfcc27b9 tests: socket: misc: Add tests for inet_pton()
Basic testcases for accepting correct input and rejecting invalid.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-07 08:30:32 +03:00
Andrei Emeltchenko d05b260e9c tests: usb: desc_sections: Cleanup test
Strip loopback name from the structures. Fix bNumEndpoints.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-06 19:00:02 -04:00
Andrei Emeltchenko 4626a8cb51 tests: usb: desc_sections: Check EP assignment order
Check that endpoints are assigned in the right order.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-06 19:00:02 -04:00
Andrei Emeltchenko c840383c6a tests: usb: desc_sections: Use automatic endpoint assignment
Use automatic assignment defined in usb_descriptor.h

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-05-06 19:00:02 -04:00
Vinayak Kariappa Chettimada 40241d81be Bluetooth: controller: Enable additional ULL/LLL CI tests
Add/Enable additional conf files for ULL/LLL CI testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-06 14:41:58 +02:00
Jukka Rissanen 758a2468fd tests: net: mqtt_publisher: Allow compilation in every platform
Fixes the compile errors in various platforms like:
* sam_e70_xplained (too few network buffers)
* galileo, cc3220sf_launchxl and mps2_an385 (missing random number
  generator configuration options)

Fixes #15878

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-04 18:28:37 -04:00
Andrew Boie 9485172677 tests: stackprot: don't set main stack size
This test uses ztest anyway, the default should be fine
just like any other test running under ztest.

k_thread_create() uses a lot of stack, and the main
stack size is very small if ztest is enabled. Do it in
another ztest task instead.

We don't need to mess with the main thread's priority,
just have the alt thread run cooperatively.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 13:30:16 -07:00
Andrew Boie e9b5fe333e tests: ieee802154: set min_ram
Fix a sanitycheck failure on usb_kw24d512 with the
whitelist removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Andrew Boie 643d689107 tests: mqtt_publisher: enable random numbers
tls_entropy_func() requires an entropy source.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Andrew Boie dc27ec3e05 tests: ethernet_mgmt: enable random generator
net_if_ipv6_calc_reachable_time() requires sys_rand32_get().
Enable the test random number generator so the build doesn't
fail.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Henrik Malvik Halvorsen 11295c190b drivers: sensor: Add ADXL362 interrupt handling
The ADXL362 driver is expanded to support interrupt handling.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-05-03 09:11:51 -05:00
Derek Hageman 37a6a7ea68 drivers: gpio: sam0: Remove defines from dts_fixup.h
Move SAM0 GPIO to use the raw defines generated from the DTS
parsing.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Andrew Boie 5f0ee9d350 tests: timer_api: run in user mode
We didn't have any coverage of the timer APIs in user
mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 18:01:06 -07:00
Andrew Boie 68a55fc84c tests: cmsis_v1: properly set stack size
There are limits to CMSIS stack sizes, we can't just
add a number to it. Use the configured maximum.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 15:42:33 -04:00
Andrew Boie 16317c1a9f lib: cmsis_v2: set default dynamic stack size
Set to same default as regular stacks. This doesn't use
any extra memory until CMSIS_V2_THREAD_DYNAMIC_MAX_COUNT
is set. 0 is not a valid default if that is set.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 15:42:33 -04:00
Andrew Boie 81a556688a tests: cmsis_v2: don't hard-code stack sizes
Just use the configured value.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 15:42:33 -04:00
Andrew Boie 1d4cc154b0 tests: pipe: fix error with optimization disabled
The various struct pipe_sequence were not located in memory
accessible to user mode. With optimization turned on, they
weren't in memory at all, but with code coverage enabled
the arrays were actually being read, resulting in memory
access failures from user mode.

Fix them by placing in ROM, they never get modified.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 07:22:37 -04:00
Andrew Boie 543c5c1b7f tests: getaddrinfo: fix stack overflow
This thread was blowing its stack if code coverage was
enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 11:13:31 +03:00
Luiz Augusto von Dentz bd007141fd Bluetooth: GATT: Rename BT_GATT_DB to BT_GATT_DYNAMIC_DB
This should be clearer about the intent of the option.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-05-02 08:29:23 +03:00
Luiz Augusto von Dentz 2c4e5d5f16 Bluetooth: GATT: Disable dynamic database by default
This makes BT_GATT_DB default to n which reduces the ram required for
many samples.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-05-02 08:29:23 +03:00
Daniel Leung a404bb76ee tests/kernel/device: extends test for code coverage
device_get_binding() compares pointers first before doing strcmp().
However, enabling coverage forces -O0 to disable any compiler
optimizations. There would be multiple copies of the same string,
and the code pathing doing pointer comparsion would not be tested
at all. So add this flag to merge string constants such that
the pointer comparison would be exercised.

This also adds a bad driver which fails initialization. This is
to make sure that execution path is covered.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-05-01 10:38:03 -04:00
Jukka Rissanen 960e6d9504 tests: net: getaddrinfo: Fix test to check the query is sent
As the getaddrinfo() test is suppose to be self contained, then
we will need to install handler for the sent DNS query. After we
receive the query in process_dns() thread, we verify that the
query was sent properly. We do not return DNS reply back to
the caller in this case as we do not want to create DNS server
just for this simple test application. This can be changed later
if we get DNS server functionality in Zephyr network stack.

Fixes #15193

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-30 09:56:01 -07:00
Benjamin Valentin 360fe70ee7 boards: atsamr21_xpro: Add SAM R21 Xplained Pro Evaluation Kit
Add the Atmel SAM R21 Xplained Pro Evaluation Kit to zephyr.

So far, UART, SPI, I2C (depends on #14128), debug LED and user button
have been tested.

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
2019-04-28 13:25:35 -04:00
Anas Nashif 9e98a94842 tests: ipm: disable on qemu_x86_64
Test is failing randomly on qemu_x86_64. See #12478

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-28 13:08:34 -04:00
Andrei Emeltchenko fbfe75c55e usb: tests: Add second IN endpoint to test
Demonstrate automatic endpoint assignment in tests for similar
endpoint types.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-28 12:22:23 -04:00
Andrei Emeltchenko 7c35a4e89a tests: usb: Add endpoint allocation verification test
Add verification that interface number and endpoint addresses are
correctly allocated.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-28 12:22:23 -04:00
Andrei Emeltchenko 1b3227fd99 samples: usb: Correct USB HID device name
Use "HID_0" as a device name since we have only device count now.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-28 12:22:23 -04:00
Kamil Piszczek 3ce677092d tests: drivers: flash_simulator: removing CONFIG_ prefix from defines
Removed the CONFIG_ prefix from definitions, which are declared in the
test source file. They could be easily confused with Kconfig
definitions.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-26 04:04:19 -07:00
Siddharth Chandrasekaran b070bbd888 tests: kernel: Exclude platforms stm32_min_dev_*
Exclude the two variants of smt32_min_dev (stm32_min_dev_black and
stm32_min_dev_blue) from kernel tests.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2019-04-26 03:34:45 -07:00
François Delawarde 94451b22fc subsys/settings: Allow to register custom backends in settings subsystem
Major changes are:
- Expose settings backend API to enable custom backend support.
- Add a new CONFIG_SETTINGS_CUSTOM backend to allow registering a custom
backend.
- Change api of the handlers h_set() routines to allow for
backend-specific read callbacks.
- Provide a customizable settings_backend_init() routine for custom
backends.
- Move runtime settings support to be its own backend.

Signed-off-by: François Delawarde <fnde@oticon.com>
2019-04-26 11:24:31 +03:00
Ravi kumar Veeramally 7fbe087d8d net: tests: ipv6_fragment: Use NET_DBG instead of DBG
ipv6_fragment tests registered log module but still use DBG
macro of printk. Replaced them with NET_DBG.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:45:45 +03:00
Ravi kumar Veeramally d19097f8c5 tests: net: Add more tests to ipv6 fragmentation
IPv6 fragmentation test case for reassembly.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:45:45 +03:00
Balaji Kulkarni a25dce964b libc: minimal: Add bsearch function
This function implements generic binary-search.

Fixes #15159

Signed-off-by: Balaji Kulkarni <balaji.kulkarni92@gmail.com>
2019-04-25 20:39:36 -07:00
Kamil Piszczek 5895f8d8f1 driver: flash: flash_simulator: moved part of Kconfig to DT
Moved part of the KConfig configuration to the Device Tree.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek dae15fa736 tests: storage: flash_map: adding qemu platform
Added QEMU platform to the Flash Map test and defined partitions for
QEMU dts.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek 129936e63d boards: changing flash simulator device name alias
Changed alias used for flash simulator device name to match the real
one.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek 570183c6cc tests: drivers: add flash_simulator driver
This commit adds a tests for flash simulator driver implementation
for qemu_x86 boards.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Tedd Ho-Jeong An 543b9c972d tests: bluetooth/tester: Add support Read Using Characteristic UUID
This patch adds an API to support Read Using Characteristic UUID.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-04-24 09:39:53 -07:00
Ioannis Glaropoulos 01a2bebc83 tests: kernel: mem_protect: protection: fix test-case filter
The test is to run for boards that have memory protection
enabled; having MPU capabilities on the SoC level is not
sufficient (the user, or the board itself, might not enable
memory protection support). This commit applies that policy
to the mem_protect/protection test suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-04-23 13:04:22 -07:00
Jukka Rissanen fcf392c6c8 tests: net: all: Add more options to catch-all test
Add more Kconfig options to prj.conf file. In the future we need
to compile also in other hw than qemu_x86 in which case we need to
create separate test cases for those configurations.

Fixes #15282

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 10:29:38 +03:00
Anas Nashif 5c6efa011a flash_map: add shell interface
Add shell for flash_map currently supporting listing the configurated
flash_map for a device.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-19 13:41:02 -05:00
Anas Nashif 27c97911b7 flash_map: fix test names
API names have changed, but not the test name.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-19 13:41:02 -05:00
Alexander Wachter 5e4e730d91 tests: drivers: build_all: Add AMS IAQcore and ENS210 to build all
This commit adds IAQcore and ENS210 from AMS to the build tests.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-04-19 08:37:17 -05:00
Yannis Damigos 95a5f90ce7 tests: can: api: Fix "Device not not found" error message
Fix "Device not not found" error message.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-04-18 16:28:09 -04:00
Daniel Leung 3fa90938fe tests/kernel/schedule_api: also test without time slicing
This extends the schedule_api test to cover situations when
time slicing is disabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-04-18 12:26:52 -04:00
Thomas Ebert Hansen 7f2f1d3c7a tests: crypto: Update HMAC_PRNG test
Use the improved HMAC_PRNG test from TinyCrypt version 0.2.8,
(commit 6e0eb53fc8403988f97345e94081b0453f47231d),
that was imported into Zephyr in
commit 06d0b6a694.

Rewrote part of the test code to use the ztest asserts and
test_utils.h functionality.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2019-04-18 12:24:52 -04:00
Andrei Emeltchenko f350c275e1 tests: usb: Add write() and set_callback() tests
Add more tests for invalid EP testing.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko 8cf9bf032b tests: usb: Add usb_read() for invalid endpoint
Check that reading invalid endpoint does not succeed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko 1178042cf4 tests: usb: Add more USB DC tests and refactor names
Add more tests covering almost all DC API with invalid parameters.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko 1b1c5f72d9 tests: usb: Add write() and set_callback() tests
Add more tests for invalid EP testing.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko dad6ddef7f tests: usb: Cleanup tests
General test cleanup and remove optimized variables.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko d0bc6891d8 tests: usb: Add usb_read() for invalid endpoint
Check that reading invalid endpoint does not succeed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko 9fa5d9a5bf tests: usb: Fix checking error code
Instead of checking for -EINVAL check that return is not successful
since USB device may return other error code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Andrei Emeltchenko 69726bbccb usb: tests: Enable other boards for test
Enable other boards with USB device supported

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -04:00
Jukka Rissanen 6bf369f306 tests: net: pkt: Verify that net_pkt_write() writes correct data
Write the net_pkt using net_pkt_write() and then verify that the
data is actually written into net_buf.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-17 10:50:09 -04:00
Marc Herbert 3061c92aaf file2hex.py: new --gzip-mtime option that defaults to zero + test
This makes the output of file2hex.py deterministic by default while also
letting the user set the mtime in the gzip header manually if desired.

Use the option without any argument to restore the previous behavior
that sets the current (and obviously changing) "now" timestamp.

To test:  ./sanitycheck --tag gen_inc_file

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-04-17 08:27:40 -04:00
Kumar Gala a3fd36d778 tests: counter: counter_basic_api: exclude nucleo_f302r8
Exclude nucleo_f302r8 platform as the tests doesn't fit in flash size.
This is due to that fact that we pull in newlib for the STM32 counter
driver.

Fixes #15460

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-04-15 20:53:17 -04:00
Wentong Wu 8646a8e4f5 tests/kernel/mem_protect/stackprot: stack size adjust
revert commit 3e255e968 which is to adjust stack size
on qemu_x86 platform for coverage test, but break other
platform's CI test.

Fixes: #15379.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-12 10:06:43 -04:00
Wentong Wu 22c9646b97 tests: adjust stack size for mps2_an385's coverage test
for SDK 0.10.0, it consumes more stack size when coverage
enabled, so adjust stack size to fix stack overflow issue.

Fixes: #15206.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-11 17:59:39 -04:00
Wentong Wu 3e255e968a tests: adjust stack size for qemu_x86's coverage test
for SDK 0.10.0, it consumes more stack size when coverage
enabled, so adjust stack size to fix stack overflow issue.

Fixes: #15206.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-11 17:59:39 -04:00
Johann Fischer c13e201b18 usb: replace MAX_PACKET_SIZE0 with meaningful USB_MAX_CTRL_MPS
Replace MAX_PACKET_SIZE0 with meaningful USB_MAX_CTRL_MPS.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-04-11 13:35:24 -04:00
Ioannis Glaropoulos e2969e5de0 tests: kernel: fp_sharing: minor fix in #ifdef expression
We need to use the ARMV7_M_ARMV8_M_FP Kconfig symbol,
which denotes the Floating-Point capabilities, instead
of the option that signifies the Cortex-M variant. Fix
is of minor importance, as long as the #ifdef block
remains empty.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-04-10 10:59:46 -04:00
Andrew Boie 9926f947ab tests: ringbuffer: avoid unaligned mem access
Casting the rb_data character array to a u32_t can result
in an unaligned u32_t * pointer being passed to
ring_buf_item_put(), since rb_data is only byte-aligned.

Our Altera Max10 CPU build is not configured to detect
unaligned memory access and throw an exception, it is
instead rounding down the memory address
of the data pointer to the nearest 4-byte value, causing
the wrong data to be copied into the ring buffer.

It appears that in the C standard this is considered
Undefined Behavior so the approach this patch takes is
to fix the test, by ensuring that rb_data is aligned to
u32_t.

Fixes: #14869

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-09 19:59:46 -04:00
Andrew Boie 7387b56c61 tests: add nsim special cases for two tests
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>
2019-04-09 19:38:32 -04:00
Andrzej Puzdrowski bfb7e4531c tests/subsys/settings/fcb: fix unaligned test
Unaligned test might filed in case fcb area was not clen before
run.
The patch insert clean operation before this test.

fixes #15063

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-04-08 10:50:10 -04:00
Anas Nashif 7f378d6ef8 benchmarks: sched: capture output and evaluate
We were running this as a test and not evluating the output. Now we
verify the output and stop treating this as a ztest item.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-08 10:46:55 -04:00
Anas Nashif a520266e44 tests: remove unused defaults.tc
This file is not used and was originally added to support TCF hardware
testing. We use harness now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 10:26:27 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
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>
2019-04-07 08:45:22 -04:00
Andrew Boie 7b1ee5cf13 tests: CONFIG_TEST_USERSPACE now off by default
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.

Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.

This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.

tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.

Fixes: #15103 (and probably others)

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie 3b53e69249 tests: bluetooth: tester: workaround build error
For mysterious reasons this test fails cmake if
CONFIG_TEST_USERSPACE=n.

Enable it for now, bug tracked in #15232

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie 027b6aaf89 tests: set userspace tag for all tests that use it
This lets us quickly filter tests that exercise userspace
when developing it.

Some tests had a whitelist with qemu_cortex_m3; change
this to mps2_an385, which is the QEMU target with an
MPU enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie ce6b80470d net: add missing syscall for gethostname()
We need all the socket APIs to work from user mode.
tests/net/socket/misc now runs in userspace.

Fixes: #15227

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie 1d0369f606 tests: net: getnameinfo: run in user mode
The test is designed to run in user mode, but was disabled
for some reason.

Re-enable, and add mps2_an385 to the whitelist as this is
the QEMU target that emulates an MPU.

Fixes: #15228

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie ad71c2fc44 tests: poll: reduce memory usage
We can re-use thread/stack objects between cases, no
need to have separate ones.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Anas Nashif ed139948a5 license: add missing licences to source code
Add missing license to source code files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-05 23:45:51 -04:00
Adithya Baglody b33dd7ebde tests: benchmark: timing_info: Fixed incorrect results.
The results were incorrect because the timer was firing the
interrupts before the measurement was made.

Fixes: GH-14556

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-04-05 16:10:27 -04:00
Andrew Boie 4e5c093e66 kernel: demote K_THREAD_STACK_BUFFER() to private
This macro is slated for complete removal, as it's not possible
on arches with an MPU stack guard to know the true buffer bounds
without also knowing the runtime state of its associated thread.

As removing this completely would be invasive to where we are
in the 1.14 release, demote to a private kernel Z_ API instead.
The current way that the macro is being used internally will
not cause any undue harm, we just don't want any external code
depending on it.

The final work to remove this (and overhaul stack specification in
general) will take place in 1.15 in the context of #14269

Fixes: #14766

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-05 16:10:02 -04:00
Cinly Ooi cf22c74405 tests: Removed legacy directory /compliance
Removed as it is no longer needed

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-04-05 09:52:59 -04:00
Cinly Ooi 8cce685bbc tests: bluetooth: Improve test case names
Improvement in test case name is needed to make it easier
to navigate from test case name to the actual test
folder.

This is useful as some tools that consume tests directory
will only output test case name without directory names

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-04-05 08:25:33 -04:00
Andrei Emeltchenko 721f3d1cd0 usb: Refactor USB status callback
Merge cb_usb_status_composite and cb_usb_status and use common
forward_status_cb for both composite and normal devices.

Fixes #14882

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-05 12:23:57 +02:00
Andy Ross 0c59471436 tests/drivers/ipm: Enable on (uniprocessor) x86_64
This test was having trouble earlier (at least with some toolchains),
but whatever was causing that seems to have been fixed.  The only
remaining issue is that neither the IPM console code nor the test are
SMP-safe.  There's a bug (#14639) tracking the need to get these
working, but for now the straightforward workaround is just to disable
SMP.

And even long term, IPM is an oddball interprocessor communication
mechanism designed for asymmetric multiprocessing devices like Quark
SE and doesn't seem like an obvious fit for a SMP machine.

Fixes #12478

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-04-04 22:32:39 -04:00
Wentong Wu b991962a2e tests: adjust stack size for qemu_x86 and mps2_an385's coverage test
for SDK 0.10.0, it consumes more stack size when coverage enabled
on qemu_x86 and mps2_an385 platform, adjust stack size for most of
the test cases, otherwise there will be stack overflow.

Fixes: #14500.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-04 08:23:13 -04:00
Wentong Wu 1214736be5 tests: disable kernel.sched.preempt and kernel.poll on nrf52810_pca10040
on platform nrf52810_pca10040, the remaining sram space is not enough
to build test cases kernel.sched.preempt and kernel.poll, temporary
exclude nrf52810_pca10040 on that two cases, will open them when issue
is fixed.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-04 08:23:13 -04:00
Patrik Flykt 7c0a245d32 arch: Rename reserved function names
Rename reserved function names in arch/ subdirectory. The Python
script gen_priv_stacks.py was updated to follow the 'z_' prefix
naming.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Andrew Boie 14db4eedff tests: userspace: check stack buffer access
The stack information stored in the thread->stack_info
fields need to represent the actual writable area for
its associated thread. Perform various tests to ensure
that the various reported and specified values are in
agreement.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-03 13:48:20 -04:00
Andrew Boie c8aee7b413 sys_mem_pool: use sys_mutex
Permission management no longer necessary, the former
parameter for the mutex is now simply ignored.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-03 13:47:45 -04:00
Andrew Boie 0ccaa5d908 tests: mqtt_packet: run in user mode
Various globals for the test cases have been moved to
the ztest memory domain data section via ZTEST_DMEM tags
so that user mode can access them.

Some anonymous arrays whose address was being placed in
the msg_subackX structs have been split out so they
are in ztest memory domain.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-03 13:47:45 -04:00
Andrew Boie f8b6276780 tests: repurpose one of the mutex tests
We have two redundant mutex tests. Repurpose one
of them to excerise sys_mutex instead.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-03 13:47:45 -04:00
Andrew Boie 468c47bb83 tests: thread_apis: fix failure on ARC
This test is only trying to prove that k_thread_foreach() works,
it has nothing to do with stacks. Remove the stack checks
completely.

Fixes: #15044

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-02 20:11:19 -04:00
Andrew Boie 3f2d2f1d54 tests: cmsis_rtos_v2: fix thread checks
It's really not possible to design a test where we can
enforce expectations on real vs. expected stack size:

- Some platforms may increase stack size over what is expected
  due to rounding up the stack buffer area to the next power
  of two.

- Some configuration options like CONFIG_STACK_RANDOM
  carve out space in the stack buffer, resulting in a stack
  size less than what is expected.

Best we can do is just assert that the amount of space
available should be less than the total size reported.

Fixes: #14640

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-02 20:11:06 -04:00
Andrew Boie b942efda58 tests: adc_api: run adc_read_async() from user
We define a system heap and assign our resource pool
from it as k_poll() requires an implicit allocation.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-02 14:17:37 -04:00
Flavio Ceolin 96659ac83b tests: fp_sharing: Fix build error
k_disable_float is only available in X86 when LAZY_FP_SHARING is
set. Adding this condition before using this function.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-04-02 11:31:22 -04:00
Andrew Boie 02be448cc4 drivers: adc: add some missing system calls
Setting callbacks is forbidden from user mode.

Some heavier code changes will be needed to support
adc_read_async(), this patch just exposes the config
and read functions for now.

Test case updated to run partially in user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-29 22:21:16 -04:00
Andrew Boie dea4394ef4 tests: fatal: fix sentinel timer IRQ checking
Tickless kernel is now always disabled, ensuring that when
the kernel's tick count changes, we really did get a timer
interrupt.

The test now awaits a change in tick count instead of busy
waiting for an arbitrary time period.

Fixes: #15013

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-29 22:13:40 -04:00
Cinly Ooi 9bfc1eb8a6 sample: nffs_fs_api: basic: Increase time for testing
Increase test timeout to 500s because it was noticed
that the default of 60s has truncated the test
suite run for nrf52840_pca10056

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-03-29 18:24:48 -04:00
Anas Nashif 15cdeb9352 tests: fix various test identifiers
Fix various test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Anas Nashif 3b58681426 tests: fix identifier for scheduler benchmark
Prefix identifier with benchmarks.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Anas Nashif 8f474020b6 samples: move mbedtls benchmark under benchmarks
This should be alongside other benchmarks under tests/benchmarks

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Aaron Tsui f7e7f0f55e tests: watchdog: Debug for boards enabled TEST_WDT_CALLBACK_2
The original code cannot go to the next step on those boards enabled
TEST_WDT_CALLBACK_2 macro, because of the flow control issue. So the
test function cannot finish, and the board keeps restart. As a result,
failure on the test.

Fixes #13468

Signed-off-by: Aaron Tsui <aaron.tsui@outlook.com>
2019-03-28 16:47:06 -05:00
Song Qiang cb26591fc7 sensor: fxos8700: add forgot int2 defines to dts_fixup.h
The last commit changes FXOS8700 to use new DT defines in its
dts_fixup.h, and the build was also succeeded after it. But
DT_NXP_FXOS8700_0_INT2_GPIOS_CONTROLLER and
DT_NXP_FXOS8700_0_INT2_GPIOS_PIN were missed so the build_all project
is still failing.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-03-28 10:54:31 -05:00
Mieszko Mierunski cbf4e54ead tests: uart: Add nrf9160_pca10090 to UART async test
Add nrf9160_pca10090 to UART async test.
Add myself as codeowner to uart_async_api tests.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-03-28 09:30:57 -04:00
Mieszko Mierunski 48f005707e tests: uart: Add chained write test case for UART async API
Add new test case

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-03-28 09:30:57 -04:00
Anas Nashif 006b97de13 tests: no-multithreading: do not report success twice
We are reporting success twice, once by calling macro directly, and once
by using ztest test_main().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-26 20:09:07 -04:00
Ravi kumar Veeramally 65d100e7f0 tests: net: Add more tests to ipv6 fragmentation
IPv6 fragmentation test case without any extra header (HBHO)
added.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-26 15:55:15 -04:00
Wayne Ren 6b5bed6aa9 arch: arc: fix the handling of stack check exception
stack check exception may come out with other protection
vilation, e.g. MPU read/write. So the possible paramter
will be 0x02 | [0x4 | 0x8].

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-26 14:34:39 -04:00
Piotr Mienkowski a3082e49a1 power: modify HAS_STATE_SLEEP_ Kconfig options
Add SYS_POWER_ prefix to HAS_STATE_SLEEP_, HAS_STATE_DEEP_SLEEP_
options to align them with names of power states they control.
Following is a detailed list of string replacements used:
s/HAS_STATE_SLEEP_(\d)/HAS_SYS_POWER_STATE_SLEEP_$1/
s/HAS_STATE_DEEP_SLEEP_(\d)/HAS_SYS_POWER_STATE_DEEP_SLEEP_$1/

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski 17b08ceca5 power: clean up system power managment function names
This commit cleans up names of system power management functions by
assuring that:
- all functions start with 'sys_pm_' prefix
- API functions which should not be exposed to the user start with '_'
- name of the function hints at its purpose

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski 204311d004 power: rename Low Power States to Sleep States
There exists SoCs, e.g. STM32L4, where one of the low power modes
reduces CPU frequency and supply voltage but does not stop the CPU. Such
power modes are currently not supported by Zephyr.

To facilitate adding support for such class of power modes in the future
and to ensure the naming convention makes it clear that the currently
supported power modes stop the CPU this commit renames Low Power States
to Slep States and updates the documentation.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Jukka Rissanen 079a2919cb tests: socket: tcp: Increase the buf count
With default buf count, we ran out of bufs in connect() in
test_v6_sendto_recvfrom().

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-26 07:29:26 -05:00
Ravi kumar Veeramally 2f941d2630 tests: net: ipv6: Add one more test case
Test case added for IPv6 neighbors. This will add more than
CONFIG_NET_IPV6_MAX_NEIGHBORS neighbors. Network stack should
remove oldest neighbor which is in STALE state and it should
add new neighbor. So call to net_ipv6_nbr_add() should succeed.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-25 22:49:52 -04:00
Tedd Ho-Jeong An 2d8ac0cf5e tests: net: mld: Check return after updating packet
This patch checks the return value after updating the packet.

Fix Bugs: #14821
Coverity CID: 196635

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-25 15:53:13 -04:00
Flavio Ceolin f1741dab6c tests: mbox: Check k_mbox_get return
Coverity was complaining that this function was not being checked only
in a specific case.

Coverity CID: 183066

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-23 20:13:12 -04:00
Andy Ross 61065b3235 tests: samples: Re-enable SMP on a few tests
The 14 individual cases that use these four config files are now
passing reliably when SMP is enabled, after the "Mark sleeping threads
suspended" scheduler fix.  Turn it back on.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 19:28:15 -04:00
Andy Ross 09fdd814df tests/kernel/smp: Give time for a wakeup to take effect
For obvious performance reasons, scheduler state changes (other than
aborting a thread) do not cause synchronous interrupts on the other
CPU.  Doing a k_thread_wakeup() means that the current CPU will run it
synchronously if it's high priority, but if you want to see it run on
the other cores you need to wait for them to reach a scheduling point
on their own.

The test was written to assume that k_thread_wakeup() is synchronous,
but that's not right, and it needs to spin a bit.  This bug was always
present in the test, but masked by a bug in the way that k_sleep() was
handled on SMP.  See #9506.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 19:28:15 -04:00
Andy Ross 4f04f6486d tests: More SMP disablement
A few more test cases that are measurably unreliable when run in SMP.
For the most part these work most of the time (though the semaphore
one was pretty borderline -- I measured about 25% failures), but are
measurably unstable against the backdrop of known qemu instability.
Something is clearly going on and we need to come back to these to fix
threadsafety issues.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-20 11:33:29 -05:00
Tomasz Bursztyka cf322c44db net: Switch usage of net_pkt_get_reserve to net_pkt_alloc
Some places were still using the old allocator. Using the new one does
not change any behavior. This will help to remove the useless data_len
attribute in net_pkt which legacy allocator was still setting.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 03bfc5dd0f net/context: Remove token parameter from net_context_send/sendto
And also to the relevant callbacks.

That parameter is not used anywhere so it is useless.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka d6d52ce9e5 net/pkt: Remove _new suffix to net_pkt_write functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka a25f054cbd net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka f8a091104e net/pkt: Remove _new suffix to net_pkt_get_data_new function
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 820f3ad006 net/ipv6: Replace legacy net_ipv6_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka ca58b4c761 net/ipv4: Replace legacy net_ipv4_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 172fe5a87b net/context: Remove _new suffix on net_context_send/sendto functions
Now that legacy functions are removew, let's rename the new functions by
removing the _new suffix.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Mariusz Skamra 56ec1d876d Bluetooth: tester: Fix possible NULL pointer dereference
Fix calling NULL attribute read function pointer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-19 06:55:16 +02:00
Daniel Leung 91eb147452 tests: kernel/smp: whitelist qemu_x86_64 for testing
Add qemu_x86_64 to the platform whitelist so that this will actually
be built and tested with sanitycheck.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-18 17:57:54 -04:00
Daniel Leung 96ccb913e4 tests: kernel/smp: fixed missing 'z_' renaming
There was a missing 'z_' renaming to
z_is_thread_prevented_from_running which would have caused
sanitycheck to fail but it is not being built at the moment.
Fix this first.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-18 17:57:54 -04:00
Andrew Boie b3eb510f5c kernel: fix atomic ops in user mode on some arches
Most CPUs have instructions like LOCK, LDREX/STREX, etc which
allows for atomic operations without locking interrupts that
can be invoked from user mode without complication. They typically
use compiler builtin atomic operations, or custom assembly
to implement them.

However, some CPUs may lack these kinds of instructions, such
as Cortex-M0 or some ARC. They use these C-based atomic
operation implementations instead. Unfortunately these require
grabbing a spinlock to ensure proper concurrency with other
threads and ISRs. Hence, they will trigger an exception when
called from user mode.

For these platforms, which support user mode but not atomic
operation instructions, the atomic API has been exposed as
system calls.

Some of the implementations in atomic_c.c which can be instead
expressed in terms of other atomic operations have been removed.

The kernel test of atomic operations now runs in user mode to
prove that this works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-18 09:18:00 -04:00
Andy Ross 5a56ee5605 tests/kernel/fifo/fifo_usage: Disable SMP
This test isn't SMP-safe and won't pass reliably on x86_64 by default
(though it does pass often enough to get CI passes on most things, it
fails spuriously in ways that aren't timing related).  Turn off the
second CPU.  Fixes #14501

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-15 19:42:59 +01:00
Maureen Helm 0cff42fe9d drivers: sensor: Refactor apds9960 to use const config struct
Refactors the apds9960 sensor driver to get the i2c device name, i2c
device address, gpio device name, and gpio pin from a constant device
configuration structure, rather than using hardcoded macros. This will
make it easier to change the names of the macros and to instantiate
multiple instances of the driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-03-15 10:30:53 -05:00
Michael Scott 83aa7cecd4 boards: arm: nrf52840-based: Free up flash room for sample apps
The current flash configurations for all nRF52840's in Zephyr is
VERY constrained when it comes to allowing samples any space for
storage or custom areas.  It only leaves the last 4 pages of flash
for "storage".

The nRF52840 is also capable of using OpenThread which defaults
to using the last 4 pages of flash for storing OpenThread-related
network data.

This means that while using OpenThread under any configuration
designed to use mcuboot partition slots, there is no space left
over for storage of any kind.

Let's adjust the partition table to set storage at 8 pages of
flash (32k).  This fixes the conflict with OpenThread and leaves
room for future use cases that may arise.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-03-15 08:52:06 -05:00
Henrik Malvik Halvorsen 64fd822652 drivers: sensor: adxl362: Driver update and CS support
Updated to add support for CS. DT config names updated
to adhere to the DTS naming convention. Init and SPI
configuration now follows the device datasheet.

Signed-off-by: Henrik Malvik Halvorsen <henrik.halvorsen@nordicsemi.no>
2019-03-15 07:39:05 -05:00
Mariusz Skamra 8b5d73e0f1 Bluetooth: tester: Move BTP specification to auto-pts repository
This moves BTP specification from Zephyr so that it's accessible for
all projects.

Related auto-pts PR: https://github.com/intel/auto-pts/pull/244

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-15 07:24:08 -05:00
Song Qiang 5c0f6a3329 sensor: fxos8700: Convert to new DT_<COMPAT>_<INSTANCE> defines
The old defines make the Shippable tests fail. Convert the fixing
ups for fxos8700 to use new defines introduced in #12491.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-03-15 07:23:27 -05:00
Andrei Emeltchenko 99403c5b13 net: ethernet: Define and use Ethernet frame and datagram size
Remove magic numbers from Ethernet drivers and tests by defining
NET_ETH_MAX_DATAGRAM_SIZE and NET_ETH_MAX_FRAME_SIZE.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-15 06:44:13 -05:00
Paul Sokolovsky f38c4c97ce tests: socket_helpers: Use zsock_ prefixed socket functions
Don't depend on CONFIG_NET_SOCKETS_POSIX_NAMES being defined (e.g.,
it's going to conflict with POSIX API).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-15 06:00:21 +01:00
Andy Ross c4e2f1b217 tests/kernel/mem_pool/mem_pool_threadsafe: Reduce tick rate
Qemu just can't handle 1000 Hz ticks.  On our CI machines, CONFIG_HZ
on the host (which is the limit of timing precision for things like
idle wakeups and signal delivery, both of which qemu seems to use for
timing) is 250.  When the mismatch gets this large, we start seeing
artifacts like interrupts being delivered "in the past" (i.e. code
sees a z_clock_elapsed() value of "2" ticks before getting a
z_clock_announce() call for "1").

As it happens, this test doesn't actually require timing with that
precision, it just wants "lots of context switching" to exercise the
threadsafety of the mem_pool APIs.  So decrease the tick rate to the
100Hz default, but put a loop counter in the worker threads to force
them to do 10x more work, keeping the number of preemptions constant.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-15 05:50:43 +01:00
Ramakrishna Pallala e1639b5345 device: Extend device_set_power_state API to support async requests
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-03-14 14:26:15 +01:00
Jukka Rissanen dc41aad2a5 tests: net: mld: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195844
Fixes #14405

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-14 13:01:01 +01:00
Tedd Ho-Jeong An 401a598503 tests: net: iface: Handle pkt allocation failure
This patch handles null pointer when packet allocation fails.

Fixes: #14390
Coverity-CID: 195903

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-14 12:06:21 +01:00
Kumar Gala 6ef55b0942 tests: kernel: context: Fix build issue with RV32M1_LPTMR_TIMER
We needed to add support for the RV32M1_LPTMR_TIMER to the test so its
knows what the IRQ of the timer is.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-13 17:02:05 -05:00
Andy Ross 05c1263ebd tests/kernel/smp: Clean up "guess waiting" on SMP thread exit
The various tests would all do a "wait for threads to exit" step
before checking the results, but this was implemented with a simple
busy wait that turns out to need careful tuning (because there was
busy waiting in the threads).

Rather than try to synchronize this, white box the issue (it's a low
level SMP test, after all) by spinning on the thread states directly
watching for the kernel to flag them dead.  The downside here is that
if the process fails for some reason we'll get a hang and a timeout
reported from sanitycheck and not a synchronous ztest assertion.  But
in return, successful tests run much faster and I don't need to worry
about how to tune them for IPI latency on different platforms.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-13 19:15:20 +01:00
Andy Ross 829f6639da tests/kernel/smp: Remove test_wakeup_pending_threads case
This case was predicated on a mistake.  The behavior of k_wakeup() has
always been NOT to wake up threads that are "pending" on a wait queue,
only ones blocked on a timeout in k_sleep().  As written, this test
case could never pass.

(Really there's no good reason for that.  It seems reasonable to me to
expect wakeup to work symmetrically, and the docs are sort of
ambiguous on the subject.  But the code in k_wakeup() is clear:
threads flagged pending get an early exit and the call becomes a
noop.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-13 19:15:20 +01:00
Andy Ross 5697dd7980 tests/kernel/smp: Honor TEST_EXTRA_STACKSIZE
There was a test-created thread that wasn't including this.  It's a
huge stack and doesn't overflow (though I thought briefly that it
was), but it's a rule that we need to have that buffer and I'm trying
to fix these as I find them.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-13 19:15:20 +01:00
Krzysztof Chruscinski 3b27779cf6 tests: drivers: counter: Fix coverity issues
Issues 190937, 190952, 190967, 190983

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-13 09:08:55 -05:00
Jukka Rissanen 6301ae74d9 tests: net: tcp: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195819
Coverity-CID: 195860
Coverity-CID: 195921

Fixes #14412
Fixes #14399
Fixes #14388

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:39:41 -05:00
Jukka Rissanen 55cd97bc43 tests: net: dhcpv4: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195880
Coverity-CID: 195816

Fixes #14413
Fixes #14395

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:38:26 -05:00
Jukka Rissanen bafdf5b329 tests: net: ipv6: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195835
Fixes #14409

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:34:46 -05:00
Thomas Stenersen 7516476386 kconfig: Use depend on instead of select to avoid kconfig loop
Remove use of select to "force" enabling other configs in subsys/fs
and subsys/net/l2. The forcing will cause infinite kconfig recursion.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-12 19:42:40 +01:00
Alexander Wachter 3aa8443ab4 tests: drivers: build_all: add CAN to the build tests
This commit adds CAN to the build_all tests.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-03-11 16:54:42 -07:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Tedd Ho-Jeong An 922f53864f tests: net: mqtt: Fix the error handling aftre read
If the rc = -EAGAIN from mqtt_read_publich_payload(), it shouldn't be
used in memcpy() since it is a negative value, and instead, it should
try to read again.

Fix: #13825
Coverity-CID: 191002

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-09 10:50:25 -05:00
Andrzej Puzdrowski 7a00658b8e tests/subsys/fs/nffs_fs_api: build ram back-end only for qemu_x86
Ram back-end was unnecessary included in non qemu test which
increased RAM footprint much.

Patch includes ram backend into build only for qemu_x86 build.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-09 10:34:17 -05:00
Tomasz Bursztyka 462fc32f7c tests/unit: Switch vlan test to new net_pkt/net_context API
Use the new net_pkt allocator. Fix a small leak in the test as well.

No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka a03efe1928 tests/net: Fix vlan test timeout values
s/0/K_NO_WAIT for all timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka ab1d38c3c3 tests/net: Reducing utils test by removing redundant ones
The very first test was basically testing the checksum calculation. And
that's already tested in more relevant tests. It was also trying in a
cumbersome way to generate packets scattered over many net_buf. But
that's also already tested in various other tests, and it's not at all
part of core utils anyway.

In any case, that all redundant, so let's remove it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 6a1387d1cf tests/net: Switch tx timestamp test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Use the new net_context option to enable timestamping of outgoing
packet (NET_CONTEXT_TIMESTAMP).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 3e6e0922fe tests/net: Fix tx timestamp test timeout values
s/0/K_NO_WAIT for timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 3fb49d89d6 tests/net: Switch traffic class test to new net_context API
No need to build the packet by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 5cff958a4f tests/net: Fix traffic class test timeout values
s/0/K_NO_WAIT for all timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka eca8f1072a tests/net: Switch tcp test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 344962270e tests/net: Switch promiscuous test to new net_pkt API
Switch to new allocator and write function.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 2a18ec99bf tests/net: Switch MLD to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 07d34b0f3e tests/net: Replace the legacy net_pkt API test by the new one.
Just a quick rm/mv. The new API is going to be the only one, so legacy
test can disappear.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka da37c67aba tests/net: Switch ipv6 fragmentation test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 07f9040ebb tests/net: Switch ipv6 test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 32dfb13b03 tests/net: Switch iface test to new net_pkt API
No need to play with net_buf by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 8e8bd65783 tests/net: Switch icmpv6 test to new net_pkt API
No need to play with net_buf by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka ae94e2ec1d tests/net: Switch context test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka a05c29f0db tests/net: Fix context test timeout values and function calls
s/0/K_NO_WAIT for all timeouts
And fix tcp context connect call (it's not net_context_listen obviously,
and one parameter was missing).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 8b857dadc5 tests/net: Switch checksum test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Ravi kumar Veeramally a391daa95a net: tests: Migrate ARP tests
Migrate ARP tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-08 07:18:19 -05:00
Kumar Gala ca357ee46c tests: spi: spi_loopback: Drop default SPI_1_NAME symbol
We use to define the SPI bus device name in Kconfig, however now that
all SPI bus controllers use DTS that comes from DTS, so SPI_1_NAME is
never set to anything.  So remove it and leave it to the config frag in
the boards dir in the test to set the name.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-08 05:38:04 -06:00
Charles E. Youse 78b98ae895 tests/xip: exclude Minnowboard from test (does not do XIP)
Minnowboard should not run the XIP test as it doesn't execute-in-place.
Updated the test specification to exclude Minnowboard.

Fixes #14099.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-07 20:31:31 -05:00
Varun Sharma 145d8f06e0 tests: subsys: fs : Fix coverity issue
Fix Unchecked return value in func: nffs_test_util_create_file_blocks

Coverity-CID: 190955
Fixes: #13860

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-03-07 09:39:39 -05:00
Ravi kumar Veeramally 746618460b net: tests: Migrate UDP tests
Migrate UDP tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-07 07:17:36 -05:00
Andrew Boie 90132d3543 tests: jwt: lower heap size
The heap, plus a few globals relevant to mbedtls get put in
their own memory partition.

With systems that have power-of-two region size/alignment
constraints, this results in a 64K partition being created,
even though we are using just a whisker above 32K.

Lower the heap size a little so everything fits in 32K.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-07 04:27:32 -06:00
Arnaud Pouliquen 97f4265c12 tests: fix compilation error for printk
Fix multiple definitions of `ram_console'. The ram_console
array is already defined in drivers/console/ram_console.c.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2019-03-06 18:15:06 -05:00
Paul Sokolovsky 1b837d64de tests: socket: tcp: Test handling of EOF condition on socket
If peer socket closed, the other side should get 0 from recv(), and
should get in stable manner (no matter how much time went from the
closure and/or how many times recv() is called).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-06 15:57:40 -05:00
Krzysztof Chruscinski 244aecf2d2 tests: drivers: counter: Fix coverity issue (190952)
Fix issue reported by coverity regarding using volatile
variables in zassert_equal macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-05 12:37:18 -06:00
Krzysztof Chruscinski e318401426 tests: drivers: counter: Fix coverity issues 190937, 190967, 190983
Fix issue reported by coverity regarding using volatile variable
in zassert_equal macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-05 12:37:18 -06:00
Ravi kumar Veeramally 0aa61651ce net: tests: Fix DHCPv4 tests
net_pkt_alloc_with_buffer() takes IP header and protocol header
length while calculating total length internally. Need not
specify explicitly. Also mutex was not properly initialized.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-05 08:29:02 -05:00
Andrew Boie e686aefe09 mbedtls: provide user mode access
The mbedtls library has some globals which results in faults
when user mode tries to access them.

Instantiate a memory partition for mbedtls's globals.
The linker will place all globals found by building this
library into this partition.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-05 08:27:20 -05:00
Pawel Dunaj 3dd44d16e6 tests: bluetooth: MESH shell is observer not central
Use BT_OBSERVER instead of BT_CENTRAL for this test.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2019-03-05 11:22:39 +01:00
Anas Nashif 99beaed7c0 tests: mbedtls: report results once only
We were reporting results twice, something that might confuse test
systems and end up reporting wrong results. Assert if any self-tests
have failed and report at the very end.

Disable test on x86_64.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-04 17:32:08 -08:00
Anas Nashif 3b745cc648 mbedtls: enable self-test in config-tls-generic.h
MBEDTLS_SELF_TEST is needed when setting CONFIG_MBEDTLS_TEST

Fixes #13919

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-04 17:32:08 -08:00
Maksim Masalski b324f35e61 macros: deleted macros SECONDS(), MSEC(), USEC()
Changed everywhere these macros to the K_MSEC(), K_SECONDS()

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-03-04 19:04:21 -05:00
Adithya Baglody aee196d597 tests: benchmarks: timing_info: Print all measurements.
All measurements will now be printed irrespective of the validity.

Fixes: GH-12900

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-03-04 14:16:13 -05:00
Piotr Zierhoffer 8642be070c m2gl025_miv: Ignore lifo_usage tests
These tests fail on hardware. An appropriate issue will be filed on
GitHub, but it doesn't make sense to hold the CI from going green.

Fixes #13960.

Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2019-03-04 12:39:09 -05:00
Andrew Boie 8207801c9b tests: userspace: remove unused partition
No data was ever being put in part2.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-04 08:05:16 -08:00
Andrzej Puzdrowski 15159dddf1 settings: always uses the storage partition for FCB
It was possible via Kconfig to assign any partition for FCB using
its number. Partitions flash_area_id becomes non predefined
(are auto-generated). So it is possible only to guess which
number will be signed to certain area.

Unfortunately it is not possible to transfer FLASH_AREA_XXX_ID
label via Kconfig.

Patch assigns settings to the storage partition and remove
SETTINGS_FCB_FLASH_AREA property from settings Kconfig.

fixes #13388

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-04 16:51:19 +01:00
Wentong Wu 0ef2408e26 tests: move tests/coverage to subsys/testsuite
This part of tests was forgotten when we move to subsys/

Fixes #13729

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-04 08:24:42 -05:00
Tedd Ho-Jeong An 378cc3d57b Bluetooth: btp: Add overlay for nrf52 and reel boards
This patch adds overlay for nrf52_pca10040 and reel board to use
btp tester. These are based on nrf52840.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-03 23:46:00 -05:00
Andrew Boie 92da519d45 tests: userspace: add some more scenarios
We want to show that performing various memory domain
operations, and then either dropping to user mode, or
swapping to a user thread in the same domain, has the
correct memory policy for the user context.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-03 23:44:13 -05:00
Daniel Leung 602a79cfeb tests: fs/nffs_fs_api: fix uninitialized reference time variable
The reftime variable used for performance numbers is not initialized
prior to being used. Initialize it to the current uptime so delta
can be calculated correctly.

Fixes #13877
Fixes CID-190936

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-02 12:27:30 +01:00
Daniel Leung 8b523e944b tests: fs/fat_fs_dual_drive: check fs_seek return values
Inside test_file_truncate(), the results of fs_seek() are not
checked. So adds some checks there.

Fixes #13874
Fixes CID-190939

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-02 12:26:37 +01:00
Charles E. Youse 3522e05f76 posix/pthreads: fix pthread_barrier_wait() behavior to match Posix
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>
2019-03-02 03:40:06 +01:00
Charles E. Youse d51ee67cbe tests/timer_api: revert testcase configuration
My test tag 'flarp' got through in the last commit.  Removed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-01 14:53:33 -08:00
Charles E. Youse fbf4c7eea0 tests/timer_api: revert testcase configuration
Removing the build_only option for tickless broke CI (for reasons
unrelated to the new tests I added in the prior commit).

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-01 14:53:33 -08:00
Charles E. Youse 0ad4022e51 kernel/timeout: fix k_timer_remaining_get() when tickless
In some circumstances (e.g., a tickless kernel), k_timer_remaining_get()
would not account for time passed that didn't involve clock interrupts.
This adds a simple fix for that, and adds a test case.  In addition, the
return value of k_timer_remaining_get() is clamped at 0 in the case of
overdue timers and the API description is adjusted to reflect this.

Fixes: #13353

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-01 14:53:33 -08:00
Piotr Zięcik 05fa9c8318 drivers: counter_nrfx_timer: Port driver to DTS
This commit updates the counter_nrfx_timer driver in order to
use device tree infrastructure.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-03-01 19:46:57 +01:00
Piotr Zięcik 298b841873 drivers: counter_nrfx_rtc: Port driver to DTS
This commit updates the counter_nrfx_rtc driver in order to
use device tree infrastructure.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-03-01 19:46:57 +01:00
Andy Ross f085928ab0 tests/kernel/fifo/fifo_timeout: Tick alignment for oversensitive timing
This test was written to wait on a fifo with a timeout, return, and
check the timing between the start and end using k_cycle_get_32() to
see that it didn't run long.  But timeouts expire on tick boundaries,
and so if tick expires between the start of the test and the entry to
k_fifo_get(), the timeout will take one full tick longer than expected
due to aliasing.

As it happened this passed everywhere except nRF (whose cycle timer is
32 kHz and thus more susceptible to coarser aliasing like this), and
even there it passed for a while until the spinlock validation layer
went in and added just enough time to the userspace code paths
(i.e. the code between the start time fetch and the point where the
fifo blocks takes longer) to open the window and push us over the
limit.

The workaround here is just to add a k_sleep(1) call, which is
guaranteed to block and wake up synchronously at the next tick.

Fixes #13289

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-01 19:45:39 +01:00
Flavio Ceolin b92f104b66 tests: fs: Add missing return check
Checking the return of fs_stat to ensure that there is not hidden error.
Problem spotted by coverity.

CID 190949

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:50:15 +01:00
Sebastian Bøe 4e5300ba7f cmake: Drop all in-tree usage 'set_conf_file'
Port all users of 'set_conf_file' to use the built-in rules
instead. This follows the convention-over-configuration principle to
make the system as a whole simpler and more consistent.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-01 09:44:09 +01:00
Flavio Ceolin ed7fb7548f tests: hwinfo: Fix invalid assertion
The return of hwinfo_get_device_id is a signed size and it returns a
negative number in case of error. This test was using an unsigned
variable invalidating the errror check.

CID 190929

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:41:48 +01:00
Andy Ross fc3ca95ba7 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 2 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>
2019-02-28 12:47:12 -08:00
Ioannis Glaropoulos ca3b6c680f tests: kernel: fatal: remove #ifdefs for ARM platforms
This commit removes the #ifdefs for ARM platforms in
tests/kernel/fatal/main.c, as all the tests suite can be
executed for platforms supporting the ARM and the NXP MPU.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Andy Ross 3f4aa6316c tests/kernel/sched/schedule_api: Restore spinning for timer alignment
Commit 0cc362f873 ("tests/kernel: Simplify timer spinning") was
added to work around a qemu bug with dropped interrupts on x86_64.
But it turns out that the tick alignment that the original
implementation provided (fundamentally, it spins waiting on the timer
driver to report tick changes) was needed for correct operation on
nRF52.

The effectively revert that commit (and refactors all the spinning
into a single utility) and replaces it with a workaround targeted to
qemu on x86_64 only.  Fixes #11721

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 13:06:48 -06:00
Andy Ross a334ac2045 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 1 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>
2019-02-28 13:02:20 -06:00
Andy Ross fe04adf99b lib/os: Conditionally eliminate alloca/VLA usage
MISRA rules (see #9892) forbid alloca() and family, even though those
features can be valuable performance and memory size optimizations
useful to Zephyr.

Introduce a MISRA_SANE kconfig, which when true enables a gcc error
condition whenever a variable length array is used.

When enabled, the mempool code will use a theoretical-maximum array
size on the stack instead of one tailored to the current pool
configuration.

The rbtree code will do similarly, but because the theoretical maximum
is quite a bit larger (236 bytes on 32 bit platforms) the array is
placed into struct rbtree instead so it can live in static data (and
also so I don't have to go and retune all the test stack sizes!).
Current code only uses at most two of these (one in the scheduler when
SCHED_SCALABLE is selected, and one for dynamic kernel objects when
USERSPACE and DYNAMIC_OBJECTS are set).

This tunable is false by default, but is selected in a single test (a
subcase of tests/kernel/common) for coverage.  Note that the I2C and
SPI subsystems contain uncorrected VLAs, so a few platforms need to be
blacklisted with a filter.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 10:06:35 -08:00
Ioannis Glaropoulos 7926cf24b6 tests: kernel: arm_irq_vector_table: extend the test for nRF9160
This commit extends the arm_irq_vector_table test,
so it can run successfully in nRF9160-based platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos 1e74007606 tests: kernel: arm_irq_vector_table: add clock ISR in the IRQ vector
This commit adds the Clock Control Interrupt Service
Routine into the customized vector table, when building
for nRF52X-based platforms. As a result, the interrupts
generated by the clock control will not interfere with
the test.

Fixes #13823.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos 3dc81a40bc tests: kernel: arm_irq_vector_table: minor typo and style fixes
Minor typo and style fixes in the test logging, stressing
that the test is applicable for Cortex-M MCUs, in general.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos bc902954e4 tests: kernel: arm_irq_vector_table: refactor custom IRQ settings
In order to make this test easy to extend for additional
Cortex-M-based platforms, we apply the following minor
refactoring to the test:
- we introduce the _ISR_OFFSET macro to denote the offset
  inside the interrupts' vector table (starting from IRQ
  line 0) of the first manually installed ISR.
- we move the asserts that ensure the validity of the custom
  vector table to build-time and place them in the beginning
  of the text, outside source code.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Andy Ross a4614372f9 tests: Mass SMP disablement on non-SMP-safe tests
(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>
2019-02-27 14:22:06 -08:00
Savinay Dharmappa ade05335b3 tests: counter: Adapt test for the qmsi rtc driver
The qmsi rtc hardware supports a single alarm only and a fixed top
value, so restructure the counter_basic_api test to skip unsupported
features.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-27 12:33:53 -08:00
Kumar Gala 34a2630141 drivers: gpio: sx1509b: convert to DT_<COMPAT>_<INSTANCE> defines
Convert sx1509b sensor driver to use new defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-27 10:19:30 -06:00
Luiz Augusto von Dentz 46298da104 Bluetooth: Mesh: Use BT_GATT_CCC_MANAGED
This makes use of BT_GATT_CCC_MANAGED so instead of having a custom
attribute which is not managed by stack.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-02-27 10:30:50 +01:00
Savinay Dharmappa f6208622fb boards: x86: quark_d2000_crb: exclude watchdog test case
patch exclude the watchdog test case for quark_d2000_crb
,as it seen that upon watchdog reset the conents of ram are lost.
Hence the existing testcase fails.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-27 00:28:40 -08:00
Cinly Ooi 2810b88971 tests: Enable kernel.device tests for qemu_x86_64
Reworked platform_whitelist to enable the "test kernel.device" for
qemu_x86_64

kernel.device.pm is not yet enabled for qemu_x86_64 because
there is a link error

   undefined symbol `_DEVICE_STRUCT_SIZEOF'
   referenced in expression

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-02-26 22:55:40 -08:00
Kumar Gala c894aa31a6 tests: posix: add newlib cfg option
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>
2019-02-26 11:36:52 -06:00
Andrew Boie feab37096b libc: fix CONFIG_STDOUT_CONSOLE semantics
The intent of this Kconfig is to allow libc stdout
functions like printf() to send their output to the
active console driver instead of discarding it.

This somehow evolved into preferring to use
printf() instead of printk() for all test case output
if enabled. Libc printf() implementation for both
minimal libc and newlib use considerably more stack
space than printk(), with nothing gained by using
them.

Remove all instances where we are conditionally
sending test case output based on this config, enable
it by default, and adjust a few tests that disabled
this because they were blowing stack.

printk() and vprintk() now work as expected for
unit_testing targets, they are just wrappers for
host printf().

Fixes: #13701

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-26 08:00:33 -06:00
Piotr Mienkowski f04a4c9deb power: rename CPU_LPS_n power states
CPU_LPS_n name used to indicate a low power state is cryptic and
incorrect. The low power states act on the whole SoC and not exclusively
on the CPU. This patch renames CPU_LPS_n states to LOW_POWER_n. Also
HAS_ pattern for Kconfig options is used in favor of a non standard
_SUPPORTED. Naming of deep sleep states was adjusted accordingly.

Following is a detailed list of string replacements used:
s/SYS_POWER_STATE_CPU_LPS_(\d)_SUPPORTED/HAS_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_CPU_LPS_(\d)/SYS_POWER_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_DEEP_SLEEP_(\d)_SUPPORTED/HAS_STATE_DEEP_SLEEP_$1/

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-26 02:30:13 +01:00
Piotr Mienkowski c75187587b power: simplify SYS_POWER_*_SUPPORTED Kconfig options
This commit removes dependency on SYS_POWER_LOW_POWER_STATES_SUPPORTED,
SYS_POWER_DEEP_SLEEP_STATES_SUPPORTED Kconfig options. Power management
SYS_POWER_LOW_POWER_STATES, SYS_POWER_DEEP_SLEEP_STATES options depend
now directly on specific power states supported by the given SoC. This
simplifies maintenance of SoC Kconfig files.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-26 02:30:13 +01:00
Ravi kumar Veeramally c4f2ab143d net: tests: Migrate DHCPv4 tests
Migrate DHCPv4 tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-26 02:25:14 +01:00
Daniel Leung 33f57c5971 tests/boards/intel_s1000_crb: fix potential uninit variables
The led_val[] may not be initialized depending on the switch-case.
So set them via default case.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-26 01:44:42 +01:00
Kumar Gala bb6b1918b2 drivers: can: stm32: Cleanup Kconfig enablement
Follow the pattern we have for other peripherals in that if the driver
class (CAN) is enabled than enable the driver for that class
(CAN_STM32).  Also have the STM32 CAN driver depend on being on a STM32
SoC.

Remove setting of CONFIG_CAN_STM32 in any .conf files as it will get set
of CONFIG_CAN is set/enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-25 10:05:21 -06:00
Tavish Naruka df500c164c boards: arm: add Electronut labs papyr (nrf52840_papyr)
Added config for https://docs.electronut.in/papyr/

Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-02-25 13:01:46 +01:00
Jukka Rissanen 23ba884b2b tests: can: Fix name of CAN msg and filter structs
The name of the CAN message and filter was changed so this
needs to be changed too here.

Fixes #13716

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-24 19:00:18 -06:00
Anas Nashif 69b6cc8956 Revert "tests: posix: add newlib cfg option"
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>
2019-02-23 17:15:29 -05:00
Kumar Gala dc39a9adcf tests: posix: add newlib cfg option
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>
2019-02-23 11:42:31 -06:00
Tomasz Bursztyka ca7b3b3703 net/ieee802154: Switch fragmentation support to new net_pkt API
- differentiating actual "fragment" to buffer element from a net_pkt
- instead of copying data (and thus allocating buffer) let's just take
the fragment buffer and put it into result packet.
- fixing compilation issue in relevant test

It's more efficient that way, as we use already allocated fragment
buffer instead of reallocating/deallocating after each fragment
reception.

A possible optimization would be to calculate the actual size + header
difference if only the actual size is close to the target size.
It would avoid to get a dry run of the header decompression for each
fragment received. The difficulty being in finding the sweet spot when
it is relevant to calculate the header difference.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-23 07:44:59 -05:00
Andrew Boie 4ce652e4b2 userspace: remove APP_SHARED_MEM Kconfig
This is an integral part of userspace and cannot be used
on its own. Fold into the main userspace configuration.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-23 07:43:55 -05:00
Anas Nashif e88752f5fe tests: stacks: increase STACK_LEN to 4
Test was failing on nios2 with:

../app/libapp.a(test_stack_contexts.c.obj): in function `tstack_pop':
/home/galak/git/zephyr/tests/kernel/stack/stack_api/src/test_stack_contexts.c:31:
warning: unable to reach (null) (at 0x004002f4) from the global pointer
(at 0x004082fc) because the offset (-32776) is out of the allowed range,
-32678 to 32767

Fixes #13595

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 23:10:22 -05:00
Andrew Boie 45631c30ca tests: stackprot: run in user mode
Ensure that stack canaries work properly in user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 18:50:43 -05:00
Ioannis Glaropoulos 67aee1f1f6 tests: kernel: userspace: fix test for non-secure builds
This commit fixes a test in kernel/mem_protect/userspace,
which was attempting to read from an address that was not
necessarily within the image memory range, causing faults
in ARM TrustZone-enabled builds.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 12:32:26 -06:00
Kumar Gala b730fa4ccb posix_lib: Disable support on native posix arch
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>
2019-02-22 11:55:01 -06:00
Anas Nashif eca2f0768d tests: crypto: increase timeout
Some platforms need more time to complete the tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 11:53:59 -06:00
Anas Nashif ccad9d0d09 tests: move testsuite and configs into subsys/
Move test related code and the testsuite away from tests/ and make it a
proper subsystem.
The way tests were integrate in the tree was not obvious and actual
tests were intermixed with the testsuite code.

This will allow us to have trees with the testcode and without the
samples by just remove the folders tests/ and samples, needed for
isolating actual code from test/sample code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 08:58:40 -05:00
Jukka Rissanen c478b5bb6e can: Rename can_msg and can_msg_filter structs
In order to follow the naming from Linux, change the name of
can_msg to zcan_frame, and can_msg_filter to zcan_filter.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen 14d4023338 tests: can: Add CAN frame struct handling tests
Make sure that can_copy_*() functions work as expected.
These functions are used by SocketCAN support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Andrzej Puzdrowski b1a7e71436 settings: fix base64 encode test
settings_line_len_calc() calculates only setting record
payload size, not record layout in flash size.

this patch remove inadequate test for this function.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Andrzej Puzdrowski 5bc3ad2a1c tests/subsys/settings: fcb unaligned value test
Added test for check whether value lenght is properly
stored for unaligned settings record size.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Nicholas Lowell f288bcaf99 pwm: add set nanosecond period and pulse width function
For improved precision of high speed PWMs, the new
function will allow you to specify period and pulse
at the nanosecond resolution.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2019-02-21 18:07:40 -05:00
Ramakrishna Pallala c69ee89018 tests: posix: Fix array overrun issue
Fix array overrun issue by limiting the array
index to the maximum possible string length.

Coverity CID: 190624

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-02-21 11:53:38 -05:00
Sathish Kuttan 2072fbdaf8 tests: intel_s1000: cache flush/invalidate tests
Added tests for data cache invalidation and flush

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-20 07:33:11 -05:00
Krzysztof Chruscinski a64b0fe1e3 shell: Deprecate macros for subcommands creation
Macros are replaced by C++ friendly versions:
- SHELL_CREATE_STATIC_SUBCMD_SET by SHELL_STATIC_SUBCMD_SET_CREATE
- SHELL_CREATE_DYNAMIC_CMD by SHELL_DYNAMIC_CMD_CREATE

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Paul Sokolovsky 49341e0065 tests: socket: Add test for getnameinfo()
Basic test for IPv4/IPv6 addresses conversion.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-19 17:34:57 -05:00
Piotr Zięcik 81c1d37c89 test: kernel: device.pm: Do not enable system-level PM. It is not used.
This commit disables system-level power management in the device power
management test as it is not used.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-19 13:25:36 -05:00
Piotr Zięcik 63b0df645e power: Clean up power state names
Some of power states used numerical suffix while otthers not.
This commit adds proper suffix to all power state names.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>

f
2019-02-19 13:25:36 -05:00
Piotr Zięcik c45961daae power: Rework OS <-> Application interface
This commit simplifies OS <-> Application interface controlling power
management. In the previous approach application-based PM required
overriding sys_suspend() and sys_resume() functions. As these functions
actually implemented power state change, in such case application
basically had to provide own implementation of all PM-related stuff,
which was not portable and hard to maintain.

This commit changes this scheme: The sys_suspend() and sys_resume()
are now system functions while the application could either use
built-in power management policies or provide its own. All details
of power mode switching are now handled by the OS.

Also, this commit cleans up the Kconfig options related to system-level
power management grouping them under common CONFIG_SYS_PM_ prefix.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-19 13:25:36 -05:00
Anas Nashif 04743c9a79 posix: rename priority in sched_param struct
Priority member in the sched_param struct should be named
sched_priority.

Fixes #13470

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-19 11:24:45 -05:00
Jukka Rissanen d4d61895b8 tests: net: ipv6_fragment: Fix interface index values
The test needs to use interface index starting from 1.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Jukka Rissanen 299832738e tests: net: ip-addr: Fix interface index values
The test needs to use interface index starting from 1.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Jukka Rissanen 3043b50403 tests: net: dns: Fix test as the interface index starts from 1
The test was using index 0 which is no longer correct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Kumar Gala 64be8d3283 tests: mem_alloc: Fix build issue with malloc test
Since malloc takes a size_t, we should use 0x7fffffff as the max size
(ie what the larget unsigned int) would normall be.  Newer newlib's have
a check that will fail building since 0xf0000000 exceeds the size.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-16 09:23:16 -06:00
Johan Hedberg 3d53ee9a39 tests: bluetooth/mesh_shell: Fine-tune config for lower RAM footprint
This app was supposed to have userspace disabled, but it kept on being
forced on by CONFIG_TEST_USERSPACE (which in turn gets enabled by
CONFIG_TEST).

Also lower the shell stack size since stack analysis shows over 700
bytes being unused.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-02-15 18:49:14 -05:00
Wolfgang Puffitsch 3f4a64cd4e tests: bsim_bt: Extend connection test case.
Change connection parameters and channel map after connection is
established. Test encrypted connection also with split stack. Tighten
pass/fail criteria.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch 4464029fb1 tests: bsim_bt: Make peripheral role part of test case.
Make peripheral role part of test case to build it with
split/non-split stack.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch 5a49a0aa1f tests: bsim_bt: Replace ad_parse function with bt_data_parse.
Use shared function, aligning with code in central_hr sample.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Andrew Boie 4ae33f0b55 tests: fatal: refactor and add user mode tests
We weren't testing whether stack overflows in user mode
were correctly reported.

A more aggressive stack overflow logic is enabled if
HW-based stack overflow detection is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 09:48:37 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Andrew Boie 2cfeba8507 x86: implement interrupt stack trampoline
Upon hard/soft irq or exception entry/exit, handle transitions
off or onto the trampoline stack, which is the only stack that
can be used on the kernel side when the shadow page table
is active. We swap page tables when on this stack.

Adjustments to page tables are now as follows:

- Any adjustments for stack memory access now are always done
  to the user page tables

- Any adjustments for memory domains are now always done to
  the user page tables

- With KPTI, resetting a page now clears the present bit

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie f093285345 x86: modify MMU APIs for multiple page tables
Current set of APIs and macros assumed that only one set
of page tables would ever be in use.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Krzysztof Chruscinski c73dc42a82 tests: drivers: counter: Test cleanup
Minor cleanup in counter test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-13 18:15:56 -05:00
Krzysztof Chruscinski 849726b3e4 tests: drivers: counter: Fix single_shot_alarm_top and multiple_alarms
Tests were failing because:

1. `alarm_cnt` was not reset before the test.
2. one test was failing because it was expecting that setting
`top_value` for channel_alarm is too high value but in fact
it is accepted and `top_value+1` is too much.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-13 18:15:56 -05:00
Ryan Erickson cb516b4bc9 tests: drivers: adc: adc_api: Add BL654 board support
Add case to support the BL654 DVK board.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdtech.com>
2019-02-13 11:02:56 -06:00
Kumar Gala a6eab1be4b tests: spi_loopback: reduce footprint by tweaking logging
Using CONFIG_LOG_IMMEDIATE gives us some flash back.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-13 08:15:37 -06:00
Anas Nashif 054e1bec2d tests: adc: reduce footprint by tweaking logging
Using CONFIG_LOG_IMMEDIATE gives us some flash back.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-12 23:38:55 -05:00
Ryan Erickson 90d1e6f6c6 tests: drivers: adc: adc_api: Add BL652 board support
Add case to support the BL652 DVK board.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdtech.com>
2019-02-12 21:16:26 -05:00
Tomasz Bursztyka 2b22b71e42 net/pkt: Remove useless legacy net_frag_linearize function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka bc5411816a net/pkt: Remove useless legacy net_pkt_append_memset function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 1fab039102 net/pkt: Remove useless legacy net_pkt_split function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 09b782a82d net/pkt: Remove useless legacy net_pkt_pull function
Now that the stack uses the new API from net_pkt for pulling, no need
to keep the legacy one around.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka c65304f088 net/pkt: Rename net_pkt_copy_new to net_pkt_copy
Now that legacy net_pkt_clone function has been removed, the new
function can be renamed accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 895c8eb0e3 net/pkt: Remove useless legacy net_pkt_copy/_all functions
Now that the stack uses the new API from net_pkt for copying, no need
to keep the legacy one around.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 38a3e79f9b net/pkt: Rename net_pkt_clone_new to net_pkt_clone
Now that legacy net_pkt_clone function has been removed, the new
function can be renamed accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka a6426620da net/private: Rename net_hexdump_frags to net_pkt_hexdump
And remove the parameter "full" as there is no "ll reserve" distinction
anymore. The parameter was unused since the ll reserve concept removal.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 909eb7271a net/udp: Remove net_pkt_udp_data() function
It is now useless and can be replaced by net_udp_get_hdr() directly, in
the 2 unit tests it was used.

Removing as well the dbg function too_short_msg()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 8ceedafdc4 net/udp: Switch net_udp_get/set_hdr to new net_pkt API
Let's use the new API for these 2 functions. Note that in some places,
using these functions is under-optimized (like in llmnr-responder in
dns: it gets the ip/udp headers already from the recv callback. That
will need to be taken care of later).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 674d7c47b4 net/udp: Remove useless net_udp_set_chksum
It was only used in ipv6_fragment unit test and could be easily
replaced.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka d8624513e6 net/icmp: Remove useless icmp functions using legacy net_pkt API
net_pkt_icmp_data was only used in ipv6 unit test and could be easily
replaced.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 04966ac10d net/tcp: Remove useless tcp function using legacy net_pkt API
net_pkt_tcp_data was only used in tcp unit test and could be replaced by
local net_tcp_get_hdr.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka fd1401495b net/tcp: Move net_tcp_set_hdr() away from net core
Only the unit test needs it now, so let's move it there.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 1a54cabe5e net/ipv4: Rename net_ipv4_finalize since legacy version disappeared
s/net_ipv4_finalize_new/net_ipv4_finalize

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 0c80a84bc7 net/ipv6: Rename net_ipv6_finalize since legacy version disappeared
s/net_ipv6_finalize_new/net_ipv6_finalize

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka b93df74fa2 net/context: Let's use the new net_ipv4_finalize
And removing the legacy and unused one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 31a079023f net/context: Let's use the new net_ipv6_finalize
And removing the legacy and unused one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 78198810ac net/tcp: Move net_tcp_get_hdr() away from net core
Only the unit test needs it now, so let's move it there.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 024a7e0502 net/sockets: Adapt net_pkt_get_src_addr to new net_pkt API
This function is only used in sockets, thus making it a private function
of socket library and renaming it relevantly.

Note that sockets should be reviewed at some point to avoid using such
function: zsock_received_cb() already get the ip header and the protocol
header, so it could grab the src addr/port from there. It would be way
more optimized to do so, since net_pkt_get_src_addr is costly as it
parses all over again the ip/protocol headers.

utils unit test is updated and the test of the former
net_pkt_get_src_addr/net_pkt_get_dst_addr are removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Kumar Gala 1f59e9e825 tests: kernel: gen_isr_table: Exclude platforms test isnt valid on
The test assumes that the last to IRQ number will be free, this isn't a
valid assumption and now that we detect multiple ISRs registering for
the some IRQ line, we see failures because of this assumption on some
platforms.  Exclude those platforms from this test for the time being.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-12 15:35:29 -05:00
Alexander Wachter 548f1f1fff tests: drivers: Add aditional tests for stm32 CAN driver
This commit adds specific stm32 CAN driver testing.
The test covers filter handling.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Alexander Wachter 241f945e49 tests: drivers: Add basic tests for CAN driver
This commit adds basic test for the CAN driver and API.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Krzysztof Chruscinski b44e06ea5b tests: subsys: logging: Enable log_core test on nios2
Nios2 platform was disabled due to compilation error. Meanwhile,
issue has been solved and tests can be re-enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-12 07:51:50 -05:00
Andrei Emeltchenko 030f06ae7b tests: usb: Use UTIL_LISTIFY macros
macros allows to define variable number of instances.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-12 07:49:04 -05:00
Piotr Zięcik 7a49356c77 power: Fix naming of Kconfig options controlling low power states
The SYS_POWER_LOW_POWER_STATE_SUPPORTED and SYS_POWER_LOW_POWER_STATE
suggests one low power state but these options control multiple
low power state. This commit uses plural in the names to indicate
that.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-12 07:46:32 -05:00
Kumar Gala 658186bb50 tests: i2c: i2c_slave_api: Remove dead Kconfig symbols from conf file
The following symbols don't exist so remove them from prj_virtual.conf:
	CONFIG_I2C_EEPROM_SLAVE_0_CONTROLLER_DEV_NAME
	CONFIG_I2C_EEPROM_SLAVE_1_CONTROLLER_DEV_NAME

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-11 22:29:58 -05:00
Alberto Escolar Piedras ee3403af3e test: Kconfig: Correct HAS_COVERAGE_SUPPORT description
HAS_COVERAGE_SUPPORT can be set both on boards with enough RAM to
store the coverage results, or for POSIX ARCH based ones

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-11 11:38:15 -06:00
Andrei Emeltchenko a4e950a276 tests: util: Add UTIL_LISTIFY tests
Add tests for UTIL_LISTIFY macro.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-11 09:28:14 -05:00
Andrei Emeltchenko a3ea6a5a6d tests: util: Correct test name
Trivial syntax fix.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-11 09:28:14 -05:00
Sathish Kuttan 45fdffe620 tests: intel_s1000: use I2C device name directly
Since this is a test dedicated to Intel S1000 CRB,
use the I2C0 device name directly instead of a Device Tree or
Kconfig defined device name.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-10 15:06:39 -05:00
Sathish Kuttan e28c1e7f81 tests: intel_s1000: I2S test update
Update I2S tests according to i2s_cavs implementation
- Removed ping-pong tests
- Added bidirectional transfer tests

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-10 15:06:39 -05:00
Sathish Kuttan 0cd56fe195 tests: intel_s1000: DMA test update
Update DMA tests according to dma_cavs implementation of
single block transfers. Multiple block transfers are achieved
by reloading DMA upon every DMA completion.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-10 15:06:39 -05:00
Kumar Gala 2508818bc3 tests: fs: nffs_fs_api: Convert FLASH_AREA to DT_FLASH_AREA
Use DT_FLASH_AREA prefixed defined instead of FLASH_AREA as the non-DT
version is deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 1b2496866c tests: fs: multi-fs: Convert FLASH_AREA to DT_FLASH_AREA
Use DT_FLASH_AREA prefixed defined instead of FLASH_AREA as the non-DT
version is deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 7731732160 tests: drivers: counter_basic_api: Convert to use DT_ prefixed defines
The code has been using non DT_ prefixed defines for DT generated
defines.  Switch to use DT_ prefixed ones as we want to deprecated
the non DT_ prefixed defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 16:03:17 -06:00
David Brown f8b838d404 jwt: Add JSON web token library
This patch adds a JSON web token library that adds the capability
to sign JSON tokens.  This was located in subsys due to the dependency
on MBEDTLS, which resides in /ext.

Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2019-02-08 15:32:58 -06:00
Armando Visconti 208f565bce driver/sensor: add LIS2DW12 sensor support
Add support to STM LIS2DW12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.

Co-authored-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-08 15:22:42 -06:00
Andy Ross d653e6868e tests/kernel/schedule_api: Bump stack size and unify stacks
The new spinlock validation features combined with spinlockification
have increased stack usage a bit in CONFIG_ASSERT builds, but this is
a good feature we want to keep.  This test was bumping into limits, so
increase the size from 512 to 640 bytes.

Unfortunately, this is also a huge test that creates a LOT of those
stacks across different test cases, so that minor bump blows us past
the 64k SRAM limit on a bunch of boards.  So unify all those stacks
that are only ever used in one case at a time so the memory can be
shared.  Now there's one fixed stack, named "tstack", and one array
"tstacks".  Much smaller.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -05:00
Andy Ross 1bf9bd04b1 kernel: Add _unlocked() variant to context switch primitives
These functions, for good design reason, take a locking key to
atomically release along with the context swtich.  But there's still a
common pattern in code to do a switch unconditionally by passing
irq_lock() directly.  On SMP that's a little hurtful as it spams the
global lock.  Provide an _unlocked() variant for
_Swap/_reschedule/_pend_curr for simplicity and efficiency.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -05:00
Andy Ross ec554f44d9 kernel: Split reschdule & pend into irq/spin lock versions
Just like with _Swap(), we need two variants of these utilities which
can atomically release a lock and context switch.  The naming shifts
(for byte count reasons) to _reschedule/_pend_curr, and both have an
_irqlock variant which takes the traditional locking.

Just refactoring.  No logic changes.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -05:00
Andy Ross aa6e21c24c kernel: Split _Swap() API into irqlock and spinlock variants
We want a _Swap() variant that can atomically release/restore a
spinlock state in addition to the legacy irqlock.  The function as it
was is now named "_Swap_irqlock()", while _Swap() now refers to a
spinlock and takes two arguments.  The former will be going away once
existing users (not that many!  Swap() is an internal API, and the
long port away from legacy irqlocking is going to be happening mostly
in drivers) are ported to spinlocks.

Obviously on uniprocessor setups, these produce identical code.  But
SMP requires that the correct API be used to maintain the global lock.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -05:00
Paul Sokolovsky 55ba23ed03 tests: posix: fs: Decrease ramdisk size, increase stack size
This test seems to be fine in the current master, but doing
development, it easily starts to overflow RAM of some boards and/or
crash due to stack checks. So, decrease the ramdisk (the biggest
eater of RAM here) from default 96K to 80K, and bump main stack
size proactively.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-08 12:07:53 -05:00
Carlos Stuart ae07bd4725 tests: cmsis_rtos_v2: Join and detach tests
Implemented tests for the new join and detach features.

 - The first tests multiple join operations.
 - The second tests trying to join a detached thread.
 - The third tests abandoning a join when the thread is detached after
creation.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-08 11:59:38 -05:00
Andrei Emeltchenko 78f81fb3be tests: hid: Use HID Device interface
Use new HID Device interface for tests/boards/intel_s1000_crb

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-08 11:23:04 -05:00
Luiz Augusto von Dentz a3bca71a5e Bluetooth: GATT: Implement Database Hash
This implements the Database Hash characteristic which generates a hash
with the contents of certain attributes. The generation of hash is
usually offloaded to the systemwq using a delayed work so that when
application register multiple services only one hash needs to be
calculated.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-02-08 18:07:34 +02:00
Findlay Feng 2d2e1614b5 dfu/flash_img: use flash_map instead of flash API
Patch introduces flash_map subsystem to operate on flash
image instead of direct operation using flash_driver API.
Changes allows to support operation on the image in any flash
device.

flash_map was not available when this subsystem was introduced.

Signed-off-by: Findlay Feng <i@fengch.me>
2019-02-08 09:13:09 -06:00
Findlay Feng 04bf2e1bd1 dfu/mcuboot: use flash_map instead of flash API
Patch introduces flash_map subsystem to operate on flash
footprint instead of direct operation using flash_driver API.
Flash area ID is used in API instead of direct flash-bank-offsets.
Changes allows to support operation on the partition in any flash
device.

flash_map was not available when this subsystem was introduced.

Signed-off-by: Findlay Feng <i@fengch.me>
2019-02-08 09:13:09 -06:00
Piotr Zięcik d02e3ebd4c power: Eliminate SYS_PM_* power states.
The power management framework used two different abstractions
to describe power states. The SYS_PM_* given coarse information
what kind of power state (low power or deep sleep) was used,
while the SYS_POWER_STATE_* abstraction provided information
about particular power mode.

This commit removes the SYS_PM_* abstraction as the same
information is already carried in SYS_POWER_STATE_*.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-08 09:07:00 -05:00
Savinay Dharmappa f2f049d891 tests: drivers: counter: Enable tests
patch enables tests for qmsi counters and rtc.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-08 08:56:45 -05:00
Andrei Emeltchenko 43d7c5bd2c tests: usb: Add more basic device API tests
Add more tests testing basic API and native_posix driver.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-08 07:56:24 -05:00
Andrei Emeltchenko 9832f1c1cb tests: device: Remove wpanusb mentions from the test
Remove wpanusb prefixes for the test to be more generic.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-08 07:56:24 -05:00
Andrei Emeltchenko 0c1f8eb28d teste: desc_sections: Add simple test
Add one more simple test.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-08 07:56:24 -05:00
Aurelien Jarno 41cdfd5920 tests: Add sam_e70_xplained config in pwm_api
Default to the PWM0 channel 2, as it is the only one available in a
non-inverted form on the EXT1 and EXT2 connectors. That way the measured
voltages match the expected ones.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 06:55:14 -06:00
Jukka Rissanen 8de351c45f tests: net: ipv6: Fix the DAD failure in the test
The DAD was failing because we received the DAD network packet
even when should not had received it. Fix it by discarding all
the ICMPv6 NS packets that we receive.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-08 14:24:03 +02:00
Tomasz Bursztyka 499ffd6573 net/ethernet: Remove inserted L2 header buffer
The packet can be referenced somewhere else and letting the newly added
L2 header will generate corrupt packet. If the same packet is being
resent, ethernet will add again its L2 header. Thus the need to remove
such L2 header every time a packet has been sent, successfully or not.

Fixes #12560

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-08 14:24:03 +02:00
Andrew Boie 41f6011c36 userspace: remove APPLICATION_MEMORY feature
This was never a long-term solution, more of a gross hack
to get test cases working until we could figure out a good
end-to-end solution for memory domains that generated
appropriate linker sections. Now that we have this with
the app shared memory feature, and have converted all tests
to remove it, delete this feature.

To date all userspace APIs have been tagged as 'experimental'
which sidesteps deprecation policies.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie 525065dd8b tests: convert to use app shared memory
CONFIG_APPLICATION_MEMORY was a stopgap feature that is
being removed from the kernel. Convert tests and samples
to use the application shared memory feature instead,
in most cases using the domain set up by ztest.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie 4b4f773484 libc: set up memory partitions
* Newlib now defines a special z_newlib_partition containing
  all globals relevant to newlib. Most of these are in libc.a
  with a heap tracking variable in newlib's hooks.

* Both C libraries now expose a k_mem_partition containing the
  bounds of the malloc heap arena. Threads that want to use
  libc malloc() will need to add this to their memory domain.

* z_newlib_get_heap_bounds has been removed, in favor of the
  memory partition for the heap arena

* ztest now includes the C library partitions in its memory
  domain.

* The mem_alloc test now runs in user mode to prove that this
  all works for both C libraries.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie a4c28f70bf ztest: setup a default app memory domain
If CONFIG_APP_SHARED_MEM is enabled, ztest will set up a
default memory domain with a single partition on startup.
Test case globals may be added to the partition via
ZTEST_BMEM/ZTEST_DMEM macros, add their own partitions,
or leave the domain and join another one.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie 84c808918b tests: set CONFIG_MAX_THREAD_BYTES for a few tests
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>
2019-02-08 07:04:30 -05:00
Andrew Boie 62a6f87139 tests: remove app_memory test
CONFIG_APPLICATION_MEMORY is being removed from
Zephyr.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie 889b2377ef tests: userspace: remove extra_sections
This is unnecessary.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie 8bfd8457ea tests: mem_protect: fix Kconfig
We want CONFIG_APPLICATION_MEMORY specifically disabled
for this test, but it was being transitively selected by
CONFIG_TEST_USERSPACE which defaults to on for CONFIG_TEST.

Turn it off so that disabling application memory in the
config actually has an effect.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrei Gansari 0730ab8bef tests: CONFIG_NET* fixup
Fixed typo: CONFIG_NET_NET_PKT_LOG_LEVEL_DBG, removed extra _NET.
Removed debug macro CONFIG_NET_DEBUG_NET_PKT that is not used.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Piotr Mienkowski 8a86b5aaac api: counter: rename counter_disable_channel_alarm()
The function to set channel alarm is called counter_set_channel_alarm.
To match the name of the function performing the reverse operation this
commit renames counter_disable_channel_alarm() function to
counter_cancel_channel_alarm().

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-08 10:47:40 +01:00
Paul Sokolovsky 36e437f537 tests: socket: misc: Add test for gethostname()
Just a basic test.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-08 10:39:30 +02:00
Peter A. Bigot d080d1d791 tests: gpio: basic_api: correct constant test for interrupt trigger
Interrupts default to trigger on level for historical reasons, so use of
GPIO_INT_LEVEL` as a mask results in a zero value.  Use a mask macro to
isolate the trigger configuration.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:46:37 -06:00
Anas Nashif 74c573635f samples/tests: filter based on toolchain features
Do not run with toolchains that do not support newlib.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 22:46:10 -06:00
Erwan Gouriou 2cefc60973 tests: counter: Update to support STM32 RTC counter
Update counter_basic_api test to support STM32 RTC counter.
Add device to list and skipp not supported test cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-07 16:14:00 -05:00
Erwan Gouriou 50da5bb214 tests/drivers: counter: bump cmake minimum version
counter_basic_api test is cmake outdated.
Set it to newest version.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-07 16:14:00 -05:00
Kumar Gala 7809970c8a drivers: counter: cmsdk: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cmsdk driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 16:14:00 -05:00
Kumar Gala c2a04890d9 tests: counter_basic_api: Enable tests for ARM CMSDK drivers
Enable testing of counter (COUNTER_{D}TMR_CMSDK) on mps2_an385 and
enable timers on v2m_beetle (TIMER_{D}TMR_CMSDK).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 16:14:00 -05:00
Maureen Helm 210a71f108 tests: counter: Enable debug logging
Enables debug logging in the counter_basic_api test. Fixes a build error
in the nrf counter drivers when logging is enabled.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-07 16:14:00 -05:00
Maureen Helm 8226862991 tests: counter: Adapt test for the mcux rtc driver
The mcux rtc hardware supports a single alarm only and a fixed top
value, so restructure the counter_basic_api test to skip unsupported
features.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-07 16:14:00 -05:00
Stanislav Poboril 9b72f66070 tests: drivers: counter: Enabled counter tests on UDOO Neo board
Tests i.MX EPIT timer peripheral driver. Since it supports zero number
of channel alarms, some tests had to be adjusted to look at the
number of channel alarms supported first.

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 708f08a4be drivers: counter: Rename wrap to top_value
Renamed:
- counter_set_wrap to counter_set_top_value
- counter_get_wrap to counter_get_top_value
- counter_get_max_wrap to counter_get_max_top_value

Updated nRF implementations and counter test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski b745355315 drivers: counter: Add user_data to alarm callback
Modify alarm callback to return user_data and channel_id.
Set_alarm and disable_alarm updated accordingly. Renamed
counter_*_ch_alarm to counter_*_channel_alarm. Updated test
and nrf implementations.

Updated doxygen comments.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski b969f40e9d tests: drivers: counter: Fix tests for nrf peripherals
Test was not aligned with changes in the API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Peter A. Bigot 889a55c86a drivers: counter: nrf: make name configuration consistent
Using `COUNTER_2_NAME` when all other properties are
`COUNTER_TIMER2_foo` is confusing.  Make the names consistent.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 16:14:00 -05:00
Peter A. Bigot 6b0e8cd879 tests: drivers: counter: improve comments on reserved instances
RTC1 (not RTC0) is excluded because it is used as the system clock.

Also document that TIMER0 and RTC0 may be rejected when CONFIG_BT_LL_SW
is enabled.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 16:14:00 -05:00
Anas Nashif 887c4ad923 tests: remove aon_counter test
This is now covered by counter API.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 549341307b tests: drivers: counter: Add tests for counter driver
Add test suite which covers main functionality of counter driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Kumar Gala 5ef93aa639 tests: kernel: interrupt: Exclude platforms test isnt valid on
The test assumes that the last to IRQ numbers will be free, this isn't a
valid assumption and now that we detect multiple ISRs registering for
the some IRQ line, we see failures because of this assumption on some
platforms.  Exclude those platforms from this test for the time being.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 15:58:43 -05:00
Kumar Gala b89a808b26 tests: subsys: settings: Use DT_FLASH_AREA_<FOO>_ID define
Set Kconfig symbol SETTINGS_FCB_FLASH_AREA based on the
DT_FLASH_AREA_<FOO>_ID define instead of being hard coded.

We replace 3 with DT_FLASH_AREA_IMAGE_SCRATCH_ID and
we replace 4 with DT_FLASH_AREA_STORAGE_ID.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 10:31:27 -06:00
Kumar Gala 25eae07217 tests: subsys: fs: fcb: Use DT_FLASH_AREA_<FOO>_ID define
Rather than using hard coded 2, use DT_FLASH_AREA_IMAGE_1_ID
that is now generated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 10:31:27 -06:00
Kumar Gala 4d38160013 tests: boards: intel_s1000_crb: Use DT_FLASH_AREA_<FOO>_ID define
Rather than using hard coded 3, use DT_FLASH_AREA_IMAGE_SCRATCH_ID
that is now generated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 10:31:27 -06:00
Andrzej Puzdrowski ee5106e3d3 tests/subsys/storage/flash_map: use auto-generated fa ID
After addition of flash_map auto-generation it is needed to
use generated flas_area name instead of hard-code.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 10:31:27 -06:00
Jukka Rissanen 85c8c0fe3c tests: net: context: Fix invalid address family test
The test had hard coded address family with value 4. This test
was failing as we have now AF_CAN family with value 4. Use 99
as an invalid address family value instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-07 18:08:27 +02:00
Ravi kumar Veeramally f0fb82dce9 net: ip: Add protocol family type to conn handler
As we are adding more protocol families and protocol types
to connection handlers, some values might be same across
different types. Current connection handler only stores
proto type to match the handler, which is not enough if
we add more types. Also combination of family and types
may vary too. So adding family to connection handler to
figure out best match.

Also changing proto variable in net_conn from u8_t to u16_t.
net_context has 16 bit proto.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-07 14:43:30 +02:00
Andrei Emeltchenko 5b3bd4e099 tests: usb: Include desc_sections test for native_posix
After including native_posix USB controller we can perform some simple
tests on native_posix.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-06 17:53:04 -05:00
Carlos Stuart c6375729ff tests: cmsis_rtos_v2: Dynamic thread stack tests
Added a set of tests that use the default thread stacks to ensure they
work the same as the passed in stacks. Abstracted the common
functionality into functions.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-06 10:20:17 -05:00
Carlos Stuart db24367652 tests: cmsis_rtos_v2: Dynamic memory pool tests
Implemented a second set of memory pool tests that function on a
dynamically allocated memory pool. Abstracted some of the common
functionality to a common function.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-06 10:20:17 -05:00
Carlos Stuart b484884c1e tests: cmsis_rtos_v2: Uncrustify source files
Ran uncrustify on all test source files to ensure a compliant base to
work from.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-06 10:20:17 -05:00
Anas Nashif 177df596d3 tests: irq_offload: remove irq_offload test
This is now part of kernel/common.
Forgot to remove it in d0bcf27eab

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-06 10:10:42 -05:00
Andrew Boie 2d9bbdf5f3 x86: remove support for non-PAE page tables
PAE tables introduce the NX bit which is very desirable
from a security perspetive, back in 1995.

PAE tables are larger, but we are not targeting x86 memory
protection for RAM constrained devices.

Remove the old style 32-bit tables to make the x86 port
easier to maintain.

Renamed some verbosely named data structures, and fixed
incorrect number of entries for the page directory
pointer table.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-05 20:51:21 -08:00
Anas Nashif a463625b76 tests: benchmarks: remove footprint tests
Those are outdated and unrunnable tests that require lots of
customization to keep them building and the information they provide
can't be retrieved in other means.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00
Anas Nashif d0bcf27eab tests: common: move irq_offload test to common
This is a small test that can be easily integrated into the common set
of tests we have already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00
Anas Nashif d35f1150f3 tests: common: move boot_delay test to common
This is a small test that can be easily integrated into the common set
of tests we have already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00
Anas Nashif 3f27247617 tests: common: move errno test to common
This is a small test that can be easily integrated into the common set
of tests we have already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00
Peter A. Bigot d75495709d drivers: gpio: fix mis-use of slist API in callback processing
The iterator over registered callbacks failed to account for the
possibility that the callback would remove itself from the list.  If
this occurred any remaining callbacks would no longer be reachable from
the node.  Switch to the slist iterator that is safe for self-removal.

Note that the slist API remains unsafe for removal of subsequent nodes.
Even with the corrected code removal of the next callback registration
(cached in tmp) will result in it being called anyway, with the
remaining unremoved registrations not being called.  If the next
callback were removed and re-registered on a different device, the
callbacks would be invoked for the wrong device.

Resolve this by a documentation change describing the conditions under
which a change to callback registration from within a callback are
permitted.  Add a similar note regarding the effect of adding a
callback.  The current event invocation behavior for callbacks added
within an event is explicitly left unspecified, though in the current
slist implementation newly added callbacks will not be invoked until the
next event.

Closes #10186

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-05 12:33:25 -06:00
Robert Lubos 418b9236fa net: lib: mqtt: Get rid of _sock suffix
As the legacy library has been removed, we no longer need to
differentiate betwen MQTT implementations. Therefore align the library
folder name with other libraries and remove the `_sock` suffix.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-02-05 11:05:26 -05:00
Vinayak Kariappa Chettimada e85571da28 Bluetooth: tests: Include building mesh ext. in CI
Include the HCI Mesh Extension implementation to be built in
CI. Note, mesh extension implementation is work in progress,
and will be continues in new LL split architecture
implementations.

Note, HCI Mesh extensions not supported in ULL/LLL arch yet,
hence disabled. Also, only a partial implementation present
in the old architecture.

Relates to #12860.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-02-05 15:00:08 +01:00
Vinayak Kariappa Chettimada d04d852db3 Bluetooth: tests : Include building the LL split with debug options
Include building the init tests with the new Link Layer
split architecture and with debug options to cover
possible conditional compilations.

Relates to #12860.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-02-05 15:00:08 +01:00
Anas Nashif 58632f8da7 doc: change board dts documentation with new URLs
flash-partitions page has moved...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 07:04:40 -05:00
Ioannis Glaropoulos 2782a00a00 tests: kernel: interrupt: group IRQ line number selection together
This commit moves the definition of IRQ_LINE(..) macro from
interrupt.h into nested_irq.c, and adds some inline comments
documenting the use of it.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-04 20:50:59 -05:00
Anas Nashif 8b8461dc35 tests: board_shell: add flash support
Enable Flash shell in the generic board_shell test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 17:55:40 -05:00
Anas Nashif 63260bf6cf drivers: gpio: enable gpio_shell in board_shell
Enable the GPIO shell in board_shell rathe the shell sample.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 17:55:40 -05:00
Ravi kumar Veeramally 1e47f26d1c net: coap: Remove legacy CoAP implementation
As we are removing net_app and net_pkt based libraries and
applications, CoAP legacy based libraries and apps are moved
to socket based implementations. So removing legacy CoAP.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-04 16:49:59 -05:00
Paul Sokolovsky 92962ddc5e tests: socket: poll, select: Fix non-blocking timing tests
As written originally, the tests assumed that if k_uptime_get_32()
returns times in milliseconds, that it also has millisecond
resolution. That however doesn't have to be the case, and indeed,
default timer interrupt period used by Zephyr is 10ms, and so system
time is incremented in such units. So, instead of "<= 1" tests to
account for timing increment, use "<= FUZZ".

For blocking tests, increase the timeout from previously used 10ms,
so we can reliably tests delays under the conditions described.

Also, enable CONFIG_QEMU_TICKLESS_WORKAROUND. Most other
timing-related tests have this enabled, and it may affect
stability of QEMU testing too.

Fixes: #12994

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-04 15:31:10 -05:00
Alexander Wachter 7b1e9e9b34 drivers: hwinfo: Add shell command for device id
This commit adds support for device id shell command.
Example:
uart:~$ hwinfo devid
Length: 12
ID: 0x1b0320d51485330313420

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-04 14:53:50 -05:00
Tomasz Bursztyka 968d423a44 net/pkt: Allocate relevant size on AF_UNSPEC
In case of Ethernet, if the requested size is larger than MTU and if
AF_UNSPEC is provided, the allocator will need to take into account
the ethernet header size which is not accounted in the MTU.

Other current L2 do not follow that rule as their MTU is based on IP
one (IPv6 most of the time). What they declare as MTU is the full frame
size they handle (minus the FCS for instance in 15.4). So with
AF_UNSPEC, such assumption on L2 header size is unrelevant.
(On 15.4 the header size is variable anyway and cannot be known until
the frame is parsed).

Fixes #12982

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-04 17:15:52 +02:00
Anas Nashif aecf90844c tests: intel_s1000: fixed test to use new DT defines
The label of this driver has changed recently.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 08:00:30 -05:00
Alexander Wachter be1c18d02c tests: drivers: Add basic tests for hwinfo_get_device_id API
This commit adds basic tests for device_uid_get API

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-03 12:07:20 -05:00
Andy Ross 54dd1a3cf1 tests/threads/thread_apis: Add test for CPU mask API
Very simple test for thread CPU masks.  While this is a SMP feature,
the implementation doesn't actually depend on SMP so we can test it
right here in the thread_apis test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-01 21:37:24 -05:00
Erwan Gouriou 54d27263fc tests: watchdog: Update test to support drivers with no callback
STM32 watchdog driver does not support callback which is not expected
by the test. Update to make test able to run on STM32 drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-01 19:16:59 -05:00
Andrei Emeltchenko bf9c6d72e8 usb: Add instance parameter to descriptors definitions
This allows to place instances of the class one after another in the
linker section.

Fixes #12908

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:11:32 -05:00
Andrei Emeltchenko a49125ca90 tests: usb: Test USB data allocations in sections
USB relies on descriptors and configuration data allocations in
specific sections. This simple test verifies that at least size of the
data is correct.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:11:32 -05:00
Andrei Emeltchenko b483804c75 usb: tests: Add basic unit test for USB drivers
Add basic tests testing simple endpoint enable and configuration.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Andy Ross eda4c027da misc/dlist: Swap insertion API for a faster one
The sys_dlist_insert_*() functions had a behavior where a NULL
argument for the insertion position to sys_dlist_insert_after/before()
was interpreted as "the end of the list".  We never used that
convention (except in one spot internal to dlist.h which was not
itself used anywhere), and of course already have an API for appending
and prepending to a list.

In practice this was a performance disaster.  The NULL check is
virtually never provable statically by the compiler, so that test and
branch is present always.  And worse, the check and call to another
function was pushing this beyond the complexity limit for gcc to
inline a function (at -Os optimization anyway), forcing us to use
function calls for what should be a ~8 instruction sequence.  The
upshot is that dlist insertions were 2-3x slower than they needed to
be.

Deprecate these older APIs and introduce a new sys_dlist_insert() call
which can be much better optimized.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-01 15:57:21 -05:00
Andy Ross aa3c9b7f1e tests/benchmarks: Add scheduler microbenchmark
Useful tool for performance work that removes interaction with other
APIs and thread state.  The best part is that it doesn't rely on timer
interrupt delivery and so works with -icount even on existing qemu
versions and produces deterministic output.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-01 15:57:21 -05:00
Tomasz Bursztyka 4b78a251d7 net/context: Make recv_cb providing the ip and protocol headers
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).

Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka e4ebe486b8 net/ip: Let's make public the 2 utility unions for ip/proto headers
Though these are currently used by the core only, it will be then used
by net_context as well. This one of the steps to get rid of net_pkt's
appdata/appdatalen attributes.

Also normalizing all ip/proto parameters name to ip_hdr and proto_hdr.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 6596c304fb test/net: Quick sample explaining/testing the new net_pkt buffer API
This goes through basic allocation, atomic read/write, data
getter/setter and cloning/copying.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 99dbe467e5 tests/icmpv6: Real packet length must be given
The test counts the '\0' of the data copied, though it does not belong
to the packet.

Since the test by-passes net_ipv6_input, which would update the packet
length according to what is in the IPv6 header, the checksum calculation
fails.

Before, checksum calculation used to grab the length from IPv6 header,
but that changed to use net_pkt_get_len(): that one must provide the
real lenth.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 8d21c68718 net/tcp: Switch rest of TCP to new net_pkt API
Only next to be removed functions like net_tcp_set_checksum() are left
untouched. All the rest is switched.

Adding net_tcp_finalize() to follow the same logic as for UDP and else.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka baa9784008 net/tcp: Apply connection callback signature change
This proovse to drastically reduce runtime overhead as it does not need
to parse IP nor TCP header all over again in a lot of places.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 118a0f0d22 net/conn: Change callback signature to pass TCP/IP headers
As these were parsed already by IPv4/6 input functions let's use them.

Applying the change on trivial UDP usage. TCP usage will have its own
commit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka e04914a963 net/ipv6: Switch sending fragmented IPv6 packet to new API
This optimizes the memory quite a bit since we do not need to clone nor
split the original packet at any time.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 88f5672e4c net/ipv6: Switch MLD join, leave and report to new net_pkt API
Most of the code had to be reworked due to the new API: it's more
logical to do everything sequentially (first headers, then MLD part)
than the contrary with inserting headers at the end.

Using get_data/set_data as well it makes the code clearer.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka ae7243b0d5 net/ipv6: Switch RA msg handler to new net_pkt API
Reworking the logic to reduce the amount of variables.
This part was heavier to change as it was not accessing the headers
directly but instead was read parts by parts.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 9a6027ba5c net/icmpv6: Improve callback signature to pass icmp header
In nbr part, this is a useful information. Since net_icmpv6_input has
already parsed the icmpv6 header, let's get pass it, instead of
retrieving/parsing it again in various handler functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 47f3b339eb net/icmpv6: Rework relevant signatures to pass ipv6 header pointer
This is meant to remove the need for macro NET_IPV6_HDR(), since we
don't know in future if accessing the header that way will be valid.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka 86ac993e0c net/ipv6: Rework input function
Use the new net_pkt API to proceed through IPv6 header and all the
extension header as well.

Use udp/tcp input functions relevantly, and call net_conn_input
afterwards.

Note: This commit temporarly disable IPv6 fragmentation support
in the code directly. Which support will be re-enabled afterwards.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka c0db7efff9 tests/net: Avoid using net_udp_get_chksum()
checksum_offload is now the only one using that function, let's get rid
of such usage.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Jukka Rissanen d1162600e9 net: app: Remove net-app API files
The net-app API is removed. Users should use the BSD socket API
for application development.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-01 12:29:21 +02:00
Armando Visconti 37e77f942a driver/sensor: lps25hb: align driver to auto-generated dts macros
Use auto-generated device tree macros in LPS25HB driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Armando Visconti 396ffbd86d driver/sensor: lsm6ds0: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DS0 driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Anas Nashif a93651085e boards: remove pulpino board
This board is unmaintained and unsupported. It is not known to work and
has lots of conditional code across the tree that makes code
unmaintainable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-31 22:47:18 -05:00
Jukka Rissanen 8b8d1dd300 tests: net: dns: Temporarily disable IPv6 query test
The disabled test causes crash in qemu_x86, so temporarily disable
it until a proper fix is found.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-31 08:53:58 -05:00
Vincent Wan ef049cc976 tests: net: port mqtt tests to cc3220sf_launchxl
This commit makes the necessary changes to allow the following tests
to run on cc3220sf_launchxl:
- mqtt_packet
- mqtt_publisher
- mqtt_subscriber
- mqtt_pubsub

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-01-31 06:36:08 -05:00
Jukka Rissanen 34b07b99da tests: net: context: Fix tests when using locking
There was a false timeout error because we did not check the
return value correctly. This issue is seen now because code
flow in core IP stack is happening in different order than
before.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-31 11:20:26 +02:00
Andrew Boie c253a686bf app_shmem: auto-initialize partitions
There are no longer per-partition initialization functions.
Instead, we iterate over all of them at boot to set up the
derived k_mem_partitions properly.

Some ARC-specific hacks that should never have been applied
have been removed from the userspace test.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-01-30 23:15:51 -05:00
Kumar Gala 1d210dc2d8 sensor: adxl372: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adxl372 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 17:51:25 -06:00
Andrew Boie 85e1fcb02a app_shmem: renamespace and document
The public APIs for application shared memory are now
properly documented and conform to zephyr naming
conventions.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-01-30 15:43:58 -08:00
Kumar Gala 136ab0036e tests: build_all: Remove explicit nsim_uart build test
Building of nsim_em board will get the NSIM UART build tested so no need
to have an explicit test for it here.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 12:27:37 -06:00
Alberto Escolar Piedras 815f6fad75 tests: bsim_bt: Rename test script for consistency
Minor change:
Rename the file names of the test scripts for consistency with
other BLE code
The simulation identification string is also changed (although
there is no actual functional need)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-30 13:24:30 -05:00
Alberto Escolar Piedras 8c8d099632 tests: bsim_bt: Add BLE connection test with split controller arch
To also cover the new split controller architecture (with a common ULL
and vendor dependent LLL).
Add a connection testcase (without encryption so far) for the nrf52_bsim
configured with the split controller architecture.
This is just the exact same as the Basic_con test but building the test
with CONFIG_BT_LL_SW_SPLIT=y.
Privacy and data lenght extensions are also so far disabled as the
new controller does not yet support them.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-30 13:24:30 -05:00
Alberto Escolar Piedras 58a7508d66 tests: bsim_bt: Compile each project in its own folder
To allow for incremental builds also when 2 projects are only
differentiated by the project configuration file.
Separate the build dirertories also by the selected project file.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-30 13:24:30 -05:00
Tomasz Bursztyka 12995b95c2 net/ip: Protocol family do not have to follow any other OS's value
It is the macro name that matters, not its value. Here, that will help
to save 1 bit in struct net_pkt later on.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-30 16:27:18 +02:00
Kumar Gala 4f334970ad sensor: adt7420: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adt7420 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 08:08:03 -06:00
Kumar Gala cdc1b1f103 sensor: ccs811: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ccs811 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 02:53:35 -06:00
Kumar Gala d7b7dbd910 sensor: apds9960: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert apds9960 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 16:03:21 -06:00
Andrew Boie f278f31da1 app_shmem: delete parallel API for domains
The app shared memory macros for declaring domains provide
no value, despite the stated intentions.

Just declare memory domains using the standard APIs for it.

To support this, symbols declared for app shared memory
partitions now are struct k_mem_partition, which can be
passed to the k_mem_domain APIs as normal, instead of the
app_region structs which are of no interest to the end
user.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-01-29 11:11:49 -08:00
Krzysztof Chruscinski 80a60412c9 tests: subsys: logging: Add log_output test suite
Add test to log_output module. Test suite covers usage of
log_output_string function.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-01-29 17:24:37 +01:00
Krzysztof Chruscinski 1d9e5ee108 logging: Refactoring 'in place' mode to reduce memory footprint
Changed 'in place' mode to bypass logger system and directly
call active backends. With this approach memory footprint of
the logger can be significantly reduced in terms of RAM and ROM.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-01-29 17:24:37 +01:00
Daniel Glöckner d678f309b8 net: pkt: convert remaining users of ref to atomic_ref
The previous commit replaced the net_pkt element ref with an element
atomic_ref. CI tests turned up more places where ref was used directly.
This commit converts them to use the new element.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2019-01-29 09:22:14 +02:00
Armando Visconti 42c7e8873c driver/sensor: lis3mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS3MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti a3ae11f897 driver/sensor: lis2mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti c81efe25d5 driver/sensor: lsm6dsl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DSL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Adithya Baglody fdedb2c4aa tests: coverage: GCOV counter value changed in GCC8.
Updated the GCOV_COUNTERS value, without which the coverage data
was corrupted when gcc 8.2 was used.

GH-12571

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-28 08:39:06 -05:00
Johan Hedberg e405fc41f2 atomic: Add atomic_set_bit_to() API
Several places in the code have constructions like this:

	if (bool_variable) {
		atomic_set_bit(flags, FLAG);
	} else {
		atomic_clear_bit(flags, FLAG);
	}

To reduce the amount of code for such situations, introduce a new
atomic_set_bit_to() helper which lets you condense the above five
lines to a single one:

	atomic_set_bit_to(flags, FLAG, bool_variable);

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-01-25 17:35:44 -05:00
Jukka Rissanen 4043909d69 net: http: Remove HTTP client and server APIs
The old legacy APIs use net-app library and as that is being
removed, then the dependencies need to be removed also.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-25 11:21:20 -05:00
Jukka Rissanen 1cba0161ed net: websocket: Remove the websocket as HTTP APIs are removed
Remove the experimental websocket code as it uses HTTP APIs
which are being removed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-25 11:21:20 -05:00
Cinly Ooi a691e5e751 tests: lib: mem_alloc: esp32 to skip newlib test
esp32 has no support for newlib

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-01-25 11:20:42 -05:00
Vinayak Kariappa Chettimada 1d470307b9 Bluetooth: tests : Include building the LL split in CI
Include building the init tests with the new Link Layer
split architecture.

Has the data length update and controller privacy disabled
until they are implemented in the new architecture.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-01-25 11:19:39 +02:00
Paul Sokolovsky 858684a72c tests: socket: select: Add actual tests for select()
Ported from earlier poll() test.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 9ff4d47a8f tests: socket: poll: Add test for poll()
Basic test for poll() behavior. UDP sockets are used for simplicity
so far (poll-related paths for UDP and TCP are similar, though later
adding TCP explicitly for full coverage may be useful).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 3339de34eb tests: net: socket: Add "socket" tag to testcase.yaml's
So it was easy to run all socket tests without remembering
the exact path(s).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 3ede9feb97 tests: net: socket: socket_helpers.h: Factor out socket test helpers
The idea is that we should have many, many tests. The only reasonable
way to achieve that is by making tests easy and pleasant to write,
and that requires common, easy to reuse infrastructure.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 0d0ce47c4e tests: net: socket: udp: Refactor and elaborate tests.
1. Consistently use prepare_sock helpers.
2. Test not just client->server sending, but sending reply.
3. Send large packets (>1 net_buf fragment), not just small.
4. Check POSIX behavior on recv()ing datagram incompletely (the rest
should be discarded and next recv() should read next datagram.
5. More cleanroom testing, e.g. explicitly reinitialize input params
on each call (without assumptions that they're left with suitable
values from previous calls), clear input buffers before each read
operations, etc.
6. Reformat code. Previously it was very sparse, giving long test
functions, and thus impression that tests are complicated and hard
to write.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky b8cc02d79c tests: ztest: Add zassert_mem_equal()
Allows to compare 2 memory areas for equality.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 10442a3f9f tests: socket: select: Basic test for select().
Currently actually just tests fd_set manipulation.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-24 17:14:43 +02:00
Krzysztof Chruscinski 383f7bec91 tests: misc: Add test suite for util.h with tests for COND_CODE_n
Added test suite to validate COND_CODE_0 and COND_CODE_1 macros.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-01-24 08:40:01 -05:00
Armando Visconti aca8ae3fd4 driver/sensor: use lis2dh as common driver among multiple sensors
Share lis2dh driver among few accelerometer sensors that has
same register interface: LIS2DH, LIS3DH, LSM303DLHC, LIS2DH12,
LSM303AGR.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Armando Visconti e35f36966b driver/sensor: lis2dh: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2DH driver to avoid
usage of dts.fixup files. The triggered interrupt part has been
slightly hacked to automatically understand whether only int1 is
configured or both int1 and int2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Peter A. Bigot d40b8ce1fb sys: dlist: Add sys_dnode_is_linked
The original implementation allows a list to be corrupted by list
operations on the removed node.  Existing code attempts to avoid this by
using external state to determine whether a node is in a list, but this
is fragile and fails when the state that holds the flag value is changed
after the node is removed, e.g. in preparation for re-using the node.

Follow Linux in invalidating the link pointers in a removed node.  Add
API so that detection of particpation in a list is available at the node
abstraction.

This solution relies on the following steady-state invariants:
* A node (as opposed to a list) will never be adjacent to itself in a
  list;
* The next and prev pointers of a node are always either both null or
  both non-null.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Mieszko Mierunski 0971d80bfc tests: uart: Add tests for async UART API.
Added tests for async UART API and test configuration for
nrf52840_pca10056 board.
For tests to work, RX and TX pins have to be connected together
and second UART is needed to output results to console.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-01-22 18:54:12 +01:00
Armando Visconti fdce786c07 driver/sensor: add LIS2DS12 sensor support
Add support to STM LIS2DS12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.
Currently it uses high resolution only as power mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-22 08:48:40 -06:00
Anas Nashif db92e5c66e lib: flatten all loose components into one lib
lib/ was starting to get messy and inconsitent. Files being either
dumped in the root or in sub-directories without a clear plan.
Move all library components into one single folder and call it 'os'.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Jan Van Winkel 26c9c7480e tests: mcuboot: Erase image slot before starting test
Erase image slot 0 in MCUBOOT test write confirm before starting
actual test.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-21 12:00:55 -05:00
Jan Van Winkel bea1568217 tests: mcuboot: Do not read past image bounds
Make sure that the MCUBOOT test case bank erase does not read passed
image bounds.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-21 12:00:55 -05:00
Andrzej Głąbek 37fbff6179 drivers: nrf: Adjust clock_control and timer drivers for nRF9160
Minor adjustments are done to the nRF clock_control and rtc_timer
drivers to make them usable on nRF9160 as well.
The arm_irq_vector_table test code is modified only because it uses
the function that has been renamed in the nrf_rtc_timer driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Sebastian Bøe 1b86fb9da3 cmake: Use variables for target names
There is an effort underway to make most of the Zephyr build script's
reentrant. Meaning, the build scripts can be executed multiple times
during the same CMake invocation.

Reentrancy enables several use-cases, the motivating one is the
ability to build several Zephyr executables, or images, for instance a
bootloader and an application.

For build scripts to be reentrant they cannot be directly referencing
global variables, like target names, but must instead reference
variables, which can vary from entry to entry.

Therefore, in this patch, we replace global targets with variables.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-19 07:21:55 -05:00
Alberto Escolar Piedras a40f07a3f3 tests: Prolong BT encrypted connection test
Prolong by 1 second the BT encrypted connection test, to ensure
there is enough time for the link itself to be encrypted.
Before this change the key was exchanged, but the 1st notification
(pass condition) was received before the link itself was encrypted.
With this change we wait for 1 notification more (1 second more),
and during that extra second the link is actually encrypted.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-18 18:28:32 -05:00
Kumar Gala affc1ed253 sensor: bmi160: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert bmi160 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:53:53 -06:00
Kumar Gala 31dad5b411 sensor: vl53l0x: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert vl53l0x sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:52:14 -06:00
Kumar Gala 957c3009a6 sensor: max30101: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert max30101 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:50:12 -06:00
Andrew Boie 970758408b printk: don't print incorrect 64-bit integers
printk is supposed to be very lean, but should at least not
print garbage values. Now when a 64-bit integral value is
passed in to be printed, 'ERR' will be reported if it doesn't
fit in 32-bits instead of truncating it.

The printk documentation was slightly out of date, this has been
updated.

Fixes: #7179

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-01-18 08:23:15 -08:00
Peter A. Bigot 12836d9280 drivers: sensors: sht3xd: support multiple devices and DT bindings
Add a configuration structure to sht3xd that holds instance-specific
parameters, implemented in a immutable statically allocated object
initialized with material from device tree binding aliases.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Kumar Gala 7b9bf08dce sensor: lps22hb: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lps22hb sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 09:38:31 -06:00
Kumar Gala 8f04f81e97 sensor: fxas21002: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert fxas21002 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 08:54:31 -06:00
Anas Nashif a1a6174b37 tests: ipm: disable on qemu_x86_64 [REVERT ME]
Fails sporadically on this platform and causing CI blockage.
Filed bug #12478. Should be reverted once bug is fixed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-18 09:50:18 -05:00
Anas Nashif eff81c498b power: remove obsolete power samples
We have a new power management system and those samples have been
written for specific boards and using the application based power
management subsystem. We are getting new tests/samples that are generic
with the new subsystem, so remove those in favor of the new ones.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-18 06:50:04 -05:00
Andrzej Głąbek 6e1dede197 tests: drivers: adc: Add a test case for invalid requests handling
This commit adds a test case checking if ADC drivers can work properly
after discarding an invalid sampling request.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-17 16:58:21 -05:00
Andrzej Głąbek 49c41d36ef tests: drivers: adc: Revert inappropriate changes
Apart from normal customizations of vendor specific parameters in ADC
configuration used in the test, a few more changes in test cases were
also introduced in commit 1bfa34f4fb.
This resulted in some parts of ADC API (like zero interval between
consecutive samplings) not being tested at all. This commit restores
the original behavior of the test cases (with added comments that
zero intervals are intentional).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-17 16:58:21 -05:00
Andrzej Głąbek 026904f7f6 tests: drivers: adc: Remove needless inputs definitions
Currently only nRF drivers need assignments of analog inputs to ADC
channels (ADC_CONFIGURABLE_INPUTS Kconfig option is activated only for
these drivers). Hence, there is no need to define ADC_xxx_CHANNEL_INPUT
labels for any other ADC driver as they will be ignored anyway.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-17 16:58:21 -05:00
Andrew Boie dfeed647f5 printk: fix printing 64-bit hex values
These were being truncated to 32-bits, and only 8
hex digits were supported.

An extraneous printk() at the beginning of the test
which was not being tested in any way has been removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-01-17 14:59:03 -06:00
Carles Cufi 962f900c0b test: nffs: Remove unsupported ICs from CMake files
The smaller Nordic ICs are not supported for those tests due to not
enough RAM.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-17 12:01:16 -06:00
Carles Cufi 9897904254 tests: nffs: Run NFFS tests on nRF52840
After the builds have been fixed, enable the tests on the 256KB-RAM
Nordic IC.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-17 12:01:16 -06:00
Carles Cufi 4f10f8ba2e tests: nffs: Tweak Kconfig to fit in RAM
NFFS tests do not fit in RAM on nRF5x, tweak the configurations so that
they do.

Fixes: #12065

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-17 12:01:16 -06:00
Kumar Gala 689ad43b62 sensor: hts221: Move GPIO to device tree
Move how we configure the DRDY gpio line to device tree from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala c77a322c6e sensors: hts221: Get I2C address from device tree
Change driver to get I2C address of sensor from the device tree like
most other sensor drivers that utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala a5e8921de9 sensors: hts221: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert hts221 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Peter A. Bigot bfad9721d2 kernel: remove k_alert API
This API was used in only one place in non-test code.  See whether we
can remove it.

Closes #12232

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Peter A. Bigot b026a34026 benchmarks: latency_measure: convert from k_alert to workqueue
This eliminates a dependency that blocks deprecation of the k_alert
infrastructure.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Kumar Gala efd31af624 sensors: lsm303dlhc: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lsm303dlhc_accel & lsm303dlhc_magn sensor driver to use new
defines so we can remove the dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 21:33:16 -05:00
Andrei Gansari 4118b8843f drivers: eth_enc28j60: moved to dts
Driver for networking device Microchip ENC28J60 is used as SPI slave,
moved to DTS type definition. Samples echo_client and echo_server use
this device on Arduino 101 board.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 21:28:23 -05:00
Rajavardhan Gundi 18b64833d5 tests: intel_s1000: flash_map: Enable tests for flash_map
This patchset introduces some tests for the flash_map and
flash_page_layout features.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi f885fd15bf DTS: flash: spi_nor: use DT_ for freq and other parameters
Use DT_ instead of CONFIG_ for spi freq, spi bus name, flash device
name and flash base address.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Kumar Gala be2b6f870d sensor: bme280: Converting to using device tree
Convert the BME280 driver to use device tree and new DT_<COMPAT>
defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 12:39:37 -06:00
Adithya Baglody 25572f3b85 tests: Dont run coverage for select test cases.
Disabled the CONFIG_COVERAGE for benchmarks and other tests.
This is needed because it interferes with normal behavior of the
test case.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-16 06:12:33 -05:00
Adithya Baglody 516bf34df5 tests: Increase the stack size by CONFIG_TEST_EXTRA_STACKSIZE.
These tests need to use stack size as a function of
CONFIG_TEST_EXTRA_STACKSIZE. These test will fail when
CONFIG_COVERAGE is enabled.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-16 06:12:33 -05:00
Adithya Baglody 76ee02b6b3 Gcov: Added Kconfig changes needed by Gcov.
This patch addes the required changes in the Kconfig files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-16 06:12:33 -05:00
Adithya Baglody e223cfa9dd tests: coverage: Add Gcov support.
This is a custom Gcov implementation. Taking excerpts from gcc
gcc libgcc/libgcov.h and gcc/gcov-io.h.
Ported to zephyr by Ramakrishna Pallala <ramakrishna.pallala@intel.com>
and Adithya Baglody <adithya.nagaraj.baglody@intel.com>

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-16 06:12:33 -05:00
Karol Lasończyk c0a5739bda drivers: watchdog: align sample and test to new DT
Sample application and test are aligned to new DT naming convention.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2019-01-15 12:40:13 -06:00
Varun Sharma 229e9f79e5 samples: Modify samples to use DEVICE_AND_API_INIT()
tests: Modify tests to use DEVICE_AND_API_INIT()

Modified samples/tests drivers to use DEVICE_AND_API_INIT() instead
of deprecated DEVICE_INIT() api

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-01-15 10:39:34 -08:00
Peter A. Bigot f3f8f96842 tests: i2c_slave_spi: update to proposed DT compatible naming
In driver and application code use the new device-tree values produced
by standard compatible-instance bindings.

As this code may be used as an example add a comment describing how the
binding instance number cannot be reliably used to distinguish multiple
instances.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-15 08:29:52 -06:00
Peter A. Bigot 83773ecc19 dts: correct compatible name for I2C EEPROM devices
Zephyr has been using "i2c,eeprom" for the compatible property.  This is
inconsistent with the property documentation which expects
"manufacturer,model" to be used.

The Linux standard compatible name for I2C EEPROMs is "atmel,at24".  The
standard for SPI EEPROMS is "atmel,at25".  We don't have support for the
latter, but change the name for the former.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-15 08:29:52 -06:00
Jukka Rissanen a7afdc3512 net: rpl: Remove the deprecated code
The RPL was deprecated earlier so remove it by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-13 09:40:36 -05:00
Tavish Naruka 19b968a0c7 boards: add new board Electronut-labs Blip
Added config for https://github.com/electronut/ElectronutLabs-blip/

Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-01-12 09:15:26 -05:00
Andy Ross c2c9265b7d tests: cmsis: Disable two cmsis portability tests on x86_64
These two tests are hitting a stack overflow on x86_64 (not entirely
surprisingly), but can't just increase stack size because there is an
assert in the CMSIS compatibility layer that stacks be under 512
bytes.  Just disable for now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross f033d542ad tests: samples: Disable newlib tests on x86_64
This builds with a host compiler, not one from the SDK, and so no
newlib library is available.  There is work to enable newlib detection
at and above the cmake level.  This patch can be reverted when that
lands.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 0cc362f873 tests/kernel: Simplify timer spinning
There is actually nothing wrong with this test code idiom.  But it's
tickling a qemu emulator bug with the hpet driver and x86_64[1].  The
rapidly spinning calls to k_uptime_get_32() need to disable
interrupts, read timer hardware state and enable them.  Something goes
wrong in qemu with this process and the timer interrupt gets lost.
The counter blows right past the comparator without delivering its
interrupt, and thus the interrupt won't be delivered until the counter
is next reset in idle after exit from the busy loop, which is
obviously too late to interrupt the timeslicing thread.

Just replace the loops with a single call to k_busy_wait().  The
resulting code ends up being much simpler anyway.  An added bonus is
that we can remove the special case handling for native_posix (which
was an entirely unrelated thing, but with a similar symptom).

[1] But oddly not the same emulated hardware running with the same
driver under the same qemu binary when used with a 32 bit kernel.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 870e8188a8 tests/kernel/sched/schedule_api: Honor TEST_EXTRA_STACKSIZE
Stacks created by tests should add this amount so thread-hungry
architectures can tune it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 31e79a791e tests/kernel/mem_protect/stackprot: Whitelist x86_64
This architecture doesn't support stack canaries.  In fact the gcc
-fstack-protect features don't seem to be working at all.  I'm
guessing it's an x32 ABI mismatch?

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 3119d2973a tests/posix/common: Correct TEST_EXTRA_STACKSIZE usage
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>
2019-01-11 15:18:52 -05:00
Andy Ross b69d0da82d arch/x86_64: New architecture added
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().

The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.

Limitations:

+ Right now the SDK lacks an x86_64 toolchain.  The build will fall
  back to a host toolchain if it finds no cross compiler defined,
  which is tested to work on gcc 8.2.1 right now.

+ No x87/SSE/AVX usage is allowed.  This is a stronger limitation than
  other architectures where the instructions work from one thread even
  if the context switch code doesn't support it.  We are passing
  -no-sse to prevent gcc from automatically generating SSE
  instructions for non-floating-point purposes, which has the side
  effect of changing the ABI.  Future work to handle the FPU registers
  will need to be combined with an "application" ABI distinct from the
  kernel one (or just to require USERSPACE).

+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
  of all memory.  No MMU/USERSPACE support yet.

+ We are building with -mno-red-zone for stack size reasons, but this
  is a valuable optimization.  Enabling it requires automatic stack
  switching, which requires a TSS, which means it has to happen after
  MMU support.

+ The OS runs in 64 bit mode, but for compatibility reasons is
  compiled to the 32 bit "X32" ABI.  So while the full 64 bit
  registers and instruction set are available, C pointers are 32 bits
  long and Zephyr is constrained to run in the bottom 4G of memory.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 1041ef0925 tests/benchmarks/timing: Unify the "standard zephyr timing" cases
It's worth using custom timing information on a few systems to save
cycles or gain precision.  But make the use of k_cycle_get_32() a
proper default instead of hardcoding all the platforms and failing to
build on new ones.  On Xtensa and RISC-V (and now x86_64) the cycle
informatoin from that call is a very fast wrapper around the native
counters anyway -- all you would save would be the function call
overhead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 0f075753b8 tests/kernel/threads/thread_apis: Fix include hygine
These files were relying on _thread_essential_set() from
kernel_internal.h, but not including it directly.  New architectures
won't transitively include things the same way.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Armando Visconti f300dedcc1 drivers/sensor/lsm6dsl: Use DT defines to select I2C/SPI bus
Remove configuration parameter CONFIG_BUS_TYPE. Now we may
make use of DT_ST_LSM6DSL_BUS_I2C and DT_ST_LSM6DSL_BUS_SPI
definition to select the bus.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-08 09:15:51 -06:00
Paul Sokolovsky c922ce6ce4 tests: net_pkt: More net_frag_linearize tests
Add tests for "can return less data than requested" behavior.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-08 11:06:56 +02:00
Alberto Escolar Piedras 32bd2df029 tests: cmsis_rtos_v2: Bugfix in test which leads to random errors
Fix a quite silly bug in the testcase which led to random failures
on execution.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-04 11:50:51 -05:00
Adithya Baglody 4c1667fbfa tests: Updated all the tests which use k_thread_access_grant.
With the new implementation we do not need a NULL terminated list
of kobjects. Therefore the list will only contain valid entries
of kobjects.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-03 12:35:14 -08:00
Spoorthi K 319e87a78c tests: cmsis_rtos_v2: Enhance semaphore tests
Add negative tests for semaphore APIs supported in
CMSIS RTOS V2 layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
Spoorthi K 9bf535eede tests: cmsis_rtos_v2: Enhance msgq tests
Add negative tests for msgq APIs supported
in CMSIS RTOS v2 layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
Spoorthi K 9296114fc2 tests: cmsis_rtos_v2: Enhance mempool tests
Add negative tests for mempool APIs supported
in CMSIS RTOS V2 layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
Spoorthi K f45eb2ac6f tests: cmsis_rtos_v2: Enhance event flags tests
Add negative tests for event flags supported in
CMSIS RTOS V2 layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
Spoorthi K 0f375034da tests: cmsis_rtos_v2: Add tests for kernel management APIs
Add negative scenarios, API tests and improve
test coverage for kernel management APIs supported
in CMSIS RTOS V2 portability layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
Andy Ross b748d5219a tests/kernel/timer_api: Synchronize racy subtest
The test_timer_periodicity test is racy and subject to initial state
bugs.  The operation of that test is to:

1. Start a timer with a known period
2. Take the current time with k_uptime_get()
3. Wait for the timer to fire with k_timer_status_sync()
4. Check that the current time minus start time is the period

But that's wrong, because a tick expiring between any of the first
three steps is going to skew the math (i.e. the timer will have
started on a different tick than the "start time").

And taking an interrupt lock around the process can't fix the issue,
because in the tickless world we live in k_uptime_get() is actually a
realtime quanity based on a hardware counter and doesn't rely on
interrupt delivery.

Instead, use another timer object to synchronize the test start to a
driver tick, ensuring that even if the race is unfixable the initial
conditions are always correct.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
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>
2019-01-03 11:51:29 -05:00
Michael Hope bbafc36b1c lib: add crc7.
Used as a checksum on command messages when talking with MMC cards.

Implemented using the unwound bytewise implementation from
https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks
which is a good mix of size and speed.

The API and naming matches lib/crc7.c in Linux.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-12-30 16:24:10 -05:00
Anas Nashif 74a74bb6b8 power: rename api sys_soc -> sys_
sys_soc is just redundant, just call APIs with sys_*.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Anas Nashif 9151fbebf2 power: rename APIs and removing leading _
Remove leading underscore from PM APIs. _ was used for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Spoorthi K e62e54bdcd tests: interrupt: Change IRQ priorities in test
Keeping IRQ0 priority as 1 and IRQ1 priority as 0
so that system timer which of priority 0 in ARC
will be interrupted by IRQ1 of same priority.
In ARM, system timer is of priority 1, hence
making ISR0 priority as 2 and ISR1 priority as 1.
Thus system timer will always be interrupted by
ISR1 in both the architectures.

Fixes: #12147

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-12-21 21:04:36 +01:00
Andrzej Głąbek 03f7569a16 tests: drivers: Remove redundant Kconfig adjustments for nRF boards
The options selecting nRF drivers are now enabled by default when
an nRF SoC is selected as the build target.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Armando Visconti b75a05cae6 driver: sensors: convert lsm9ds0_gyro to use information coming from dts
Convert lsm9ds0_gyro driver to get the device name as well as
i2c slave information and gpio info for triggers from device tree.
Updates the build_all test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-20 12:35:46 +01:00
Rajavardhan Gundi b6ab4e8a7f tests/cmsis_rtos_v2: Use CONFIG_SCHED_SCALABLE
Using multi-queue scheduler doesn't work for cmsis_rtos_v2 as it
supports a max of only 32 priority levels which is less than the
total priority levels required by cmsis_rtos_v2 (which is 56).
Hence explicitly asking the tests to use the scalable scheduler.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi 50d321943e tests/cmsis_rtos_v2: Introduce tests to make use of ThreadFlags APIs
Some test programs to illustrate the usage of ThreadFlags APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi 7ffa3455fb tests/cmsis_rtos_v2: Introduce tests to make use of EventFlag APIs
Some test programs to illustrate the usage of EventFlag APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi ff911f7fdf tests/cmsis_rtos_v2: Introduce tests to make use of messageQ APIs
Some test programs to illustrate the usage of msgq APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi 00ffaed189 tests/cmsis_rtos_v2: Introduce tests to make use of mempool APIs
Some test programs to illustrate the usage of mempool APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi c58733c302 tests/cmsis_rtos_v2: Introduce tests to make use of Semaphore APIs
Some test programs to illustrate the usage of Semaphore APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi a1eaa23fe3 tests/cmsis_rtos_v2: Introduce tests to make use of Mutex APIs
Some test programs to illustrate the usage of Mutex APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi 2b22e30888 tests/cmsis_rtos_v2: Introduce tests to make use of Timer APIs
Some test programs to illustrate the usage of timer APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Rajavardhan Gundi d6c50517d9 tests/cmsis_rtos_v2: Introduce tests to make use of Thread APIs
Some test programs to illustrate the usage of thread APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-20 12:23:22 +01:00
Armando Visconti 4446b16e24 driver: sensors: convert lsm9ds0_mfd to use information coming from dts
Convert lsm9ds0_mfd accel/magn driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-19 07:31:18 -06:00
Tomasz Bursztyka 77d1c86478 tests/net: Remove usage of net_pkt_ll() function
This function is planned to be removed, thus avoiding its usage.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 7f8d92827f net/ethernet: Remove usage of net_pkt_ll() function
This function is planned to be removed, thus avoiding its usage.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka b105fc58f2 net/pkt: Rename net_pkt_ll_clear for better relevancy
Now it does not mangle with any ll reserver space, let's rename it to
net_pkt_lladdr_clear instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka e97a543e9b net/pkt: Remove parameters to "reserve" some headroom
Such parameter is not used anymore, it was defaulted to 0 previously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 0e88d6d068 tests/net: Switch ieee802154 tests to ztest
These were not ran anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka c73c9e2040 tests/ieee80154: Apply L2 changes
Now that fragmentation is serialized and ll_reserve has disappeared from
15.4 L2.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 57a0c55dac net/6lo: Remove fragmentation function parameter on compression
Fragmentation has nothing to do with 6lo. Up to the bearer to do so.

This change is required for futur serialization of 15.4 fragmentation.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka c77d864841 tests/net: Get rid of the ll reserve
As it is unused now, let's default to 0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Varun Sharma 3d9213ac57 tests: subsys: fs: multifs: Enable fs shell using new shell
Fixes #11356, resolved compilation issue wrt to NFFS_FLASH_DEV_NAME

Enabled new shell implementation for testing fs shell

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2018-12-14 13:14:17 +01:00
Paul Sokolovsky 4b1eba7cac tests: posix: test_fs_file: Add testcase with non-zero lseek()
Check that skipping a few initial bytes of file gives the expected
result.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-12-14 13:21:31 +02:00
Krzysztof Chruscinski 0899a6c0b7 logging: severity-wise filtering of function name prefix presence
Extended logger configuration to allow function name prefix for
messages with certain severity levels. By default only debug
messages are prefixed with function name.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-13 14:21:25 +01:00
Flavio Ceolin f704f91222 tests: benchmark: Remove redundant define
The constant NSEC_PER_USEC is already defined in sys_clock.h, there is
no need to define it here.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-11 14:37:10 -08:00
Spoorthi K 82f73bd5e3 tests: nested_irq: Fix k_busy_wait usage and interrupt priority
k_busy_wait() call used in test expects time in us, but the test
is specifying wait in ms.

Also the test fails on NRF5 platform as the test hardcodes the
interrupts priority to 0 and 1 and assumes system timer to be of
priority 0 which is not the case in NRF5 platforms as per
@pizi-nordic where system timer is at priority 1. Hence changing
test interrupts to 1 and 2.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-12-11 13:36:52 -05:00
Jukka Rissanen 7a0c52277c tests: net: ipv6: Fix reference to stack variable
Valgrind reported this:

==14823== Invalid read of size 4
==14823==    at 0x113FB9: memcpy (string_fortified.h:34)
==14823==    by 0x113FB9: ethernet_fill_header (ethernet.c:483)
==14823==    by 0x113FB9: ethernet_send (ethernet.c:588)
==14823==    by 0x116720: net_if_tx (net_if.c:173)
==14823==    by 0x116720: process_tx_packet (net_if.c:211)
==14823==    by 0x10FDB6: z_work_q_main (work_q.c:32)
==14823==    by 0x10FD55: _thread_entry (thread_entry.c:29)
==14823==    by 0x111CF7: posix_thread_starter (posix_core.c:301)
==14823==    by 0x49673BC: start_thread (pthread_create.c:463)
==14823==    by 0x4A78E15: clone (clone.S:108)
==14823==  Address 0x87822a6 is in a rw- anonymous segment

The issue is that we had a pointer that pointed to local stack
variable and that pointer was used to access stuff after the
test function had returned.

Fixes #12006

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-11 10:18:06 -05:00
Armando Visconti ec47b7cd7d sensors: convert lis2mdl to use information coming from dts
Convert lis2mdl magnetometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-11 08:11:11 -06:00
Tomasz Bursztyka bd23754387 net/icmpv6: Refactoring ICMPv6 input end-point
It was weird to pre-parse ICMPv6 headers in IPv6. Moreover parsing
failure of such header would not generate the right statistic.

Instead, centralizing all into net_icmpv6_input relevantly, and adapting
the test cases which were using that function. In RPL test, removing the
dummy dio test was simpler since dio is anyway tested later on.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-11 15:49:45 +02:00
Kumar Gala ff85af5c9c tests: crypto: tinycrypt: Limit to boards with more than 128K flash
This test can be on the boarder line with systems that only have 128K of
flash.  Limit it systems with more for now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-11 08:43:21 -05:00
Andrzej Puzdrowski 55024fe5f0 tests: subsys: settings: tests value get len API
This Patch add tests for API in nffs and fcb back-ends.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski e5a09ccb3e settings: add API for check value size
Such API is convinient for check the persistent storage
value size or whether the value is NULL.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski 03efd7d049 tests: subsys: settings: extend fcb back-end testing
Since it is possible to test back-end with base64 and without
test suite should be extended.

This patch introduce tests with and without base64 encoding

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski cb2445d8fe tests: subsys: settings: extend nffs back-end testing
Since it is possible to test back-end with base64 and without
test suite should be extended.

This patch introduce tests with and without base64 encoding

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski ccb914dc61 tests: subsys: settings: fcb-int tests rework
Introduction of stream-style encoding required rework
of tests.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski c2550d17a0 tests: subsys: settings: fs-backend tests rework
Introduction of stream-style encoding required rework
of tests.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski 35edac74f7 tests: subsys: settings: fcb-backend tests rework
Introduction of stream-style encoding required rework
of tests.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski 6ace20e189 tests: subsys: settings: common tests rework
Introduction of stream-style encoding required tests reworks.
Test for checking especially byte-string encoding is not required
anymore as any value is kept as byte-string.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrzej Puzdrowski 84a88f107c tests: subsys: settings: stream encoding tests
Added tests for recently introduced sterem-style encoding.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-11 11:22:16 +01:00
Andrew Boie 5f793cc25c tests: mem_pool_api: reduce stack usage
Some arches were getting a stack overflow in ISR context.

Fixes: #9777

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-12-07 20:09:47 -05:00
Andrei Emeltchenko 6d8673c3ac pci: Use logger
Use logger for logging.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Armando Visconti 7dbbb07f07 sensors: convert lis3dh to use information coming from dts
Convert lis3dh accelerometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-07 10:43:13 -05:00
Adithya Baglody f6e7c8b1b5 tests: subsys: fs: Fixed headers which were creating objects.
These tests were creating objects from header file in the bss.
Fixed it by moving the objects to appropriate object files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody b6fbb30b1a tests: benchmarks: timing_info: Remove common variables
This patch ensures that there are no .common variables in the
test case.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Jukka Rissanen d551f6c5ff tests: net: context: Disable assertion for net_context tests
The unit test gives net_context_get() an invalid protocol family
value which triggers an assert in net_context.c:160
This assert fails the test when it should not as we properly
check the return value. Fix this by disabling asserts for this
test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Jukka Rissanen 0869a86760 tests: net: tcp: Fix interface initialization
The network interface mac address was not initialized properly
which caused assert in net_if.c:2881 to fail.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Jukka Rissanen 86689030e8 net: Clarify logging in networking code
Remove network specific default and max log level setting
and start to use the zephyr logging values for those.

Remove LOG_MODULE_REGISTER() from net_core.h and place the
calls into .c files. This is done in order to avoid weird
compiler errors in some cases and to make the code look similar
as other subsystems.

Fixes #11343
Fixes #11659

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Alberto Escolar Piedras 7593be7a3f tests: bsim_bt tests: Fix malformed JUNIT results file
Fix the following issues regarding the JUNIT results file
format (xml):

The logger produces illegal xml characters in the text output
=> Ensure that any non-valid xml character is replaced with
the valid xml scapes

When GNU parallel is installed and a testcase fails, the
xml output was malformed => Fixed it

Also store in the Junit output the processes stderr

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-12-06 09:15:38 -05:00
Ioannis Glaropoulos e8e5c388b4 test: kernel: userspace: add include for arm core mpu
In the wake of dfa7a354ff2a31fea8614b3876b051aadc30b242, where
the inclusions for MPU APIs were clean-up, we need to directly
include arm_core_mpu_dev.h in the userspace test suite, which
invokes arm_core_mpu_enable/disable(), directly. The same is
already done for ARC MPU.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-12-05 15:15:07 -05:00
Jakub Rzeszutko b928b71756 shell: rename shell_help_print function
Function printing help has been renamed to shell_help.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 5451ff2848 shell: remove "options" concept
Removing help "options" from shell API.

Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.

Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.

And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Krzysztof Chruscinski 7c68befb15 logging: Fix initial log level in shell
Shell log backends were initialized from shell context. After
lowering logger thread priority order has been flipped. That
revealed a bug where shell logger backend was enabled before
backend ID's has been assigned during logger initialization.

ID assignment is moved to log backend enabling function making
it independent of order of initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-05 14:35:33 +01:00
Tomasz Bursztyka 0dd5113ca4 net/connection: Verify UDP and TCP checksum the easy way
No need to store/reset/recompute the chksums, only compute it again and
if it's not 0: drop the packet.

RFC 1071:

"To check a checksum, the 1's complement sum is computed over the
 same set of octets, including the checksum field.  If the result
 is all 1 bits (-0 in 1's complement arithmetic), the check succeeds."

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-05 11:43:54 +02:00
Tomasz Bursztyka b4f79ae418 net: Return fully calculated chksum
IPv4, ICMPv4/6, UDP, TCP: all checksums are meant to be one's complement
on a calculated sum. Thus return one's complement already from the right
place instead of applying it in each and every place where
net_calc_chksum is called.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-05 11:43:54 +02:00
Patrik Flykt 440b535602 tests: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Rajavardhan Gundi 2ed29b5545 tests: intel_s1000: i2c: Support green and white LED blinking
S1000 i2c test was blinking only blue and red lights. However, if
we have to distinguish between 2 test images for whatever reasons,
it is handy to have one test image blinking blue-red while the
other blinks green-white.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-04 16:08:34 -05:00
Anas Nashif b8424b4cae crc: deprecate old headers and issue warning when used
Change code to use crc.h instead crc{8,16,32}.h and issue warning when
old headers are used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-04 08:52:46 -06:00
Krzysztof Chruscinski d3c651d748 tests: subsys: logging: Add test for message drop notification
Extended logger suite to test correctness of reporting dropped
log messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-03 14:22:42 -08:00
Tomasz Bursztyka 72e1c2b4c1 tests/net: Apply L2 change everywhere where relevant
Many tests use either Ethernet or Dummy L2 and as such require
modifications towards the driver API on their fake devices.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Peter A. Bigot 6e29416fff samples: sensor: add sample for SHT3XD sensor
Added sample code for Sensirion SHT3XD humidity sensor.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Armando Visconti 73a6f58dd4 sensors: convert lis2dh to use information coming from dts
Convert lis2dh accelerometer driver to get the device name as well
as i2c/spi slave information from device tree. Updates the build_all
test accordingly. (issue #11605)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-30 08:36:29 -06:00
Flavio Ceolin 98d03266f1 serial: Change poll_out signature
poll_out function was returning the character that was sent. It
happens that it is always constant and the return of this functions is
never tested. Changing it to be a void function.

MISRA-C rule 17.7

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-29 10:18:59 -08:00
Andrew Boie 2b1d54e897 kernel: add user mode work_q capability
This allows for workqueues to be started in user mode.
No additional kernel objects or system calls are defined
other than starting the workqueue in user mode; for
permission purposes the embedded queue and thread objects
are sufficient.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-29 09:21:18 -08:00
Andrew Boie 3ced428f2f tests: don't enable application memory
This shouldn't be enabled unless the test case is
specifically testing the feature.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-28 15:33:11 -08:00
Himanshu Jha 13a3199ad3 tests: net: mgmt: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Himanshu Jha 5a4481415b tests: tinycrypt: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Rajavardhan Gundi 73562dc863 tests: intel_s1000: Fix the spi flash tests for R/W
The tests are modified to reflect the changed return values
the spi flash read and write APIs return.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-24 07:58:05 -05:00
Rajavardhan Gundi e50ce17578 tests: intel_s1000: Change flash offset from 0x10000 to 0x3F0000
Use the last sector of 4MB flash to run the flash API tests.

Fixes #11462.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-23 14:52:00 -05:00
Aurelien Jarno a3a3383387 tests/i2s: align memory slabs to 32 bytes
The memory slabs used for I2S are used through DMA. In case the CPU has
a cache, we need to ensure minimum alignment so that an entire number of
cache lines can be cleaned or invalidated.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-22 13:16:42 -05:00
Anas Nashif 3d906dc4c1 net: coap: Move both CoAP implementations into one Kconfig
Two separate folders and Kconfig options causing confusion on
CoAP and CoAP_SOCK implementations. This patch simplifies it.
Current CoAP Kconfig option moved to COAP_NET_PKT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-22 09:08:46 -05:00
Jakub Rzeszutko b7a5874830 tests: shell: migrate tests to the new shell
Testing:
1. Shell built-in commands.
2. Wildcards module.
3. Static commands creation and execution.
4. Dynamic commands creation and execution.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-22 11:32:29 +01:00
Jakub Rzeszutko 200da3acaa test: unittest: run for 32bit architecture
Running tests compiled for 64bit architecture were causing errors
in logger module. Updated unittest.cmake to build tests only
for 32bit architecture.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-22 11:32:29 +01:00
Piotr Mienkowski 970aef2905 kernel: ensure System Power Managment enables Tickless Idle.
System Power Management is only supported in Tickless Idle mode.
This patch modifies Kconfig dependencies to ensure System Power
Management option selects Tickless Idle one.

Fixes: #11046

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2018-11-21 23:16:35 -05:00
Kumar Gala c256949bae dts: adc: cleanup CONFIG_ADC_x_NAME
All of the cases of CONFIG_ADC_x_NAME should be DT_ADC_x_NAME.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Mariusz Skamra 8f5ba0be88 Bluetooth: Add common Kconfig option to disable LE Data Length Update
This adds common option to disable support for LE Data Length Update
procedure in controller and host.
This will reduce flash usage by compiling out le_data_len_change
event handler that will never be called if controller has been
compiled with BT_CTLR_DATA_LENGTH option disabled.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-11-21 12:26:27 -05:00
Mariusz Skamra be314d3af5 Bluetooth: Add common Kconfig option to disable PHY Update
This adds common option to disable support for PHY Update
procedure in controller and host.
This will reduce flash usage by compiling out le_phy_update_complete
event handler that will never be called if controller has been
compiled with BT_CTLR_PHY option disabled.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-11-21 12:26:27 -05:00
Alberto Escolar Piedras d92fd5a5b8 tests: bsim_bt: Add option to re-build incrementally
In the provided compile.sh script (which builds all bsim_bt
testcases used in the CI regression runs) add the option to
do an incremental build (if possible).
This is just a nicety for users who want to use this script
while testing locally.

This is controller with the existance of the variable INCR_BUILD

For ex., the script can be called, as:
 WORK_DIR=${ZEPHYR_BASE}/my_work_folder INCR_BUILD=y \
 tests/bluetooth/bsim_bt/compile.sh

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-21 09:42:46 -05:00
Mieszko Mierunski b370b2ba05 dts: nrf: Remove ADC dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Andrew Boie 3aa59a6eed tests: test dynamic IRQ APIs
The gen_isr_table test now tries to install two dynamic
IRQ handlers.

RISCV32 has a workaround due to limited number of SW
triggerable interrupts that can be configured.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-20 09:30:34 -05:00
Spoorthi K 06fa2e6764 tests: msgq: Modify test to verify k_msgq_peek
Verify k_msgq_peek() API functionality by
modifying existing test suite.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-11-19 22:43:04 -05:00
Robert Lubos b5fd15de0c tests: mqtt: Add test to verify publish reception
Add MQTT test to verify PUBLISH message reception.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos 0f7698be8b tests: mqtt: Port tests to use new implementation
Port existing MQTT tests to new socket MQTT API.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos f50aa6d3fb net: mqtt: Mark existing implementation as legacy
Rename existing headers and sybols to mqtt_legacy, to allow new
implementation to keep old config and header names.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Andrew Boie 2d8b86d2c2 tests: i2s_api: run in user mode
Now all tests are additionally run in user mode.

Test now all use the i2s_buf_read/write APIs, which
are themselves implemented in terms of i2s_read/write.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Andrew Boie 9dc6c77bb0 ztest: wait for all suites to finish
The ending report needs to be emitted after all test
suites have run, not after each one.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Andrew Boie 7f1f2385d2 tests: i2s_api: disable log subsystem
Enabling this throws off the timing of the test case, resulting
in failures.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Andrew Boie 696d9a72be tests: pci_enum: don't use STDOUT_CONSOLE
Fixes a stack overflow on qemu_x86.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Rajavardhan Gundi 50c0ff6e8c lib/cmsis_rtos_v1: Use k_is_in_isr instead of _is_in_isr
Use the kernel API k_is_in_isr() instead of the internal
_is_in_isr() function.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-15 09:20:57 -05:00
Rajavardhan Gundi 31351734e2 kconfig: intel_s1000: Clean up App level prj.conf
USB is desired to be configured by default and hence the Kconfigs
are addressed in _defconfig for intel_s1000_crb. Cleaned it up
from the app level prj.conf which was anyway redundant.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-15 07:44:04 -05:00
Maureen Helm f2d8d93269 drivers: sensor: Convert adxl362 to device tree
Converts the adxl362 sensor driver to get the device name and spi slave
properties from the device tree rather than Kconfig. Updates the
build_all test accordingly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-14 23:54:57 -05:00
Savinay Dharmappa f805343941 tests: boards: intel_s1000_crb: Add a test app to read/write from flash
patch test SPI flash on intel_s1000_crb board.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-11-13 18:49:03 -05:00
Andy Ross 39b2a09f38 drivers/timer: New xtensa timer with tickless support
Rewritten Xtensa CCOUNT driver along the lines of all the other new
drivers.  The new API permits much smaller code.

Notably: The Xtensa counter is a 32 bit up-counter with a comparator
register.  It's in some sense the archetype of this kind of timer as
it's the simplest of the bunch (everything else has quirks: NRF is
very slow and 24 bit, HPET has a runtime frequency detection, RISC-V
is 64 bit...).  I should have written this one first.

Note also that this includes a blacklist of the xtensa architecture on
the tests/driver/ipm test.  I'm getting spurious failures there where
a k_sem_take() call with a non-zero timeout is being made out of the
console output code in interrupt context.  This seems to have nothing
to do with the timer; I suspect it's because the old timer drivers
would (incorrectly!) call z_clock_announce() in non-interrupt context
in some contexts (e.g. "expiring really soon").  Apparently this test
(or something in the IPM or Xtensa console code) was somehow relying
on that on Xtensa.  But IPM is a Quark thing and there's no particular
reason to run this test there.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross ea35343eb1 tests/kernel/interrupt: Shrink very long k_busy_wait() argument
This test was written with an outrageously long timeout of 25 seconds.
That blows right through the 32 bit cycle counter on qemu_cortex_m3[1]
and produces an essentially random delay instead of the desired
number, causing a hang with the new SysTick driver in tickless mode.

Push the number down so it doesn't overflow.  The root cause, though,
is that k_busy_wait() can take arguments it can't handle.  It ought to
have an outer loop or something so that it can spin for INT_MAX
milliseconds correctly.

[1] Which has a 12MHz clock rate.  Many hardware implementations are
much faster still.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 4b305e1a25 tests/kernel/context: Limit no-tick-during-irq-load to !TICKLESS
When TICKLESS_KERNEL is enabled, the current time in ticks is based on
a hardware counter and not interrupt delivery (which is the whole
point of tickless), so irq-locking does not prevent time from
advancing.  Disable this test in that configuration.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 46891f0213 tests/kernel/benchmarks: Disable TICKLESS_KERNEL for "no tick" tests
These tests was written to try to eliminate timer interrupts, but the
mechanism chosen (setting TICKS_PER_SECOND to 1) is dangerously
susceptible to overflow conditions on systems with fast cycle counters
and high timeout durations.

Actually the tests pass just fine if you use a conventional tick rate
and use a tickless-capable driver (which eliminates interrupts too,
which is the whole point), but there's no easy way in kconfig to do an
"if" to select that condition for capable systems only.  Just disable
tickless to keep the same behavior.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 0f444c84e5 drivers/timer: Add a standard workaround for known qemu issues
Qemu doesn't like tickless.  By default[1] it tries to be realtime as
vied by the host CPU -- presenting read values from hardware cycle
counters and interrupt timings at the appropriate real world clock
times according to whatever the simulated counter frequency is.  But
when the host system is loaded, there is always the problem that the
qemu process might not see physical CPU time for large chunks of time
(i.e. a host OS scheduling quantum -- generally about the same size as
guest ticks!) leading to lost cycles.

When those timer interrupts are delivered by the emulated hardware at
fixed frequencies without software intervention, that's not so bad:
the work the guest has to do after the interrupt generally happens
synchronously (because the qemu process has just started running) and
nothing notices the dropout.

But with tickless, the interrupts need to be explicitly programmed by
guest software!  That means the driver needs to be sure it's going to
get some real CPU time within some small fraction of a Zephyr tick of
the right time, otherwise the computations get wonky.

The end result is that qemu tends to work with tickless well on an
unloaded/idle run, but not in situations (like sanitycheck) where it
needs to content with other processes for host CPU.

So, add a flag that drivers can use to "fake" tickless behavior when
run under qemu (only), and enable it (only!) for the small handful of
tests that are having trouble.

[1] There is an -icount feature to implement proper cycle counting at
the expense of real-world-time correspondence.  Maybe someday we might
get it to work for us.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Ulf Magnusson fc210ab505 Kconfig: Remove unused symbols defined only in Kconfig.defconfig files
Turning 'def_bool' in Kconfig.defconfig files into 'default' revealed
three unused symbols (confirmed with 'git grep'). Remove them.

Search for "Kconfig.defconfig" in
https://docs.zephyrproject.org/latest/application/kconfig-tips.html for
an explanation of how def_bool->default can reveal undefined symbols.

Removed unused symbols:

 - SPI_DW_CLOCK_GATE

 - PINMUX_MPS2

 - BOARD_XTENSA

Also remove an assignment to the promptless symbol ALTERA_AVALON_SYSID,
in tests/boards/altera_max10/sysid/prj.conf. Assignments to promptless
symbols have no effect.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-11-13 16:04:01 -05:00
Luiz Augusto von Dentz b7c6ea4971 Bluetooth: shell: Remove macros to print messages
Make use of shell_print and shell_error now that they are available.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-11-13 20:42:01 +02:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Alberto Escolar Piedras a822bc2241 tests: Add new bsim based encrypted BLE link test
Test which depends on the nrf52_bsim board.
It is based on the basic connection bsim test,
with the same pass/fail critaria.
The only difference being that the link will be encrypted
therefore exercising that part of the BLE stack.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras a325fdd575 tests bsim_bt: Add scripts to compile and run tests
The compile.sh script compiles the neccessary applications to run
all testcases.

The run_parallel.sh script runs all avaliable tests scripts
(e.g.
tests/bluetoothbsim_bt/bsim_test_app/tests_scripts/Basic_con.sh )
and reports which of them pass or fail.

Note that the run_parallel script will run the test in parallel
only if it can find GNU parallel (which is missing in CI),
otherwise it just runs them in serial

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras d21a36d981 tests bsim_bt: Add script to execute the basic connection test
A script which will execute:
* the peripheral sample
* the bsim_test_app (the actual self-testing application)
* the BabbleSim phy

This script will return
* 0 if the test passes
* something else otherwise

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras 3983ccf583 tests: Add new BabbleSim based BT test
Test which depends on the nrf52_bsim board.
It is based on the central_hr sample application.
The testcase is considered passed, if during the first 5 seconds
after boot, it manages to find and connect to a
peripheral and a notification is received from it.
Otherwise, the testcase fails.
Note that the executable return code will reflect the status of the
test:
0: Testcase passed
1: Testcase was stopped while in progress
2: Testcase failed
anything else: A failure not from the testcase itself

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras f1da7abc75 tests: kernel: context: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 09:19:03 -05:00
Alberto Escolar Piedras 0682a51686 tests: kernel: sched: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 09:19:03 -05:00
Alberto Escolar Piedras 018073b359 tests: kernel: tickless: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 09:19:03 -05:00
Alberto Escolar Piedras 74e9ee967a tests: kernel: common: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 09:19:03 -05:00
Alberto Escolar Piedras bdc0a20f4e tests: sched: schedule_api: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 09:19:03 -05:00
Kumar Gala a134438840 sensors: bmi160: Add DTS support
Convert the BMI160 to use Device Tree to get SPI and GPIO params instead
of Kconfig.  Updated samples, tests, and arduino_101_sss board support
for this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-13 10:23:22 +01:00
Anas Nashif c79dea567a intel_s1000: do not enable options in _defconfig
Application should be responsible for enabling various drivers and
features, we should not enable everything by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-12 13:50:21 -05:00
Niranjhana N 6316d774f2 tests: kernel: test force suspend of device
Add test for the force suspend of device by
setting state to device_set_power_state API.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-11-10 13:50:42 -05:00
Krzysztof Chruscinski 5e346812ac logging: Refactor LOG_MODULE_REGISTER and LOG_MODULE_DECLARE macros
Changed LOG_MODULE_REGISTER and LOG_MODULE_DECLARE macros to take log
level as optional parameter. LOG_MODULE_DECLARE can now also be used
in static inline functions in headers. Added LOG_LEVEL_SET macro
which is used when instance logging API is used to indicate maximal
log level compiled into the file.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Luiz Augusto von Dentz 7aa58ff91d mesh: Port shell module to the new shell
This makes mesh shell to register commands with the new shell subsystem
and stop using the legacy shell.

Fixes #11056

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-11-09 11:19:49 +01:00
Jukka Rissanen 6c64cb9e67 tests: net: ethernet_mgmt: Enable IPv6 for this test
IPv6 is needed as there is special handling of IPv6 addresses
when MAC address is changed. We do not need DAD + other IPv6
specific features so those are disabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-08 15:23:05 +02:00
Ioannis Glaropoulos ff5d942db8 tests: kernel: userspace: minor typo fixes
Some minor style and typo fixes in
tests/kernel/mem_protect/userspace/src/main.c.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-11-06 16:14:41 -05:00
Jukka Rissanen a561913516 tests: net: ipv6: Test interface local scope dst pkt sending
Make sure that if network packet destination IPv6 address is
interface local scope multicast address FF01::, then those
packets must routed back to us when sending them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-06 11:11:08 +02:00
Anas Nashif d8a8012758 tests: make ethernet build test depend on netif
Test for ethernet should depend on the HW having ethernet support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-05 12:07:30 -06:00
Anas Nashif aed52d7058 tests: add board_shell test app
Group various shell modules for kernel, peripherals and other
subsystems. This will be used to test board functionality interactively
using commands implemented in the individual shell modules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-05 09:32:38 -05:00
Anas Nashif cd9103826b tests: add Kconfig for testing via shell
One Kconfig to select shell modules based on configured featues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-05 09:32:38 -05:00
Paul Sokolovsky 9aafe38828 tests: socket: Bump number of available fd's
These tests require much bigger number than default 4.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-04 22:04:11 +01:00
Flavio Ceolin aecd4ecb8d kernel: Change k_poll_signal api
k_poll_signal was being used by both, struct and function. Besides
this being extremely error prone it is also a MISRA-C violation.
Changing the function to contain a verb, since it performs an action
and the struct will be a noun. This pattern must be formalized and
followed and across the project.

MISRA-C rules 5.7 and 5.9

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-04 11:37:24 -05:00
Flavio Ceolin a406b88fca kernel: Remove duplicated identifier
There was an struct and a variable called _kernel. This is error prone
and a MISRA-C violation. It is changing the struct to have a unique
identifier.

MISRA-C rule 5.8

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-04 11:37:24 -05:00
Jukka Rissanen cf063fe85b net: Rename net_is_xxx...() functions to net_xxx_is...()
Unify the function naming for various network checking functions.

For example:
     net_is_ipv6_addr_loopback() -> net_ipv6_is_addr_loopback()
     net_is_my_ipv6_maddr() -> net_ipv6_is_my_maddr()
etc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 14:52:33 -04:00
Pushpal Sidhu 1f1faa9195 tests: fat_fs_api: add renaming tests
Test both directory and file renaming.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-11-02 12:21:22 -04:00
Johan Hedberg 62fb942d74 tests: bluetooth/tester: Fix having unique log domains
Each c-file must have unique log domains or building will fail at the
linker stage.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-02 10:41:11 -04:00
Jukka Rissanen f87c4c03f4 tests: net: ipv6: Calculate ICMPv6 checksum for RA message
The IPv6 test was failing because the ICMPv6 checksum was
wrong.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 16:03:18 +02:00
Jukka Rissanen 75ed6d78df tests: net: mld: Fix ICMPv6 checksum calculation
The ICMP checksum was not placed to correct position in the
created test packet. This caused the checksum to be bad, and
because we now check the ICMP checksum, the packet was rejected
and the mld test failed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 16:03:18 +02:00
Jukka Rissanen 0a3b5f2294 tests: net: ipv6: Drop pkt for org scope mcast addresses
Test that we drop the received packet if the destination
address is organisation scope (ff08::) multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 15:10:48 +02:00
Jukka Rissanen bd37a9462b tests: net: ipv6: Drop pkt for site scope mcast addresses
Test that we drop the received packet if the destination
address is site scope (ff05::) multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 15:10:48 +02:00
Jukka Rissanen 57ae1db1e0 tests: net: ipv6: Drop pkt for zero scope mcast addresses
Test that we drop the received packet if the destination
address is zero scope (ff00::) multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 15:10:48 +02:00
Jukka Rissanen 5fba8bfda2 tests: net: ipv6: Drop pkt for iface scope mcast addresses
Test that we drop the received packet if the destination
address is interface scope multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-02 15:10:48 +02:00
Kumar Gala a8f1431a53 boards: bbc_microbit: Move button data into dts from board.h
Move the GPIO info for the buttons into the dts, this lets us match what
all other boards are doing.  Update some sample & test code to use the
dts generated SW0_GPIO_CONTROLLER define instead of SW0_GPIO_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 15:58:51 -05:00
Jukka Rissanen ae6ed44883 tests: net: ipv6: Check if we receive ::1 as src or dst address
Add two tests that will check if the source or destination address
is loopback address ::1 and we drop those packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-01 14:32:21 +02:00
Kumar Gala 9db7175e67 tests: Remove board.h include
We either don't need board.h in the test or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:15:18 +01:00
Ravi kumar Veeramally b925452911 tests: net: coap: Add new tests
New tests are added.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-10-31 19:44:25 -04:00
Alberto Escolar Piedras 847b7ccbcc tests: kernel tickless: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-31 19:43:10 -04:00
Alberto Escolar Piedras 574fc953e2 tests: sleep: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-31 19:43:10 -04:00
Alberto Escolar Piedras a57ddef003 tests: sched: schedule_api: Bugfix for POSIX arch in TICKLESS
In the POSIX architecture, with the inf_clock "SOC", time does
not pass while the CPU is running. Tests that require time to pass
while busy waiting should call k_busy_wait() or in some other way
set the CPU to idle. This test was setting the CPU to idle while
waiting for the next time slice. This is ok if the system tick
(timer) is active and awaking the CPU every system tick period.
But when configured in tickless mode that is not the case, and the
CPU was set to sleep for an indefinite amount of time.
This commit fixes it by using k_busy_wait(a few microseconds) inside
that busy wait loop instead.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-31 19:43:10 -04:00
Anas Nashif 9c2c677da8 tests: remove logger-hook test
We now use logger backends with new logger system.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-31 10:11:14 -04:00
Spoorthi K a94f97b4b3 tests: kernel: Validate set thread name to current thread
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>
2018-10-29 10:17:10 -04:00
Adithya Baglody 24b89f12eb tests: sched: schedule_api: Increase the minimum ram needed.
This test was failing on nrf52810_pca10040 due to lack of RAM.
It was a side effect of increasing the privilege stack size.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-10-28 11:43:32 -04:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
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>
2018-10-27 21:31:25 -04:00
Jukka Rissanen a85a123477 tests: net: ip-addr: Add checks for IPv4 broadcast addresses
Make sure that IPv4 broadcast address checks work as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-26 15:37:21 +03:00
Jukka Rissanen 601426866a net: Set used transport protocol to net_pkt
Cache the used transport protocol in net_pkt. This way we can
avoid traversing IP header to get the last protocol in network
packet. This is mostly an issue in IPv6 which can have a long
list of extension headers after IPv6 header and before the
transport protocol header.

Fixes #10853

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-26 14:08:43 +03:00
Jukka Rissanen 55673d045d tests: net: pkt: Do not print extra errors
Some irrelevant errors were printed even if the tests passed.
Make sure that these obsolete errors at not printed so that
sanitychecker does not get confused about them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-24 15:10:33 +03:00
Jukka Rissanen d0679d9dd7 tests: net: Fix possible null dereference in net_pkt tests
It might be that the test might access null pointer in some cases.
In practice this is not possible as the test is using pre-defined
data when running the test.

Fixes #10777

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-24 14:25:28 +03:00
Spoorthi K 7fa2ec42ae tests: posix: Check for return values
Check for return value of pthread_attr_destroy().
Fixes: #10754

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-10-24 11:15:30 +01:00
Krzysztof Chruscinski 5d28fcd689 logging: Add optional function name prefix
Extended logger to support optional log message prepending with
function name.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-24 11:14:26 +01:00
Krzysztof Chruscinski c696e68bb9 logging: Added support for 10 arguments in log message
Extended supported number of arguments in log message. Support for
messages consisting of more than 2 chunks had to be added. So far
messages could consist of one chunk (up to 3 args) or two chunks
(2 args in first chunk and 7 in second chunk). Once 2+ chunks
support is added number of arguments is techinically limited to
15 (4 bit field). log_core and log_output extended to suppor 10
arguments.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-24 11:14:26 +01:00
Alberto Escolar Piedras c6799dc7a1 tests: posix: Bugfix unitialized array in posix_pthread_execution
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>
2018-10-23 09:19:34 -07:00
Johan Hedberg a0c22de270 tests: bluetooth/tester: Convert from SYS_LOG to new logger
Use the LOG_* macros instead of the deprecated SYS_LOG_* ones.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Johan Hedberg 343c53e841 Bluetooth: Switch from SYS_LOG to logger-based logging
Initial conversion to use syslog instead of logger.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Jakub Rzeszutko 147122e77f shell: examples unification
Updating examples according to new return value of function
shell_cmd_precheck.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 13:35:56 +02:00
Johann Fischer ebe3eb21d4 tests: build_all: remove MMA8451Q from dts.fixup
Remove MMA8451Q from dts.fixup.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Krzysztof Chruscinski fe7416a27e tests: subsys: logging: Fix log_core test
Log_core test was failing due to test structure elements not being
correctly reset before the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-17 09:13:01 -04:00
Galen Seitz a14b3f0e37 tests: spi_loopback: Add nucleo_f302r8 configuration
Add nucleo_f302r8 board configuration for the spi loopback test.

Signed-off-by: Galen Seitz <galens@seitzassoc.com>
2018-10-16 22:52:07 -04:00
Anas Nashif d3ed3f11fa tests: interrupt: disable riscv32
This is a new test and we have riscv32 failing on that all of the
sudden. Disabling while we look into it and identify if that is a
testcase issue or not.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 21:27:23 -04:00
Jun Li 2acbaf499e tests: dma: use generic callback arg for all dma_callbacks
Replace the first argument in dma_callback with
generic 'void * arg'.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2018-10-16 16:58:19 -04:00
Andy Ross a715a5fc57 tests/kernel/context: Skip test_kernel_cpu_idle when tickless
This test was written to assume that on idle the CPU would wake up on
the next tick boundary because of the timer interrupt.  No such
interrupt arrives in tickless mode and it hangs forever.

A more whiteboxy test involving setting a clock timout will have to be
written for this feature if we want to keep it on tickless systems.
Alternatively we could move this test out of tests/kernel/context and
always disable tickless.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 4f02dd1407 tests/kernel/context: Disable test_kernel_interrupts when tickless
The theory behind this test seems to be that taking an IRQ lock should
prevent the advance of the kernel's tick counter.  That works on
traditional timers only.  In tickless mode the timer hardware/driver
is expected to be able to give us an answer for time independent of
interrupt delivery, so the test fails spuriously.  The "bug" detected
is a feature of tickless!

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross cfe62038d2 kernel: Checkpatch fixups
I was pretty careful, but these snuck in.  Most of them are due to
overbroad string replacements in comments.  The pull request is very
large, and I'm too lazy to find exactly where to back-merge all of
these.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross af7bf89ed2 tests/kernel: Bump stack size for mem_protect/stackprot
This test needs just a tiny bit of extra stack.  512 bytes isn't
enough on x86 with the most recent set of timer patches.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 987c0e5fc1 kernel: New timeout implementation
Now that the API has been fixed up, replace the existing timeout queue
with a much smaller version.  The basic algorithm is unchanged:
timeouts are stored in a sorted dlist with each node nolding a delta
time from the previous node in the list; the announce call just walks
this list pulling off the heads as needed.  Advantages:

* Properly spinlocked and SMP-aware.  The earlier timer implementation
  relied on only CPU 0 doing timeout work, and on an irq_lock() being
  taken before entry (something that was violated in a few spots).
  Now any CPU can wake up for an event (or all of them) and everything
  works correctly.

* The *_thread_timeout() API is now expressible as a clean wrapping
  (just one liners) around the lower-level interface based on function
  pointer callbacks.  As a result the timeout objects no longer need
  to store backpointers to the thread and wait_q and have shrunk by
  33%.

* MUCH smaller, to the tune of hundreds of lines of code removed.

* Future proof, in that all operations on the queue are now fronted by
  just two entry points (_add_timeout() and z_clock_announce()) which
  can easily be augmented with fancier data structures.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 7aae75bd1c idle: Fix tickless timeout behavior
If the idle code was detecting that it needed to sleep for less than
CONFIG_SYS_TICKLESS_IDLE_THRESH, then it would never call
z_clock_set_timeout() at all, which means that the system would never
wake up unless it already had a timeout scheduled!  Apparently we
lacked a test case to detect this condition.

Honestly this seems like a crazy feature to me.  There's no benefit in
delivering needless tick announcements.  If the system has the
capacity to enter deeper sleep for long timeouts, that's already
exposed via the PM APIs, the timer subsystem needn't be involved.
But... we actually have a test (tickless_concept) that looks at this,
so support it for now and consider deprecation later.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 317178b88f sys_clock: Fix unsafe tick count usage
The system tick count is a 64 bit quantity that gets updated from
interrupt context, meaning that it's dangerously non-atomic and has to
be locked.  The core kernel clock code did this right.

But the value was also exposed to the rest of the universe as a global
variable, and virtually nothing else was doing this correctly.  Even
in the timer ISRs themselves, the interrupts may be themselves
preempted (most of our architectures support nested interrupts) by
code that wants to set timeouts and inspect system uptime.

Define a z_tick_{get,set}() API, eliminate the old variable, and make
sure everyone uses the right mechanism.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross b2e4283555 sys_clock: Make sys_clock_hw_cycles_per_tick() a proper API
This was another "global variable" API.  Give it function syntax too.
Also add a warning, because on nRF devices (at least) the cycle clock
runs in kHz and is too slow to give a precise answer here.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross cbb77be675 sys_clock.h: Remove sys_clock_ticks_per_sec()
This just got turned into a function from a "variable" API, but
post-the-most-recent-patch it turns out to be degenerate anyway.
Everyone everywhere should always have been using the kconfig variable
directly, and it was only a weirdness in the tickless API that made it
confusing.  Fix.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 220d4f8347 sys_clock.h: Make "global variable" APIs into proper functions
The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Anas Nashif deaab90641 tests/samples: cleanup tags
Remove redundant 'sample' tag and add something that matches the
functionality and features being tested, demonstrated.

Avoid short abbriviations and using full names for fs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Anas Nashif 20b73e74a1 tests/samples: rename 'app' tag to something meaningful
Remove very generic apps tag and replace it with something that matches
what the test/sample does.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Anas Nashif e11192e4b5 tests: fix test identifier
After merging tinycrypt testcases, we left the original identifier, this
is not called crypto.tinycrypt.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Anas Nashif 5ffbd36f69 tests: pm -> powermanagement
pm can be short for many things, call it out.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Anas Nashif 621f75bfa7 tests: remove bat_commit, replace core with kernel
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>
2018-10-16 09:17:51 -04:00
Punit Vara e5620a2b87 drivers: sensor: Migrate to new logger
Move all sensor drivers and samples to new logging system.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-10-16 08:49:53 -04:00
Philémon Jaermann aad6ada14c tests: drivers: lsm303dlhc build test
Enable sensor build test for lsm303dlhc_accel/magn

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-10-15 12:47:13 -05:00
Alberto Escolar Piedras 5166b95626 tests: lib: mem_alloc: Blacklist all POSIX arch boards
These tests rely on compiling with one of the provided
C libraries which are not compiled for any
of the POSIX ARCH boards => balcklist based on the arch
and not on the board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Varun Sharma 7622fc37a0 subsys: fs: Migrate to new logging subsys
subsys:fs : Migrate from `SYS_LOG` to `LOG` logging mechanism.

tests: subsys: fs: Enabled CONFIG_LOG in prj.conf

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2018-10-15 09:18:03 -04:00
Anas Nashif 91cdb35584 tests: fatal: fix condition for NXP MPU
Fixed condition and wrong Kconfig name, shoud be CONFIG_CPU_HAS_NXP_MPU
instead of only CPU_HAS_NXP_MPU.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-15 09:07:43 -04:00
Savinay Dharmappa 020884c02c test: drivers: watchdog: Modify test application.
test application of watchdog assumes that the variable
created in noinit section will have initial value as
zero. This is an incorrect assumption as variable
in noinit section can have any value. The application
is modified work even if variable in noint section
have any value.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-10-14 14:16:03 -04:00
Mario Tesi a0ad4e0125 tests: driver: lis2mdl: Add configuration for CI tests
Add default dts configuration for CI tests in case
	selected board used for test purpose do not export
	dts configuration for LIS2MDL

Signed-off-by: Mario Tesi <mario.tesi@st.com>
2018-10-12 14:13:50 -05:00
Mario Tesi 5d8834bee4 driver: sensor: Add support for LIS2MDL Mag sensor
Added support to LIS2MDL Magnetometer sensor provided
with following features:
	- I2C interface
	- Mag data
	- Temperature data
	- ODR configurable by config or at runtime
	- Trigger mode selectable by menuconfig
	- IRQ pin configurable (by dts or Kconfig)
	- Hard Iron offset setting at runtime
	- Include yaml file

Tested on ST MEMS IKS01A2 + NUCLEO STM32F411RE board.
LIS2MDL connected to I2C master interface (SPI 3 wire not
supported yet).
Test run with all ODR {10, 20, 50, 100} Hz in poll and
trigger mode.

GPIO IRQ dts configuration has been tested by adding
to boards/arm/nucleo_f411re/nucleo_f411re.dts file
this patch:

&i2c1 {
        status = "ok";
        clock-frequency = <I2C_BITRATE_FAST>;
+
+       /* ST Microelectronics LIS2MDL mag sensor */
+       lis2mdl-magn@1e {
+               compatible = "st,lis2mdl-magn";
+               reg = <0x1e>;
+               irq-gpios = <&gpioa 4 0>;
+               label = "LIS2MDL";
+               status = "ok";
+       };
};

and adding boards/arm/nucleo_f411re/dts.fixup with following
content:

	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_LABEL
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BASE_ADDRESS
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BUS_NAME
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_CONTROLLER
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_PIN

For more info on this LIS2MDL please follow this link:
http://www.st.com/en/mems-and-sensors/lis2mdl.html

Signed-off-by: Mario Tesi <mario.tesi@st.com>
2018-10-12 14:13:50 -05:00
Rajavardhan Gundi 6bcb9c6a98 xtensa: intel_s1000: Move some functions to SoC level SYS_INIT
Mux configuration for I2C and GPIO are now done in SYS_INIT
which were earlier done in the respective tests.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-10-12 07:52:17 -04:00
Jukka Rissanen 2c69edc149 net: Remove obsolete config options from samples and tests
Removed obsolete CONFIG_SYS_LOG_* and CONFIG_NET_DEBUG_* options
from various sample and test applications.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-11 14:44:14 -04:00
Anas Nashif b5a51f8b01 tests: s1000: rename board
Instead of Intel_S1000, use correct name "Intel S1000 CRB"

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-11 10:49:56 -04:00
Krzysztof Chruscinski 5f6070e2f7 logging: Add autostart option to LOG_BACKEND_DEFINE
Extended macro to accept flag indicating if given backend must be
initialized and enabled when log subsystem starts. Typically, simple
backends will have autostart flag set. More complex may require
explicit enabling (e.g. shell over BLE can only be enabled when
BLE connection is established).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-11 13:29:50 +03:00
Jakub Rzeszutko f6197c4f3c shell: create instances automatically basing on enabled backend
If user will enable shell than for each backend shell instance
will be created automatically.

Update all shell examples according to the new initialization
procedure.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-11 12:08:04 +02:00
Ajay Kishore 2a103ea674 tests: add tests to validate interrupt nesting feature
This test is intended to verify the interrupt nesting.
Interrupt nesting feature allows an ISR to be preempted
in mid-execution if a higher priority interrupt is signaled.
The lower priority ISR resumes execution once the higher
priority ISR has completed its processing.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-10-10 19:59:47 -04:00
Anas Nashif 6cb52b97fe tests: boards: intel_s1000_crb: move to new logger
Move to new logger and use new logger macros/Kconfig variables.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 18:32:13 -04:00
Anas Nashif e1508ae21f tests: ring_buffer: move to new logger
Move to new logger and use new logger macros/Kconfig variables.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 18:32:13 -04:00
Ulf Magnusson 92ef8582b9 Kconfig: Remove redundant $(ZEPHYR_BASE) from 'source's
The $srctree environment variable gives the path relative to which
'(o)source' statements work (the current directory is used if $srctree
is unset). It is set to $ZEPHYR_BASE in cmake/kconfig.cmake, so there's
no need to qualify the source of Kconfig.zephyr in sample Kconfig files
(or in external projects).

All 'source's in Zephyr assume that the Zephyr root directory is used as
the srctree as well, and would break otherwise.

Remove the $(ZEPHYR_BASE)s to make it clearer that all 'source'
statements work relative to the Zephyr root. There was some user
confusion on IRC.

Also explain how things work in the documentation.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-10-10 11:28:27 -05:00
Anas Nashif a66967b0f2 driver: i2s: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Niranjhana N 11775b2247 tests: posix: enhance pthread test
Added negative tests to pthread APIs
to improve code coverage.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-10-10 09:29:42 -04:00
Niranjhana N 81f835f27c tests: posix: group pthread tests
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>
2018-10-10 09:29:42 -04:00
Andrei Emeltchenko 777347daf1 tests: Fix sanity_check
Use right order for tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Jukka Rissanen 7ff64bfead tests: net: arp: Add gratuitous ARP tests
Make sure that we change the HW address in ARP cache if we
receive gratuitous ARP.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-10 16:12:35 +03:00
Spoorthi K 4c73b485c2 tests: POSIX: Enhance clock tests
Enhance clock test to validate gettimeofday() and
to improve line coverage.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-10-10 14:25:30 +02:00
Jakub Rzeszutko b0571746e2 shell: parsing output LF character
Some terminals literally interprets shell output data. Hence to print
a message in new line shell needs to send `\r\n` each time. To minimize
flash usage user can now send `\n` as a line delimiter and shell will
automatically add missing CR character.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-10 10:45:28 +02:00
Ioannis Glaropoulos 52b729a6a4 arch: arm: fix mem domain sample/test for ARMv8-M access permissions
This commit updates the mem_domain_apis_test sample and the
mem_protect test, so they can compile and execute in ARMv8-M
platforms, which do not support the P_RW_U_RO access permissions
combination (privileged read/write, unprivileged read-only). The
modification consists of, simply, selecting a different access
permission (P_RO_U_RO) when building for ARMv8-M MPUs with the
unmodified ARM MPU architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-10-09 19:33:24 -04:00
Krzysztof Chruscinski 26031f7bfd lib: ring_buffer: add raw byte access mode
Extended ring buffer to allow storing raw bytes in it. API has been
extended keeping 'data item' mode untouched.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-09 13:58:44 -04:00
Krzysztof Chruscinski ff5f00f2c3 lib: ring_buffer: Rename sys_ring_buf_ to ring_buf_item_
Deprecate API prefixed with sys_ring_buf_ and rename it
to ring_buf_item_ since this API is not a typical ring buffer
but ring buffer of data items (metadata + 32bit words).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-09 13:58:44 -04:00
Daniel Leung df23ac3f83 tests: wdt_basic_api: rename noinit section
The linker section where data is not being initialized is
.noinit.*.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-10-09 08:23:41 -04:00
Paul Sokolovsky 3949846e10 tests: posix: fs: Use ssize_t/off_t types
As the POSIX return types of read/write/lseek.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-09 08:19:44 -04:00
Anas Nashif 92080a0670 ztest: remove unused include of sys_log.h
Remove include that is not being used in the file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 07e5bf6894 tests: crypto: use CONFIG_LOG
Use CONFIG_LOG instead of old CONFIG_SYS_LOG. The drivers in questions
already moved to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif fbbb3da192 tests: logging: disable default log modules
log modules of kernel are creating noise, set them to off to have this
test work as expected.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 37d5c90619 tests: crypto: use printk instead of logging
Remove single use of logger in favor of printk.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 88aa2ca49f driver: spi: use new logger
move SPI drivers to use new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 07ff2d580b drivers: dma: move to new logger
Move to new logger and adapt samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif f7dac85d15 drivers: i2c: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 9a8567fa4a drivers: adc: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 0a0c8c831f kernel: move to new logger
Use the new logger framework for kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Yannis Damigos d1a655a624 subsys/usb: Move to new logger subsystem
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Yannis Damigos 1674d061b6 drivers: usb: device: Migrate to new logger
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Sebastian Bøe 8eb734cd82 DT: Rename from dts.fixup to dts_fixup.h
The Zephyr configuration system uses many different files in many
different formats. It makes it a lot easier for users to understand
what these files do if when we use the correct file extensions.

To this end we rename the dts.fixup files to the correct file
extension '.h'.

This is a breaking change for out-of-tree fixup files. Such files will
be detected and given an appropriate error message.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-08 11:38:56 -04:00
Spoorthi K dc8bbce357 tests: POSIX: Enhance semaphore tests
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>
2018-10-04 22:27:26 -04:00
Spoorthi K 11aa39bc25 tests: POSIX: Refactor POSIX API tests
Refactor and club the POSIX API tests into one test suite.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-10-04 22:27:26 -04:00
Jukka Rissanen f3f04bf9eb tests: net: Convert to new logging system
Use new logging system with support for network log level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Carles Cufi 94f8e75b24 tests: Bluetooth: shell: Whitelist nrf52840_pca10056
In order to fully cover the platform that supports most of the optional
features in the specification, whitelist the nRF52840 DK.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-10-03 11:03:21 -05:00
Luiz Augusto von Dentz 76714c1480 Bluetooth: Shell: Make error message for unknown parameter consistent
Also simplify it by having the 'unknown parameter:' as part of the
message format.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-03 09:49:58 +02:00
Luiz Augusto von Dentz 4058f724bc Bluetooth: samples: shell: Don't use printk
Make use of shell_fprintf whenever possible.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-03 09:49:58 +02:00
Rajavardhan Gundi 7fdfe03ad0 lib/cmsis_rtos_v1: Fix some Kconfig inconsistencies
Fixed some Kconfig inconsistencies around THREAD_CUSTOM_DATA,
POLL and NUM_PREEMPT_PRIORITIES.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-10-02 14:08:33 -07:00
Rajavardhan Gundi fa77e400aa tests/kernel: fifo_timeout: Remove wake-up order checking
There is no guarantee of wake-up order when multiple threads
are woken up on the same tick. Hence, modified the tests
accordingly.

Fixes #8159.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-10-02 14:06:50 -07:00
Jakub Rzeszutko c471614cb6 subsys: shell: fix accept either CR or LF as as line delimiter
1. Shell will accept CR or LF as line delimiter.
2. Macro SHELL_DEFINE simplified - it no longer requires
   new line character.
3. Fixes: #10207.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-02 11:55:47 -07:00
Paul Sokolovsky ccb2ef9250 tests: posix: Enable CONFIG_POSIX_API
As a master switch to access POSIX APIs.

Also, remove dependency on pthreads for tests which don't require it.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-02 10:51:52 -07:00
Paul Sokolovsky c152ebd634 include: posix: Split dirent.h from unistd.h
From POSIX
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html

"""
The <dirent.h> header shall define the following type:
DIR

...

also define the structure dirent
"""

etc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-02 10:51:52 -07:00
Jakub Rzeszutko 0eea1ef212 subsys: shell: add int ret_val to command handlers
1. Command handler can return command exectution status as int.
2. Existing command handlers rework.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-02 14:44:25 +02:00
Maureen Helm 89ccead382 drivers: boards: Merge HAS_DTS_SPI_DEVICE with HAS_DTS_SPI
Every board that uses dts-enabled spi drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_SPI_DEVICE and
HAS_DTS_SPI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 75bc6ba454 drivers: boards: Merge HAS_DTS_I2C_DEVICE with HAS_DTS_I2C
Every board that uses dts-enabled i2c drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_I2C_DEVICE and
HAS_DTS_I2C.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Krzysztof Chruscinski d0776bcc02 tests: logging: add log_strdup test to log_core test
Extended log_core test suite to test string duplication.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-01 15:26:14 -04:00
Krzysztof Chruscinski a15438e8f5 logging: add mechanism for handling transient strings
Extending logger to support logging transient strings (with %s).
With dedicated call (log_strdup), string is duplicated to a buffer
from internal logger pool. Logger implicitly manages the pool.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-01 15:26:14 -04:00
Luiz Augusto von Dentz 592dd2e964 Bluetooth: shell: Port commands to the news shell
Fixes #8873

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-01 11:10:46 +02:00
Spoorthi K 6a34c72582 tests: POSIX: Enhance test to verify deadlock
Check pthread_join() call with current thread ID.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-09-29 06:01:39 -04:00
Mark Ruvald Pedersen d67096da05 portability: Avoid void* arithmetics which is a GNU extension
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.

Pointer arithmetics over void types is:
 * A GNU C extension
 * Not supported by Clang
 * Illegal across all ISO C standards

See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2018-09-28 07:57:28 +05:30
Flavio Ceolin 02ed85bd82 kernel: sched: Change boolean APIs to return bool
Change APIs that essentially return a boolean expression  - 0 for
false and 1 for true - to return a bool.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-28 06:28:41 +05:30
Alberto Escolar Piedras bded528b6b tests: uart: add extra config for native_posix
When running a UART test in CI, it is better to configure
the nativeposix UART to be mapped to the process STDIN/OUT.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-27 17:24:34 +02:00
Anas Nashif f6e7e98909 tests: test k_thread_name_set
Basic test for new API: k_thread_name_set.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-27 08:58:55 +05:30
Sebastian Bøe c0287695fb kconfig: Remove remnants of unimplemented BUILD_TIMESTAMP feature
The Kconfig option CONFIG_BUILD_TIMESTAMP became unused when
BUILD_VERSION was introduced, but it's option and parts of it's
implementation was not completely cleaned from the repository.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-26 22:18:29 +05:30
Punit Vara 4b120c27f2 tests: adc_api: Fix delay problem with test
Increase interval time so that asynchronous test get enough time to run
successfully.

Fixes #9830

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-09-26 15:56:21 +05:30
Maureen Helm 71f5a1776e tests: i2c_slave_api: Add missing testcase.yaml
The i2c_slave_api test was missing a testcase.yaml and therefore not
getting built by CI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-26 08:06:11 +05:30
Daniel Leung 7228a60173 kernel: Fix compilation errors when CONFIG_TIMESLICING=n
Add ifdef guard to the z_reset_timeslice() to fix compilation
errors when CONFIG_TIMESLICING is disabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-25 12:54:58 +05:30
Mieszko Mierunski 1dd5dc63c1 drivers: i2c: Add dts support for i2c slaves.
Adding i2c slave requires overlay with node definitions and
proper aliases depending on driver implementation.

Modified i2c_slave_api test to use information from dts.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-09-24 07:26:07 -05:00
Luiz Augusto von Dentz 3151d26572 Bluetooth: L2CAP: Add return to recv
This adds a int return to recv callback which can be used to notify the
stack about errors when receiving a packet. In addition to that the user
can return -EINPROGRESS to inform the stack the data will be processed
asynchronously which can be complete by calling
bt_l2cap_chan_recv_complete.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-09-24 12:51:11 +03:00
Sebastian Bøe 72e7bfa680 cmake: Remove unnecessary KCONFIG_ROOT configuration
It is no longer necessary to set the KCONFIG_ROOT variable when the
KConfig file is in the application root directory.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-21 13:37:21 -04:00
Maureen Helm d2d076445c tests: build_all: Add missing dts fixups for apds9960
The apds9960 sensor driver recently added support for trigger mode, but
the gpio dts fixups weren't added to the build_all test. Adds the
missing dts fixups and updates the sensor trigger test to include the
apds9960 sensor driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-21 17:35:16 +02:00
Ajay Kishore 22d653fd20 tests: sched: Use SCHED_MULTIQ for native posix platform
To improve the code coverage on native posix, adding CONFIG_SCHED_MULTIQ
for scheduler api tests.

Extracting a separate prj_native_posix.conf file for the scheduler test,
which validates the "multi queue" scheduler on native posix.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-09-21 08:50:13 -04:00
Adithya Baglody da73606218 tests: benchmarks: sys_kernel: Reduce the number of loops.
The total number of loops being executed were taking far too long
to finish executing the test case. This was causing the timer handler
to execute in the middle of the test case. Thereby causing a test case
failure.
Now the number of loops have been reduced and this will make sure the
test case completes.

This change has no effect on the time being calculated by the
benchmark.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Adithya Baglody 0e11792f4e tests: userspace: Incorrect location to the privileged stack.
The test case was supposed to access the privileged stack area
but instead it was accessing the stack guard region.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Adithya Baglody b19f3ec2ba tests: mem_protect: mem_protect: Update the stack size.
This patch updates the alignment for the memory domain partitions.
Also update the stack size for qemu_cortex_m3.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Adithya Baglody 44057a197f tests: kernel: pipe : Update the stack size.
Now the stack size is a function of CONFIG_TEST_EXTRA_STACKSIZE.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Adithya Baglody a8f2675604 tests: userspace: Update the required stack size for mps2_an385
Increasing the stack size to 1024.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Maureen Helm 71feeceb1b tests: build_all: Add missing sensor drivers and rebalance testcases
Adds many missing sensor drivers and rebalances the testcases to
instantiate similar numbers of sensor drivers. Splits the sensor trigger
testcase into two due to having too many thread objects.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 806bc1a4da tests: build_all: Add missing dts fixups for sensor drivers
Adds missing dts fixups for multiple sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Piotr Zięcik 1c16cfcc30 arch: arm: Make ARM_MPU the sole option controlling MPU usage
This commit removes all MPU-related (ARM_CORE_MPU and NXP_MPU)
options exept ARM_MPU, which becomes master switch controlling
MPU support on ARM.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-09-20 14:16:50 +02:00
Piotr Zięcik 9331064ff9 arch: nrf52: Remove ARM_MPU_NRF52X option.
The ARM_MPU_NRF52X option is just selecting ARM_MPU option,
which could be also controlled through menuconfig.

This commit removes the ARM_MPU_NRF52X option and replaces
its usage by ARM_MPU option.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-09-20 14:16:50 +02:00
Krzysztof Chruscinski ba808d789e samples: subsys: shell: Port sample to new shell subsystem
Ported shell sample to use new shell.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Krzysztof Chruscinski 527256501f shell: Rename shell to legacy_shell
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Maureen Helm cddf26a4f6 tests: spi_loopback: Add mimxrt1050_evk configuration
Adds a board-specific configuration for the mimxrt1050_evk to the
spi_loopback test.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-19 09:15:29 -04:00
Krzysztof Chruscinski cd850647d5 tests: subsys; logging: log_core test to cover LOG_MODULE_DECLARE()
Extending log_core test suite to test LOG_MODULE_DECLARE() macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 08:38:35 -04:00
Kumar Gala 05272d62b3 tests: mem_protect: syscalls: set CONFIG_USERSPACE in prj.conf
Set CONFIG_USERSPACE in the prj.conf to ensure its set, right now
getting CONFIG_USERSPACE depends on tests/Kconfig setting it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-09-18 17:03:57 -04:00
Sebastian Bøe 878a0f050e ld: Put 'sizeof(struct device)' in the generated offsets header
Rename _DEVICE_STRUCT_SIZE to _DEVICE_STRUCT_SIZEOF. This causes it to
be picked by the script 'gen_offset_header.py' and inserted into the
header file 'include/generated/offsets.h'.

Renaming from x_SIZE to x_SIZEOF will align it's name with the other
symbols that denote a sctruct's size, like K_THREAD_SIZEOF.

Furthermore, it will allow the symbol to be accessed through a header
file define, instead of only as an extern symbol. This is more
flexible, and more aligned with the other symbols in offsets.

Finally, if we are able to move all of offsets.c symbols into the
offsets.h header file we be able to remove offsets.o from the link and
thereby simplify the linking process.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-18 16:23:40 +02:00
Alberto Escolar Piedras eca0fb6ca0 tests: subsys: logging: log_core fix with inplace process
tests/subsys/logging/log_core does not work if inplace processing
is set and the process thread is disabled.
So let's set the valid configuration in its project file

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-18 14:56:10 +02:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Flavio Ceolin a1135620ba misc: printk: Change function return
The result of both printk and vprintk are not used in any place.
MISRA-C says that the return of every non void function must be
checked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Maureen Helm df2cc4084a tests: usb: Enable usb tests on frdm_k64f
Enables the bos and os_desc tests on the frdm_k64f platform.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-14 13:22:03 -05:00
Maureen Helm 4c81e94af1 tests: usb: Don't enable stdout console
This was causing a stack overflow on the frdm_k64f platform.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-14 13:22:03 -05:00
Ajay Kishore 75780a8135 tests: pipe: Enhance tests to improve code coverage
This test is intended to validate k_pipe_alloc_init()
and k_pipe_cleanup(), when CONFIG_USERSPACE is not defined.
Also added test to validate pending reader and pending writer
feature in pipe.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-09-14 09:06:31 -04:00
Varun Sharma 28f5da6c38 subsys: shell : fs new shell module for fs mount operation
Fixes # 7348, also includes test cases

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2018-09-13 09:27:45 -04:00
Anas Nashif 81b272119a docs: fixed documenation pointers
Fixed URL to documentation, now latest docs are under /latest/..
Fixes #9932

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-12 12:03:18 -04:00
Ulf Magnusson d713033d5c Kconfig: Use new preprocessor syntax for env. variables
With the new Kconfig preprocessor (described in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/
kconfig-macro-language.txt), the syntax for expanding environment
variables is $(FOO) rather than $FOO.

$(FOO) is a general preprocessor variable expansion, which falls back to
environment variables if the variable isn't set (like in Make). It can
also be used in prompts, 'comment's, etc.

The old syntax will probably be supported forever in Kconfiglib for
backwards compatibility, but might as well make it consistent now that
people might start using the preprocessor more.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-09-11 19:17:25 -04:00
Anas Nashif ec6b0dfbb8 tests: crypto: rename hmac_prng
Make the test specific to tinycrypt.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-11 17:25:00 -04:00
Anas Nashif ec18f1d640 tests: tinycrypt: consolidate tests
Put all tinycrypt tests into one project. Having project for every small
feature does not scale and slows down testing and CI operations.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-11 17:25:00 -04:00
Kumar Gala 4fede8dd0b log: make name param explicit
Rather than having some implied name for the logging name, explicitly
pass it in the macros LOG_MODULE_REGISTER & LOG_MODULE_DECLARE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-11 13:25:55 -05:00
David Brown ced1c03c40 tests: posix: Test realtime clock
Create a basic test for the realtime clock.  This sets the clock value
to a particular time, half a second in, and monitors the clock for a few
seconds, making sure that the value returned is reasonable.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-09-11 09:21:52 -04:00
Tomasz Bursztyka b6468999e4 net/pkt: Rename link layer address accessors relevantly
*_ll_src/*_ll_dst/*_ll_swap/*_ll_if were not self explanatory, ll
meaning "link layer" it's ambiguous what the names meant.
Changing to:
*_lladdr_src/*_lladdr_dst/*_lladdr_swap/*_lladdr_if to fix this.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-09-11 16:06:13 +03:00
Rajavardhan Gundi 8f3c338497 tests/cmsis_rtos_v1: Introduce negative tests for mailQ
Introduces some negative test cases to check all possible values
returned by the APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-09-11 09:03:03 -04:00
Filip Kubicz 990a0e8c71 dts: add SPI bindings for nRF family
This change adds DTS definition of SPI device for nRF chips.
It also removes SPI pin configuration from Kconfig and moves it to
chip DTS.

Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
2018-09-11 11:41:37 +02:00
Jukka Rissanen 6850df31a0 tests: net: ipv6: Test long lifetime IPv6 prefixes
Make sure that long lifetime IPv6 prefixes are supported
properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-09-11 10:53:30 +03:00
Jukka Rissanen f8c6c7f0f0 tests: net: ipv6: Test long address lifetime timeouts
Check that long (> 24 days) IPv6 address lifetime timer is
properly handled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-09-11 10:53:30 +03:00
Praful Swarnakar 50930300d9 tests: cmsis_rtos_v1: Add additional test scenarios
Add additional test scenarios to validate signal event
APIs such as setting signal from ISR, setting/clearing
each unique flag and few negative test cases too.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-09-09 12:54:27 -04:00
Rajavardhan Gundi 1b0391682e tests/cmsis_rtos_v1: Test mutex ownership during releasing
Introduce test to check that only the thread which locks the mutex
shall be able to release it.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-09-09 11:05:23 -04:00
Andy Ross a7e5d2f02e tests/kernel/sched/deadline: Disable CONFIG_BT
The BT threads are interfering with the main thread priority selection
and the test fails semi-spuriously on NRF5x boards with "threads ran
too soon" (i.e. not an EDF failure per se, but the fact that the new
threads at K_LOWEST_APPLICATION_PRIO are running instead of the test
thread).  This is a reasonable workaround for testing the
SCHED_DEADLINE ordering behavior, though.

Fixes #9843

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-09-08 08:43:06 -04:00
Flavio Ceolin 502db21672 tests: crypto: mbedtls: Fix mbedTLS self test usage
All _self_test functions should be called only if MBEDTLS_SELF_TEST is
enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-06 21:11:31 -04:00
Flavio Ceolin 8b70ace563 crypto: tests: Change crypto tests to use Kconfig defined header
While it's possible to define which mbedTLS config header to use, our
samples should use config-tls-generic.h as default because this header
is configurable through Kconfig.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-06 21:11:31 -04:00
Andy Ross 02aa980042 tests: Add kernel/sched/deadline test for EDF validation
Simple test for CONFIG_SCHED_DEADLINE.  It creates a bunch of threads
at randome deadlines but within the same priority, and validates that
they run in the correct order.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-09-06 14:26:22 -04:00
Daniel Leung 0c55752687 tests/drivers: adc: add config for Quark D2000
Add the configuration block for Quark D2000 for the adc_api
test.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Anas Nashif a9f32d66cf tracing: remove stray event_logger code
Remove obsolete kernel event logger code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-05 16:05:08 -04:00
Adithya Baglody 41a0fb937e tests: benchmarks: timing_info: Fixed userspace benchmarks for nrf52
In NRF52 we need to write to a capture register to retrieve the current
counter value. This was missing for userspace implementation.

Fixes: GH-9676

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-03 12:43:07 -04:00
Anas Nashif f2883ec169 tests: rename test entry functions
Be compatible with the rest and enable parsing of sub-cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-31 15:11:39 -04:00
Anas Nashif c8402bc3ce tests: preempt: increase stack size for test
Failed with:

Running test suite suite_preempt
===================================================================
starting test - test_preempt
***** Stack Check Fail! *****
Current thread ID = 0x0040019c
eax: 0x00400254, ebx: 0x00400254, ecx: 0x004002b0, edx: 0x00000001
esi: 0x004001f8, edi: 0x00401080, ebp: 0x00408024, esp: 0x00408000
eflags: 0x00000046 cs: 0x0008
call trace:
eip: 0x00002115
     0x000021b8 (0x40019c)
     0x00002685 (0x4001f8)
     0x00004f65 (0x401120)
     0x00005187 (0x401120)
     0x000051c2 (0x40019c)
     0x000052be (0xffffffff)
     0x00005bab (0x246)
     0x000019c4 (0x400078)
Fatal fault in thread 0x0040019c! Aborting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-31 11:14:39 -04:00
Anas Nashif af17c195b4 tests: syscalls: ignore faults, they are intentional
We are blowing up the kernel here intentionally, so ignore the faults on
some platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-30 15:05:30 -04:00
Andy Ross 2f95e2400f tests/kernel/threads/no-multithreading: Disable USERSPACE
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>
2018-08-30 13:29:09 -04:00
Praful Swarnakar 9c68c469e2 tests: crypto: sha256: Add the missing test case for execution
Add the missing sha256 crytographic algorithm testcase for
execution via ztest. The sub test case was not getting executed
as it was missed to be added in ztest suite.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-30 10:02:42 -04:00
Paul Sokolovsky 14742d79fe tests: k_poll: Add testcase to poll fifo which gets k_fifo_cancel_wait
In this case k_poll() returns -EINTR, while still fills in event
states.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-30 09:28:29 -04:00
Niranjhana N 30d478a5fd tests: cmsis_rtos_v1: add and enhance msgq tests
Added few more tests to cover all the message
send and receive scenarios. Added negative tests
to increase code coverage.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-30 01:11:08 -04:00
Maureen Helm 3e41864e25 tests: gen_isr_table: Add barriers after triggering the irq
Fixes the gen_isr_table kernel test on mimxrt1050_evk by using data and
instruction synchronization barriers instead of disabling compiler
optimization on arm platforms. According to [1] section 4.5, "if a
pended interrupt request needs to be recognized immediately after being
enabled in the NVIC, add a DSB instruction and then an ISB instruction"

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHJDAAE.html

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-29 18:48:42 -04:00
Daniel Leung 4a2ba0dd04 tests/kernel: pipes: add tests for smaller pipe buffers
This adds some test cases where the pipe buffer is smaller than
the size of data being pushed through the pipe.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-08-29 15:57:28 -04:00
Punit Vara 108b5398e4 tests: adc_api: Remove sample width test scenario
Remove unnecessary sample width scenario.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara 1bfa34f4fb tests: adc_api: Add ARC related parameters for ADC
Add ARC related parameters and modified test case to work
this test case on arc sensor subsystem.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Justin Watson 4e551aabb6 sam: adc: Updated SAM ADC driver.
Updated to work with new ADC API.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-08-29 13:46:57 -04:00
Maureen Helm c68e41dffe tests: adc_api: Add support for kinetis boards
Adds board-specific macros to enable the adc_api test to run on kinetis
boards. This restores the test to support all the nxp boards that were
supported before the new adc api was introduced.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek 9e161a5a01 tests: adc_api: Add configurations for nRF5 boards
This adds to the adc_api test board-specific configurations
for the following boards:
- nrf51_pca10028
- nrf52_pca10040
- nrf52840_pca10056

"adc" is indicated as supported in the yaml files for these boards
so that they are included in sanitycheck.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek f1891e9473 drivers: adc: Introduce reworked API
This commit replaces the API for ADC drivers with a reworked one.
As requested in the issue #3980, the adc_enable/adc_disable functions
are removed. Additionaly, some new features are introduced, like:
- asynchronous calls
- configuration of channels
- multi-channel sampling

Common parts of code that are supposed to appear in each implementation
of the driver (like locking, synchronization, triggering of consecutive
samplings) are provided in the "adc_context.h" file to keep consistency
with the SPI driver. Syscalls are no longer present in the API because
the functions starting read requests cannot use them, since they can be
provided with a callback that is executed in the ISR context, and there
is no point in supporting syscalls only for the channels configuration.

"adc_api" test is updated and extended with additional test cases,
with intention to show how the API is supposed to be used.
"adc_simple" test is removed as it does not seem to add much value.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Jukka Rissanen 44498e6c8a tests: net: websocket: Fix crash when tearing down tests
No need to have setup and teardown functions. Teardown will
even cause crash when tearing down last IPv4 test.

Fixes #9617

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-29 10:57:56 -04:00
Jukka Rissanen a81aad9756 tests: net: Run networking tests only for selected platforms
Run networking tests for native_posix, qemu_x86 and qemu_cortex_m3
platforms only as the tests are generic enough so no need to run
them in real physical device.

Fixes #9623 #9614 #9622 #9621 #9618

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-29 10:57:56 -04:00
Adithya Baglody 24c96a8a47 tests: benchmarks: sys_kernel: Enable benchmark for slower SoCs
Few SoCs whose clock speed is very less will cause multiple ticks
to occur for 1 sec of sleep. For such a platform we cant run
the loops for over 5000 because the tick handler will get executed.
Thus rendering the test useless for such platforms. By reducing
the number of iterations we get the required benchmark results.

Fixes: GH-7906

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-29 07:58:02 -04:00
Jørgen Kvalvaag 70f85fee34 tests: net: mqtt: Fix rc check in mqtt_publisher test
Actually use the inverted condition.

Signed-off-by: Jørgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
2018-08-29 07:56:29 -04:00
Spoorthi K baabe64549 tests: cmsis_rtos_v1: Wait for longer duration in k_busy_wait
For boards like nrf52 with low system clock (32768), k_busy_wait
for values less than 1 second (1000000 us) ends up waiting less
than the desired wait time because of decimal truncation while
converting wait time to hw clock cycles. Hence increased the wait
to 1 second.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-28 19:19:56 -04:00
Wayne Ren 3f2f6dda1a tests: a fix for ARC and MPU VER 3
For ARC MPU version 3, the defined partitions are not added to MPU
when appmem_init_app_memory is doning app_bss_zero().

So need to disable mpu first to allow appmem_init_app_memory to
access all partitions.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-08-28 13:57:50 -04:00
Anas Nashif d2b4d8f049 tests: thread_api: increase stack for test
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>
2018-08-27 18:41:22 -04:00
Spoorthi K 1b5db96a1d tests: benchmark: Check for return values
Check for return value of k_mbox_get() and k_mbox_put()
    functions.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-27 12:43:43 -04:00
Ajay Kishore f17b111e39 tests: kernel: init: Fix integer overflow issue
Cast the msec to nsec conversion macro with u64_t to fix the
integer overflow issue.

Fixes #9135

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-26 18:47:08 -07:00
Niranjhana N dc537eb6a9 tests: cmsis_rtos_v1: add semaphore negative tests
Added couple of negative tests for osSemaphoreWait
and osSemaphoreRelease to increase code coverage.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-26 08:56:17 -07:00
Praful Swarnakar 9dd63f7ddf tests: cmsis_rtos_v1: Add more test scenarios in mutex
Add additional test usecases in cmsis mutex to check
maximum number of mutexes allowed at a time. Also, add
couple of negative tests for invalid parameter check.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-25 07:16:48 -07:00
Niranjhana N 5c3198e3b7 tests: power: exclude arduino_101
The test errors on Arduino_101 due to
limitations in power management driver
on the platform. Hence excluding this.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-24 07:06:11 -07:00
Adithya Baglody 871cc3232f tests: kernel: sched: schedule_api: Increase stack size.
The stack size was way too less. Increasing the size to minimum
of 512 for all platforms.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-24 07:03:34 -07:00
Anas Nashif ac47070d10 tests: qmsi: remove soc watch sample
Remove this feature specific to QMSI and available through samples only
to allow for migration to tracing hooks.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-21 05:45:47 -07:00
Jukka Rissanen 9038416bdd tests: net: ipv6: Add tests for verifying DAD timers
Make sure that DAD timers are triggered in proper order.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-21 14:01:10 +03:00
Spoorthi K 2a72f500cb tests: smp: Modify test to verify thread delay
Improved test with thread delay and removed few prints.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-20 17:51:07 -07:00
Adithya Baglody a4d1e36aaa tests: benchmarks: timing_info: Cleanup testcase.yaml
The only architecture not supported is native posix. Added it to
arch_exclude.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 1d27b404a6 tests: benchmarks: timing_info: Enable benchmarks for riscv32.
This patch provides support needed to get timing related
information from riscv32 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 79f65d4db7 tests: benchmarks: timing_info: Enable benchmarks for nios2.
This patch provides support needed to get timing related
information from nios2 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody bb918d85f8 tests: benchmarks: timing_info: Enable benchmarks for xtensa.
This patch provides support needed to get timing related
information from xtensa based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 30b569e84a tests: benchmarks: timing_info: Discard selected measurements.
Discard selected measurements that occur immediately before and
after the timer interrupt occurs. This causes fluctuations in the
time measured.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 43af891a37 tests: include: Add implementation of timestamp_serialize()
Add implementation of timestamp_serialize() for xtensa, nios2
and riscv. The implementation for the above architectures is an
empty function.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 022588e88d tests: benchmarks: timing_info: Enable benchmarks for ARC.
This patch provides support needed to get timing related
information from ARC based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 667ad04086 tests: benchmarks: timing_info: Add userspace related KPIs.
Added new KPIs for the userspace benchmarks.
1. Drop to user mode.
2. User thread Creation.
3. Syscall overhead.
4. Validation overhead k object init.
5. Validation overhead k object permission.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Karol Lasończyk c9e3c938e6 tests/samples: watchdog: Update projects' configuration
WDT_NRFX is now enabling by default. Its configuration from proj.conf
files was removed.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-08-20 06:38:02 -07:00
Ajay Kishore 8c456f755d tests: mempool: Enhance tests to improve code coverage
Assisning system heap to the current thread.
And validate allocation and free memory from the same system
heap memory pool.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-19 13:09:35 -07:00
Anas Nashif ce88792a6e tests: fp_sharing: use filter
use CONFIG_ARMV7_M_ARMV8_M_FP as filter instead of platform_whitelist.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-19 12:26:13 -07:00
Adithya Baglody f3e0566650 tests: kernel: fp_sharing: Added support for Cortex-M7
Added required macros to get the test case working with a
cortex-M7.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-19 12:26:13 -07:00
Ajay Kishore d36aae1550 tests: cmsis_rtos_v1: add negative tests for timer api
Added negative tests to timer api. It will help to increase
code coverage.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-17 07:30:12 -07:00
Mieszko Mierunski 4f6aac1a67 dts: nrf5: Changed GPIO and GPIOTE define names
Changed names using nrf5 to nrf for consistency with other drivers.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski b468b24d75 tests: gpio: Added nRF board to gpio test
Added pin definitions for gpio tests for PCA10056, PCA10048
and PCA10028

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Ajay Kishore 47889cd12c tests: fatal: Add description and RTM links
Add doxygen groups, description and RTM links for
fatal test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-17 06:18:21 -07:00
Jukka Rissanen db2cbe7ed4 tests: net: iface: Initialize port number
Coverity-CID: 187671
Coverity-CID: 187672

Fixes #9460
Fixes #9461

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-17 15:42:21 +03:00
Jukka Rissanen aaaf20e615 tests: net: ptp: Check max number of interfaces
Add checks so that we do not overflow the network interface
array. Similar issues was fixed in commit b4dae00741 for
TX timestamp tests.

Fixes #9465

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-17 13:50:59 +03:00
Oleg Zhurakivskyy 99dc5aef88 net: ip: Refactor usage of net_sprint_ip*()
Refactor usage of net_sprint_ip*() where multiple
invocations are needed per single log call.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-08-17 12:36:50 +03:00
Tomasz Gorochowik fe1797f62c tests: net: ethernet_mgmt: Don't recalculate deltaBW with no link
Fixes #9462

Coverity ID: 187670

Attempts to recalculate deltaBandwidth with no link lead to division by
zero.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-17 12:27:44 +03:00
Anas Nashif ba6763a187 tests: disable HDC1008 from build tests
Causing some issues with some boards after introducing DTS support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-16 20:48:50 -07:00
Flavio Ceolin 0866d18d03 irq: Fix irq_lock api usage
irq_lock returns an unsigned int, though, several places was using
signed int. This commit fix this behaviour.

In order to avoid this error happens again, a coccinelle script was
added and can be used to check violations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-16 19:47:41 -07:00
Spoorthi K 1c721217df tests: smp: Additional tests to verify SMP functionality
Add tests to verify SMP functionality

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-16 15:48:40 -07:00
Praful Swarnakar 94acc18b3e coverage: tests: poll: Add test to validate multiple polling threads
Add testcase for validating poll events by manipultaing thread
state to improve code coverage. Also, add multiple threads to
wait on same event.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-16 15:31:43 -07:00
Anas Nashif 57db41516e tests: remove subsys from test identifier
subsys should not be part of the identifier, it is folder structure.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-16 13:20:53 -07:00
Anas Nashif 9956dfc7b1 tests: update test identifier
Fix some wrong test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-16 13:20:53 -07:00
Spoorthi K c9ca19949e tests: cmsis_rtos_v1: Add and enhance test suite
Add tests for kernel managament APIs and enhance memory
pool tests with bulk allocation, free and negative cases.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-16 06:21:28 -07:00
Niranjhana N 74e02e5d4e tests: cmsis_rtos_v1: add negative tests
Added few negative tests to thread_apis test
to increase code coverage.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-16 06:19:47 -07:00
Grzegorz Kolodziejczyk 734eda39f5 bluetooth: tester: Increase SDU size to meet PTS requirement
PTS test cases MESH/NODE/TNPT/BV-07-C, MESH/NODE/TNPT/BV-12-C, requires
to receive 8 segment of data which summary requires 108 bytes of SDU.
This patch make test cases PASSing.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-08-16 12:41:55 +03:00
Daniel Egger 5d3bc8b3d8 net: pkt: Added new function net_pkt_append_memset() to prefill packet
Some locations like DHCPv4 client create a prefilled packet by appending
new fragments in a loop with one byte each via net_pkt_append_u8() which
is wasteful and noisy. This patch adds the new functions
net_pkt_append_memset() which creates fragments as needed in the desired
size and initialises it to the specified value.

This change also adds a unittest for the new function.

Prerequisite for #9287

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-08-16 10:35:01 +03:00
Kumar Gala 331659c76b tests/net: ieee802154: fragment: Fix build error
Commit ac92a01f5a changed the net_ipv6_hdr
definition.  The ieee802154 fragment test wasn't updated to match this
change.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-08-15 23:48:22 +03:00
Kumar Gala ebc3ce3a0e Revert "log: make name param explicit"
This reverts commit 2cb17a0332.  It
doesn't handle the dynamic logging case and thus breaks things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-08-15 11:19:46 -05:00
Kumar Gala 5f1d6264ae tests: CONFIG_ARC_INIT is n by default
Commit 8525944c54

    tests: power: refactor power_states test

Re-introduced CONFIG_ARC_INIT=n that isn't required and causes build
errors for sanitycheck.

Fixes #9444

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-08-15 10:18:09 -05:00
Kumar Gala 2cb17a0332 log: make name param explicit
Rather than having some implied name for the logging name, explicitly
pass it in the macros LOG_MODULE_REGISTER & LOG_MODULE_DECLARE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-08-15 09:41:02 -05:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
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>
2018-08-15 04:06:50 -07:00
Piotr Zięcik 5b3a7ed740 tests: kernel: Do not use exact time in timing checks.
This commit replaces exact time compassion by a range check, allowing
the tests to pass on platforms which needs rounding in __ticks_to_ms()
and _ms_to_ticks().

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-08-14 07:18:44 -07:00
Krzysztof Chruscinski 3c63d05dfc logging: Add metadata to hexdump
Extended hexdump API with a raw string attached to the data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-08-14 07:14:34 -07:00
Paul Sokolovsky 028aae1ec9 net: config: Rename Kconfig options to correspond to library name
This finishes refactor of splitting off net_config library name from
net_app library, started in c60df1311, c89a06dbc. This commit makes
sure that Kconfig options are prefixed with CONFIG_NET_CONFIG_
instead of CONFIG_NET_APP_, and propagates these changes thru the
app configs in the tree.

Also, minor dependency, etc. tweaks are made.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-13 18:42:31 -07:00
Maureen Helm ecd7504d0b tests: spi_loopback: Increase k_poll timeout
The frdm_kw41z runs at a much slower clock frequency than the frdm_k64f.
Increase the k_poll timeout in the asynchronous callback thread to allow
the spi transaction to complete on frdm_kw41z.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Maureen Helm f15bca29c3 tests: spi_loopback: Add zasserts to fix false passes
The testcase was using only SYS_LOG_ERR() to signal error conditions,
which would print useful error information to the console, but allow the
test to pass when it should fail. Add zasserts after every SYS_LOG_ERR()
to make the test fail properly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Maureen Helm 7dc09636f1 tests: spi_loopback: Increase size of async callback thread stack
The asynchronous callback thread was overflowing its stack and causing a
bus/mpu fault when hardware stack checking is enabled. Increase the size
of the stack.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Rajavardhan Gundi f7779895fd tests/cmsis_rtos_v1: Introduce tests to make use of Signal APIs
Some test programs to illustrate the usage of Signal Event APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi f4999f7949 tests/cmsis_rtos_v1: Introduce tests to make use of messageQ APIs
Some test programs to illustrate the usage of msgq APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi 1b6eb7d1ad tests/cmsis_rtos_v1: Introduce tests to make use of mailq APIs
Some test programs to illustrate the usage of mailq APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi d543e8c835 tests/cmsis_rtos_v1: Introduce tests to make use of mempool APIs
Some test programs to illustrate the usage of mempool APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi c996d0581f tests/cmsis_rtos_v1: Introduce tests to make use of Semaphore APIs
Some test programs to illustrate the usage of Semaphore APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi a76556a22c tests/cmsis_rtos_v1: Introduce tests to make use of Mutex APIs
Some test programs to illustrate the usage of Mutex APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi a57d994aaa tests/cmsis_rtos_v1: Introduce tests to make use of Timer APIs
Some test programs to illustrate the usage of timer APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi b2b53196bc tests/cmsis_rtos_v1: Introduce tests to verify Thread instances
Some tests to verify the implementation of thread instances.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi 0ab496b5be tests/cmsis_rtos_v1: Introduce tests to make use of Thread APIs
Some test programs to illustrate the usage of thread APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Ajay Kishore 4cc2866358 tests: FIFO: Add description and RTM links
Add doxygen groups, description and RTM links for
FIFO test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-13 12:35:10 -07:00
Ajay Kishore 648477c6ed tests: static_idt: Add description and RTM links
Add doxygen groups, description and RTM links for
static idt test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-13 12:34:11 -07:00
Johan Hedberg 7ec40e81d0 Bluetooth: shell: Add multiple identity support
Add shell support for creating and showing identities.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Johan Hedberg 5708f1e8b1 Bluetooth: Add infrastructure to handle multiple identities
Make it possible to have multiple identity addresses as an LE
peripheral. For central role only the default identity is supported
for now. This also extends the flash storage in a backward compatible
way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Andrew Boie 18cec245ba net: introduce system calls for zsock socket APIs
Add system calls for the zsock implementations of socket,
close, bind, connect, listen, accept, sendto, recvfrom,
fcntl, poll, inet_pton, and getaddrinfo.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-08-13 07:19:39 -07:00
Spoorthi K a54a887a70 tests: kernel: Add doxygen groups
Add doxygen groups for kernel test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-13 07:02:21 -07:00
Spoorthi K db9f6a9094 tests: obj_tracing: Enhance object tracing test
Enhance object tracing test to improve code coverage
of kernel object initialization.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-13 06:39:01 -07:00
Niranjhana N 8525944c54 tests: power: refactor power_states test
Refactored test to work with ztest framework
and to calculate and display time in milliseconds
for each power state.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-13 04:50:19 -07:00
Niranjhana N e21e6c1b97 tests: posix: improve pthread_key test
In addition to testing all the APIs, this enhancement
tests the following two scenarios
  - when multiple threads use a single key for storage
  - when a single thread associates its value with
    multiple keys

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-08-13 04:48:48 -07:00
Oleg Zhurakivskyy ac92a01f5a net: ipv6: Refactor IPv6 header length handling
Change the length to uint16_t and work with it
through standard htons/ntohs() macros.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-08-13 13:53:14 +03:00
Inaky Perez-Gonzalez b073b29688 tests/booting/stub: remove CONFIG_ARC_INIT
This stub was forcing this configuration option that is not neccesary
and the configuration system is complaining about it, failing most
Arduino101 stub builds.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-08-12 06:52:48 -07:00
Ulf Magnusson 3ed9328d33 Kconfig: Get rid of some leftover 'option env's
These are no longer required. Kconfiglib expands references to
environment variables directly.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Praful Swarnakar 68bde79ee5 tests: kernel: device: Add RTM link, description and doxygen group
Add RTM links, description and doxygen group for device test cases.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-10 04:06:42 -07:00
Ajay Kishore b3f4d6b057 tests: lifo: Add description and RTM links
Add doxygen groups, description and RTM links for
lifo test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-10 04:03:59 -07:00
Ajay Kishore dec8b9e559 tests: msgq: Add description and RTM links
Add doxygen groups, description and RTM links for
msgq test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-10 04:03:16 -07:00
Spoorthi K 234f48e1ef tests: userspace: Add description and doxygen links
Add description and doxygen links to userspace test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:55:44 -07:00
Spoorthi K 6910f15fcf tests: protection: Add description and doxygen group
Add description and doxygen groups for protection
test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:55:44 -07:00
Spoorthi K b32b39af05 tests: userspace: Remove extra call to same testcase
The test read_kobject_user_pipe() is called twice in
the test suite. There is no need of calling same test
twice. Removing the extra call.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:54:43 -07:00
Spoorthi K 0975663e3f tests: x86_mmu_api: Add description and doxygen groups
Add description, RTM links and doxygen groups for
x86_mmu_api test cases.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:53:57 -07:00
Spoorthi K 477219b2dc tests: syscall: Add description and RTM links
Add description, RTM links and doxygen groups for
syscall test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:52:47 -07:00
Spoorthi K 4ae9dd5a7c tests: mp: Add description, RTM links and doxygen group
Add description, RTM links and doxygen group for
test cases in mp.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:51:35 -07:00
Jukka Rissanen 45a1c1fb67 tests: net: ipv6: Wrong API struct was used for ethernet device
As ethernet_api is larger than net_if_api, and we are accessing
ethernet_api elements in ethernet L2 driver, then invalid memory
was accessed in L2 ethernet.c.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-10 12:36:19 +03:00
Praful Swarnakar 3a82aef5df tests: lib: mem_alloc: Add tests to validate dynamic allocation
Add new test cases to validate dynamic memory allocation
functions such as malloc, calloc, realloc using minimal libc
and newlibc implementation of standard C library.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-09 09:41:00 -07:00
Daniel Leung b16b4e6e4b tests: kernel: add tests for dynamic threads
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>
2018-08-09 09:20:14 -07:00
Daniel Leung cd3e5b561d tests/kernel: kernel.queue.poll: fails if MAX_THREAD_BYTES > 2
The kernel.queue.poll test fails if CONFIG_MAX_THREAD_BYTES is larger
than 2, complaining about no memory for semaphore object. Turns out
the memory pool is not large enough. So make it a bit larger.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-08-09 09:20:14 -07:00
Oleg Zhurakivskyy fbac80bb94 net: ipv4: Refactor IPv4 header length handling
Change the length to uint16_t and work with it
through standard htons/ntohs() macros.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-08-09 16:25:17 +03:00
Jukka Rissanen 297efa514d tests: net: iface: Add test for net_if_select_src_iface() function
Make sure net_if_select_src_iface() function works ok for both IPv4
and IPv6 addresses.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 14:54:27 +03:00
Jukka Rissanen 05d9b0461c tests: net: iface: Add test for net_if_ipv6_select_src_iface()
Make sure that net_if_ipv6_select_src_iface() returns correct network
interface for a given destination address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 14:54:27 +03:00
Tomasz Gorochowik 7930419ad6 tests: net: ethernet_mgmt: Improve and finish Qav testing
With this commit all Qav parameters are tested and the fake driver
properly stores and recalculates info about all the Qav parameters to
make them available for read-back.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:37:09 +03:00
Tomasz Gorochowik d380c891cc tests: net: Add new TC mappings testcases
The new mappings require at least two traffic classes so there are fewer
tests than there are for the strict mapping.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:23:57 +03:00
Szymon Janc 504584a998 Bluetooth: att: Add option to disable GATT writable name
This allow to set name at runtime while leaving GAP name characteristic
read only.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-08-03 10:41:01 +02:00
Tarun Kumar Agarwal b8ca8cf9b7 tests: net: lib: coap: Added new functions to improve code coverage
In coap module previous test cases are modified as well as
new test functions are added to increase the code coverage

Signed-off-by: Tarun Kumar Agarwal <tarun.kumar.agarwal@intel.com>
2018-08-02 20:35:33 +03:00
Flavio Ceolin 1ad369df08 tests: crypto: cbc_mode: Fix input length
Input length was accounting TC_AES_BLOCK_SIZE twice and consequently
not considering the whole cipher.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-02 19:18:58 +02:00
Alberto Escolar Piedras 71523eceb9 tests: native_tasks: Add missing header
Added missing header in tests/boards/native_posix/native_tasks/

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Jukka Rissanen 334ce69e2a tests: net: ipv6: Must use Ethernet L2 instead of Dummy L2
As the test is testing neighbor discovery which needs to know
link addresses, we must run the test using Ethernet L2.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-02 16:41:55 +03:00
Spoorthi K 67d2ddc6ad tests: mem_protect: Add RTM links and description
Add doxygen groups, RTM links and description for
memory protection test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-01 10:14:44 -07:00
Ulf Magnusson d1684a83a4 Kconfig: Clean up some symbol definitions
- Remove redundant 'n' defaults. 'n' is the default value for bool
  symbols.

  This makes the auto-generated documentation clearer as well: You get
  "implicitly defaults to n" instead of
  "- n if <propagated dependencies>".

- Shorten

      <type>
      prompt "foo"

  to

      <type> "foo"

  This works for all types, not just bool.

- Various formatting nits.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-01 12:47:17 -04:00
Johan Hedberg b049ac1216 Bluetooth: shell: Add command for setting fixed passkey
Add a shell command to utilize the newly added bt_passkey_set() API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-01 16:13:21 +03:00
Tomasz Gorochowik 805e2f2c79 net: eth: mgmt: Merge 802.1Qav related mgmt requests
There are too many individual requests for Qav related parameters. There
are more Qav parameters that need to be supported (and will be supported
soon - both on the GET and SET side). Handling it the way it was handled
so far would render the eth mgmt API dominated by Qav parameters. That
would make the file hard to read and understand.

Instead of that - use a single GET and SET requests for all Qav
parameters. This works by adding a separate enum with Qav request type
to the ethernet_qav_param struct.

Additionally this approach makes it much easier to document it all since
we now have just a single request and documentation comments in the
ethernet_qav_param struct.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-01 15:58:05 +03:00
Praful Swarnakar a51fb782d7 coverage: tests: poll: Add missing poll event to improve code coverage
Add testcase for validating K_POLL_TYPE_IGNORE poll event to
improve code coverage.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-07-31 20:39:19 -04:00
Spoorthi K 0b76567ac3 tests: mem_protect: Add description and doxygen groups
Add descriptions and doxygen groups for app_memory,
    stack_protection, stack_randomization and
    obj_validation.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-31 11:56:49 -04:00
Tomasz Gorochowik 966ab0e42f tests: net: ethernet_mgmt: Add Qav status tests
This commit changes how the fake driver stores info about priority
queues. This allows it to test the Qav status API.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-31 17:54:24 +03:00
Andrew Boie cef0748687 userspace: add syscalls test case
Test that we can define our own system calls in application code
and that fault handling works properly.

Additional tests for base system call infrastructure, outside of
specific system calls, go here.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-07-31 07:47:15 -07:00
Jukka Rissanen 00e37cbb5b net: IPv4 link local support
Add basic IPv4 Link Local support as described in RFC 3927.

Signed-off-by: Matthias Boesl <matthias.boesl@gmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-31 16:34:28 +03:00
Maureen Helm 45f34a4313 tests: flash_map: Add k64-based boards to platform whitelist
Adds the frdm-k64f and hexiwear_k64 boards to the platform whitelist.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-07-31 08:44:45 -04:00
Maureen Helm 08470c0f7f tests: flash_map: Don't enable stdout console
This was causing a stack overflow on the frdm_k64f platform.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-07-31 08:44:45 -04:00
Maureen Helm 08db8c19a3 tests: flash_map: Enable mpu and allow flash write
It shouldn't be necessary to disable the mpu for this test. Enable
CONFIG_MPU_ALLOW_FLASH_WRITE=y instead.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-07-31 08:44:45 -04:00
Maureen Helm f16a7ea836 tests: flash_map: Disable write protection before erase
The flash API requires write protection to be disabled before erasing
the flash. It appears that the nordic platforms for which this test was
originally implemented do not enforce the requirement to disable write
protection. The mcux flash driver, however, does enforce the
requirement, so fix the test to make it work on kinetis platforms.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-07-31 08:44:45 -04:00
Alberto Escolar Piedras 550225b668 native: Generalize native tasks
Some drivers or tests need to execute some code before Zephyr is
booted, dynamically register command line arguments, etc.

For this purpose, we generalize the NATIVE_EXIT_TASK to also
provide hooks to run a function at a given point during the startup
of native_posix.

Also, test/boards/native_posix/exit_tasks is generalized to cover
this new functionality.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-30 22:13:46 -04:00
Spoorthi K 07a8c0cf84 tests: kernel: Add test to verify k_thread_user_mode_enter()
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>
2018-07-30 14:20:09 -07:00
Anas Nashif 87de383c66 tests: CONFIG_ARC_INIT is n by default
CONFIG_ARC_INIT is set to 'n' by default, no need to set this in the
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-30 15:17:51 -04:00
Praful Swarnakar d05bee87e2 tests: kernel: profiling: Add description and doxygen group
Add doxygen group, test description and RTM links for
Profiling test cases.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-07-30 08:46:24 -04:00
Tomasz Bursztyka 2c1863ff4c net/ethernet: Add a way to configure MAC address filters into devices
Some Ethernet devices can filter out incoming packets through a list of
valid MAC addresses, so let's add a way to expose this capability, using
it through the ethernet device API.

Fixes #7596

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-07-30 08:28:38 -04:00
Daniel Leung 44be3943bb tests/benchmarks/footprint/min/x86: disable I2C and SPI
Disable CONFIG_I2C and CONFIG_SPI for minimum footprint test,
since we are doing "minimum" footprint.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-27 17:16:18 -04:00
Robert Lubos 6101e232f8 tests: net: TLS credentials subsystem tests
Add some tests to verify basic TLS credentials subsystem operation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-27 20:28:15 +03:00
Tomasz Gorochowik abd646c3e7 tests: net: ethernet_mgmt: Test the new get_config callback
This commit adds the get_config callback to the fake driver and makes
use of it to get the number of priority queues. That number is in turn
used in Qav tests.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:27:59 +03:00
Ajay Kishore dbc8789a19 tests: sched: Enhance tests to improve code coverage
call k_wakeup() if the timer has expired and the thread
is not even in the sleep state.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-07-27 12:38:49 -04:00
Spoorthi K 55642afe4c tests: obj_tracing: Add obj_tracing tests for kernel objects
Add obj tracing test for all kernel objects to improve code
coverage.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-27 07:51:26 -04:00
Karol Lasończyk f19a05385d tests: watchdog: Add new testcase and improve existing ones
New testcase sets max value to zero and checks if install function
fails.
Improvement introduces k_yield and k_sleep in while loops to make zephyr
responding.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-07-26 22:22:03 -04:00
Spoorthi K bb8cb5acf5 tests: pipe: Add description and RTM links
Add doxygen groups, description and RTM links for
pipe test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-26 14:59:02 -04:00
Ramakrishna Pallala 00e29c176d tests: kernel: Move k_thread_foreach() API test to thread_apis test
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>
2018-07-26 00:53:31 -04:00
Shawn Mosley 573f32b6d2 userspace: compartmentalized app memory organization
Summary: revised attempt at addressing issue 6290.  The
following provides an alternative to using
CONFIG_APPLICATION_MEMORY by compartmentalizing data into
Memory Domains.  Dependent on MPU limitations, supports
compartmentalized Memory Domains for 1...N logical
applications.  This is considered an initial attempt at
designing flexible compartmentalized Memory Domains for
multiple logical applications and, with the provided python
script and edited CMakeLists.txt, provides support for power
of 2 aligned MPU architectures.

Overview: The current patch uses qualifiers to group data into
subsections.  The qualifier usage allows for dynamic subsection
creation and affords the developer a large amount of flexibility
in the grouping, naming, and size of the resulting partitions and
domains that are built on these subsections. By additional macro
calls, functions are created that help calculate the size,
address, and permissions for the subsections and enable the
developer to control application data in specified partitions and
memory domains.

Background: Initial attempts focused on creating a single
section in the linker script that then contained internally
grouped variables/data to allow MPU/MMU alignment and protection.
This did not provide additional functionality beyond
CONFIG_APPLICATION_MEMORY as we were unable to reliably group
data or determine their grouping via exported linker symbols.
Thus, the resulting decision was made to dynamically create
subsections using the current qualifier method. An attempt to
group the data by object file was tested, but found that this
broke applications such as ztest where two object files are
created: ztest and main.  This also creates an issue of grouping
the two object files together in the same memory domain while
also allowing for compartmenting other data among threads.

Because it is not possible to know a) the name of the partition
and thus the symbol in the linker, b) the size of all the data
in the subsection, nor c) the overall number of partitions
created by the developer, it was not feasible to align the
subsections at compile time without using dynamically generated
linker script for MPU architectures requiring power of 2
alignment.

In order to provide support for MPU architectures that require a
power of 2 alignment, a python script is run at build prior to
when linker_priv_stacks.cmd is generated.  This script scans the
built object files for all possible partitions and the names given
to them. It then generates a linker file (app_smem.ld) that is
included in the main linker.ld file.  This app_smem.ld allows the
compiler and linker to then create each subsection and align to
the next power of 2.

Usage:
 - Requires: app_memory/app_memdomain.h .
 - _app_dmem(id) marks a variable to be placed into a data
section for memory partition id.
 - _app_bmem(id) marks a variable to be placed into a bss
section for memory partition id.
 - These are seen in the linker.map as "data_smem_id" and
"data_smem_idb".
 - To create a k_mem_partition, call the macro
app_mem_partition(part0) where "part0" is the name then used to
refer to that partition. This macro only creates a function and
necessary data structures for the later "initialization".
 - To create a memory domain for the partition, the macro
app_mem_domain(dom0) is called where "dom0" is the name then
used for the memory domain.
 - To initialize the partition (effectively adding the partition
to a linked list), init_part_part0() is called. This is followed
by init_app_memory(), which walks all partitions in the linked
list and calculates the sizes for each partition.
 - Once the partition is initialized, the domain can be
initialized with init_domain_dom0(part0) which initializes the
domain with partition part0.
 - After the domain has been initialized, the current thread
can be added using add_thread_dom0(k_current_get()).
 - The code used in ztests ans kernel/init has been added under
a conditional #ifdef to isolate the code from other tests.
The userspace test CMakeLists.txt file has commands to insert
the CONFIG_APP_SHARED_MEM definition into the required build
targets.
  Example:
        /* create partition at top of file outside functions */
        app_mem_partition(part0);
        /* create domain */
        app_mem_domain(dom0);
        _app_dmem(dom0) int var1;
        _app_bmem(dom0) static volatile int var2;

        int main()
        {
                init_part_part0();
                init_app_memory();
                init_domain_dom0(part0);
                add_thread_dom0(k_current_get());
                ...
        }

 - If multiple partitions are being created, a variadic
preprocessor macro can be used as provided in
app_macro_support.h:

        FOR_EACH(app_mem_partition, part0, part1, part2);

or, for multiple domains, similarly:

        FOR_EACH(app_mem_domain, dom0, dom1);

Similarly, the init_part_* can also be used in the macro:

        FOR_EACH(init_part, part0, part1, part2);

Testing:
 - This has been successfully tested on qemu_x86 and the
ARM frdm_k64f board.  It compiles and builds power of 2
aligned subsections for the linker script on the 96b_carbon
boards.  These power of 2 alignments have been checked by
hand and are viewable in the zephyr.map file that is
produced during build. However, due to a shortage of
available MPU regions on the 96b_carbon board, we are unable
to test this.
 - When run on the 96b_carbon board, the test suite will
enter execution, but each individaul test will fail due to
an MPU FAULT.  This is expected as the required number of
MPU regions exceeds the number allowed due to the static
allocation. As the MPU driver does not detect this issue,
the fault occurs because the data being accessed has been
placed outside the active MPU region.
 - This now compiles successfully for the ARC boards
em_starterkit_em7d and em_starterkit_em7d_v22. However,
as we lack ARC hardware to run this build on, we are unable
to test this build.

Current known issues:
1) While the script and edited CMakeLists.txt creates the
ability to align to the next power of 2, this does not
address the shortage of available MPU regions on certain
devices (e.g. 96b_carbon).  In testing the APB and PPB
regions were commented out.
2) checkpatch.pl lists several issues regarding the
following:
a) Complex macros. The FOR_EACH macros as defined in
app_macro_support.h are listed as complex macros needing
parentheses.  Adding parentheses breaks their
functionality, and we have otherwise been unable to
resolve the reported error.
b) __aligned() preferred. The _app_dmem_pad() and
_app_bmem_pad() macros give warnings that __aligned()
is preferred. Prior iterations had this implementation,
which resulted in errors due to "complex macros".
c) Trailing semicolon. The macro init_part(name) has
a trailing semicolon as the semicolon is needed for the
inlined macro call that is generated when this macro
expands.

Update: updated to alternative CONFIG_APPLCATION_MEMORY.
Added config option CONFIG_APP_SHARED_MEM to enable a new section
app_smem to contain the shared memory component.  This commit
seperates the Kconfig definition from the definition used for the
conditional code.  The change is in response to changes in the
way the build system treats definitions.  The python script used
to generate a linker script for app_smem was also midified to
simplify the alignment directives.  A default linker script
app_smem.ld was added to remove the conditional includes dependency
on CONFIG_APP_SHARED_MEM.  By addining the default linker script
the prebuild stages link properly prior to the python script running

Signed-off-by: Joshua Domagalski <jedomag@tycho.nsa.gov>
Signed-off-by: Shawn Mosley <smmosle@tycho.nsa.gov>
2018-07-25 12:02:01 -07:00
Johan Hedberg d26e482dab Bluetooth: Mesh: Use more reasonable advertising buffer counts
The number of buffres influences e.g. the maximum SDU size, which in
turn influences call stack consumption. Use lower values where a high
number of buffers isn't necessary, and use the default (6) where it's
sufficient.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-07-25 18:16:45 +03:00
Sebastian Bøe c9e12493b2 cmake: Remove duplicate invocations of target_link_libraries on app
It is not necessary to link 'app' with ELMFAT or NFFS because their
usage requirements are covered by the 'APP_LINK_WITH_MBEDTLS'
mechanism that automatically links 'app' with the interface library
FS.

This patch removes the redundant target_link_libraries invocations.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-07-25 08:27:45 -04:00
Ramakrishna Pallala c27af47999 tests: power: power_states: Do not enter LPS states on test exit
Do not enter Low Power states once the test execution is done. This is
is needed to avoid the flashing issues which were seen when system is
in deep sleep states.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-25 07:21:17 -04:00
Ramakrishna Pallala d9d3a5adf8 tests: kernel: timer: Add a test case to cover k_timer_start
Added test to cover the case where the app can start the timer
even before the previous one is expired. In this case the timer
will start with latest settings or params.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-25 07:15:54 -04:00
Alberto Escolar Piedras 8ba0ddf4ba test: Add test for native_posix RTC and real time control
Added a simple test to validate the real time control and
RTC functionality

Note that this test depends too much on not having a high host
load to pass.
Therefore it is better to not run in it automated regression

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-24 22:59:07 -04:00
Ajay Kishore 7b24690e14 tests: msgq: Enhance tests to improve code coverage
This test is intended to validate k_msgq_alloc_init()
and k_msgq_cleanup(), when CONFIG_USERSPACE is not defined.
Also added test to validate k_msgq_get() api, if any thread is
pending to write in message queue.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-07-24 20:07:12 -04:00
Spoorthi K 7c8aa526cb tests: queue: Enhance tests to improve coverage
Modify test to cover k_queue_insert() and k_queue_alloc_prepend(),
       and allocation failure/success scenario.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-24 19:28:36 -04:00
Ajay Kishore cea73067ce tests: kernel: Add test to validate k_stack_alloc_init, k_stack_cleanup
This test is intended to validate k_stack_cleanup() and
k_stack_alloc_init(). Passed stack pointer in k_stack_alloc_init()
is statically defined.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-07-24 15:28:31 -07:00
David B. Kinder 9af485adf8 doc: fix incorrect defgroup comment in Queue tests
defgroup was missing the group title parameter

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-24 16:24:28 -04:00
Spoorthi K 4c6b90e317 tests: queue: Add description and doxygen groups
Add description for queue tests and doxygen groups

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-24 11:54:41 -04:00
Spoorthi K cb499d3232 tests: stack: Add description for test cases
Add description for test cases and some uncrustify
changes

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-24 11:53:42 -04:00
Jukka Rissanen d202834e86 tests: net: Add tests for net_promisc API
Test that user is able to turn on/off promiscuous mode and
also receive any data from network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-24 15:12:37 +03:00
Jukka Rissanen e18900c5c5 tests: net: if: Add promisc mode tests
Make sure that user is able to toggle promiscuous mode flag
in network interface level and that flag value is passed
to device driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-24 15:12:37 +03:00
Jukka Rissanen 7352260696 tests: net: ethernet_mgmt: Add promisc mode tests
Test in ethernet mgmt level that promiscuous flag is passed
properly to the device driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-24 15:12:37 +03:00
Ravi kumar Veeramally 3fafe4f9ad net: ipv6: Handle large IPv6 packets properly
Current implementation does not handle large extension headers
(e.g HBHO). Which resulted network stack crashes or due to
misinterpretation of lengths network packets are dropped. Also
caused issues while preparing IPv6 packet (e.g. large HBHO header
with IPv6 fragmentation support).

Issues fixed and provided more unit tests.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-07-23 15:01:09 +03:00
Luiz Augusto von Dentz e9e5115116 Bluetooth: shell: Add name command
name command can be used to read or write the GAP Device Name which is
used by the advertise command.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-07-23 14:45:58 +03:00
Jukka Rissanen 127220c663 tests: net: Run various tests only in qemu_x86 or native_posix
No need to run the tests in real hardware as there we can run
out of network buffers that happened with Atmel SAM-E70.

Fixes #8966

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-21 08:26:02 -04:00
Jukka Rissanen faae730a53 tests: net: Print proper error if we run out of net bufs
Generate proper error if we run out of network buffers which means
so that the test can fail properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-21 08:26:02 -04:00
Ajay Kishore 4238418eb2 tests: kernel: document gen_isr_table tests for RTM
Group interrupt test in doxygen.

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-07-20 10:26:39 -04:00
Ramakrishna Pallala 09a322ae21 tests: kernel: device: Set device power state
Set device state to DEVICE_PM_ACTIVE_STATE before making it busy.

Also improves the kernel/device.c coverage.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-20 10:12:27 -04:00
Ramakrishna Pallala 913507a21f tests: crypto: rand32: Add test for z_early_boot_rand32_get
Add test for z_early_boot_rand32_get() API.

This also improves the coverage for kernel/init.c

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-20 10:12:27 -04:00
Piotr Zięcik 2fe998cdef kernel: Deprecate sys_clock_us_per_tick variable.
On some architectures tick time cannot be expressed as integer
number of microseconds, introducing error in calculations using
sys_clock_us_per_tick variable.

This commit deprecates the sys_clock_us_per_tick variable and
replaces its usage by more precise calculations based on
sys_clock_hw_cycles_per_sec and sys_clock_ticks_per_sec.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-07-20 00:03:52 -04:00
Piotr Zięcik 81a2c4b8ff tests: sleep: Fix _TICK_ALIGN correction.
This commit replaces _TICK_ALIGN correction in the test (which was based
on simple division), by more precise estimation using __ticks_to_ms()
and _ms_to_ticks() functions.

This commit fixes #8899.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-07-20 00:00:36 -04:00
Ramakrishna Pallala 770eba360f tests: power: multicore: Fix power state entry for LMT
Enter SYS_POWER_STATE_CPU_LPS_2(C2LP) state on Lakemont to achieve
the Low Power Sensing Standby(LPSS) state on Quark SE C1000.

Also added a busy loop to have syncronization b/w x86 and ARC
console outputs.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-19 17:12:58 -04:00
Ramakrishna Pallala 05434d1bb6 tests: power: multicore: Fix the idle synchronization issue
On Quark SE, to enter the Low Power Sensing Standby(LPSS) State,
ARC can enter the Deep Sleep state (LPSS bit enable + SS2) and
wait for the Lakemont core to enter C2 or C2LP state.

To achieve LPSS, ARC core enters the Deep Sleep state much before
the Lakemont core enters the C2 or C2LP state and waits for the
LPSS entry.

Also fixed the Deep Sleep state entry according to the Quark SE C100
documentation.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-19 17:12:58 -04:00
Ramakrishna Pallala 49f5f5bc23 tests: power: power_states: Define power states as per architecture
Define or enable the power states as per architecture (x86 or ARC).

Remove the redundant and unneccessary config options from
prj_tickless.conf file

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-19 17:12:58 -04:00
Niranjhana N 8891beaf84 tests: posix: add test for pthread_key
Added a simple test case for pthread_key, which
tests all the APIs - the thread creates a key,
sets a value to the key, retrieves and asserts
they are equal, and then deletes the key.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-07-19 08:46:33 -04:00
Alberto Escolar Piedras d35d8e9310 tests: Add test for NATIVE_EXIT_TASK
Added a simple testcase for the NATIVE_EXIT_TASK hook

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-18 15:43:12 -04:00
Spoorthi K 34ee20a375 tests: sleep: Add description and RTM links
Add test description for sleep and some uncrustify
changes

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-18 12:37:39 -04:00
Anas Nashif 19666a9beb tests: fix u32_t type usage
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Anas Nashif 8cdb5d5d24 tests: nffs: fixed types
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Spoorthi K 934c8eae45 tests: spinlock: Add description and doxygen groups
Add test description, RTM links and doxygen groups
for spinlock tests

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-18 11:28:03 -04:00
Olivier Martin e7ae7334db lib/crc: Add CRC32 support
It only adds CRC32 IEEE support at the moment.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-07-18 10:00:12 -04:00
Jukka Rissanen cf6a870863 tests: net: udp: Increase network buffer counts
In some hw like Atmel SAM-E70, the original amount of network
buffers is too small so increasing it slightly.
Also generate proper error if this happens in the test so it
is easier to figure out.

Fixes #8865

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-18 07:46:37 -04:00
Spoorthi K bffae85488 tests: kernel: Add description for common and interrrupt
Add test description, RTM links and doxygen links for common,
    interrupt and boot page table test cases.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-18 06:52:18 -04:00
Diego Sueiro 5d1b57ff9d tests: Add colibri_imx7d_m4 config in pwm_api
Adds the appropriated configuration for colibri_imx7d_m4 board in
pwm_api tests.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-07-17 16:08:22 -05:00
Jukka Rissanen cf71938aa1 tests: net: tcp: Use correct network interface for sending
The test app creates two network interfaces, one for simulating
local device and the other one for peer device. Make sure that
the tests use correct network interface in each test. We cannot
guarantee that net_if_get_default() will always return correct
interface in different architectures as that depends how the
net_if structs are placed in corresponding linker section.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-17 21:12:45 +03:00
Praful Swarnakar 5b8e4ae4df tests: kernel: init: Add description and RTM links
Add description for init boot delay tests and group
them for doxygen.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-07-17 12:19:49 -04:00
Praful Swarnakar f789a728bb doc: tests: Add test description and doxygen groups in timer
Add test case description and doxygen groups for tracebility.
Add references to APIs being tested in timer component.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-07-17 10:56:24 -04:00
Spoorthi K 25966c8406 tests: semaphore: Add description for semaphore tests
Add description for test cases in semaphore and group
them for doxygen.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-17 07:55:35 -04:00
Anas Nashif c8b114f25d samples: exclude socket samples on esp32
ESP32 does not like newlib, exclude for now to get a clean sanitycheck
run. We have issues about this already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-16 19:00:32 -04:00
Spoorthi K 02addfff50 tests: poll: Add description and RTM links
Add description and RTM links for polling tests.
Also uncrustify changed indentations.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-16 08:23:42 -04:00
Krzysztof Chruscinski 6b01c89935 logging: Add log initialization to system startup
Log API can be used before user can explicitly initialize the logger.
In order to ensure that logger core is ready to buffer log messages
it must be initialize as early as possible. Initialization does not
include initialization of default backend since driver may not be
ready and backend is needed only when log messages are processed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-07-14 08:32:44 -04:00
Jukka Rissanen 9ad36e7145 tests: net: arp: Increase network buffer counts
In some hw like Atmel SAM-E70, the original amount of network
buffers is too small so increasing it slightly.
Also generate proper error if this happens in the test so it
is easier to figure out.

Fixes #8866

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-12 23:12:32 -04:00
Andrei Emeltchenko c8af08e5d4 usb: osdesc: Use definition for string descriptor index
Use definition and add description block.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-07-12 23:10:22 -04:00
Andrei Emeltchenko 5a9c069c83 usb: tests: Add testing os_desc feature
Add testing usb_handle_os_desc_feature()

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-07-12 23:10:22 -04:00
Andrei Emeltchenko 65cbe9db57 usb: tests: Add unit tests for MS OS Descriptors testing
Add test for testing MS OS String Descriptor version 1.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-07-12 23:10:22 -04:00
Savinay Dharmappa 70944e8375 tests: boards: intel_s1000_crb: Fix build error.
A HID application can no longer write to the default
 interrupt IN endpoint because the addresses are assigned
 dynamically. Add hid_int_ep_write() function  and leave
 it to the hid-core to call the usb_write() with the correct
 endpoint address.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-07-12 23:09:36 -04:00
Kumar Gala 8317e366a8 tests: sprintf: Add inf/nan testing for %{e,E,g,G}
Added testing to make sure we get the proper results from %e, %E, %g and
%G conversion specifiers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-12 14:57:52 -05:00
Kumar Gala e66da3f9e0 libc: minimal: Add support for %F conversion specifiers
For some reason %F wasn't supported initially.  Its simple enough to
handle the case difference in infinity and NaN handling to add support
for %F.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-12 14:57:52 -05:00
Kumar Gala 409c9e751f libc: minimal: Fix support for -nan
We were only handling the sign bit for infinity, but not NaN.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-12 14:57:52 -05:00
Kumar Gala 96ea7ab7d1 libc: minimal: Fix handling of %f conversion specifiers for inf & nan
The C standard says that %f should use '[-]inf' or '[-]infinity' (which
style is implementation defined) for infinity handling and '[-]nan' for
NaN.

We where adding a '+' and had the wrong case for 'inf' and 'nan'.

Before -> After

+INF -> inf
-INF -> -inf
 NaN -> nan

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-12 14:57:52 -05:00
Kumar Gala e6f4f623b7 libc: minimal: Fix handling of floating point exponent
For %{e,E,g,G} conversion specifiers the C standard says the exponent
contains at least two digits, and only as many digits are necessary.  So
instead of 1.234000e-001 we should have 1.234000e-01.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-12 14:57:52 -05:00
Spoorthi K c6c811072f tests: kernel: Add description and group tests for doxygen
Updated test description for tickless test cases, grouped test cases
as per doxygen requirements and some uncrustify's cosmetic changes.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-11 10:20:53 -04:00
Spoorthi K 3e1c0bd386 tests: kernel: Add description and doxygen groups for workq
Update and rearrange doxygen groups and test description
for workq tests

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-11 10:18:04 -04:00
Spoorthi K 22ea79db70 tests: pending: Add description and RTM links
Add test description, doxygen and RTM links to tests
in pending

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-11 10:17:04 -04:00
Christian Tavares 7bc396465f lib: json: add helper macro for array of array
The new JSON_OBJ_DESCR_ARRAY_ARRAY allows use of an array of
array. The macro is based on the comments and directions provided by
Leandro Pereira <leandro.pereira@intel.com> (in #8567).

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
2018-07-06 19:17:07 -04:00
Jukka Rissanen f5ec56747e tests: net: trickle: Initialize test variables earlier
The cb_[1|2]_called variables were initialized just before running
the test. This was too late as in some cases the Trickle timer
was triggered before the variables were init, which then caused the
test to fail even though there was no actual timer failure.

This was seen with frdm_k64f and when CONFIG_BOOT_DELAY=1000 was set.

Fixes #8658

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-06 13:07:06 +03:00
Ajay Kishore 0de49e5d40 tests: kernel: Add description for test case
Add description to test case in tests/kernel/fatal

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-07-05 12:52:21 -04:00
Adithya Baglody 2f5fea0eec benchmarks: app_kernel: Fixed coverity issue.
The return value from the k_mem_slab_alloc was not read. Hence
adding code to make use of this return value.

Fixes: GH-6681

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-07-04 22:00:22 -04:00
Tomasz Gorochowik 01c11c172a tests: net: Add 802.1Qav test
For now just assume that the fake driver has just one priority/Qav
capable queue.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-04 16:27:34 -04:00
Tomasz Gorochowik 2ca3b1e3c4 net: if: Fix TX timestamp callbacks invocation
The problem is that net_if_call_timestamp_cb only checked if the
callback was registered for the PORT which invoked the whole action.

There is a possibility, that the callback will be registered, and packet
A will be passed to eth driver. Before the driver is finished with
packet A, network layer will start handling another packet (B) - so it
will unregister the callback for packet A and register it for B. After
that the network driver will finish processing packet A and invoke the
timestamp callback. The mechanism would then only check if a callback is
registered for the port of the driver and invoke the callback for the
packet that was registered earlier (so A instead of B).

This commit fixes that by storing info not only about the port but about
the packet too.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-04 16:26:35 -04:00
Andrei Emeltchenko 6e15dc789a usb: tests: Fix BOS test related to linker order
The current test expects particular order of cap_webusb and cap_msosv2
structures, create alternative structure for comparison.

Fixes: #8732

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-07-04 15:10:31 -04:00
Jukka Rissanen b4dae00741 tests: net: tx_timestamp: Check max number of interfaces
Add checks so that we do not overflow the network interface
array.

Fixes #8715

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-04 16:00:22 +03:00
Morten Priess 8a74e7056d tests: ztest: ztest_mock to support multiple calls to same mock
Updated ztest_mock.c to support multiple calls to same mock function
within a single function under test. This allows sequencing mock
return values for improved decision coverage in a test, or simply
when a given function under test calls the same function more than
once with different parameters, or different return values.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2018-07-04 08:57:09 -04:00
Jukka Rissanen 482865c4c4 tests: net: ptp: Make sure we check clock increment properly
If the sys_rand32_get() returns large value, then we might
decrement the clock which is not intended in this test.

Fixes #8657

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-04 08:29:50 -04:00
Neil Armstrong 94d3156540 test: i2c: Add i2c_slave_api test
Add a new test to make I2C transfers between an I2C controller and
an I2C slave driver, either by:
- Using a virtual I2C driver
- Using a physical link and 2 physical controllers

The Physical test uses :
- Two EEPROM Slave drivers each connected to one I2C controller
- Both I2C controllers also act as master and take turns writing
to the opposite EEPROM Slave.
All of this connected physically on the board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-07-04 11:57:33 +02:00
Piotr Zięcik 91fe22ec7d kernel: Improve tick <-> ms conversion.
The kernel incorrectly assumed, that system timer frequency is always
divisible without remainder by couple "natural" tick rates (like 100).
As result on some SoCs, time calculations was not correct, producing
strange effects (invalid sleep times, incorrect k_uptime_get() etc.).

This commit enables accurate, but costly (using 64-bit math) tick <-> ms
conversion if the selected tick interval is not exact due to hardware
limitations.

Also, this commit fixes tests in which removed _ms_per_tick were used.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-07-03 22:46:39 -04:00
Andy Ross dd33b37eff tests/sched/scheduler_api: samples/philosophers: Use SCHED_SCALABLE
These two tests ask for lots of priority levels, more than the 32
maximum allowed by SCHED_MULTIQ (which is by design: if you have
requirements like that DUMB or SCALABLE are better choices due to the
RAM overhead of MULTIQ), so the build will fail on boards that defined
MULTIQ as default.

Don't let the platform choose the scheduler backend, ask for SCALABLE
explicitly.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-07-03 17:09:15 -04:00
Alberto Escolar Piedras bdab07a2fd native_posix: Do not select COVERAGE by default
Now that it is possible to easily add Kconfig options from command
line, we do not need to always compile native_posix with coverage.
This was done only to have it set easily for sanity_check.

So do not select it anymore, and let users choose if they
want coverage dumps or not.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-03 08:36:06 -04:00
Paul Sokolovsky c89a06dbc1 net: config: Introduce a dedicated header for the library
Split out definition of net_app_init() and its parameter flags from
net_app.h header to new net_config.h header. As we do this, rename
the function to net_config_init() and flags to NET_CONFIG_NEED_*.
This is a second step in splitting out network configuration API
out of net_app API, started in the c60df1311 commit.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-07-02 12:36:35 +03:00
Tomasz Bursztyka d309c870c7 net/ipv6: Properly separate what belongs to ipv6 from the rest
Context part should be in context. Then, rename ipv6 function for
clarity.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-07-02 12:34:12 +03:00
Anas Nashif 305ec6751b tests: fix struct initialization
uncovcerd by clangm we are initialising too late and after first use.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-01 22:58:23 +02:00
Kumar Gala 9127c4b3b1 tests: Cleanup converting int result to string
Introduce TC_RESULT_TO_STR to convert from an integer test result to a
string like "PASS", "FAIL", "SKIP".  Do this to remove the defines of
PASS/FAIL/SKIP since those names might get used by other code and to
have a single consistent way of doing the conversion.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-06-29 11:53:59 -05:00
Tomasz Bursztyka 1a12571482 tests/net: Fix L2 directory lookup for header inclusion
L2 directory is now located in subsys/net/l2

Fixes #8642

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-29 10:32:27 -05:00
Tomasz Bursztyka 89eeba4250 net/arp: No need to expose publicly arp header
ARP is something internal to ethernet L2, let's just hide its header
file.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-29 12:57:45 +03:00
Krzysztof Chruściński 17ae882b43 tests: subsys: logging: Add tests for log_msg and log_list
Tests for intrnal logging subsystem modules.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2018-06-29 10:16:45 +02:00
Niranjhana N 0b00493d86 tests: drivers: adc: fix failing test for frdm_k64f
This test is failing for the frdm platform because
the ADC_DEVICE_NAME is different. Add #if statements
to correct for respective platform names.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-06-28 16:02:21 -05:00
Alberto Escolar Piedras 2b02f8d316 tests: sprintf: suppress Wformat-truncation warning
GCC 7 and newer are smart enough to realize that in test_snprintf()
the output will not fit in 0 or 4 bytes, but that it requires 9.
So it throws a warning in compile time. But in this case we are
actually testing that snprintf's return value is what it should be
while truncating the output. So let's suppress this warning here.

Fixes: #5732

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-28 19:58:55 +02:00
Jukka Rissanen 45b06a252f net: gptp: Initial core IEEE 802.1AS support
Core IEEE 802.1AS-2011 (gPTP) support and application interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Julien Chevrier <julien.chevrier@intel.com>
2018-06-28 16:50:50 +03:00
Vinayak Kariappa Chettimada fdedc49a61 Bluetooth: tests: exclude btshell/mesh_shell on NRF52810_PCA10040
Exclude building the btshell and mesh_shell application for
NRF52810_PCA10040 boards due to limited RAM and Flash
availability on the nRF52810 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-06-27 16:09:58 +02:00
Morten Priess 80e02a93d3 tests: ztest: added test case for multiple mock expects
The test verifies that the mock framework can handle functions
under test which call more than one mock function, and
correctly processes each call.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2018-06-27 03:58:36 -04:00
Morten Priess c52439a6f4 tests: ztest: fixed off-by-one in sys_bitfield_find_first_clear
Calling __builtin_ffsl(neg_bitmap) returns first bit set in the word,
e.g. 4 if bitmap is 11111000. As this must translate to zero-based index
3, one must be subtracted from the result.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2018-06-27 03:58:36 -04:00
Sebastian Bøe 2bcfb88aed cmake: Remove duplicate invocations of target_link_libraries on app
It is not necessary to link 'app' with mbedTLS because mbedTLS is
covered by the 'APP_LINK_WITH_MBEDTLS' mechanism that automatically
links 'app' with mbedTLS.

This patch removes the redundant target_link_libraries invocations.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-06-26 15:53:32 +02:00
Jukka Rissanen 2c8c1310fb tests: net: ptp: Add ptp clock driver tests
Make sure that the PTP clock driver works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-26 12:37:28 +03:00
Maureen Helm c4123643b5 tests: fp_sharing: Extract x86 configs to separate .conf
The SSE and SSE_FP_MATH configs exist only in the x86 architecture, so
extract them to a separate prj_x86.conf file for the fp_sharing test.

Fixes Kconfig warnings when building the test for frdm_k64f:
- warning: attempt to assign the value "y" to the undefined symbol SSE
- warning: attempt to assign the value "y" to the undefined symbol
  SSE_FP_MATH

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-06-25 12:49:42 -07:00
Carles Cufi 6eeeb2a3e5 tests: Fix sizing for several test for chips with 24KB of RAM
When adding the nRF52810, which has 24KB of RAM, some of the tests don't
compile anymore due to lack of SRAM. Address this by either filtering
the test out or reducing the amount of memory allocation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-25 19:34:33 +02:00
Ulf Magnusson 34e11f0c45 tests: kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-22 15:11:58 -04:00
Jukka Rissanen c63363711d tests: net: Add unit test for network pkt timestamping
Test that Tx timestamp callback code is called properly if network
packet timestamping is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-22 12:31:32 -04:00
Sebastian Bøe c1c25dea1a cmake: Remove stray CMakeLists.txt file
Remove the CMakeLists.txt file that is in the 'common' directory of
nffs_fs_api. It has likely been added by mistake as it does not make
any sense as it is written.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-06-22 12:28:01 -04:00
Andrei Emeltchenko b9c82121c6 usb: bos: unit: Add unit test for BOS testing
Add testing USB Binary Device Object Store descriptors and macros.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-06-20 15:47:00 -04:00
Yasushi SHOJI 064608b429 include: remove unused macros from include/arch/*/arch.h
All architecture defines OCTET_TO_SIZEOFUNIT and SIZEOFUNIT_TO_OCTET
as identity functions. But the only user is tests/benchmarks/app_kernel.
It's effectively a no-op.  Remove them.

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
2018-06-20 12:07:59 -04:00
Mariusz Skamra aa190cd5b5 bluetooth: tester: Set configuration file for qemu_cortex_m3 target
qemu.conf will be chosen by default for qemu_cortex_m3.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Mariusz Skamra 3904442e6b bluetooth: tester: Remove redundant config option from qemu.conf
UART_PIPE_ON_DEV_NAME is set to UART_1 by default in
boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Mariusz Skamra 37e6162c47 bluetooth: tester: Fix bt_gatt_service_register call with invalid params
This fixes an assert
ASSERTION FAIL [svc->attr_count] @ subsys/bluetooth/host/gatt.c:259:
	invalid parameters
caused by bt_gatt_service_register call with invalid (uninitialized)
services array.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Spoorthi K a3fe7af2dd tests: obj_tracing: Enhance object counter logic
Restructured the test, added description and enhanced
semaphore count logic to check for semaphores created
only in the test.

Fixes: #7106

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-06-14 23:54:31 -04:00
Leandro Pereira c16bce7a6a samples, subsys, tests: Use ARRAY_SIZE() whenever possible
The ARRAY_SIZE() utility macro will actually test the parameter types,
and ensure that it is only called with arrays, and not arrays decayed
to pointers.

Changes were performed with a simple Coccinelle script.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-14 19:12:51 -04:00
Andy Ross 7bbd3a79ae tests/kernel: Add a test for CONFIG_MULTITHREADING=n
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>
2018-06-13 17:23:05 -04:00
Ulf Magnusson 072a43d1a4 tests: Do not build arm_irq_vector_table .config's for ARC
Previously, ARC .config's would get built for this test, giving Kconfig
warnings along the lines of

  warning: NUM_IRQS ... was assigned the value "3" but got the value
  "38". Check its dependencies...

Add an 'arch_whitelist: arm' so that .configs only get built for ARM.

These warnings will soon be turned into errors.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-12 20:18:14 -04:00
Andrew Boie 791daa7037 tests: sprintf: remove kconfig options
These aren't necessary.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-06-12 18:08:00 -04:00
Mariusz Skamra bb4ed94c60 bluetooth: tester: Increase system workqueue stack size
This fixes an issue of system workqueue stack overflow that was
was observed during Bluetooth Mesh automated testing.
Increase system workqueue stack to avoid MPU faults.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fixes #8262
2018-06-12 16:51:26 +02:00
Alberto Escolar Piedras 4a2d109a4b native tests: fix kernel sched preempt for arch posix
The test kernel.sched.preempt was hanging in the posix arch,
due to a busy wait loop in wakeup_src_thread() added in
a803af2fa7.

We fix it by halting the cpu to let time pass in the posix
arch.

Reenabling the testcase in this board by reverting
e8a906c29c

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-12 08:16:12 -04:00
Anas Nashif e8a906c29c tests: disable preempt testcase for native_posix
Disabling testcase due to hang during sanitycheck run while we figure
out the real cause of this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 21:13:23 -04:00
Alberto Escolar Piedras 252be0b909 tests/kernel/sched/preempt: enable test for native_posix
The native_posix board does model irq_offload properly now
and therefore this test can be executed without problems.
So let's enable it.

Related to commit:
86b5364335

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-11 17:25:58 -04:00
Anas Nashif 9b2880fe6e tests: posix: fix meta-data and rename test file
Be consistent with other posix tests, and name main file main.c.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Wayne Ren a91f1e5e14 tests: modify the test conditions for emsk_em7d_v22
Because the address and size alignment of MPUv2,
limite the thread numbers for emsk_em7d_v22.

If not, build will faill because of DCCM overflow

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-06-11 09:05:15 -05:00
Wayne Ren 144a4390b5 tests: fix the bug of sentinel.conf
Even CONFIG_HW_STACK_PROTECTION is no here,
it is still yes as it will be re-selected by
CONFIG_TEST_HW_STACK_PROTECTION in tests/Kconfig.

So the correct setting here is:

CONFIG_TEST_HW_STACK_PROTECTION=n

This fixes #8092 (case1)

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-06-08 16:37:22 -05:00
Leandro Pereira 33aa90539a tests: kernel: fifo_timeout: Do not potentially dereference NULL ptrs
The return value from k_fifo_get() might be NULL in some situations,
so protect against that.

Coverity-ID: 186190
Coverity-ID: 186058
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-08 13:07:19 -05:00
Anas Nashif fb2e142b0e tests: fix test identifiers
Fix test identifiers and use subsystem correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-07 18:01:49 -05:00
Anas Nashif b20c4846dd sanitycheck: fail on faults/panics/oopses
Fail in tests where we have an OOPS or a panic. Right now and in many
cases we continue and test case might be reported as PASS.

Cases that have the tag ignore_faults will ignore those faults (cases
that are testing faults for example).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-07 18:01:49 -05:00
Carles Cufi bb631076f6 tests: arm: irq_vector_table: Fix Kconfig override
Since on ARM CONFIG_NUM_IRQS option has no prompt, it cannot be properly
overridden by a prj.conf fragment. Instead make it have a prompt for
this particular test to be able to override it properly.

Fixes #8200

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-06 15:23:07 -04:00
Anas Nashif 3057da079a tests: logger-hook: increase ztest stack size
We are getting stack corruption on some platforms, so increase stack to
allow the test to run.

Fixes #8085

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-05 14:13:17 -04:00
Jukka Rissanen 59bf65f481 tests: net: Fix tests so they can be run in real hw
Both the vlan and checksum_offload tests expect to be run in
controlled environment where the test application is providing
ethernet connectivity. If the board under test has also ethernet
support, then internal checks will fail in the test application.
Because of this, disable on board ethernet so that the tests will
pass.

Fixes #8172

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-05 10:30:30 -04:00
Jukka Rissanen b43000f5eb tests: net: trickle: Fix running on frdm-k64f
The trickle API tests were not run properly in frdm-k64f board.

Fixes #8171

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-05 10:30:30 -04:00
Jukka Rissanen a803335a7c tests: net: Increase the stack size of frdm-k64f
The icmpv6, http_header_fields, mqtt_packet, dns_packet and
net utils tests were failing in frdm-k64f because of too small
stack.

Fixes #8171

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-05 10:30:30 -04:00
Leandro Pereira a07d0731c7 tests: mbox_api: Fully initialize k_box_msg struct
`mmsg` should be fully initialized prior to calling k_mbox_get().  The
mailbox implementation (mainly, mbox_message_match()) will look inside
the second parameter passed to k_mbox_get() in order to determine if
which pending messages should be returned to the caller.

Fixes Valgrind warning listed in #7478.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-05 10:26:59 -04:00
Andy Ross a803af2fa7 tests/kernel/preempt: Add yield and sleep cases
Scheduler choice is subtle across yield and k_sleep(), add calls to
those to the state table and validate that we're making the right
decisions.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-06-04 23:07:13 -04:00
Anas Nashif 9cefce8168 tests: remove obsolete k_thread_cancel
k_thread_cancel was obsoleted, yet we still have a few tests using it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-04 16:56:06 -04:00
Anas Nashif b5a3ddf7d7 tests: ieee802154/crypto: use console harness
Use console harness to detect PASS/FAIL. This test should be moved to
ztest at some point.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-04 14:34:00 -04:00
Andrew Boie 2237ce6b56 tests: mem_protect: use better stack size arg
True stack sizes may be rounded up, instead of using a multiplier
just fetch the true stack size and add one to it, just one byte
over should produce an error.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-06-02 16:29:46 -04:00
Nagaraj Hegde 75e2af20ea tests: fifo_timeout : Dereference after null check
fifo data obtained is dereferenced after NULL check.

Coverity-CID:186190

Signed-off-by: Nagaraj Hegde <hegdenagaraj4@gmail.com>
2018-06-02 16:27:34 -04:00
Andy Ross 2d03b55293 tests/kernel/mem_slab: Fix memory overcommit for real
Commit 4ef36a4b54 ("tests/kernel/mem_slab: Fix memory overcommit")
caught this error, but missed the fact that there are two slabs that
need to be resized.  I also failed to properly explain (or, to be
honestly, fully understand) the deadlock condition, so add a nice big
comment explaining it.

Basically: you have a bunch of threads that can allocate all but one
of their blocks before trying to allocate their last one and pending.
There must be at least one block left so all the threads don't
symmetrically go to sleep waiting on each other.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-06-02 16:24:47 -04:00
Sritej Kanakadandi Venkata Rama f5bf2816df tests: posix: Function call return values need to be validated.
In this fix we are asserting the return value of pthread_attr_init.

Resolves #7084
Coverity-CID: 185280

Signed-off-by: Sritej Kanakadandi Venkata Rama <sritej.kvr@gmail.com>
2018-06-01 14:59:10 -04:00
Andrzej Puzdrowski 66e84540f7 tests: subsys: settings: fcb: Fix failure on nrf52_pca10040
Tests failed on the target because flash area reserved
for fcb data storage was to small.
This path add dts overlay file for nrf52_pac10040 board which
increases this flash area to proper size.

Fixes #8038

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-06-01 09:00:42 -04:00
Ramakrishna Pallala 338f451981 tests: kernel: profiling: Fix _sys_soc_suspend logic
Call k_thread_foreach only once from _sys_soc_suspend()
otherwise it will flood the console with stack dumps. As per
the test implementation, the one time call happens through
test_call_stacks_analyze_idle test case.

Also removed the the stack size comparision logic from
thread_callback() as the actual size allocated could be
different from what is requested based on the Kconfig option
CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT

Fixes Issue #7858

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-06-01 08:57:59 -04:00
Andy Ross 4ef36a4b54 tests/kernel/mem_slab: Fix memory overcommit
This test spawned 4 threads all of which try to allocate 3 blocks from
the same mem_slab before freeing any, leading to a maximum of 12
in-flight allocations.  But the slab contained only 3 blocks!

Most of the time it passed, but CI caught it failing on occasion,
possibly more often now due to recent scheduler changes.  Fixes #8069
(hopefully).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-31 14:54:15 -04:00
Anas Nashif 2f7fe7e252 tests: mem_pool: organise test documentation
Add references to tests APIs. Create new group for memory pools.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-31 14:05:38 -04:00
Anas Nashif bed0ac6877 tests: workqueue: fix doxygen group
Use group name folowing the new conventions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-31 14:05:38 -04:00
Andy Ross c782d07a1c tests/kernel/smp: Properly synchronize CPU counters at test start
The idea behind this test is to race two CPUs against each other,
validating that each is truly running simultaneously.  But it just
assumed that the other thread/cpu would start synchronously as soon as
k_thread_create() returned.

Normally, that works fine.  But while debugging I added some code that
was slowing down entry to the other thread (or maybe the return from
k_thread_create() into the main thread) long enough to allow one
thread to get a significant head start.  That breaks the logic in the
test and things were inexplicably "failing".

Put a spin loop around the count so that the main thread can start
counting to within the memory system's ability to inform it of the
change from the other thread.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-31 14:02:03 -04:00
Adithya Baglody 8bbf0fd732 benchmarks: timing_info: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 2182178bae benchmarks: sys_kernel: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody a9dda77f61 benchmarks: footprint: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody e8626d71ac benchmarks: boot_time: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody a5988f811a benchmarks: latency_measure: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 6663286fd8 benchmarks: app_kernel: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 22838e8b50 benchmarks: object_footprint: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Wayne Ren 92a3c41dd5 tests: necessary fixes for ARC
* because stack analysis is required, so STACK_CHECK must be
turned off. No HW_STACK_PROTECTION has no impact on current test

* If CONIFG_USERSPACE, the real stack size is bigger than the declared
stack size

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-30 20:23:35 -04:00
Wayne Ren 467f8fbe3d tests: fixes for ARC
Like ARM, ARC also needs to return

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-30 20:23:35 -04:00
Wayne Ren e63cccdc41 tests: fixes for ARC
In arc, privileged stack is merged into defined stack. So
the real stack size should add privileged stack size.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-30 20:23:35 -04:00
Andrew Boie aa26d9926a tests: mbedtls: don't use stdout console
This redirects PRINT() to printf() and not printk() and
was causing stack overflows on some platforms.

Fixes: #8033

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-30 15:55:18 -05:00
Ulf Magnusson 12f87f7a94 tests: net: Fix assignments to CONFIG_NET_DEBUG_6LO
This symbol was renamed by commit 14e73e73c3 ("net: Make DEBUG config
option naming consistent"), but an assignment (and a commented-out
assignment) to the old name remained.

Fix the assignments to use the new name.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-29 16:20:35 -04:00
Ulf Magnusson 5405f68878 kconfig: Remove remaining 'option env' bounce symbols
These are no longer needed since commit 4dc9e5b2de ("kconfig: Get rid
of 'option env' bounce symbols"). The C tools are likely to get rid of
them soon too.

The APPLICATION_BASE symbol (option env="PROJECT_BASE") triggered a
compatibility warning, because 'option env' symbols now need to have the
same name as the environment variables they reference to be compatible
with Kconfiglib. APPLICATION_BASE is unused, so just remove it.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-28 17:21:11 -04:00
Ulf Magnusson b20cc63d81 tests: power states: Remove CONFIG_GPIO_QMSI_1_{NAME,PRI} assignments
These symbols were removed in commit ed26b95746 ("drivers/gpio:
Removing dts generated options in QMSI Kconfig").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-28 17:16:46 -04:00
Ulf Magnusson 4317a181c9 tests: net: all: Increase NET_MAX_CONTEXTS from 4 to 5
DNS_RESOLVER_MAX_SERVERS has the range [1,NET_MAX_CONTEXTS], with
NET_MAX_CONTEXTS being set to 4, but is set to 5. Out-of-range .config
values are ignored, so the symbol reverts to its default value (1).

Increase NET_MAX_CONTEXTS to 5. DNS_SERVER{1-5} being set probably
implies that DNS_RESOLVER_MAX_SERVERS shouldn't be decreased to 4.

This fixes two Kconfig warnings (out-of-range + didn't get assigned
value).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-28 12:20:10 -04:00
Anas Nashif 8c8ddb8196 tests: workqueue: add API references and doxygen group
Add a doxygen group and reference tested APIs using @see.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif c2e9eef8b0 tests: kernel context: rewrite test to use ztest correctly
The test was using ztest incorrectly exposing everything as one single
test function. We now have multiple tests that can be tracked back to
features and requirements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif 9a28c87b42 tests: posix: rename entry file to main.c
Change all tests to have main.c as the main file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif 6faf5b8608 test: early_sleep: cleanup test
Fixed comments and naming of test functions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif f0f11289ad tests: schedule_api: change category to sched
Use kernel.sched instead of kernel.thread

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif 20e969b8f1 tests: schedule_api: fix references to tested APIs
Use @see instead of custom keyword.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif c5be083df5 tests: move schedule_api under sched/
Group tests per area.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif 43293b9016 tests: critical: fix naming and comments
We were referring to old function names and still using the task
terminology which can be confusing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-28 08:52:46 -04:00
Anas Nashif eeae0eeffb tests: kernel: put all thread tests on one level
Remove unnecessary deep hierarchy and put all tests on one level.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-26 09:16:42 -04:00
Anas Nashif fe4693bd9f tests: threads: fold customdata tests into main test
Move this small test to the main thread test project.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-26 09:16:42 -04:00
Anas Nashif fa4aa9fec0 tests: threads: fold systemthread tests into main test
such a simple test does not deserve to be on its own, lets just put it
with other thread tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-26 09:16:42 -04:00
Anas Nashif 0a4389839f tests: kernel: document thread tests for RTM
Group threads in doxygen.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-26 09:16:42 -04:00
Andrew Boie ba2c44e483 tests: enable HW stack protection by default
Userspace doesn't necessarily imply stack overflow protection
for supervisor threads. Enable this as well if the hardware
supports it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-25 17:18:56 -04:00
Punit Vara 6a014b6321 tests: spi: Check for return value
Check return value for k_poll()

issue: #6687

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-25 13:37:45 -05:00
Andy Ross 86b5364335 tests/kernel: Add preemption priority test
This test exaustively tests preemption points between threads of all
priority classes (cooperative, preemptible, and metairq), done both
from a synchronous reschedule (via k_sem_give() and from interrupt
context (via irq_offload()), and with and without the sched_lock()
held.  It then detects the next thread that runs and validates vs. the
documented priority rules.

Note that there is a whitelisted case on ARM, where irq_offload()
seems not to be working like a true interrupt (it always returns to
the interrupted context and doesn't seem to hit the normal exception
return path which can context switch).  And native_posix is excluded
because of failures and the fact that it's actually never possible to
truly preempt a thread there (they run to completion inside _Swap()
et. al. and then block themselves).  Both of these should be fixable
in the future but don't (seem to) directly relate to this test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-25 09:40:55 -07:00
Spoorthi K 21792fa020 tests: posix: timer: Fix integer handling issues
Fixes coverity issue and some cosmetic issues through uncrustify.

Fixes: GH-6667

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-05-25 09:30:20 -07:00
Ulf Magnusson 3c8e033e69 tests: net: all: Remove CONFIG_HTTP_HEADER_FIELD_ITEMS assignment
This symbol was removed by commit d1675bf3e6 ("net: http: Remove the
old legacy API").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:21:01 -04:00
Ulf Magnusson f6bdcb71ea tests: net: all: Fix assignments to old nbuf API Kconfig symbols
These symbols were renamed by commit bf964cdd4c ("net: Renaming net
nbuf API to net pkt API").

Update the assignments to use the new names.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:21:01 -04:00
Ulf Magnusson 7765813787 tests: net: all: Fix assignments to old TIME_WAIT Kconfig symbols
CONFIG_NET_TCP_{TIME_WAIT,2MSL_TIME} were replaced by
CONFIG_NET_TCP_TIME_WAIT_DELAY in commit 89f57c225a ("net:tcp: Define
single condig option for TIME_WAIT delay"), which also switched from
seconds to milliseconds for specifying the delay.

Remove the old assignments and set the new symbol to give the same
behavior as before.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:21:01 -04:00
Ulf Magnusson 637ad4cc49 tests: net: all: Remove redundant/misspelled NET_RPL assignments
CONFIG_NET_RPL_MC_ETX was misspelled as "..._EXT".

CONFIG_NET_RPL_MC_{NONE,EXT,ENERGY} are choice symbols. Setting a choice
symbol to 'y' implies that none of the other choice symbols are
selected, so remove the 'n' assignments and keep just the
CONFIG_NET_RPL_MC_ENERGY=y assignment.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:21:01 -04:00
Ulf Magnusson 2facf33f28 net: ieee802154: Remove old cc2520 AUTO_ACK assignments
CONFIG_IEEE802154_CC2520_AUTO_ACK started out as
CONFIG_TI_CC2520_AUTO_ACK, which was removed in commit 6b43821f20
("net: Remove legacy Contiki based uIP stack"). The assignments were
later renamed in commit 573774a9bf ("drivers/net/ieee802154: Change
configuration prefix").

Remove them.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:20:37 -04:00
Ulf Magnusson d96dbadd75 tests: adc_simple: Change ADC_DEBUG=y to SYS_LOG_ADC_LEVEL=4
The ADC_DEBUG Kconfig symbol was removed in commit a679f32920
("sys_log: replace old debug macros at ADC driver"), which introduced
SYS_LOG_ADC_LEVEL and switched to using SYS_LOG_DBG() for debug
messages.

Remove the ADC_DEBUG=y assignment and set SYS_LOG_ADC_LEVEL=4 so that
the debug messages still show up.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 11:19:34 -04:00
Ioannis Glaropoulos e8182fa03d test: kernel: remove workaround for arm_mpu (keep for nxp_mpu)
The generation of Stack Corruptions reports is, now, supported
in ARM SOCs with the ARM MPU (CONFIG_ARM_MPU). Therefore, this
commit removes the workaround for ARM architecture in
tests/kernel/fatal/ and keeps it only for SOCs with the NXP MPU
(CONFIG_MXU_MPU).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-05-25 09:46:24 -05:00
Ulf Magnusson f3f767a2ae tests: power: multicore: Remove CONFIG_UART_{0,1}=n assignments
No such generic UART symbols ever existed, afaict. Maybe some
board-specific UART was meant to be disabled.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-25 09:13:20 -05:00
Kumar Gala 8e41572774 drivers: spi: remove dead references to CONFIG_SPI_QMSI{_SS}
During the spi rework we removed the qmsi spi drivers so we no longer
have Kconfig symbols or drivers related to CONFIG_SPI_QMSI{_SS}.  There
are a few references still around that we should remove

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-24 21:09:32 -04:00
Andrew Boie dda7befdba tests: benchmarks: force assertions off
These would interfere with size/footprint data.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-24 15:12:56 -07:00
Punit Vara 843ad8b07e tests: semaphore: Check return value
Check return value for pthread_create()

issue: #6701

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-24 14:25:25 -07:00
Ulf Magnusson 45221a9706 serial: nsim: Fix impossible-to-enable CONFIG_UART_NSIM
CONFIG_UART_NSIM depends on CONFIG_NSIM, which was removed in commit
9bc69a46fa ("boards: Update arc em_starterkit support from 2.2 to
2.3"). Remove the dependency, and also remove the CONFIG_NSIM=y setting
from the test_nsim test (which should now work).

Also change the condition for EXTERN()ing _VectorTable in
include/arch/arc/v2/linker.ld to check CONFIG_UART_NSIM instead of
CONFIG_NSIM. I'm guessing the EXTERN() is there to make the symbol
visible to nSIM, though I don't know anything about it.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-24 13:09:28 -04:00
Punit Vara ba8c8c3ceb tests: mslab_threadsafe: Check for return value
Check return value for k_mem_slab_alloc()

issue: #6693

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-24 10:56:58 -04:00
Ulf Magnusson 5b20350a72 gdb_server: Remove leftover testing and x86 parts
gdb_server was removed in commit 0f669132a0 ("kernel: remove
gdb_server"), but still has a testcase that sets CONFIG_GDB_SERVER=y,
and some code in arch/x86/debug.

Remove the leftover parts. This also gets gets rid of undefined
references to the CONFIG_GDB_SERVER symbol.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-24 08:10:21 -04:00
Jukka Rissanen d6b11e15be tests: net: arp: Check NULL in unicast test
Coverity-CID: 186047
Fixes #7724

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-24 08:01:28 -04:00
Andy Ross e9174c6dde tests/kernel/common: Add rigorous integer typing test
Zephyr code routinely assumes conventional ILP32/LP64 integer
behavior, and occasionally relies on it to perform some nice tricks.
This is despite the fact that this behavior (while pervasively adopted
and in use on all architectures we care about supporting) isn't
actually guaranteed by the language standard which allows much looser
semantics than actual exist on hardware.

Put it into the intmath section of this test as a build time thing.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-23 19:40:07 -07:00
Andy Ross f8ef918d06 tests/lib/c_lib: Turn off too-clever compiler warning
GCC 8 is smart enough to warn about the truncation condition we're
trying to test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-23 20:54:36 -04:00
Anas Nashif d73e970084 tests: stack: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif 876195de4d tests: pipe: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif 234484fda8 tests: msgq: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif e989283f35 tests: lifo: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif 12d47cc553 tests: fifo: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif c2be441712 tests: alert: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Anas Nashif 6f40b5330a tests: semaphore: improve test documentation
Add references to APIs being tested and groups tests correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-23 18:58:03 -04:00
Kumar Gala e1fab4c310 tests: kernel: timer: timer_api: Remove nonexistent config option
CONFIG_NUM_DYNAMIC_TIMERS doesn't exist so remove setting it in prj conf
file.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Johan Hedberg 8d1f67c605 Bluetooth: Remove references to non-existing Kconfig symbols
Remove non-existent Kconfig symbol references. An additional (but
related) change is the removal of all persistent storage symbols from
the Arduino 101 Bluetooth shell app, since BT_STORAGE no longer
exists.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-23 16:57:59 -04:00
David B. Kinder 071b1bd6b6 doc: fix misspellings in test documentation
Found some misspellings missed during normal review

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-23 15:27:19 -05:00
Andrew Boie 2348daa874 tests: crypto: disable user mode on 2 tests
These tests have an enormous stack which can be troublesome
to align on MPU-based systems; just disable user mode on
them.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-23 15:05:15 -05:00
Andrew Boie 179988888c tests: footprint: only use user mode for max
The min and reg tests need to have user mode disabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-23 15:05:15 -05:00
Andrew Boie 4afc6c9ff2 kernel: remove STACK_ALIGN checks
STACK_ALIGN has somewhat different semantics across our arches,
particularly ARC.

These checks are unnecessary, _new_thread() is required
to properly align stack sizes anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-23 15:05:15 -05:00
Inaky Perez-Gonzalez 14fe2727b8 tests: unfold nffs_fs_api
The introduction of `sanitycheck --list-tests` fails to properly parse
the subcases in tests/subsys/fs/nffs_api/ beacause four of them are
all packed with #ifdefs in a single src/main.c.

So this breaks that testcase in four:

- creating a common folder with the code itself
- moving the common code in */src/main.c to common/test_nffs.h and
  adding ../common/*.c to the sources
- thinning each testcase.yaml to have only the needed testcase
  definition
- adding zephyr_include_directories(../common) to the cmakefiles

so we now produce with --list-tests

    - filesystem.nffs.basic.append
    - filesystem.nffs.basic.corrupt_block
    - filesystem.nffs.basic.corrupt_scratch
    - filesystem.nffs.basic.fs_mount
    - filesystem.nffs.basic.gc
    - filesystem.nffs.basic.gc_on_oom
    - filesystem.nffs.basic.incomplete_block
    - filesystem.nffs.basic.large_write
    - filesystem.nffs.basic.long_filename
    - filesystem.nffs.basic.lost_found
    - filesystem.nffs.basic.many_children
    - filesystem.nffs.basic.mkdir
    - filesystem.nffs.basic.open
    - filesystem.nffs.basic.overwrite_many
    - filesystem.nffs.basic.overwrite_one
    - filesystem.nffs.basic.overwrite_three
    - filesystem.nffs.basic.overwrite_two
    - filesystem.nffs.basic.read
    - filesystem.nffs.basic.readdir
    - filesystem.nffs.basic.rename
    - filesystem.nffs.basic.split_file
    - filesystem.nffs.basic.unlink
    - filesystem.nffs.basic.wear_level
    - filesystem.nffs.cache.cache_large_file
    - filesystem.nffs.cache.fs_mount
    - filesystem.nffs.large.fs_mount
    - filesystem.nffs.large.large_system
    - filesystem.nffs.large.large_unlink
    - filesystem.nffs.performance.fs_mount
    - filesystem.nffs.performance.performance
   30 total.

vs before, that we did:

    - filesystem.nffs.basic.append
    - filesystem.nffs.basic.corrupt_block
    - filesystem.nffs.basic.corrupt_scratch
    - filesystem.nffs.basic.fs_mount
    - filesystem.nffs.basic.gc
    - filesystem.nffs.basic.gc_on_oom
    - filesystem.nffs.basic.incomplete_block
    - filesystem.nffs.basic.large_write
    - filesystem.nffs.basic.long_filename
    - filesystem.nffs.basic.lost_found
    - filesystem.nffs.basic.many_children
    - filesystem.nffs.basic.mkdir
    - filesystem.nffs.basic.open
    - filesystem.nffs.basic.overwrite_many
    - filesystem.nffs.basic.overwrite_one
    - filesystem.nffs.basic.overwrite_three
    - filesystem.nffs.basic.overwrite_two
    - filesystem.nffs.basic.read
    - filesystem.nffs.basic.readdir
    - filesystem.nffs.basic.rename
    - filesystem.nffs.basic.split_file
    - filesystem.nffs.basic.unlink
    - filesystem.nffs.basic.wear_level
    - filesystem.nffs.cache.append
    - filesystem.nffs.cache.corrupt_block
    - filesystem.nffs.cache.corrupt_scratch
    - filesystem.nffs.cache.fs_mount
    ...
    - filesystem.nffs.cache.split_file
    - filesystem.nffs.cache.unlink
    - filesystem.nffs.cache.wear_level
    - filesystem.nffs.large.append
    - filesystem.nffs.large.corrupt_block
    - filesystem.nffs.large.corrupt_scratch
    ...
    - filesystem.nffs.large.split_file
    - filesystem.nffs.large.unlink
    - filesystem.nffs.large.wear_level
    - filesystem.nffs.performance.append
    - filesystem.nffs.performance.corrupt_block
    ...
    - filesystem.nffs.performance.unlink
    - filesystem.nffs.performance.wear_level
   92 total.

(so it was repeating ALL the subcases for eatch main testcase)

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-05-23 15:07:24 -04:00
Ramakrishna Pallala a1492325c0 tests: kernel: fifo: Do NULL pointer check before accessing data
Do NULL pointer check before accessing data.

CID: 186058

Fixes Issue #7716

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-23 13:14:17 -04:00
Ramakrishna Pallala dccd275349 tests: posix: fs: Free dirp resource in case error
Free dirp reosurce by calling closedir() in case of
readdir() error.

CID: 186040
CID: 186043

Fixes Issues #7731 #7728

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-23 13:14:17 -04:00
Punit Vara 7a3ace35dd tests: Remove newline character
Remove new line character from all zassert_*
messages. Following script has been used to do this.

https://github.com/punitvara/scripts/blob/master/remove_newlinech.py

zassert test framework adds newlines character implicitly.

issue: #7170

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-23 12:59:12 -04:00
Ulf Magnusson 24b0b3c1d0 tests: Remove CONFIG_COMMAND_STACK_SIZE assignments
CONFIG_COMMAND_STACK_SIZE was removed in 4f798177cf ("kernel: remove
old micro/nanokernel C code"). Its help was "Microkernel server command
stack size (in packets)".

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-23 10:14:10 -05:00
Kumar Gala ac13bedc84 tests: net: all: Fix COAP enablement in prj.conf
We had a left over from the old ZOAP lib in pjr.conf.  So enable the
COAP lib instead of ZOAP.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 09:06:05 -05:00
Ulf Magnusson cf227f3681 tests: drivers: build_all: Fix CONFIG_ETH_ENC28J60_0_MAC2 reference
I'm guessing this was meant to assign CONFIG_ETH_ENC28J60_0_MAC{3-5},
which exist.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-23 08:52:58 -04:00
Ulf Magnusson 4190f61c28 tests: net: Fix misspelled CONFIG_DNS_NUM_CONCUR_QUERIES assignments
CONFIG_DNS_NUM_OF_CONCUR_QUERIES doesn't exist.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-23 08:51:11 -04:00
Ulf Magnusson 5414a7de5f tests: mqtt: Fix CONFIG_NET_BUF_DATA_SIZE assignments
These were using the older name CONFIG_NET_NBUF_DATA_SIZE (note the
extra 'N'). The symbol was renamed in commit bf964cdd4c ("net:
Renaming net nbuf API to net pkt API").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-23 08:50:48 -04:00
Andrew Boie efe0c4b764 tests: enable user mode by default
Many boards do not enable user mode in their default configuration
even though they support it. However for purposes of our unit
testing we really do want it on all the time.

It's not enough to just flip on CONFIG_USERSPACE, the tests largely
assume that CONFIG_APPLICATION_MEMORY and CONFIG_DYNAMIC_OBJECTS
are enabled. Update CONFIG_TEST_USERSPACE to be on by default if
CONFIG_TEST is active, and hang CONFIG_DYNAMIC_OBJECTS on it too.

This problem was not previously detected as qemu_x86 has the
user mode options in its defconfig and it is currently the only
user mode compatible platform which runs in emulation.

Fixes #7692

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-22 15:59:07 -07:00
Andrew Boie 8e57097eac bluetooth: disable user mode for one test
This is a workaround until #7704 is fixed, we are getting
an assembler error due to the r7 clobber in the syscall
invocation macros.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-22 15:59:07 -07:00
Andrew Boie 5b8da206c1 tests: fatal: fix several issues
An errant commit accidentally disabled all testing of
hardware-based stack protection. Restore it, and work
around a problem with how these kinds of exceptions are
reported on ARM until #7706 is fixed.

We need to globally disable user mode due to how the
select statements in Kconfig work, the stack sentinel
is incompatible with user mode.

Some build warnings when compiling as native_posix
fixed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-22 15:59:07 -07:00
Andrew Boie 136687d26c test_build_sensors_a_m: disable app memory
We run into the limit of 32 object files on ARM when
CONFIG_APPLICATION_MEMORY is enabled.

Bug #7703 filed, meanwhile just disable it, it's not
needed for this test case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-22 15:59:07 -07:00
Andrew Boie 9f30a6caed tests: mem_protect: fix off-by-one
A test was trying to add the maximum number of partitions,
but when the domain was initialized there was already one
added which needed to be accounted for to avoid an
assertion failing.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-22 15:59:07 -07:00
Sebastian Bøe cde6bef778 kconfig: Drop support for CONFIG_TOOLCHAIN_VARIANT
The Kconfig option TOOLCHAIN_VARIANT (not to be confused with
ZEPHYR_TOOLCHAIN_VARIANT) is a legacy configuration option that has
very few use-cases and can easily be dropped.

It's functionality is easily covered by CONFIG_X86_IAMCU and
ZEPHYR_TOOLCHAIN_VARIANT.

This commit removes all references of it from Zephyr.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-05-22 11:15:36 -04:00
Ramakrishna Pallala 4c7a44b56d tests: posix: Fix pthread attribute initialization
Fix pthread_rwlock test pthread attributes initialization.

Fixes Issue #7569

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-22 08:58:59 -04:00
Jukka Rissanen 6180b904af net: Too long timeout was passed to k_sleep
The code was using MSEC() macro in few places instead of more
proper K_MSEC(). The MSEC() takes seconds as a parameter and
K_MSEC() takes milliseconds.

Fixes #7657

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-22 08:55:27 -04:00
Spoorthi K c182520ee1 tests: kernel: Add description for test cases
Add description to test cases in tests/kernel/mem_heap,
    tests/kernel/mem_slab and tests/kernel/mem_pool

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-05-21 11:23:09 -04:00
Andy Ross 0c80ee0831 tests/kernel: Bump stack sizes for a few tests on qemu_x86
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>
2018-05-19 07:00:55 +03:00
Andy Ross 6040bf7773 lib/rbtree: Fix & document insert comparison order
The scheduler priq implementation was taking advantage of a subtle
behavior of the way the tree presents the order of its arguments (the
node being inserted is always first).  But it turns out the tree got
that wrong in one spot.

As this was subtle voodoo to begin with, it should have been
documented first.  Similarly add a little code to the test case to
guarantee this in the future.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-19 07:00:55 +03:00
Punit Vara 5e87c08a39 tests: posix: Increase sram size
Increase sram to avoid overflow due to new posix apis and structure
changes.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-18 23:02:28 +03:00
Punit Vara f0eaa8e879 tests: mutex: Add test case to test mutex API
This test case tests posix mutex apis.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-18 23:02:28 +03:00
Jan Van Winkel ca16779d9e driver: ILI9340 LCD display driver
Minimal driver for ILI9340 LCD display driver including support
for adafruit 2.2" LCD display (1480)

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-05-18 20:21:45 +03:00
Spoorthi K 7393cb2478 tests: threads: Add test case to verify k_wakeup()
Test case to verify wakeup() of pending thread

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-05-18 17:02:55 +03:00
Ramakrishna Pallala c1200cd3e2 tests: posix: fs: Add description for test cases
Add description for POSIX File System API test cases.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-18 17:01:41 +03:00
Ajay Kishore 8b31cdad16 tests: kernel: Add description for test cases
Add description to test case in
tests/kernel/arm_runtime_nmi/

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-05-18 13:33:20 +03:00
Ramakrishna Pallala 55cf6dd76c tests: posix: Add test for Posix File System API's
Added a test to verify Posix File System API's.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-18 13:32:36 +03:00
Ajay Kishore ad6b890471 tests: kernel: Add description for test cases
Add description to test case in
tests/kernel/arm_irq_vector_table/

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-05-18 02:10:35 +03:00
Anas Nashif 39f396a8ad doc: tests: remove obsolete and bogus test groups
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>
2018-05-18 01:48:31 +03:00
Andrew Boie 3772f77119 k_poll: expose to user mode
k_poll is now accessible from user mode. A memory allocation takes place
from the caller's resource pool to copy the provided poll_events
array; this can be large enough to make allocating it on the stack
not preferable.

k_poll_signal are now proper kernel objects. Two APIs have been added,
one to reset the signaled state and one to check the current signaled
state and result value.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Andrew Boie 2b9b4b2cf7 k_queue: allow user mode access via allocators
User mode may now use queue objects. Instead of embedding the kernel's
linked list information directly in the data item, a container struct
is allocated from the caller's resource pool which is then added to
the queue. The new sflist type is now used to store a flag indicating
whether a data item needs to be freed when removed from the queue.

FIFO/LIFOs are derived from k_queues and have had allocator functions
added.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Andrew Boie c18a11327b HACK: tests: disable output disasm for 1 ARC test
For baffling reasons, the ARC objdump is crashing when
creating the disassembly for the power/multicore/arc
test.

It is known that the patch for adding user mode support
to k_queue objects introduces this issue, but why objdump
crashes is yet unknown.

The compiler problem is tracked in #7608

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Maureen Helm 3f43fc7770 tests: watchdog: Replace platform whitelists with depends_on
Replaces platform whitelists with "depends_on: watchdog" to make the
watchdog test build for all supported platforms. Also updates the
testcase name to follow the new <component>.<subcomponent>
classification scheme.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-17 15:00:55 -05:00
Maureen Helm fb74866c2d tests: watchdog: Update test to work with the mcux watchdog driver
Makes the dual timeout test conditional upon the nrfx watchdog driver
because not all watchdogs can support multiple timeouts.

Test now passes on frdm_k64f, hexiwear_k64, and usb_kw24d512 boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-17 15:00:55 -05:00
Andy Gross eeeffcaf58 tests: rtc: Adjust RTC samples tests for NXP RTC
This patch adjusts some of the timeouts for the RTC sample test.  The
NXP RTC varies a little bit from the QMSI due to the way the timer
count and alarm count work.  The NXP will trigger an alarm when the
timer count and alarm count are the same, but only when it increments
to the next value.

If you set the alarm to be 1 second past the current time, it may take
up to 2 seconds.  Setting the alarm equal to the current time will
result in an alarm occurring in less than 1 elapsed second.

Signed-off-by: Andy Gross <agross@kernel.org>
2018-05-17 13:45:08 -05:00
Andy Gross 27bdb83308 rtc: Add prescalar configuration option
This patch adds a prescaler configuration option that denotes the
number of RTC ticks per second.  This is used to calculate the value
for 1 second.

Signed-off-by: Andy Gross <agross@kernel.org>
2018-05-17 13:45:08 -05:00
Andy Ross ba2405023b lib: rbtree: Add RB_FOR_EACH macro for iterative enumeration
Works mostly like the list enumeration macros.  Implemented by fairly
clever alloca trickery and some subtle "next node" logic.  More
convenient for many uses, can be early-exited, but has somewhat larger
code size than rb_walk().

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-17 11:32:20 -07:00
Anas Nashif a1fc3969fc tests: common: fixed pointer formatting
Make this test also build with newlib enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-17 13:21:39 +03:00
Andrew Boie f3bee951b1 kernel: stacks: add k_stack_alloc() init
Similar to what has been done with pipes and message queues,
user mode can't be trusted to provide a buffer for the kernel
to use. Remove k_stack_init() as a syscall and offer
k_stack_alloc_init() which allocates a buffer from the caller's
resource pool.

Fixes #7285

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:32:59 -07:00
Andrew Boie 0fe789ff2e kernel: add k_msgq_alloc_init()
User mode can't be trusted to provide a memory buffer to
k_msgq_init(). Introduce k_msgq_alloc_init() which allocates
the buffer out of the calling thread's resource pool and expose
that as a system call instead.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:32:59 -07:00
Andrew Boie 44fe81228d kernel: pipes: add k_pipe_alloc_init()
User mode can't be trusted to provide the kernel buffers for
internal use. The syscall for k_pipe_init() has been removed
in favor of a new API to draw the buffer memory from the
calling thread's resource pool.

K_PIPE_DEFINE() now properly locates the allocated buffer into
kernel memory.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:32:59 -07:00
Andrew Boie 97bf001f11 userspace: get dynamic objs from thread rsrc pools
Dynamic kernel objects no longer is hard-coded to use the kernel
heap. Instead, objects will now be drawn from the calling thread's
resource pool.

Since we now have a reference counting mechanism, if an object
loses all its references and it was dynamically allocated, it will
be automatically freed.

A parallel dlist is added for efficient iteration over the set of
all dynamic objects, allowing deletion during iteration.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:32:59 -07:00
Andrew Boie e9cfc54d00 kernel: remove k_object_access_revoke() as syscall
Forthcoming patches will dual-purpose an object's permission
bitfield as also reference tracking for kernel objects, used to
handle automatic freeing of resources.

We do not want to allow user thread A to revoke thread B's access
to some object O if B is in the middle of an API call using O.

However we do want to allow threads to revoke their own access to
an object, so introduce a new API and syscall for that.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:32:59 -07:00
Andrew Boie 577d5ddba4 userspace: fix kobj detection declared extern
If a variable is declared extern first, the name and type
information is stored in a special DW_DIE_variable which
is then referenced by the actual instances via the
tag DW_AT_specification.

We now place extern variable instances in an extern environment
and use this data to fetch the name/type of the instances,
which do not have it (which is why they were being skipped).

As it turns out, the gross hack for the system workqueue was
due to this problem because of the extern declaration in
kernel.h.

Fixes: #6992

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-16 17:00:27 -07:00
Johan Hedberg cfb34d2b80 Bluetooth: Mesh: shell: Add persistent storage support
Add persistent storage support to the mesh shell module and app.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-16 18:41:23 +03:00
Tomasz Gorochowik e2db76c9cc tests/net: Fix ethernet mgmt mac change test
The test checked if the change was reported as successful and it always
was.  What needs to be done is comparing whether the mac address was
actually changed to the requested one.

This commit adds this check.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-05-16 16:22:38 +03:00
Michael Scott 2c987298f2 net: tcp: expose some TCP helper functions
Similar to UDP, some drivers can make use of the following functions:
net_tcp_get_hdr()
net_tcp_set_hdr()

Let's expose them as <net/tcp.h> and change all internal references
to "tcp_internal.h".

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
2018-05-15 18:07:47 +03:00
Adithya Baglody c07ec386bf tests: subsys: fs: Enable proper configuration for qemu_x86.
The sample was running with incorrect kconfigs.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Adithya Baglody 2db1c080d8 tests: drivers: build_all: Ensure correct builds.
Ensure that sanitycheck runs this sample only on boards with
right drivers support. This test was picking all targets and
executing on each of them .This eliminates incorrect builds.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Adithya Baglody 43775402a9 tests: Kconfig: Added a new Kconfig for qemu_x86
The qemu doesn't have any flash drivers present in the
drivers/flash folder.
When building the tests/subsys/fs/nffs_fs_api the qemu picks
up a local file to emulate the drivers. This setup was causing the
failures in mapping required dependencies. This patch creates a
new kconfig which can be used to test out the flash drivers.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Ramakrishna Pallala bb7177830d tests: kernel: profiling: Add test for k_thread_foreach API
Add a test case for k_thread_foreach API.

Replace deprecated k_call_stacks_analyze API with
k_thread_foreach for existing test cases.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-15 13:43:00 +03:00
Luiz Augusto von Dentz 1b038f2941 Bluetooth: GATT: Make BT_GATT_CHARACTERISTIC declare its value
This ensures the every characteristic has a value attribute declared
with the same UUID since the old macro did not declare the value the
application would normally have to declare one itself using a different
UUID which is not allowed.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-05-14 18:51:22 +03:00
Karol Lasończyk c9898097bb tests: watchdog: Add new test implementation
New test checks watchdog API if the simpliest test cases work
correctly. Each test contains description at the begining of the
source file.
This implementation replace old SoC-centric implementation.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-05-14 10:28:23 -05:00
Jukka Rissanen e8d0571b26 tests: net: tcp: Remove unnecessary code
As this test uses dummy L2 driver, there is no need for ethernet
specific setup as that is not used for anything.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-14 14:54:24 +03:00
Jukka Rissanen 4763844013 tests: net: tcp: IPv4 header was not initialized
When creating IPv4 packet, the IPv4 header contained uninitialized
values. This was reported by valgrind.

Conditional jump or move depends on uninitialised value(s)
   at 0x8066AB0: calc_chksum (utils.c:386)
   by 0x8066C99: calc_chksum_pkt (utils.c:428)
   by 0x806710A: net_calc_chksum (utils.c:487)
   by 0x8067B8D: net_calc_chksum_icmpv4 (net_private.h:138)
   by 0x8067FEC: net_icmpv4_set_chksum (icmpv4.c:90)
   by 0x8068E7A: net_icmpv4_send_error (icmpv4.c:338)
   by 0x807272F: send_icmp_error (connection.c:773)
   by 0x80731A3: net_conn_input (connection.c:992)
   by 0x806A34D: net_ipv4_process_pkt (ipv4.c:212)
   by 0x805D8B9: process_data (net_core.c:103)
   by 0x805D939: processing_data (net_core.c:117)
   by 0x805E498: net_rx (net_core.c:300)
 Uninitialised value was created by a stack allocation
   at 0x804A437: setup_ipv4_tcp (main.c:297)

Conditional jump or move depends on uninitialised value(s)
   at 0x8067117: net_calc_chksum (utils.c:489)
   by 0x8067B8D: net_calc_chksum_icmpv4 (net_private.h:138)
   by 0x8067FEC: net_icmpv4_set_chksum (icmpv4.c:90)
   by 0x8068E7A: net_icmpv4_send_error (icmpv4.c:338)
   by 0x807272F: send_icmp_error (connection.c:773)
   by 0x80731A3: net_conn_input (connection.c:992)
   by 0x806A34D: net_ipv4_process_pkt (ipv4.c:212)
   by 0x805D8B9: process_data (net_core.c:103)
   by 0x805D939: processing_data (net_core.c:117)
   by 0x805E498: net_rx (net_core.c:300)
   by 0x805E51D: process_rx_packet (net_core.c:312)
   by 0x8085E87: work_q_main (work_q.c:39)
 Uninitialised value was created by a stack allocation
   at 0x804A437: setup_ipv4_tcp (main.c:297)

Fixes #7447

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-14 14:54:07 +03:00
Jukka Rissanen d551565802 tests: net: coap: Fix uninitialized memory access
The options array was not initialized to 0 and the size of the
array was not set properly. This caused following error in valgrind

Conditional jump or move depends on uninitialised value(s)
   at 0x8056777: coap_find_options (coap.c:1096)
   by 0x804AEFF: test_parse_simple_pdu (main.c:455)
   by 0x80500E6: zephyr_app_main (main.c:1585)
   by 0x807E231: bg_thread_main (init.c:254)
   by 0x80842D7: _thread_entry (thread.c:201)
   by 0x8059618: posix_thread_starter (posix_core.c:301)
   by 0x40752C8: start_thread (in /usr/lib/libpthread-2.25.so)
   by 0x4182055: clone (in /usr/lib/libc-2.25.so)

Fixes #7447

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-14 14:54:07 +03:00
Jukka Rissanen 93e71ab092 tests: net: mgmt: Do not allocate link address from stack
This will lead invalid IPv6 address to be generated. This was seen
in valgrind.

Conditional jump or move depends on uninitialised value(s)
   at 0x40371A4: bcmp (vg_replace_strmem.c:1100)
   by 0x8058833: net_ipv6_addr_cmp (net_ip.h:542)
   by 0x805B999: ipv6_addr_find (net_if.c:768)
   by 0x805BC8C: net_if_ipv6_addr_add (net_if.c:846)
   by 0x804A7D7: _iface_ip6_add (mgmt.c:271)
   by 0x804A5DC: test_core_event (mgmt.c:251)
   by 0x804AD1D: test_mgmt (mgmt.c:320)
   by 0x807EA81: run_test_functions (ztest.c:56)
   by 0x807EC3C: test_cb (ztest.c:196)
   by 0x8085AFD: _thread_entry (thread.c:201)
   by 0x8051B43: posix_thread_starter (posix_core.c:301)
   by 0x40752C8: start_thread (in /usr/lib/libpthread-2.25.so)

Fixes #7447

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-14 14:54:07 +03:00
Andy Gross 7e0d1d27d5 tests: lib: rbtree: Clarify increment of variable
This patch fixes a coverity issue with the post increment of ni inside
an zassert call.  There might be side effects of non-debug builds that
would cause the code to not do the right thing.

Coverity-ID: 185391

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 20:03:00 -04:00
Andy Gross f71e497d98 tests: net: ipv6: Add assert for net_if_config_ipv6_get
This patch fixes a coverity issue with checking the outcome of a call
to net_if_config_ipv6_get().

Coverity-ID: 183478

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 18:43:13 -04:00
Andy Gross 5575487da6 tests: posix: Fix sigevent initialization
This patch fixes a couple of coverity issues pertaining to
uninitialized members of a sigevent structure.

Coverity-ID: 183070
Coverity-ID: 185276

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 16:52:19 -04:00
Andy Gross d76cc488a2 tests: net: checksum_offload: Check for valid UDP_HDR
This patch fixes a coverity issue with dereferencing a null ptr.  The
test needs to make sure there is a valid udp hdr before inspecting the
contents.

Coverity-ID: 183484
Coverity-ID: 183480

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 16:50:59 -04:00
Johan Hedberg 88dfd399f4 Bluetooth: Mesh: Remove sequence number from bt_mesh_provision()
The sequence number was acting as a stop-gap for missing persistent
storage. Now that we have the settings support in place it's no longer
needed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-11 16:44:43 +03:00
Johan Hedberg 8703ffad23 Bluetooth: Mesh: Redesign element and storage info for models
Keeping the model struct same sized, change the element pointer to two
indexes, and add a flags member that will be used to track pending
storage actions.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-11 16:44:43 +03:00
Andrzej Puzdrowski 3be0c56d50 tests/subsys/settings/fcb: add deleted settings compression test
New test for check whether deleted item is not copied to the newest
fcb sector during compression procedure.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-05-11 09:56:52 +02:00
Maureen Helm 5ef03f5f41 tests: spi_loopback: Add frdm_kw41z configuration
Adds a board-specific configuration for the frdm_kw41z to the
spi_loopback test.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Alberto Escolar Piedras 0e8daafd4c tests kernel pending: unitialized variable
Fix in an unitialized variable in tests/kernel/pending.
To avoid a set of valgrind errors.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-05-10 08:20:15 -07:00
Spoorthi K 79a0fa68e3 tests: mem_protect: Add memory domain testcases
Add few tests to check access permissions of memory partitions
of a memory domain, validate memory domain destroy.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-05-09 21:10:56 -07:00
Inaky Perez-Gonzalez 2a64fe666a ztest: prints newline after failure message
Most calls to ztest_assert() contain a message with no trailing
newline. So when it fails, we get (eg:):

  starting test - test_multilib

      Assertion failed at multilib.c:19: test_multilib: (c not equal to 323)
  smoke-test failed: wrong multilib selectedFAIL - test_multilib.

when we'd like to get:

  smoke-test failed: wrong multilib selected
  FAIL - test_multilib.

among other things, because it is easier to parse for correctness.

So this patch adds a trailing newline to the message instead of going
around trying to police every call site to do it.

print[kf]() is used vs k_str_out() as we need something that is
available also for unit tests. As this is not in any hot path,
performance wise is not such a big deal.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-05-09 09:33:24 -04:00
Anas Nashif 8e8cb4a90b tests: doxygen comment cleanup
Group tests under 'Zephyr Tests' and only document the actual tests.
Create cross references to APIs being tested where applicable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-09 00:32:34 -04:00
Spoorthi K 7174546b75 tests: threads: Document description for test cases
Add description for test cases and some cosmetic changes

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-05-08 12:35:51 -04:00
Ramakrishna Pallala c239ea701f tests: subsys: fs: Add test for FAT FS dual instance case
Add a test application to demonstrate the dual instances of
FAT file system.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-08 08:53:01 -04:00
Ramakrishna Pallala 01b831751d tests: subsys: fs: Add changes to support multiple FS instance
Set FAT FS mount point name as per ELM FAT Library drive
name format.

Add file system specific headers wherever necessary.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-08 08:53:01 -04:00
Anas Nashif a279403c47 tests: remove dot after PASS|FAIL
That dot does not belong here, just stands in the way when parsing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-08 07:56:18 -04:00
Anas Nashif 7a6f7136bb doc: process test documentation
Also parse test documentation. When add tests to doxygen, we get
warnings about device.h macros not being defined. Exclude this now and
track this in issue #7367.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif c44f4e0ee5 tests: alert: add doxygen documentation
Add doxygen comments to test functions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif c57326e1b6 tests: fix doxygen comments
Fix many warnings resulting from doxygen comments in tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif 540e11ced7 tests: rename main test to main.c
For many tests, avoid splitting into files and put eveything in main.c.
For many of the tests, use main.c as the test source file to keep things
consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif bc672895ba tests: remove duplicate tests
Remove a few duplicates and avoid calling tests multiple times for
setup/teardown.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif 8603f7a4ce tests: flash_map: use proper test name
Use a meaningful name for the test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif ee6b8761cd tests: ipv6: convert to ztest
Use ztest instead of custom routine to iterate over tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif 478f6807a4 tests: http: call tests via ztest macro
Move tests to be ztest items instead of calling them directly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif efb52c5bc0 tests: neighbor: use ztest asserts
Use ztest macro and convert to ztest proper.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Anas Nashif 93109f2d8e tests: enhance test meta-data/improve test naming
Enhance the test meta-data and test names. This will is needed for
better and consistent reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Paras Jain 12c5bfaf14 tests : ipv6_fragment : Avoid NULL pointer access
Assign the pointer only when it is not NULL.
Coverity-CID: 185397

Signed-off-by: Paras Jain <parasjain2000@gmail.com>
2018-05-05 00:39:48 -04:00
Johan Hedberg a29554360a Bluetooth: shell: Add settings support
Enable settings and increase the system workqueue size to deal with
the stack usage. This also makes it possible to test unpairing support
with the shell's 'clear' command.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-04 17:26:05 -04:00
Johan Hedberg d22b7c9f2d Bluetooth: Remove bt_storage API
The same functionality is now supported by the settings-based
solution, so remove bt_storage out of the way. There were stubs in
bt_storage to handle per-peer information (e.g. pairing keys) but this
was never actually implemented in full. The next step is to add this
support to the settings-based solution.

Leave the code for generating temporary IRK and identity address in
case BT_SETTINGS is not enabled. Also leave the code for using vendor
HCI to read the identity address, in which case the settings
implementation will not touch it.

Introduce a new bt_unpair() API to replace the removed
bt_storage_clear(), since the latter was actually doing more than just
storage management: it was also handling runtime storage of pairing
information. Later, the bt_unpair() implementation will be extended to
clear settings-based pairing storage.

There is one feature that the bt shell module looses: the ability to
give a specific identity address to the "init" command as a parameter.
We might look later in the future if this is really needed, and add a
separate API for this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-04 17:26:05 -04:00
Maureen Helm cc6f8b524c tests: fp_sharing: Fix definition of PI_NUM_ITERATIONS
The fp_sharing test has an option to control the number of iterations in
the pi calculation, which is used to adjust the duration of the test on
different platforms that may have significantly different execution
frequencies (e.g., qemu_x86 vs. frdm_k64f). The conversion to CMake did
not handle this option correctly and forced the same value for all
platforms.

The test now completes in about 5 minutes on frdm_k64f.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-03 23:24:57 -04:00
Ramakrishna Pallala ee1e9886a9 tests: boards: altera_max10: Add test for Nios-II MSGDMA soft IP
Add test for Altera Nios-II MSGDMA soft IP core. This IP on
Altera MAX10 support Memory to Memory DMA transfers.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-03 10:38:09 -04:00
Anas Nashif 11120bf1c7 tests: remove comma from whitelist
items in platform_whitelist are not comma separated.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-03 09:28:36 -04:00
Jukka Rissanen 542f10de78 tests: net: ip: Refactor and add IPv4 tests
Add new test for testing IPv4 source address selection functions.
Refactor the tests:
- split tests to smaller pieces
- use proper zassert() statements
- print debugging information only when needed

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-03 12:47:52 +03:00
Anas Nashif b3275d651c tests/samples: add hw dependencies
Add hardware dependencies and filters to make sure we do not explode if
for example we try to build a sample/test using rtc when the platform
does not support that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 19:10:27 -04:00
Savinay Dharmappa e57df9a3ed tests: boards: intel_s1000_crb: select application based on config
Add support to enable test application selectively based
on defconfig

Change-Id: I8111750ff099edd95ffa22c6e312999c801678ea
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Savinay Dharmappa a2afa6cf8c test: board: intel_S1000: Add test application for HID
patch add a hid test application which sends continues
reports to the host

Change-Id: I3a638caded629b502b4cfc6c7bdcba0b67428350
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi 46d6ba4674 boards: intel_s1000: enable I2S
Enable the CAVS I2S on intel_s1000. Also, introduce a test to
validate I2S in ping-pong and normal modes.

Change-Id: Iea78e22cedc7724c1c2e821c68d7030cc0a65047
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi cea1c75e2b boards: intel_s1000_crb: enable DMA
Enable the CAVS DMA on intel_s1000. Also, introduce a test to
validate the DMA.

Change-Id: I2ff233c45cfd8aea55e254d905350a666aa649a0
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi 567482ff35 intel_s1000: tests: introduce tests to check features enabled
This patchset carries out basic tests on the features supported
on intel_s1000. Currently, Interrupt mechanism, GPIO handling, I2C
communication and UART prints are illustrated.

Change-Id: I7ea03b5085b7fa8d29635c294038536465a70660
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Ulf Magnusson 18cc28a9e7 tests: Fix malformed CONFIG_TEST=y prj.conf entry
The "=y" part was accidentally left out.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-05-01 20:53:40 +02:00
Anas Nashif 2b62f1ab02 tests: fixed doxygen comments
Various fixes to bad doxygen syntax.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-30 17:15:29 -04:00
Anas Nashif 67194a40ef tests: errno: document test functions
Use doxygen to document test and cleanup test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-30 17:15:29 -04:00
Anas Nashif 25e7b27be5 tests: critical: document test functions
Use doxygen to document test and cleanup test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-30 17:15:29 -04:00
Anas Nashif 2182a53fec tests: irq_offload: document test functions
Use doxygen to document test and cleanup test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-30 17:15:29 -04:00
Spoorthi K ff0857df25 tests: threads: Add test to verify delayed thread abort
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>
2018-04-30 06:55:46 -04:00
Andrzej Puzdrowski 3298d60ff9 tests: subsys: settings: Add FCB-beckend initialization test
Added test for initialization with FCB backend.
This test should goes over reset so it test blank and
subsequent initialization and data restoring capability
after the reset.



Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-27 13:20:14 +02:00
Anas Nashif 6f1cff733e ztest: fix result checking
Fixes #7208: failed tests return -1, not 1. Fix this and adjust logic.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-27 08:37:29 +05:30
Johan Hedberg 9968cda453 fs: Convert NFFS partition to a generic one
The NFFS partition at the end of flash is also useful for any other
file system or even the Flash Circular Buffer (FCB). Rename the
partition from 'nffs_partition' to 'storage_partition' and make it
depend on a new hidden Kconfig entry which the relevant users will
select (such as NFFS and FCB).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-04-26 16:06:55 +05:30
Johan Hedberg 9a2b5357ea tests: settings: Remove references to non-existent Kconfig variable
There's no such Kconfig variable as CONFIG_SOC_FLASH_NRF5.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-04-26 11:58:07 +03:00
Anas Nashif b4cb101427 tests: mem_prot: skip unsupported tests
If a test is not supported on some platform, skip it and report SKIP.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-26 13:01:45 +05:30
Adithya Baglody 7753bc5065 tests: kernel: mem_protect: tests for userspace mode.
The testcases presented here will test the following functionality
1. Inheritance of permission from parent thread to child.
2. Memory domain implementation.
3. Access permission for k objects.

The combinations of these test cases will cover some of the basic
usecases of the userspace mode.
These test cases are meant to be executed by any board with has
CONFIG_USERSPACE enabled.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-04-25 14:44:31 -07:00
Leandro Pereira 39dc7d03f7 scripts: gen_kobject_list: Generate enums and case statements
Adding a new kernel object type or driver subsystem requires changes
in various different places.  This patch makes it easier to create
those devices by generating as much as possible in compile time.

No behavior change.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
Andrzej Puzdrowski 9fe30535d7 susbsys: settings: fix coverity issues
API settings_subsys_init call was changed so that it returns
error (so returns int instead of void).
Prototype of storage helper function export_func for
settings_handler::h_export was changed so that it returns error
(so returns int instead of void).
Fixed few other error handling issues by ignoring return
values.

Tests were aligned to above patches.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-25 22:25:32 +05:30
Anas Nashif eb6f20318e tests: fix meta data of peripheral tests
Improve naming of tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 7a5ff13703 tests: allow unsupported tests to be skipped
Instead of completely excluding those tests, mark them as skipped and
provide an noop function that marks the test as skipped where test is
not supported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 20495e897b ztest: support skipping tests
Some tests cant run everywhere, instead of completely dropping them, we
should report them as being skipped.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 910a569ea7 tests: stackprot: move to ztest
Move test to use ztest instead of freestyle.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 0f5a88b0ef tests: posix: mqueue remove extra printk
Remove useless printk at the end of the tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif fa6cce430c tests: ztest: style, tag and category fixes
Fix categories.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 89a50932d3 tests: posix: style, tag, and category fixes
Fix coding style, test tags and use categories.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 9312de0077 tests: crypto: style, tag, and category fixes
Fix coding style, test tags and use categories.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 1f2627a638 tests: net: style, tag, and category fixes
Fix coding style, test tags and use categories.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 63f21391b9 tests: use consistent test function names
Minor change to make test names consistent with other tests using ztest.
All test functions need to start with test_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Anas Nashif 1609f251ee tests: kernel: style, tag, and category fixes
Fix coding style, test tags and use categories.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-25 14:18:15 +05:30
Paul Sokolovsky e564d58b7d tests: socket: udp: Close test sockets
Close test sockets in test_send_recv_2_sock() to avoid Coverity
warnings.

Coverity-Id: 182764
Fixes: #6107

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-04-25 10:26:19 +03:00
Andrew Boie 31bdfc014e userspace: add support for dynamic kernel objects
A red-black tree is maintained containing the metadata for all
dynamically created kernel objects, which are allocated out of the
system heap.

Currently, k_object_alloc() and k_object_free() are supervisor-only.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-04-24 12:27:54 -07:00
Andy Ross 3f55dafebc kernel: Deprecate k_thread_cancel() API
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>
2018-04-24 03:57:20 +05:30
Paul Sokolovsky 1d1db121d3 tests: socket: udp: Tighten up error checking
Add zassert's to check results of intermediate operations like
socket/bind/connect. Also, use symbolic expressions instead of
constants like 4 (for data length).

Coverity-Id: 182765, 182767
Fixes: #6104, #6106

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-04-23 15:26:43 +03:00
Diego Sueiro 140daa2f27 sanitycheck: add min_flash option for 32K devices
Following tests were failing on a microcontroller with 32KB flash:
    test-mbedtls
    kernel.common

The min_flash option has been added in the test case yaml files.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-04-21 06:57:38 -07:00
Stig Bjørlykke e8bcc6f1f0 tests: socket: Free resources with freeaddrinfo
In Zephyr this has no effect because getaddrinfo() returns a pointer
to a static array, but Coverity scan checks for this pattern.

Coverity-CID: 185273
Coverity-CID: 185279

Fixes #7085
Fixes #7091

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-20 10:48:52 +03:00
Paul Sokolovsky edc048e06f tests: socket: udp: Make sure client sockaddr fully initialized
Previously, some fields like sin6_scope_id weren't explicitly
initialized. Such aren't really used, but to keep Coverity
happy, let's zero out the entire address structure.

Coverity-Id: 182763
Fixes: #6108

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-04-20 10:47:27 +03:00
Wayne Ren 1931f1242b tests: fix arc related codes
code fixes for arc architecture

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-04-17 10:50:12 -07:00
Erwan Gouriou 25e5c60c41 tests/net: utils: increase min RAM requirement to 24K
Min RAM requirement for tests/net/utils was 16K,
hence run on nucleo_l073rz.
Though, build size is a little more than 20K which
overflows board RAM.

Increase min RAM requirement for this test to 24K

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-04-13 13:40:05 -05:00
Andrzej Głąbek f2177bfb8e tests: net: Make "app" tests dependent on netif
This will prevent building these tests for boards not supposed to run
a TCP/IP stack, particularly 96b_carbon_nrf51 where test-with-dns
would not fit into 32 kB of RAM.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-13 17:04:16 +02:00
Leandro Pereira 1f45f79d61 tests: mempool: Add overflow checks
Test for overflow in k_malloc() and k_calloc().

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-12 14:27:24 -07:00
Rajavardhan Gundi 3c8b3875c6 tests: kernel: threads: Additional tests for set_priority
Added some additional tests for setting priority of threads.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-04-12 14:21:43 -04:00
Andrzej Głąbek 998c79d09b drivers: spi: Add shim for nrfx SPIM driver
This adds a translation layer to make the nrfx driver for the nRF SPIM
(SPI Master with EasyDMA) peripheral accessible via the Zephyr's API.
The shim is provided only for nRF52840 because of a hardware anomaly
present in nRF52832. See Anomaly 58 (SPIM: An additional byte is clocked
out when RXD.MAXCNT = 1) in Errata for this chip.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-12 14:19:53 -04:00
Dario Pennisi 6d387ec98f net: Remove the need for an l2 on offloaded drivers
Drivers will be directly contacted via net_if's offload attribute. No
need for a an extra layer as an L2.

Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Massimiliano Agneni <massimiliano.agneni@iptronix.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-12 09:56:07 -04:00
Marti Bolivar 3718684e06 tests: net: dhcpv4: fix net mgmt event handler
This is missing a mandatory check against the actual event.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-12 10:35:10 +03:00
Marti Bolivar 0d83900ddf tests: net: mld: fix net mgmt event handler
This is missing a mandatory check against the actual event.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-12 10:35:10 +03:00
Armando Visconti 9bde3c06e1 tests: build_all: Add LPS22HB and LSM6DSL sensors build test
Add to CI system the build test for LPS22HB environmental
sensor and LSM6DSL motion sensor.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-10 22:12:14 +02:00
Kumar Gala d7b7f51157 tests: rbtree: Fix test so its actually runs
1. Add a tag in the testcase.yaml to deal with the following error from
sanitycheck:

E: tests/lib/rbtree/testcase.yaml: can't load (skipping):
   <NotMappingError: error code 6: Value: None is not of a
    mapping type: Path: '/'>

2. Reduced the MAX_NODES so the test will build on small memory systems

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-04-10 15:01:23 -04:00
Andy Ross 2ef57f0a1b lib/rbtree: Add a rb_contains() predicate
Returns true if the specified node is in the tree.  Allows the tree to
be used for "set" style semantics along with a lessthan_fn that simply
compares the nodes by their address.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-04-10 12:31:51 -04:00
Andy Ross c625ab85d4 tests: rbtree test
Test for the rbtree balanced tree.

The theory here is that the test uses a PRNG to randomly build and
modify trees build from an array of node objects (whose comparison
operator is just their memory address).  It begins with tiny node
sets, so as to catch edge cases (e.g. nodes being the root, or a leaf,
or parent/child) in the balancing algorithm before increasing the size
and continuing.

At each iteration the resulting tree is walked, verifying that it
contains exactly the nodes that we expect it should, that they appear
in the correct sorted order in the walk, that their local structure
matches a correct binary tree, and that the red/black rules are
followed always:

* The root must be black
* Red nodes can have only black children
* The path from the root to any NULL child pointer in the tree must
  cross the same number of black nodes.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-04-10 12:31:51 -04:00
Diego Sueiro e2924ab42b tests: add min_flash option for some tests
Following tests were failing on a microcontroller with 32KB flash:
    benchmark.application
    crypto.ecc_dh
    crypto.ecc_dsa
    test_build_ethernet
    test_build_sensors_a_m

The min_flash option has been added in the test case yaml files.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-04-10 10:07:18 -05:00
Tomasz Bursztyka 757c5d1857 net/ethernet: Fix uninitialized attributes in ethernet mgmt parameters
Without that, behavior is unknown and bogus.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 16:43:32 +03:00
Jukka Rissanen 3c8560289c tests: net: checksum_offload: Adjust number of interfaces
The test actually has three network interfaces in native_posix board
and not two so check that correctly.

Fixes #6988

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-10 08:36:26 -04:00
Tomasz Bursztyka b71d6babfb tests/net: Add a test for Ethernet net mgmt interface
Basically testing the various requests that can be done through this
interface.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 14:45:37 +03:00
Tomasz Bursztyka 4bf1a9bd60 net/ethernet: All types are prefixed with ethernet_
Aligning eth_hw_caps to the right prefix, so ethernet_hw_caps.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 14:45:37 +03:00
Tomasz Bursztyka e996b37c0a net/ethernet: Add capabilities exposed by device drivers
Curently only link speed is exposed.
Opportunity taken to remove any post-fix enumerating the iface init
and/or the api: these must be generic and used by all the instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 14:45:37 +03:00
Michael Hope fe067eb370 tests: add a C++ compile test.
The test case checks that many of the common header files are C++
compatible and checks that some of the primitives like ARRAY_SIZE
work.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-04-09 23:21:52 -04:00
Michael Hope d2807576ec ztest: define test_main in the header file.
This also makes test_main C++ compatible by setting the linkage.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-04-09 23:21:52 -04:00
Anas Nashif 835ee3fff0 tests: net: checksum_offload: exclude native [REVERTME]
Failing on this platform right now, needs fix.

See GH-6988.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 55ce5510f5 tests: cleanup subsystem tests meta-data
Cleanup testnames, tagging and filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif d7e7b08cdc tests: cleanup meta-data of various tests
Use sensible test name and cleanup filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 31e201b5dc tests: net: context: simplify filtering
Remove complex filtering based on BT feature being on/off.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 3e086c687d tests: base64: do not exclude newlib
This should also run on systems where newlib is default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 5c89a4ce2f tests: ipv6: cleanup tests
Clean tagging and test names. Also make test depend on netif

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 848c105485 tests: classify net tests and cleanup
More tagging and filterting cleanup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 49bb83138c tests: classify periphera tests
Fix testcase naming and follow <component>.<subcomponent> where it makes
sense.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 8e8d6de6f7 tests: posix: fix tags and sections
Improve tagging and fix test names.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 390a2c4c4e tests: classify tests
Give test names that follow <component>.<subcomponent>.
Also, improve tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif fca15b49de tests: xip: cleanup test
Consolidate source files and cleanup testcase.yaml

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 4f4f135b9e tests: mqtt: fix dependencies
Fix platform dependencies.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 1934d3bd5a tests: enhance test filtering for net tests
Use common section of testcase.yaml.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif f3e8cb7e61 tests: add missing harness support
Add missing harness requirement for driver tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif e73a95bd64 tests: kernel: use a consistent test suite name
Lots of tests use different ways for naming tests, make this consistent
across all tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 5d569eac7f tests: rename test -> main.c
Use main.c across the board and move away from custom test naming.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 86bb19ac7d tests: mutex: rename main test function
For consistency sake and for better reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif 88c16923e7 tests: context: use ztest macros
Use ztest whereever possible instead of conditional checking.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Anas Nashif f8502690e1 tests: context: rename main test
Use test_ for tests to be consistent with other tests and make parsing
easier.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Jukka Rissanen bdda369580 tests: net: vlan: Fix VLAN disable test
Because we now return first non VLAN interface if found, the
VLAN disable test case needs adjustment.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-09 17:17:00 +03:00
Punit Vara 4fc2ccbdab test: mbox_usage: add legacy test case for mailbox
Add different scenario for mailbox testing

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-04-09 09:11:44 -04:00
Ioannis Glaropoulos 316ffff6f2 tests: kernel: fix irq_vector_table test for nRF52X platforms
This commit disables Bluetooth and adds a customized vector
table for nRF52X-based platforms in the irq_vector_table kernel
test, in order to prevent UsageFault during system timer
interrupts, and, therefore, let the test execute properly.

This commit fixes #6890.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-04-08 08:47:36 -04:00
Ioannis Glaropoulos 9e4bbcc937 tests: kernel: add Cortex-M33/M7 in list of MCUs
Add Cortex-M33 and Cortex-M7 in the list of supported
ARM MCUs for the arm_irq_vector_table test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-04-08 08:47:36 -04:00
Ramakrishna Pallala 46931c9a44 tests: posix: Resolve header file dependencies
Fixed header file dependencies by reordering the
inclusion sequence in posix tests.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-04-05 16:43:05 -04:00
Andrew Boie 95f1432275 sys_mem_pool: add test case
This is loosely based on the existing mheap_api_concept test
case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-04-05 07:03:05 -07:00
Andrew Boie e3076a4717 tests: add tag for memory pool tests
There are four of them, make it simpler to run just these tests in
sanitycheck.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-04-05 07:03:05 -07:00
Jukka Rissanen 14e356c79a tests: net: vlan: Add VLAN tests
Add tests to verify the bit manipulation functions in net/vlan.h
file. Also check that we can check if given network interface has
VLAN enabled or not. Verify also that received network packet
contains correct VLAN tag.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen de13e979fc net: if: vlan: Add virtual lan support
This allows creation of virtual lan (VLAN) networks. VLAN support is
only available for ethernet network technology.

Fixes #3234

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen a0df4f6698 samples: net: Fix sanitycheck for sam_e70_xplained board
Some of the sanitycheck tests were having too small limit for
network buffers when compiling for sam_e70_xplained board.
Increase the buffer limits when testing this for this board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:25:49 -04:00
Punit Vara fab8c27880 tests: lifo: Add lifo test with scenario
Add different scenario for testing LIFO.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-04-05 08:24:06 -04:00
Spoorthi K d155e88624 tests: stack_random: Add Ztest support
Add Ztest support for stack randomization test case.Ztest support for
stack randomization test case.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-04-05 08:07:43 -04:00
Marti Bolivar 92be41126d tests: drivers: build_all: add TEMP_NRF5 to sensor test
Build the nRF5 temperature sensor driver in this test case.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-04 14:53:54 -05:00
Andrzej Głąbek 18d354c491 tests: spi_loopback: Add configurations for a few nRF5 boards
This adds to the spi_loopback test board-specific configurations
for the following boards:
- nrf51_pca10028
- nrf52_pca10040
- nrf52840_pca10056

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-04 19:02:35 +02:00
Maureen Helm 9116cc7aee tests: spi_loopback: Add frdm_k64f configuration
Adds a board-specific configuration for the frdm_k64f to the
spi_loopback test.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka b4247fde4d tests/spi: Remove excluded boards
These now support the new API through SPI DW native driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka a5efadf219 tests/drivers: Removing old SPI test
It was much more limited than the spi_loopback test, and of course using
the legacy API. Removing it then.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka f44ba8e7d4 api/spi: Make cs attribute in struct spi_config constant
Content is never modified by any driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka da42c0077c api/spi: Add a dedicated Kconfig option for asynchronous mode enablement
Instead of using CONFIG_POLL, which is not directly related to SPI and
is a kernel option, let's have SPI_ASYNC instead. When enabled, it will
select POLL automatically.

Fixes #5839

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka ea2431f32f api/spi: Reduce parameter number on transceive function
tx_bufs/tx_count and rx_bufs/rx_count can be hold in another dedicated
structure, thus reducing the number of parameters to transceive. This
permits to avoid using the stack when calling transceive.

Since we saved parameters, we can expose back the struct device pointer,
to stay consistent with other device driver APIs.

Fixes #5839

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 324265420b api/spi: Disable legacy API by default
Let's start deprecation work of the SPI legacy API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Niranjhana N 80e221618d tests: posix: add more tests
Added posix_checks, which checks supported priorities,
clocks and timer APIs, mainly in the point of negative
tests to increase code coverage.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-04-03 15:57:14 -04:00
Niranjhana N 2ecaee071c tests: posix: Fixing pthread attr object initialization.
In some cases pthread attrib initialization may fail as
garbare value may indicate that this attribute is already
initialized. Destroy the attr object and recreate it.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-04-03 15:57:14 -04:00
Youvedeep Singh 2486d5a2d2 tests: posix: mqueue: Add test for posix message queue APIs.
Added new test for message queue APIs.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-04-03 15:30:44 -04:00
Youvedeep Singh 188c1ab5ca kernel: msg_q: Add routine to fetch basic attrs from message queue.
For posix layer implementation of message queue, we need to fetch
basic attributes of message queue. Currently this routine is not
present in Zephyr. So adding this routing into message queue.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-04-03 15:30:44 -04:00
Jukka Rissanen 5e6c2c3a9b tests: net: tc: Run the tests only for qemu_x86
Speedup the CI by only running the tests in qemu_x86 instead of
almost all boards.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-03 09:38:14 -04:00
Stig Bjørlykke 97b83ffc2c net: sockets: Check for errors from dns_get_addr_info
When dns_get_addr_info() returns an error it does not call the
resolve callback, and thus the semaphore will not be given.

This fix will avoid a deadlock situation for various errors.

Added some small tests for getaddrinfo().

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-03 14:15:43 +03:00
Anas Nashif fe476cc036 tests: ztest: test_main takes no arguments
Some tests were using test_main with arguments causing conflicts during
build.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-01 14:14:16 -04:00
Inaky Perez-Gonzalez 5e7a104e7b tests/kernel/gen_isr_table: fix mispelled 'kerne'
There is a typo in the area description of the testcase (kerne.XYZ vs
kernel.XYZ).

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-03-30 07:56:46 -04:00
Patrik Flykt 41d21bd123 tests: socket: Enable loopback and net tests
Enable the loopback driver and set up network testing so that it
will not require a SLIP driver. Move values from the extra test
config so that they are always enabled.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Andrzej Puzdrowski 94ff339cbf subsys: Add a new settings subsystem
Adapt the MyNewt non-volatile configuration system to become a settings
system in Zephyr.
The original code was modifed in the following ways:

* Renamed from config to settings
* Use the zephyr FCB, FS API, and base64 subsystems
* lltoa like function was added to sources as it was required but not
  included in Zephyr itself.
* The original code was modified to use Zephyr's slist.h as single
  linked list implementation.
* Reworked code which was using strtok_r, added function
  for decoding a string to a s64_t value.
* Thank to the above the settings subsys doesn't require newlibc anymore.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-28 10:44:20 -04:00
Jukka Rissanen c609bd8fd7 tests: net: Increase the size of main stack
This avoids this crashing in qemu_x86

***** Stack Check Fail! *****
Current thread ID = 0x004015e0
Faulting segment:address = 0x0008:0x00003593
eax: 0x0041e930, ebx: 0x00000000, ecx: 0x004170bc, edx: 0x0000dff8
esi: 0xffffffff, edi: 0x0041e930, ebp: 0x00417010, esp: 0x00416ffc
eflags: 0x216
Fatal fault in essential thread! Spinning...
Terminate emulator due to fatal kernel error

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Jukka Rissanen ba3c0bb123 samples: net: Add traffic class sample application
This demostrates how to classify the network traffic when sending
data. The application will create similar functionality as
echo-client so user can use echo-server running in remote host to
test this sample application.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Jukka Rissanen 2a3de97ce9 tests: net: Add unit test for traffic class support
Test that we can set the priority of the network packet and
that high priority packets are sent before low priority ones.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Jukka Rissanen ca8b00a3cc net: if: Make interface IP configuration more flexible
Instead of always allocating both IPv6 and IPv4 address information
to every network interface, allow more fine grained address
configuration. So it is possible to have IPv6 or IPv4 only network
interfaces.

This commit introduces two new config options:
CONFIG_NET_IF_MAX_IPV4_COUNT and CONFIG_NET_IF_MAX_IPV6_COUNT
which tell how many IP address information structs are allocated
statically. At runtime when network interface is setup, it is then
possible to attach this IP address info struct to a specific
network interface. This can save considerable amount of memory
as the IP address information struct can be quite large (depends
on how many IP addresses user configures in the system).

Note that the value of CONFIG_NET_IF_MAX_IPV4_COUNT and
CONFIG_NET_IF_MAX_IPV6_COUNT should reflect the estimated number of
network interfaces in the system. So if if CONFIG_NET_IF_MAX_IPV6_COUNT
is set to 1 and there are two network interfaces that need IPv6
addresses, then the system will not be able to setup IPv6 addresses to
the second network interface in this case. This scenario might be
just fine if the second network interface is IPv4 only. The net_if.c
will print a warning during startup if mismatch about the counts and
the actual number of network interface is detected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Jukka Rissanen 47dafffb67 net: if: Separate IP address configuration from net_if
Move IP address settings from net_if to separate structs.
This is needed for VLAN support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Spoorthi K f37507604d tests: kernel: mem_protect: Update platform whitelist
Remove arduino_101 from platform whitelist in testcase.yaml as all the
test cases are not meant to run on Arduino_101.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-03-26 14:24:34 -04:00
Anas Nashif 993c350b92 cleanup: replace old jira numbers with GH issues
Replace all references to old JIRA issues (ZEP) with the corrosponding
Github issue ID.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-26 13:13:04 -04:00
Jukka Rissanen 4d16076efe tests: net: websocket: Fix null at the end of string
We might access too long string when copying URL.

Coverity-CID: 183041
Fixes #6691

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-26 13:01:07 +03:00
Anas Nashif 66d60d2941 boards: delete arduino_101_ble board
This board is the same as curie_ble, so remove duplication and have only
one board definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-23 16:21:16 -04:00
Carles Cufi 20cd4b551b lib: base64: Add statement of changes
As per the Apache v2 License, state changes made to the original code in
the modified version of the files.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-23 13:54:48 +01:00
Jukka Rissanen 6170ae5e2e net: websocket: Use system provided base64 function
Instead of using mbedtls_base64, use system provided base64 encoding
function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-23 08:30:26 -04:00
Adithya Baglody 093b8b9a6a tests: kernel: semaphore: Added tests for semaphore.
The following test cases have been added for semaphore.

1. Test simple semaphore give/take from an isr.
2. Test simple semaphore give/take from a task.
3. Test semaphore take with no wait.
4. Test semaphore take with no wait and fails.
5. Test semaphore take with timeout and fails.
6. Test semaphore take with timeout.
7. Test semaphore take with timeout as forever
8. Test semaphore take with timeout from an isr.
9. Test semaphore take on multiple threads.
10. Test semaphore give/take from an isr.
11. Test semaphore multiple threads wait on a semaphore.
12. Test semaphore measure timeouts.
13. Test semaphore measure timeout when give is from another thread.
14. Test semaphore multiple sem take and timeouts.
15. Test semaphore multiple sem take with diff timeout & semaphore.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-23 08:04:26 -04:00
Praful Swarnakar d55387e56f tests: crypto: rand32: move rand32 test out of kernel
This test validates random number generator APIs that
is not related to kernel and should not be part of
kernel tests.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-03-23 07:29:18 -04:00
Carles Cufi ca1bb5eaf5 test: lib: base64: Add a base64 test
Add a test imported from the original mbedTLS suite.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-23 05:18:11 -04:00
Jukka Rissanen 22eeb70a26 tests: net: Network packet checksum offloading tests
Test that if the checksum offloading is enabled, then we do not
calculate the checksum. Also the normal case, where offloading is
disabled and we need to calculate the checksum, is tested.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-23 08:37:01 +02:00
Jukka Rissanen 85a2459edb net: Support network packet checksum calc offloading
Create infrastructure that allows ethernet device driver to tell
if it supports network packet checksum offloading. This applies only
to IPv4, UDP or TCP checksums. The driver can enable/disable checksum
offloading separately for Tx and Rx network packets.

If the device (ethernet in this case) can calculate the network
packet checksum for IPv4, UDP or TCP, then do not calculate the
corresponding checksum by the stack itself.

Fixes #2987

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-23 08:37:01 +02:00
Spoorthi K e1f0a3e1ef tests: kernel: Add test to verify k_thread_start()
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>
2018-03-22 08:15:33 -04:00
Sebastian Bøe aad9ab4b11 tests: Added test for UTF-8 characters in Kconfig values
Added a test for having UTF-8 characters in Kconfig values. This
ensures that issue
https://github.com/zephyrproject-rtos/zephyr/issues/6649 does not
affect any supported platforms and that it does not re-appear in the
future.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-03-21 19:11:19 -04:00
Juan Manuel Torres Palma 4aa49053f6 tests: posix: fix semaphore.h test
Previous implementation was buggy, destroying
resources with pending thread and race conditions.

New version tests basic functionality with 2
threads and basic synchronization.

Signed-off-by: Juan Manuel Torres Palma <j.m.torrespalma@gmail.com>
2018-03-21 14:27:47 -07:00
Savinay Dharmappa 04d2abb118 tests: kernel: alert: Add testcases
Add testcases for following scenario

Test to check alert_recv(timeout) against the following cases

1. The current task times out while waiting for the event.
2. There is already an event waiting (signalled from a task).
3. The current task must wait on the event until it is signalled
   from either another task or an ISR

Test to check alert_recv(K_FOREVER) against the following cases:

1. There is already an event waiting (signalled from a task and ISR).
2. The current task must wait on the event until it is signalled
   from either another task or an ISR

Test to checks that the event handler is set up properly when
alert_event_handler_set() is called.  It shows that event handlers
are tied to the specified event and that the return value from the
handler affects whether the event wakes a task waiting upon that
event

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-03-21 15:39:10 -04:00
Carles Cufi 8aa9a37902 drivers: flash: nrf: Rename nrf5 to nrf
With upcoming ICs that are not in the nRF5x family, rename the flash
driver and all its dependencies from nrf5 to nrf.

Should also fix the issue introduced by f49150cab6 which broke the
assignment of the flash device due to a partial rename.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 20:07:09 +01:00
Ramakrishna Pallala a2e1341592 tests: kernel: Add fifo timeout scenario tests
Add k_fifo kernel object timeout scenario tests like basic
k_fifo API tests with timeouts and tests which involve other
threads to get/put items from/into k_fifo with timeouts.

This test is inspired from test_stack legacy test from
Zephyr v1.7.0 release.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-20 12:39:30 -04:00
Ramakrishna Pallala f112b3eee1 tests: kernel: Add fifo usage scenario tests
Add k_fifo kernel object usage scenario tests between thread
to thread and thread to ISR.

This test is inspired from test_fifo legacy test from
Zephyr v1.7.0 release.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-20 12:39:30 -04:00
Jukka Rissanen 44eb83624f tests: net: websocket: Fix null pointer dereference
Network packet cannot be NULL so no need to check its value.

Coverity-CID: 183063
Fixes #6669

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-20 12:19:13 -04:00
Punit Vara fcf942afce tests: msgq_api: Improve scenario testing
Pend multiple thread to wait for writing on msgq.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-03-20 12:13:27 -04:00
Jukka Rissanen 8b8178b0f9 drivers: eth: gmac: Do not verify config for unit tests
No need to verify that the configuration is proper if we are
compiling the driver for unit test and not going to ever run
the test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-20 10:37:34 -04:00
Stig Bjørlykke 7c9c825138 net: sockets: Support MSG_PEEK flag in zsock_recvfrom
Add support for MSG_PEEK flag in recv and recvfrom.

This flag is needed when using non-zephyr embedded applications with
Zephyr's socket API.

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-03-20 15:55:04 +02:00
Carles Cufi f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Adithya Baglody c7553acdef tests: kernel: pipe_api: Run test with userspace enabled.
Previously qemu_x86 was the only device to run this test in
userspace. With this patch, the pipe testcases can now
run on any device which has userspace enabed.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-19 18:18:00 -04:00
Adithya Baglody 84fed56236 tests: kernel: pipe: Added new test cases for pipe.
The following are the test cases added for pipe.
1. Test pipe APIs on single data element.
2. Test pipe APIs on multiple data elements.
3. Test pipe APIs with forever wait.
4. Test pipe APIs with timeout.
5. Test pipe APIs on an empty pipe.
6. Test pipe get API with forever timeout.
7. Test pipe get API with limited timeout.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-19 18:17:35 -04:00
Adithya Baglody a47f14accc tests: Kconfig: Added a new kconfig.
A new Kconfig to help test the userspace mode. Needed for devices
which have userspace capabilities but are not enabled by default.
This kconfig enables the userspace for the devices which have
CONFIG_ARCH_HAS_USERSPACE enabled.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-19 18:16:58 -04:00
Spoorthi K bdfa021772 tests: kernel: Test for essential thread set/clear
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>
2018-03-18 09:35:29 -07:00
Andrew Boie 83752c1cfe kernel: introduce initial stack randomization
This is a component of address space layout randomization that we can
implement even though we have a physical address space.

Support for upward-growing stacks omitted for now, it's not done
currently on any of our current or planned architectures.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-03-16 16:25:22 -07:00
Paul Sokolovsky 6b7435b85d tests: bluetooth: shell: Set min_flash to 145K
With recent master, this sample started to overflow ROM area of
arduino_101, which has 144K of it:

Memory region         Used Size  Region Size  %age Used
             ROM:      149420 B       144 KB    101.33%
             RAM:       26228 B        52 KB     49.26%
        IDT_LIST:         564 B         2 KB     27.54%
        MMU_LIST:          0 GB         1 KB      0.00%

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-03-16 13:44:06 -07:00
Adithya Baglody 11f7d17444 tests: mbox: mbox_api: Disable execution on RAM constrained devices.
SRAM size is very small and so we cant fit the test-suite inside.
Hence disabling the execution on boards with very small RAM region.
Example: quark_d2000 & nucleo f030

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-16 08:22:29 -07:00
Adithya Baglody e20abd55fa tests: mbox: mbox_api: Added new test cases.
Added new test cases to increase the impact of the test cases.
The following are the brief description of the testcases:
1. Incorrect receiver address.
2. Incorrect transmit address.
3. Mbox_get timeout occurs when not able to retrive a msg.
4. Discard a msg by passing an invalid pool id.
5. Msg id mismatch between the receiver and transmitter.
6. Copy tx buffer to a new block in the pool.
7. Copy a big tx buffer to a block in the pool but no block
   can fit it.
8. Dispose a msg as soon as it is read.
9. Free tx pool when we read the msg.
10. A Asynchronous put unblocks a waiting get.
11. A Asynchronous put sends a wrong address to a waiting get.
12. Multiple Asynchronous put populates the msg_q and mbox_get
    retrives it.
13. Multiple waiting mbox_get and each put unblocks it one at a time.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-16 08:22:29 -07:00
Adithya Baglody cbd1c184ee tests: mbox: mbox_api: Added required kconfigs to test obj tracing
Some parts of the code were not being executed because of the kconfig.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-16 08:22:29 -07:00
Jukka Rissanen 24da695ad9 tests: net: websocket: Fix buiding on qemu_xtensa
The net-shell must be turned off in order to build on xtensa.

Fixes #6635

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-16 08:48:42 -05:00
Praful Swarnakar 7f28edcaeb tests/kernel/common: Random32 test update for entropy subsystem
Modified the testcase for comparing the successive random
numbers generated by sys_rand32_get(). Also, added new configs
for verifying different sources of random number generation.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-03-16 06:02:11 -07:00
Kumar Gala 0fea45aa4f samples/tests: net: websocket: Fix yaml files
The yaml files had a '-' before test: which was causing an error
relating to trying to load the yaml

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-15 16:29:01 -05:00
Kumar Gala f303337fea tests: net: websocket: exclude qemu_xtensa
We don't currently build on qemu_xtensa because completion is missing.
Seems like we have some dependency issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-15 16:29:01 -05:00
Kumar Gala 8b08f851d2 tests: net: websocket: Bump min ram to 46k
On most arm targets this looks like it needs at least 45-46k of memory.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-15 16:29:01 -05:00
Jukka Rissanen 4d4c7bf3ea tests: net: websocket: Add tests for websocket
This tests websocket by creating a websocket support http server
and sending data to it and verifying the returned data is the same.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-15 15:17:36 +02:00
Aapo Vienamo 3108d05420 tests: drivers: build_all: Add SX1509 GPIO test
A new build test for gpio drivers is added to build_all testcase.yaml.
The gpio_sx1509 driver is enabled in the .conf file and dts.fixup macros
are added for the driver.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-13 12:31:16 -05:00
Kumar Gala 924e8aad12 tests: arm_runtime_nmi: Make test build on v8m
The ICSR[NMIPENDSET] bit got renamed to ICSR[PENDNMISET] in the v8m
architecture.  So we map SCB_ICSR_PENDNMISET_Msk to
SCB_ICSR_NMIPENDSET_Msk to the tests builds and functions.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-13 10:02:59 -05:00
Savinay Dharmappa 02347f9c6f tests: kernel: work_q: Add testcases
Add a testcase where single work is submitted to
multiple queue. In this case handler invoked only
once as single work cannot be submitted to multiple
queue.

Add a test case which submit a work to a queue twice. This testcase
is added to test neagtive case when  k_delayed_work_cancel() fails
in k_delayed_work_submit_to_queue API

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-03-13 07:55:41 -07:00
Ramakrishna Pallala d3a6d933f6 tests: subsys: fs: Add test for multiple file systems
Add a new test for testing multiple file systems mounted
simultaneously on Zephyr. The test enables FATFS and NFFS
togeather and uses RAM as backend storage device.

The intention of this test is to demonstrate multiple file systems
support and perform basic file and directory operations. This test
heavily reused the existing fat_fs_api and nffs_fs_api test sources.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-10 21:38:04 -05:00
Ramakrishna Pallala 3228e70bbf tests: subsys: fs: Adapt nffs_fs_api test as per VFS changes
Adapt nffs_fs_api test as per the VFS layer changes.

Add new test for NFFS file system mount.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-10 21:38:04 -05:00
Ramakrishna Pallala eb30e80bed tests: subsys: fs: Adapt fat_fs_api test as per VFS changes
Adapt fat_fs_api test as per the VFS layer changes.

Add new test for FatFs file system mount.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-10 21:38:04 -05:00
Rajavardhan Gundi a06cc42d29 tests: kernel: timers: Added a test to check periodicity
Added a test to check for the predictability with which
the timer expires depending on the period configured.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-03-10 21:32:02 -05:00
Punit Vara 9edc7ce490 tests: semaphore: test APIs
Test sem_destroy and sem_trywait.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-03-10 21:30:14 -05:00
Henrik Brix Andersen b31ccd1261 tests: spi_loopback: Fix Arduino Zero SPI device name.
The SAM0 SoC was switched to use DTS for SPI configuration. Adapt the
spi_loopback test configuration for the Arduino Zero to use the
correct device name.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-03-10 17:03:33 -06:00
Michael Hope f7c1903418 tests: gpio: add a configuration for the Arduino Zero.
Allows testing the new interrupt support.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-10 11:42:25 -06:00
Ramakrishna Pallala e2a1682c57 tests: kernel: Add stack usage scenario tests
Add stack object usage scenario tests between thread
to thread and thread to ISR.

This test is inspired from test_stack legacy test from
Zephyr v1.7.0 release.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-10 12:24:15 -05:00
Rajavardhan Gundi 813e9633ef init: verify boot_delay
Introduce a test to verify the boot_delay portion
of the code in init.c.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-03-10 08:44:39 -05:00
Mariusz Skamra fd2124913c Bluetooth: btp: Add Enable advertising with Node Identity cmd
This adds Enable advertising with Node Identity BTP command and
it's implementation.
This command is needed to pass PTS MESH/NODE/CFG/NID/BV-02-C
test case.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-03-10 11:56:22 +02:00
Mariusz Skamra c2d7c8579d Bluetooth: btp: Add missing Clear Replay Protection List Cache cmd
This command has been agreed and implemented in tester application.
The patch updates BTP document only.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-03-10 11:56:22 +02:00
Praful Swarnakar 0e1a03b866 tests: crypto: mbedtls: enabled test for esp32
Removed esp32 platform exclusion to allow test
to run on esp32 hardware.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-03-09 21:29:08 -05:00
Stig Bjørlykke a7e01f4d40 samples: net: Remove references to ZoAP
Rename variable zpkt to cpkt to complete the move from ZoAP to CoAP.

Remove unused tests/net/lib/zoap/CMakeLists.txt file.

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-03-09 20:25:37 -05:00
Andrzej Puzdrowski 6db7b43daf test: subsys: storage: flash_map: fix test of get sectors API
Test of f. flash_area_get_sectors was failing because parameter for
passing capacity of the sectors array was uninitialized.
This patch fix this bug.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-08 10:18:57 +01:00
Youvedeep Singh dbb6511c90 tests: posix: pthread_cancel: Added some APIs in test.
Added some APIs in test to increase code coverage.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-03-07 08:23:09 -05:00
Youvedeep Singh 5dd4ac9270 tests: posix: timer: Added some APIs in test.
Added some APIs in test to increase code coverage.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-03-07 08:23:09 -05:00
Youvedeep Singh 38a9a36b3e tests: posix: pthread_rwlock: Added more APIs in test.
Added some APIs in test to increase in code coverage.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-03-07 08:23:09 -05:00
Anas Nashif 1566d0fa3b tests: remove duplicate pthread test
We had this test also under posix/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Anas Nashif f6558f57c9 tests: pthread: use posix semaphore
Now that we have sempahores, use them in the thread test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Anas Nashif 0a59c6b30a tests: posix: add negative testing for semaphore
More asserts on API calls and error handling.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Anas Nashif d5e8a2c5a1 tests: posix: fix test names in yaml
Use meaningful test names.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Anas Nashif 13e1718660 tests: move posix layer tests out of kernel
Put everything under tests/posix, this is not stirctly part of the
kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Anas Nashif 40c8c44450 tests: posix: rwlock: add more tests
Add some negative API testing

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-06 22:40:04 -05:00
Andy Ross 61c0189b91 tests/crypto/mbedtls: Disable CONFIG_FORCE_NO_ASSERT
The root cause for this issue was found in
https://github.com/zephyrproject-rtos/zephyr/issues/6470
so this kconfig isn't needed anymore.

This is a partial reversion of 6eef2f14.  The actual feature is left
in place, as it's plausibly useful in other contexts (otherwise
assertions enabled by sanitycheck can't be disabled by the app as
they're passed in via CFLAGS).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-03-06 14:13:56 -08:00
Kumar Gala e9fadc142f tests: fatal: Fix incorrect filter on kernel.fatal.stack_protection
The kernel.fatal.stack_protection was filtering on
ARCH_HAS_STACK_PROTECTION and that should be
CONFIG_ARCH_HAS_STACK_PROTECTION

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-06 15:12:01 -05:00
Ramakrishna Pallala 2a44e8ea4d tests: kernel: Add a test to verify early sleep
Add a test to verify that k_sleep() can be used to put
the calling thread to sleep for a specified number of
ticks during system initialization.

This test is inspired from legacy test_early_sleep test
from v1.7.0 release.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-05 22:00:06 -05:00
Punit Vara 0306344f59 tests: add semaphore posix API test
This test case tests posix APIs which are implemented for semaphore.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-03-05 20:51:36 -05:00
Johan Hedberg b9588d8eb6 Bluetooth: Mesh: Switch to using Linux Foundation Company ID
The Linux Foundation now has an assigned Company Identifier, so switch
to using that.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-03-05 19:54:21 -05:00
Youvedeep Singh cd3ef98ee1 tests: kernel: posix: pthread_rwlock: POSIX rw lock test.
Added test for POSIX read-write lock APIs.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-03-05 19:27:37 -05:00
Niranjhana N e44affceae tests: kernel: posix: stop relying on path for naming
Use proper test names instead of relying on path name where the
    test is located.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-05 05:23:56 -05:00
Anas Nashif d397109e9d tests: slab: fix dead code
Increase number of blocks to make this code count.

Fixes coverity issue: CID: 174928
Fixes #4010

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-03 15:06:21 -05:00
Niranjhana N 423c8df8f7 tests: kernel: posix: add pthread tests
This test verifies pthread_equal returns the
expected values.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:39:28 +01:00
Niranjhana N b56aeecc72 tests: kernel: posix: add ztest to timer
Added ztest to timer.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:35:28 +01:00
Niranjhana N 92e87e5923 tests: kernel: posix: add ztest to pthread_join
Added ztest to pthread_join.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:35:28 +01:00
Niranjhana N a8d3286a31 tests: kernel: posix: add ztest to pthread_cancel
Added ztest to pthread_cancel.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:35:28 +01:00
Niranjhana N 1083629b6b tests: kernel: posix: add ztest to pthread
Added ztest to pthread test.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:35:28 +01:00
Niranjhana N 86f90c1d87 tests: kernel: posix: add ztest to POSIX clock
Added ztest to POSIX clock APIs test.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-03-03 18:35:28 +01:00
Spoorthi K b1ba49be7c tests: kernel: Verify the call to abort handler
The test sets a abort handler and checks if it is called
when the thread is aborted.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-02-23 13:45:51 -05:00
Youvedeep Singh 49fbfbb015 tests: kernel: posix: timer: POSIX timer test.
Added test for POSIX timer APIs.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-02-21 19:17:28 -05:00
Youvedeep Singh f0b678b03b tests: kernel: posix: pthread_cancel: POSIX thread cancel test.
Added test for POSIX thread cancel APIs.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-02-21 19:17:28 -05:00
Youvedeep Singh cdaffef883 tests: kernel: posix: pthread: Add pthread test.
This test is POSIX based implementation of tests:kernel:pthread test.
It used POSIX APIs instead of Zephyr APIs.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-02-21 19:17:28 -05:00
Youvedeep Singh 2d37286404 tests: kernel: posix: clock: Add posix clock test.
Add posix clock API test.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-02-21 19:17:28 -05:00
Youvedeep Singh 2e43d001ea tests: kernel: posix: pthread_join: Add pthread join test.
Implement pthread_join test application.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-02-21 19:17:28 -05:00
Anas Nashif 5766a88c63 tests: fatal: rename function to be consistent
Get the reporting right and consistent with other tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 5e9279a35c tests: sleep: rename function to be consistent
Get the reporting right and consistent with other tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 10c0bea562 tests: mslab: cleanup output and use ztest
Get the reporting right and consistent with other tests. Use ztest
possible where possible and remove too many lines and confusing output.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 0ebaaf400b tests: static_idt: cleanup test
Use some more ztest magic and cleanup test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif b16f89a094 tests: move multilib test to common/
A very minimal test that can join other tests under common.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 4192a24f8c tests: lib: use meaningful test names
Use proper test names instead of relying on path name where the test is
located.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 84d14e823b tests: move bitfields test to common/
Test is very minimal and can be combined with an existing common
testsuite.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 5783775584 tests: move c lib test to lib/
This is not a kernel test, move it to where it belongs under lib/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif c797a9ef7b tests: libc: cleanup naming and expand string tests
move to a more cosnistent test naming using test_ to improve reporting
and parsing. Expand string tests and run them as separate ztest tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 46f0718eb1 tests: crypto: aes: use meaningful test names
instead of using numbers, change name to what is actually being testing
to improve reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 10d75d478d tests: crypto: stop relying on path for naming
Use proper test names instead of relying on path name where the test is
located.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 841835554d tests: kernel: stop relying on path for naming
Use proper test names instead of relying on path name where the test is
located.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 7e5853888c tests: boot_page_table cleanup
Use ztest macro for asserts instead of plain conditionals. Cleanup style
a bit.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 516ded7dff tests: work_queue: use ztest properly
Convert test to ztest in a clean way and other cleanup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 57f158802b tests: mem_pool: move proper to ztest
Convert test to ztest correctly and other minor cleanup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-18 09:16:40 -05:00
Anas Nashif 3b2434f25c tests: move sprintf test out of kernel
sprintf is not a kernel feature, move it out to lib/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-16 16:09:42 -05:00
Anas Nashif edd85e17dc tests: sprintf: move to ztest
Use ztest for this test instead of legacy way of testing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-16 16:09:42 -05:00
Anas Nashif d18ef7fd75 tests: common: use consistent test names
prefix all tests with test_ and make test names consistent for easy
reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-16 16:09:42 -05:00
Andy Ross 6eef2f1485 misc: Add a FORCE_NO_ASSERT kconfig directive
The mbedtls test is hitting a compiler bug where two subtests will
soft fail on qemu_xtensa when assertions are enabled.  This is despite
the fact that:

+ The failure is entirely internal to the mbedtls suite.
+ The mbedtls code does not use zephyr asserts
+ The mbedtls code does not call into zephyr code that might assert.
+ The behavior persists even when an irq_lock() is held across the
  entire test, ruling out any asserts in interrupt/exception context.
+ And EVEN WHEN the mbedtls library blobs are bytewise identical
  between assert and non-assert cases.

The bug seems to be a layout thing where the mbedtls code behavior
differently based on code address and/or link-time optimizations
(xtensa has a few).

Unfortunately sanitycheck enables assertions by setting CFLAGS
directly and not via kconfig, so we can't fix this by turning the
feature off in an app right now.  This patch adds a simple "override"
flag that can be set by apps like this that hit bugs.

Again, note that zephyr assertions are not used nor needed by this one
test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 992ea243d5 tests/kernel/fatal: Add xtensa/asm2 to the "error returns" family
This test had to special case ARM, where error handlers are not
NORETURN functions.  The xtensa/asm2 layer has the same behavior
(albeit for a different reason).  Add it to the list, and clean up the
explanation a bit.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross c3c4ea730d nios2: Add include for _check_stack_sentinel()
This API moved into kswap.h and the resulting warning on this arch got
missed.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 59cdfe6e44 tests/kernel: SMP test
Simple SMP test to validate the two threads can be simultaneously
scheduled.  Arranges things such that both threads are at different
priorities and never yield the CPU, so on a uniprocessor build they
cannot be fairly scheduled.  Checks that both are nonetheless making
progress.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 9c62cc677d kernel: Add kswap.h header to unbreak cycles
The xtensa-asm2 work included a patch that added nano_internal.h
includes in lots of places that needed to have _Swap defined, because
it had to break a cycle and this no longer got pulled in from the arch
headers.

Unfortunately those new includes created new and more amusing cycles
elsewhere which led to breakage on other platforms.

Break out the _Swap definition (only) into a separate header and use
that instead.  Cleaner.  Seems not to have any more hidden gotchas.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 73678c4388 tests/kernel: Add spinlock test
Simple test of spinlock semantics.  Bounce between two CPUs locking
and releasing, validating that nothing changes at unexpected times.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 86ff14824d tests/kernel: Simple test for multiprocessor start API
Starts the second CPU and verifies that it can set a variable while we
spin on the first.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 32a444c54e kernel: Fix nano_internal.h inclusion
_Swap() is defined in nano_internal.h.  Everything calls _Swap().
Pretty much nothing that called _Swap() included nano_internal.h,
expecting it to be picked up automatically through other headers (as
it happened, from the kernel arch-specific include file).  A new
_Swap() is going to need some other symbols in the inline definition,
so I needed to break that cycle.  Now nothing sees _Swap() defined
anymore.  Put nano_internal.h everywhere it's needed.

Our kernel includes remain a big awful yucky mess.  This makes things
more correct but no less ugly.  Needs cleanup.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Wayne Ren 078259dc7f tests: modify the user space test codes for ARC
Both em_starterkit_em7d and em_starterkit_em7d_v22 are
tested.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-02-16 12:20:16 +01:00
Wayne Ren 0c3aebef49 tests: add the test case for user space support of arc
add arc specific codes in tests/kernel/mem_protect/userspace

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-02-16 12:20:16 +01:00
Leandro Pereira b55eb03e40 kernel: device: Only compare strings if pointer comparison fails
Split the search into two loops: in the common scenario, where device
names are stored in ROM (and are referenced by the user with CONFIG_*
macros), only cheap pointer comparisons will be performed.

Reserve string comparisons for a fallback second pass.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-15 17:31:59 -08:00
Paul Sokolovsky 42680b07af mbedtls: Switch default MBEDTLS_CFG_FILE to config-mini-tls1_2.h
The previous default, "config-threadnet.h", is more or less arbitrary
choice made in a commit 312def2c78 1.5 years ago. In particular,
it's not related to Thread support in Zephyr per se (there was no
such support at that time).

It doesn't make sense to have a default intended for a particular,
not widely used (yet) protocol. Instead, the default should work
out of the box with a contemporary widely deployed arrays of TLS
servers, which are HTTPS server. config-mini-tls1_2.h works with
https://google.com, and by extension, with many other servers on
the Internet.

So, have that as the default, and let applications with special
needs to override that to what they need.

Addresses: #6132

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-15 12:35:31 -05:00
Anas Nashif 0be346eed4 tests: do not use comma separated strings
platform_whitelist does not deal with comma separated strings. Also
remove build_only option, this should also run on those devices.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 08:53:25 -05:00
Anas Nashif 91b681a724 tests: add test for device class/API
Test APIs of device model and verify execution with power management
enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 07:54:45 -05:00
Stephen Smalley 7032027f1f tests: userspace: fix read/write privileged stack tests
The read/write_kernel_stack tests are confusingly named and incorrectly
implemented for ARM; they are intended to test that user mode threads
cannot read or write their privileged stacks.  The privileged stacks
on ARM are not relative to the user stack, and thus their location
cannot be computed from the user stack.  To find the privileged stack on
ARM, we have to use _k_priv_stack_find(), which we do during setup
in test_main() rather than from the usermode thread itself.  Accessing
thread_stack directly from the test function requires making it
non-static in ztest, so we also give it a ztest_ prefix to avoid
collisions with other test programs.  Rename the test functions and
global pointer variable to more accurately reflect their purpose.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2018-02-14 13:06:21 -08:00
Christopher Collins 821dc37f3f subsys: storage: flash_map: Fix warning
Prior to this commit, `flash_area_layout()` was being passed a pointer
to the incorrect type (`uint32_t *` where `int *` was expected).  This
caused the following warning to be reported:

```
[...]/subsys/storage/flash_map/flash_map.c: In
function 'flash_area_get_sectors':
[...]/subsys/storage/flash_map/flash_map.c:191:32:
warning: passing argument 2 of 'flash_area_layout' from incompatible
pointer type [-Wincompatible-pointer-types]
  return flash_area_layout(idx, cnt, ret, get_sectors_cb, &data);
                                ^~~
[...]/subsys/storage/flash_map/flash_map.c:136:12:
note: expected 'int *' but argument is of type 'uint32_t * {aka long
unsigned int *}'
 static int flash_area_layout(int idx, int *cnt, void *ret,
            ^~~~~~~~~~~~~~~~~
```

This commit changes the argument type to `u32_t` for both functions.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-14 14:36:52 -05:00
Daniel Wagenknecht 0aef9030e4 tests: spi_loopback: add testcase.yaml
Add a testcase.yaml configuration to spi_loopback test to include
it into sanitycheck.

Fixes #4576

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Daniel Wagenknecht c7c442ad9f tests: spi_loopback: add board specific configuration
This restores the board specific configurations that were present
before moving the test to using KConfig.

<board>.conf files from boards subdirectory get merged with
prj_base.conf file.

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Daniel Wagenknecht 64060020ea tests: spi_loopback: Move to using KConfig
Convert this test to using KConfig instead of conditional compilation.
Standard configuration is provided by prj_base.conf and KConfig
default values.

Remove prj_<board>.conf files.

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Andy Gross f35c0318a1 tests: mem_protect: userspace: Adjust kernel stack tests
This patch adjusts the calculation of the overflow size for the kernel
stack tests which read/write to areas below the current user stack.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Johan Hedberg ac1360f0a7 Bluetooth: Mesh: Convert to new net_buf_simple APIs
Convert the mesh code to use the new net_buf_siple APIs. This has the
benefit of saving 4 bytes off the stack due to the not needed pointer.
Also update the publication context helpers to map to the new
net_buf_simple API in an intuitive way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:00:08 +02:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
Johan Hedberg 4637620a66 tests: net/buf: Update to new API
Update the net_buf unit test to test the features from the new API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 09dcbcc579 tests: net: mgmt: Increase mgmt event stack
This stack seems to be overflowing on xtensa.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg bd989a79ba tests: Remove broken net_buf unit tests
The net_buf unit tests were doing some pretty hacky stuff with
defining a dummy _net_buf_pool_list variable to fulfil the linker
magic that happens with a real build. Until now the code got lucky in
that the simple net_buf_alloc() tests didn't depend on
_net_buf_pool_list being valid, however with the coming redesign even
net_buf_alloc will require proper setup of this.

Since the unit tests were extremely minimal, and not testing anything
beyond what tests/net/buf already tests, just remove them for now.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Carles Cufi 48ddce7a66 tests: build: Test build with MCUboot support
Add a new build variant that builds for Nordic nRF52832 with the new
MCUboot CONFIG_BOOTLOADER_MCUBOOT Kconfig variable set.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-09 09:11:13 -05:00
Ioannis Glaropoulos a0a03d7597 arch: arm: common Armv8-M support
This PR includes the required changes in order to support
conditional compilation for Armv8-M architecture. Two
variants of the Armv8-M architecture are defined:
- the Armv8-M Baseline (backwards compatible with ARMv6-M),
- the Armv8-M Mainline (backwards compatible with ARMv7-M).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-02-08 12:07:38 -06:00
Ramakrishna Pallala 55662a7f89 tests: boards: altera_max10: Add test for Nios-II i2c core
Add test application for Nios-II i2c core on Altera MAX10 board.

This test uses ADV7513 HDMI I2C slave module on Altera MAX10
board to perform i2c read and write operations. For more details
on ADV7513 HDMI module, please refer to the following link.

https://ez.analog.com/docs/DOC-1986

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-07 19:37:35 -05:00
Michael Hope a5eb5418d1 crc: add crc16_itu_t which is used in the MMC protocol.
This is the MSB first version of crc16_ccitt.  Use the same name as in
Linux.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-07 16:49:52 -05:00
Michael Hope f77c1d53b5 crc: add a faster, chainable version of CRC16/CCITT.
The existing version of crc16_ccitt() is actually CRC-16/AUG-CCITT and
gives different results to Linux, Contiki, and the CRC unit in the
SAM0 SOC.  This version matches Linux.

Note that this is an incompatible API change.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-07 16:49:52 -05:00
Michael Hope 88b1ad138e crc: add test vectors for the ANSI version.
The test cases match
http://reveng.sourceforge.net/crc-catalogue/16.htm for
CRC-16/DDS-110.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-07 16:49:52 -05:00
Alberto Escolar Piedras 867447135d tests: run tests/kernel/tickless also in ARCH_POSIX
Added support in tests/kernel/tickless for ARCH_POSIX
and enabled this test for this architecture

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Alberto Escolar Piedras 7d19f26a11 test: run benchmark/boot_time also in native_posix
This test can also be run in ARCH_POSIX
+
added a filter in the test yaml so it does not float fault
with too low HW frequencies

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Alberto Escolar Piedras 91256cb370 test: bugfix kernel/tickless/tickless_concept
The test was actually never tickless

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Alberto Escolar Piedras dc089dfe95 test: kernel/common added note about systick period
If the systick period is < 5ms the clock testcase will
stall.
Added a note to warn whoever hits it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Alberto Escolar Piedras 31bd6ab1c1 test: sha256 can also be run in native_posix
The tests/crypto/sha256 can also be run in the posix arch

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Kumar Gala 30824c9dc3 tests: build_all: Fix building for lps25hb and lsm6ds0
The introduction of device tree support sensors need to update the
dts.fixup file in build_all to make sure that we still build.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-02-07 12:31:51 -06:00
Andrzej Puzdrowski b3614c0b17 subsys: fs: fcb: remove f_area_id from fcb structure
It is faster to operate directly on flash_area pointer instead
of fetch it all the time using the fcb flash area id.
Also as f_area_id was needed only for get appropriate flash_area
pointer, so it is better to pass it only while initialization
the fcb and not store it in fcb instance data at all.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-02-07 09:51:26 -05:00
Andrzej Puzdrowski 9d56247cc7 test: subsys: fs: fcb: align to using sectors
fcb sectors description switch from using array of flash_area
structures to array of flash_sector structures.
This patch aligns tests to this change.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-02-07 09:51:26 -05:00
Christopher Collins a528d4d3d7 storage: flash_map: fix directory name typo
tests/subsys/storage/flash_mpa --> tests/subsys/storage/flash_map

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-07 09:51:26 -05:00
Ravi kumar Veeramally 9ac64c1837 net: tests: Fix coap test case
Test case should first check for next block in the coap packet and
unref the packet (assuming packet has been sent).

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-07 13:24:25 +02:00
Stephen Smalley 6c2085bfed tests: userspace: fail on unexpected fault reason
Check the fault reason against the expected value.
This is presently architecture-specific, and possibly
reflects a bug on ARM (all faults end up with reason 0,
even though ARM does define a separate value for Oops).

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2018-02-05 14:06:51 -05:00
Stephen Smalley a252ac2326 tests: userspace: fail on unexpected faults
Previously we were handling any fault during test execution as
a pass condition.  Explicitly indicate when a fault is expected
and fail the test if we encounter an unexpected fault.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2018-02-05 14:06:51 -05:00
Adithya Baglody db8c5439c1 tests: pipe: pipe_api: Converted pipe test cases to run in usermode.
Converted few test cases to run in usermode.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-02-05 10:46:38 -08:00
Michael Hope e13e90f87f tests: spi: add a configuration for the Arduino Zero.
Used to test the recent driver updates.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-05 07:42:58 -08:00
Paul Sokolovsky b2ce9df077 tests: Few test require CONFIG_STDOUT_CONSOLE=n
For some, "y" affects output, for some less tested platforms, leads
to crashes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 07:05:12 -08:00
Ramakrishna Pallala 727653333e tests: boards: Add QSPI flash test app for altera_max10
Add test application to demonstrate the usage of Nios-II
QSPI Flash soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Alberto Escolar Piedras 1e46d39068 native test: End tests as soon as they pass fail
To avoid indeterministic behaviour of the tests
which leads to changing coverage reports, let's
finish the tests exectuion as soon as they pass
or fail.
Also let's return 0 to the shell if the test passed,
and 1 if it failed.

(Reverting
f9af42f078c93eca8b9f461f91b6cafddb57a35d and
07c9163f67
)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Sebastian Bøe 600c8f7d85 kconfig: Change how optimization level is set
This patch does several things, most notably it changes the semantics
of CONFIG_DEBUG. CONFIG_DEBUG continues to behave as a vaguely defined
"debug mode" that enables printf's, -Og, etc. but now the user may
choose to be in "debug mode" while using a different optimization
level than -Og.

Tp support this a new config is defined to enable -Og;
CONFIG_DEBUG_OPTIMIZATIONS.

Additionally CONFIG_SIZE_OPTIMIZATIONS is introduced to allow the user
to explicitly request optimizing for size instead of relying on
defaulting to it.

The three config's {NO,SIZE,DEBUG}_OPTIMIZATIONS are now organized in
a Kconfig choice to ensure that at most one can be enabled at a time.

Finally, selected users of CONFIG_DEBUG have been ported to use one of
the optimizations configs when it was clear from usage that the
intention was to behave differently when using a different
optimization level and not when in "debug mode".

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-02-05 06:23:20 -08:00
Alberto Escolar Piedras f60527a138 build: Added CONFIG_NO_OPTIMIZATIONS
Added a new config option which lowers the compiler
optimizations to -O0 independently of other flags.

CONFIG_COVERAGE uses it now instead of having its own
choice in CMakeLists.txt

Fixes #5720

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:23:20 -08:00
Joshua Domagalski 90f175b19d tests: userspace: test syscall buffer validation
Tests system call memory buffer read/write validation using the
k_pipe_get() and k_pipe_put() calls from a userspace thread.
Specifically, this tests _SYSCALL_MEMORY_READ/WRITE checks
by the system call handler by attempting to read/write to a
kernel object.

write_kobject_user_pipe() attempts to write over a kernel object
by using the kernel object's location as the buffer to place
the data read from the pipe.

read_kobject_user_pipe() attempts to read a kernel object by using
the kernel object's location as the location of data to be placed
into the pipe.

Tested on qemu_x86 and frdm_k64, passes on both.

Signed-off-by: Joshua Domagalski <jedomag@tycho.nsa.gov>
2018-02-02 13:09:35 -08:00
Joshua Domagalski 3ad0207321 tests: userspace: test revoke, user_mode_enter
Added three tests for kernel objects focusing on 1) revoking
access to a k_object that the thread does not have
permissions to access, 2) accessing a k_object after
permissions to access it were revoked, and 3) trying to
revoke access to a k_object from a parent thread by a
child thread.  Additionally, added a test for
k_thread_user_mode_enter().

revoke_noperms_object() tests by calling
k_object_access_revoke() on a semaphore (kernel object) that it
does not have access to (ksem).

access_after_revoke() tests ability to access a semaphore after
access has been revoked by itself.

revoke_other_thread() tests whether a thread can revoke access
for an object for which it has permissions from a thread for
which it does not have permissions.

user_mode_enter() tests whether k_thread_user_mode_enter()
truly enters user mode.

Tested on qemu_x86 and frdm_k64 with pr-4974 applied, passes
on qemu_x86 but requires small fix for ARM (will submit
separately).

Signed-off-by: Joshua Domagalski <jedomag@tycho.nsa.gov>
2018-02-02 13:09:35 -08:00
Alberto Escolar Piedras 6ef85ed6fc test: shell: native_posix also supports shell
The native_posix port also supports shell apps thru its
stdin redirection.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-02 07:48:46 -08:00
Ravi kumar Veeramally 49894b98e4 net: Improve net management event information
Provided separate event information structs based on events. This way
user will know what kind of information will be received to that
particular event.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-02 16:50:07 +02:00
Johan Hedberg b072de3b1e Bluetooth: mesh_shell: Increase L2CAP TX buffer count
In case of split host & controller we may need to do ACL segmentation
of packets. Sending the composition data will already have allocated
three TX buffers, so trying to segment the first one further will
result in a deadlock. Increase the buffer count from the default (3)
to 4 to work around this risk.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-01 16:51:11 +01:00
Jukka Rissanen 17fcbb0507 tests: net: ipv6: Increase the multicast address count
Increasing the IPv6 multicast address count from 2 to 5 so that
tests will always run ok.

Fixes #4401

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-02-01 14:41:37 +02:00
Maureen Helm 7dc68b38c3 tests: build_all: Add missing sensors
Now that we have an application level dts fixup, we can re-enable the
fxos8700 sensor in the build_all test. Also added fxas21002 and max30101
sensors which were missing.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Ramakrishna Pallala 301acb8e1b kernel: include: rename nano_internal.h to kernel_internal.h
Rename the nano_internal.h to kernel_internal.h and modify the
header file name accordingly wherever it is used.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-01-31 10:07:21 -06:00
Ramakrishna Pallala 275d16dc6c tests: Kconfig: add proper description to config option
Add proper description to the TEST_EXTRA_STACKSIZE config
option prompt message.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-01-30 11:32:02 -05:00
Anas Nashif a5bde70d3a tests: add ringbuffer api test and combine original test
We already have a test for ring buffers, this combines it with an API
test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 23:19:17 -05:00
Kumar Gala e8d40df739 tests: build_all: add dts.fixup to deal with compile issues
The following drivers are in the process of support getting their I2C
name, bus, address params from device tree.  However if a given board
that supports device tree doesn't have one of these sensors we can't
build it.

To address this we add a dummy dts.fixup at the application level with
provides values for the defines we'd normally get from the dts
generation.

Fixes: #5722

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 10:39:59 -06:00
Kumar Gala d06b650712 tests: build_all: cleanup unused Kconfig symbols
We don't have anything that defines CONFIG_LSM2DS0 or
CONFIG_LSM2DS0_GYRO anymore so remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 10:39:59 -06:00
Andrzej Puzdrowski 6f7699fb14 tests: subsys: fs: nffs_fs_api: cleanup configuration for nRF5x
Removed CONFIG_FLASH_PAGE_LAYOUT because it is already selected
by NFFS kconfig itself. Some other keywords were duplicated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-29 12:50:35 +01:00
Andrzej Puzdrowski 351a2c7872 tests: subsys: fs: nffs_fs_api: fix nRF5x failures
CONF_FILE was overwritten by boilerplate.cmake so not proper
settings were took for tests. NRF5 flash driver had changed
its name to one defined by DT (see #5773) - which causes
incompatibility witch previous settings.

This patch solves this problems.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-29 12:50:35 +01:00
Kumar Gala 26e4da52cf arm: nordic: flash: Use FLASH_DEV_NAME define
We want to move to use a common FLASH_DEV_NAME across the various flash
drivers. So samples, tests, or other code can be a bit more generic.  So
replace CONFIG_SOC_FLASH_NRF5_DEV_NAME with FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 15:23:00 -06:00
Vinayak Kariappa Chettimada 5f4a7ea119 Bluetooth: shell: Support a non-connectable build
Add conditional compilation and move code to support
building a non-connectable Bluetooth shell application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-01-25 10:51:54 +02:00
Kumar Gala 9a87b8535e tests: benchmarks: latency_measure: Fix build issue with abs()
We now have a define for abs() in stdlib, so we can remove the version
implemented in the test.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 01:27:22 -06:00
Anas Nashif e76de53202 test: mbedtls: remove while loop
Remove useless while loop from test, it serves no purpose.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 07c9163f67 tests: native: do not kill process when test completes
We can now send a signal and exit gracefully. This is to maintain
consistency across other runners and samples that can run natively but
do not have a test hook or macro to kill the application in completion.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 5d3a534807 samples: use console harness for some samples
The output of those samples can be parsed and verified by sanitycheck,
so lets use the console harness for this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Adithya Baglody f435fda313 ztest: cleanup phase should reset the timeout queue.
Reusing the k_thread structure requires a cleanup of all essential
info. We need to remove the ztest_thread information from the timeout_q.

If left untouched, when a tick occurs the thread's delta_ticks_from_prev
would be corrupted. This inturn causes a chain reaction of problems.
Thus once the unit test is completed the timeout_q is scrubbed.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-24 21:16:17 +05:30
Adithya Baglody 61b7757da0 tests: abort: Testcase for repeated thread abort
Test case to showcase the repeated abort of a thread.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-24 18:18:53 +05:30
Mariusz Skamra 834ab2c192 Bluetooth: tester: Fix device connected and disconnected events
This fixes parameters order in events to be BTP compliant.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-23 12:30:29 +02:00
Mariusz Skamra a6cfda8d64 Bluetooth: btp: Fix address in GAP Device Found event
This event had address and address type parameters swapped
in it's structure.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-23 12:30:29 +02:00
Adithya Baglody 9fad6d9fcd tests: x86_mmu_api: Fixed testcase crash.
Running this testcase on qemu without userspace enabled it
crashes. The testcase was modifing page table information
of the bss region. This in turn caused some variables to be
inaccessible. Fixed it by moving the page manipulation to a
different location.

GH-5646

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-18 09:19:06 -08:00
Yannis Damigos 3d1115adea tests: Clear SPI_*_IRQ_PRI from tests and samples
Remove SPI_*_IRQ_PRI from tests and samples.
Using DT to get the *_IRQ_PRI, we can't
override it using Kconfig.

If needed, use a BOARD_NAME.overlay file to
override default values.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-01-17 11:51:48 -06:00
Anas Nashif 5f5e16311b Revert "ztest: cleanup phase should reset the timeout queue."
This reverts commit 5e545e47fb.

This is breaking some tests, needs to be retested with latest master.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-17 09:07:41 -05:00
Adithya Baglody 5e545e47fb ztest: cleanup phase should reset the timeout queue.
Reusing the k_thread structure requires a cleanup of all essential
info. We need to remove the ztest_thread information from the timeout_q.

If left untouched, when a tick occurs the thread's delta_ticks_from_prev
would be corrupted. This inturn causes a chain reaction of problems.
Thus once the unit test is completed the timeout_q is scrubbed.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-17 07:48:08 -05:00
Alberto Escolar Piedras 4c1d8029b4 tests: bluetooth/bluetooth fix for boards with a controller
Fix in the prj.conf so the test will also work in boards which
by default compile a BT controller.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-17 12:41:06 +02:00
Mariusz Skamra 83f5c3365e Bluetooth: tester: Fix uart-pipe build error on nrf52840 board
This fixes build error due to undeclared CONFIG_UART_PIPE_ON_DEV_NAME
on nrf52840 board.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-16 14:41:23 +02:00
Alberto Escolar Piedras 9851b1ac21 tests: kernel/context support other posix boards
Make it possible to run in other posix boards.
By default, if the POSIX board does not define the TICK_IRQ
just run without that part of the test, printing a note.
The place where other POSIX boards should define it, is also
clear, and should be easy to keep those lines free from merge
conflicts in the future.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-15 18:42:09 -05:00
Alberto Escolar Piedras eb633eaa53 tests: driver/ipm blacklist for POSIX arch
This test should be blacklisted for any board based
on the POSIX arch, not just the native_posix board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-15 18:42:09 -05:00
Anas Nashif f88f57b5c2 tests: obj_tracing: disable BT for this test
BT does use a semaphore, which does cause the count of sempahores to
fail, disable BT here to only keep locally created objects.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-15 18:31:47 -05:00
Andrzej Puzdrowski ae9560636f tests: subsys: fs: Add tests Flash Circular Buffer module
Tests added were adopted from MyNewt.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-15 15:46:37 -05:00
Andrzej Puzdrowski 1d59bf1212 tests: unit: lib: crc: Add test for crc8-ccitt implementation
CRC test suite was extended by crc8-ccitt test.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-15 15:46:37 -05:00
Andrzej Puzdrowski 25269fb0ed subsys: storage: Add flash_map abstraction module
Introduce flas_map module is abstraction over flash memory and its
driver for using flash memories along with description of
available flash areas.
Module provides simple API for write/read/erase and so one.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-15 15:46:37 -05:00
Andrew Boie dff0cb2d65 tests: userbuffer_validate: move and rename
What this test actually does is verify internal APIs for manipulating
the MMU specifically on the X86. It is not compatible with other arches.
Moved to live with the rest of the memory protection tests.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-01-12 13:22:10 -05:00
Mariusz Skamra bf58fb481b Bluetooth: tester: Add Configuration and Health Client models
PTS requires the composition data of size that cannot be sent in
single PDU. This patch adds Configuration and Health Client models
to the root_models to increase the Elements size in Composition Data
Page 0.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-12 15:10:24 +02:00
Neil Armstrong 7ab0333640 tests: spi_loopback: Enable SPI Loopback test on nucleo_f091rc board
Enable spi_loopback test to work with the nucleo_f091rc board using
the SPI1 controller

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-01-11 19:00:19 -05:00
Alberto Escolar Piedras 095300a3e1 tests: bluetooth/bluetooth can also be run in native_posix
The bluetooth/bluetooth can also be run in the native_posix
board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-11 18:01:01 -05:00
Anas Nashif 320c078c02 tests: mqtt_packet: fix README and adapt for cmake
Use built-in macro for build instructions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-11 12:50:14 -05:00
Anas Nashif 5f42cb1b12 tests: mem_protect: fix README and adapt for cmake
Use built-in macro for build instructions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-11 12:50:14 -05:00
Anas Nashif e029e94100 tests: fs: fix README and adapt for cmake
Change build instructions to use CMake and remove confusing
'Troubleshooting' section.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-11 12:50:14 -05:00
Anas Nashif 911be994d1 tests: enable coverage
coverage option was dropped by mistake moving away from IS_TEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-09 11:13:08 -05:00
Adithya Baglody 34b8b3b5ee tests: kernel: fatal: x86: Fixed the issue with stack alignment.
The test case used a stack which was not aligned to 4kB. Hence an
assert was catching this issue.

GH-5539

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-09 08:22:05 -05:00
Mariusz Skamra a45e18ec2e Bluetooth: tester: Set BT_MESH_LABEL_COUNT
This is required to run tests related to Virtual Addresses

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-09 10:29:10 +02:00
Anas Nashif af00e22d07 tests: remove test.config
Remove this magic addition of configuration options and control
everything using CONFIG_TEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif a2eaae57f0 tests: add help text for TEST_EXTRA_STACKSIZE
Add a description of the configuration option.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif 829598be2b tests: add CONFIG_TEST for marking tests
Mark tests with CONFIG_TEST to allow for test specific setup and
configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif 94066e0f15 tests/samples: remove unknown option LOG_CBUFFER/LOGGER_BACKEND
Those options are not part of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Anas Nashif c78296dab4 tests: remove obsolete CONFIG_MDEF
CONFIG_MDEF is no more..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Anas Nashif 3858b3c85f tests: minor cleanup of test file headers
Create a doxygen header

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Anas Nashif 51e93dd105 tests: remove empty test header
Empty file with no value...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Anas Nashif 9b20fa22ac tests: static_idt: do not include test cmake
We should not include test/CMakeLists.txt directly, it is included by
cmake already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Punit Vara 71948788eb tests: logger-hook: convert sample to ztest and move to test/
issue: #3302

Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-05 18:17:59 -05:00
Mariusz Skamra 0083634f73 Bluetooth: tester: Increase Mesh model group count
BT_MESH_MODEL_GROUP_COUNT has to be increased to meet the
PTS requirements.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-05 18:53:42 +02:00
Punit Vara 72a5f06ceb tests: obj_tracing: Convert legacy test to ztest
Use ztest API in legacy test to support ztest
framework and also update README according to new
output.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-01-05 07:21:32 -05:00
Anas Nashif d872010f93 tests: test sys_kernel_version_get()
Basic test for sys_kernel_version_get verifying macros work correctly
and we get the expected version parts using the macros.

Fixes #4777

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-04 13:29:03 -05:00
Mariusz Skamra 9d6bb0995c Bluetooth: tester: Do not start LPN automatically
This disables CONFIG_BT_MESH_LPN_AUTO flag in Kconfig.
LPN is enabled by calling BTP Low Power Node command
if requested.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-04 15:03:33 +01:00
Anas Nashif 8a67369887 tests: coverage depends on native applications
Build with coverage enabled for any other boards or applications is
useless at least right now. Make sure we only enable coverage for native
applications.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-03 13:12:03 -05:00
Mariusz Skamra 813ec50838 Bluetooth: btp: Add event indicating expiration of incomp timer
This event indicates that segmented message incomplete timer
expired.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 8274cbabf6 Bluetooth: btp: Add Mesh Clear Replay Protection List Cache command
This command is needed for Bluetooth Mesh testing against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra a909aa3a0b Bluetooth: btp: Add LPN Subscribe/Unsubscribe commands
This adds commands to manage Friend node Subscription List.
Those will be used to add or remove and group/virtual address
from subscription list.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 0bd3790d5b Bluetooth: btp: Add event indicating invalid provisioning BearerOpcode
This adds BTP event indicating reception of provisioning message
with invalid (RFU) BearerOpcode.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 083937be32 Bluetooth: tester: Do not send BTP error if fault_update failed
This may fail, if model publication was not set by remote.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 0d71cef1f2 Bluetooth: tester: Add BTP Mesh Model Send command implementation
This command will be used to test if model can properly send
segmented and unsegmented messages to a given destination address.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Sebastian Bøe 6f642a19fd cmake: Ported mbedTLS to use Zephyr interface libraries
mbedTLS include directories will now default to be in the 'app'
include path when mbedTLS has been enabled.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-02 22:09:01 -05:00
Paul Sokolovsky e25df54eae various: Update/fix some textual material and code comments.
Of these, only struct net_ipv6_nbr_data::send_ns is a descriptive
change:

send_ns is used for timing Neighbor Solicitations in general, not
just for DAD.

The rest are typo/grammar fixes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-29 09:45:39 -05:00
Anas Nashif c263f2a208 tests: timer_api: remove build_only, exclude arches
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 83fcd1cded tests: gdb server is build_only
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif d4784555d0 tests: remove build_only option
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 2292d7881d tests: move gdb_server to test_build
No need for this to be a standalone test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 7bdf166bdb tests: benchmark: rename default .conf file
Have the default config be prj.conf

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 38e40427ec tests: kernel: move build test out of kernel
This test has nothing related to kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
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
Kumar Gala 805d69c288 tests: protection: Fix building on ARC
Added a case for ARC in the test so it builds.  ARC MPU has execute
permision bit so we can enable the NO_EXECUTE_SUPPORT testing.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-15 08:49:53 -05:00
Johan Hedberg 255edcfde2 Bluetooth: Mesh: Provisioning: Add NetKeyIndex to complete callback
It may be useful for the app to know what the initial NetKeyIndex that
it was given during provisioning is.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-15 13:48:29 +02:00
Johan Hedberg 70cbcef576 Bluetooth: Mesh: Rename health server code from health to health_srv
This is in anticipation of soon adding health client support, which
could then cause confusion due to the ambiguous API names.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-15 13:48:29 +02:00
Johan Hedberg 3b252ca2be Bluetooth: Mesh: Rename configuration server code from cfg to cfg_srv
Now that there's support for configuration client as well, rename cfg
to cfg_srv to avoid any confusion.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-15 13:48:29 +02:00
Johan Hedberg 0ef7c6e09a Bluetooth: Mesh: Add more flexible APIs for provisioning bearers
Add the ability to track the provisioning bearer through an extra
parameter to link_open/close. Also introduce new public functions to
enable/disable specific provisioning bearers. This also means that one
now needs to explicitly enable provisioning bearers after calling
bt_mesh_init().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-15 13:48:29 +02:00
Johan Hedberg a81fa43a59 Bluetooth: Mesh: Use proper _t suffix for typedefs
To be consistent with the coding style, use a _t suffix for typedefs.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-15 13:48:29 +02:00
Andrew Boie 02d6c11f1d tests: mheap_api_concept: test k_calloc()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-11-14 12:50:10 -08:00
Punit Vara 4a9a0e209a tests: context: convert legacy test to ztest
Use ztest apis in legacy test to support ztest
framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-14 10:02:43 -08:00
Punit Vara eeb4cd24ab tests: work_queue: Convert legacy test to ztest
Make use of ztest apis to support ztest framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-14 10:02:02 -08:00
Punit Vara 1604a9351f tests: timer_monotonic: Migrate legacy test to ztest
Use ztest macros and apis in legacy test to support ztest
framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-14 09:50:12 -08:00
Andy Ross a9f0f445ba tests/kernel/pipe: fix uninitialized semaphore
The end_sema k_sem was only initialized on one of the several paths
that used it, leading to some crazy clobber-the-run-queue behavior
that was dependent on linkage order (see the linked bug) when end_sema
and the pipe object were made non-static..

Adding a k_sem_init() call fixes the corrupt issue, but really the
right thing is to use the DEFINE macro, so do that instead.  Note that
that the initializer changes the linkage order too (by putting the
semaphore in a separate segment), so... yeah, it's actually impossible
to prove that this patch in isolation resolves the issue seen without
manual validation.

Issue: https://github.com/zephyrproject-rtos/zephyr/issues/4366

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-11-14 09:47:19 -08:00
Johan Hedberg 588887c9b7 Bluetooth: Mesh: Add primary address to provisioning complete callback
It may be useful for the app to know that the local node's primary
address is.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 16:48:49 +02:00
Johan Hedberg 2a1e16c2a3 Bluetooth: Mesh: Add skeleton for Configuration Client Model
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 16:48:49 +02:00
Andrzej Puzdrowski 2adbed8d6d tests: subsys: dfu: mcuboot: fix return value not handling issue
Function flash_read was calling without checking return value.
(Coverity CID: 178794)
This patch cover this issue.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-11-14 06:58:54 -05:00
Robert Chou 1d70a39d1b net: samples: replace tag zoap with coap
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-11-14 06:42:57 -05:00
Johan Hedberg e2e74f705b Bluetooth: Mesh: shell: Add basic skeleton
Add a basic shell skeleton for Mesh, containing basic command for
initialization, provisioning and reset.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 11:03:58 +02:00
Punit Vara 85be9db682 tests: fatal: convert legacy test to ztest
Clear checkpatch errors and make use of ztest apis to
support ztest framework.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-13 16:35:27 -05:00
Johan Hedberg af512e5498 Bluetooth: tests/shell: Rename Arduino 101 conf file for cmake
The conf file name must be of the form prj_<board>.conf for it to be
automatically chosen for a given board.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-13 15:10:20 +02:00
Johan Hedberg 9bdd8d6b60 Bluetooth: tests: Update tester documentation for cmake
Remove references to make-centric build process, and refer to the
steps in a more neutral way (which is equally applicable to using
either make or ninja as the generator type).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-12 15:05:49 +02:00
Johan Hedberg a30d876a6c Bluetooth: tests: Remove explicit setting of QEMU_EXTRA_FLAGS
The needed options to QEMU_EXTRA_FLAGS now get set from a single
central place, so applications don't need to do it anymore.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-12 15:05:49 +02:00
Johan Hedberg 6249ae7cda Bluetooth: tests/mesh: Update lpn.conf with saner defaults
Use the default values for scan latency and receive delay, and enable
useful logging, like that for LPN.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-10 22:17:43 +03:00
Johan Hedberg 58b476fb33 Bluetooth: tests/mesh: Remove manual LPN enabling
The default of the stack is now to automatically enable LPN
functionality after a given timeout.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-10 22:17:43 +03:00
Szymon Janc 1a50ee1fe0 Bluetooth: btp: Add initial commands for Mesh service
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-11-10 14:44:23 +02:00
Sebastian Bøe c7832bd343 cmake: Use -serial bt-server when CONFIG_BT
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Anas Nashif 9b12769479 tests: use cmake to build object benchmarks
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
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>
2017-11-08 20:00:22 -05:00
Johan Hedberg 3a0b1b435e tests: bluetooth/mesh: Enable beacon by default
There are some PTS tests, which expect the IUT to send some beacons
after provisioning, so enable the feature by default.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-07 18:59:06 +03:00
Aska Wu a9b2d57664 tests: sockets: Check the value-result argument
The addrlen of accept() and recvfrom() should be updated to the actual
value of source address.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-11-06 20:59:05 +02:00
Johan Hedberg a022e950b5 Revert "tests: mesh: Convert legacy test to use ztest"
This reverts commit b66a6acad7.

The mesh test app is (at least for now) only supposed to be manually
run. It e.g. contains special configurations for feature-specific
testing using the Bluetooth PTS.

The ztest conversion that was done to the app doesn't really make any
sense since nothing of essence is tested by the ztest hooks and
everything that the app intends to be tested need manual action either
way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-06 13:22:24 -05:00
Jukka Rissanen 2486694eb9 net: http: Create HTTP library that uses net-app
Create http library that uses net-app instead of net_context
directly. The old HTTP API is deprecated.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-11-06 09:33:00 -05:00
Aska Wu 6bbb5f2094 net: tests: Add tests for net pkt address parsing
Add IPv6/TCP, IPv6/UDP, IPv4/TCP, IPv4/UDP address parsing test cases.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-11-06 14:09:46 +02:00
Ramakrishna Pallala a44e88df2a tests: kernel: timer: Fix TC_PRINT format specifiers
Pass Zephyr type format specifiers to TC_PRINT().

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 10:59:43 -07:00
Punit Vara d8f85d736d tests: static_idt: convert legacy test to ztest
Migrate testcase to ztest and use ztest macros

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-03 12:55:56 -04:00
Nirmala Devi 44a3514a33 Uart: Added testcase support for drivers using only poll mode
Signed-off-by: Nirmala Devi <nirmala.devix.m@intel.com>
2017-11-03 10:53:17 -04:00
Punit Vara c2f60ebe56 tests: bitfield: Convert legacy test case to ztest
migrate testcase to ztest and use ztest macros.

Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-02 18:32:56 -04:00
Punit Vara e2a974497b tests: mslab: convert legacy test to ztest
This patch removes checkpatch warnings as well as
make use of ztest apis to convert legacy test to ztest.

Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-02 18:20:32 -04:00
Punit Vara 658a5a2ddb tests: rpl: convert legacy test in ztest
This patch makes use of ztest apis to make output unified with
other test cases

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-02 17:22:59 -04:00
Punit Vara cb81b5ebb4 tests: mem_pool: convert legacy test in ztest
Make legacy test case use of ztest test api to support
test framework

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-11-02 17:18:38 -04:00
Anas Nashif 36bc8d797f tests: add testcase.yaml to multicore power
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-02 15:53:04 -04:00
Adithya Baglody edd072e730 tests: benchmarking: cleanup of the benchmarking code.
The kernel will no longer reference the code written in the
test folder.

GH-1236

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-11-02 09:01:06 -04:00
Aska Wu 34b5ca6122 tests: sockets: Add TCP test cases
- Test ipv4/ipv6 send() and recv().
- Test ipv4/ipv6 sendto() and recvfrom().
- Test ipv4/ipv6 sendto() and recvfrom() with NULL dest address.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-11-01 15:08:39 +02:00
Leandro Pereira da9b0ddf5b drivers: Rename random to entropy
This should clear up some of the confusion with random number
generators and drivers that obtain entropy from the hardware.  Also,
many hardware number generators have limited bandwidth, so it's natural
for their output to be only used for seeding a random number generator.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Leandro Pereira 059bd32a26 tests: mcuboot: Check results from flash write/read functions
Coverity-ID: 177215
Coverity-ID: 177216
Coverity-ID: 177217
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-31 18:52:09 -04:00
Leandro Pereira 7929db12bb tests: icmpv6: Assert that net_pkt and net_buf could be allocated
Coverity-ID: 177215

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-31 18:52:09 -04:00
Leandro Pereira 972992c524 tests: dns_resolve: Fix NULL pointer derefence if iface is NULL
Coverity-ID: 173653

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-31 18:52:09 -04:00
Anas Nashif 1efce2b3cc tests: removed stray bitfield.c file
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Anas Nashif 0ef69a3361 tests: minor cleanup for fp_sharing test
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Anas Nashif a7b45d0bfc tests: gen_inc_file: fix include syntax
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Punit Vara aeb6a7e323 tests: 6lo: convert legacy test to ztest with cleanup
Test uses ztest and coding cleanup errors along with
warnings are removed through this patch

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-31 09:49:20 +02:00
Anas Nashif 780324b8ed cleanup: rename fiber/task -> thread
We still have many places talking about tasks and threads, replace those
with thread terminology.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-30 18:41:15 -04:00
Andrew Boie 4c305a51e9 tests: schedule_api: slightly increase stack size
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>
2017-10-30 13:20:19 -07:00
Jukka Rissanen 0e7c8edc92 net: context: Make sure we honor timeout when waiting data
The call to net_context_recv() with timeout returned -ETIMEDOUT
even when data was returned properly and there was no timeout.

Fixes #4565

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-30 17:18:11 +02:00
Aska Wu 939aad913f tests: sockets: Make udp test cases self-contained
Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-10-30 14:53:13 +02:00
Punit Vara 68e00378d0 tests: trickle: convert legacy test to ztest
This patch makes legacy test to use ztest APIs.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-30 11:11:34 +02:00
Vikram Singh Shekhawat cbbec3db70 tests: entropy: Add Entropy driver test case
This test runs with ztest suite. It will verify get_entropy
operation of entropy driver.

Signed-off-by: Vikram Singh Shekhawat <vikramx.shekhawat@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 23:06:51 -04:00
Tomasz Bursztyka 1b77ee12ea samples/net: Reducing prj*.conf files by relevantly removing 6Lo option
If NET_L2_IEEE802154 and NET_IPV6 are enabled:
- NET_6LO is enabled
- NET_L2_IEEE802154_FRAGMENT is enabled

Thus removing setting this config options to yes where applicable.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-28 14:28:02 -04:00
Punit Vara 273c0fdcfb tests: ztest: Add formatting in assert APIs
All ztest_* apis now support format specifier which will
evetually help to pass variable arguments to ztest assert
apis in different test cases while showing error messages.

Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 13:09:33 -04:00
Sebastian Bøe b7eaeb9f0a cleanup: Use quote include instead of system include
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.

than a system include like

Avoiding the use of system includes in these cases is beneficial
because;

* The source code will be easier to build because there will be fewer
system include paths.

* It is easier for a user to determine where a quote-include header
  file is located than where a system include is located.

* You are less likely to encounter aliasing issues if the list of
  system include paths is minimized.

Authors:
Anas Nashif
Sebastian Bøe

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 07:11:53 -04:00
Punit Vara 9544b7eca4 tests: context: Make legacy test to use ztest API
Use ztest APIs in test case to make output unified with other test
cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-26 14:51:00 +03:00
Punit Vara a29f67beed tests: route: Convert legacy test to use ztest framework
This patch makes use of ztest apis to make output unified with other
test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-26 12:55:22 +02:00
Paul Sokolovsky cdfdac394a tests: net: tcp: Update for clean up in seqno handling
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-25 14:19:04 +03:00
Robert Chou 7aa223174a net: coap: empty payload with payload marker is malformed
From RFC 7252, section 3
"The absence of the Payload Marker denotes a zero-length payload.
The presence of a marker followed by a zero-length payload MUST
be processed as a message format error."

Check empty payload when COAP_MARKER is found and add a test case to
cover it

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-10-25 13:21:53 +03:00
Ravi kumar Veeramally a3a1772218 net: tests: Add more CoAP test cases
More test cases related to malformed packets (invalid options).

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-10-25 10:54:25 +03:00
Jukka Rissanen 964f399813 tests: net: coap: Use proper array for payload
The payload variable was one byte long but we read 32 bytes
from it.

Coverity-CID: 178064
Fixes #4397

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-24 11:31:16 +03:00
Adithya Baglody 990809799b tests: protection: Enable the complete test suit for qemu_x86.
Using the PAE page tables it is possible to disable code execution
form RAM.

JIRA:ZEP-2511

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-10-23 10:13:07 -07:00
Ravi kumar Veeramally ca642fbf62 net: tests: Add more testcases to 6lo tests
Add more testcases of SAC 1 and SAM 00 combinations to 6lo tests.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-10-20 10:33:28 +03:00
Andrew Boie 967ee03271 tests: thread_init: run in user mode
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>
2017-10-19 15:07:45 -07:00
Andrew Boie c725e64b64 tests: lifecycle_api: run in user mode
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>
2017-10-19 15:07:45 -07:00
Andrew Boie a9557ef219 tests: custom_data: run in user mode
main.c and test_customdata_api.c merged.

Preemptive priority case now run in user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie 60e6632e65 tests: stack_api: run in user mode when possible
All non ISR tests now run in user mode.

userspace added to testcase.yaml tag list.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie bcd3803180 tests: msgq: run in user mode when possible
Unnecessary k_thread_abort() removed from test_msgq_purge_when_put.

A single global msgq object is now shared instead of being declared
on thread stacks, except for an ISR test case which has had its
semaphore renamed.

Moved k_sem_init() call from msgq_thread() to test_msgq_thread()
to fix a race condition.

userspace tag added to testcase.yaml.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie bf7d53395e tests: semaphore: run some threads in user mode
main.c and test_sema_contexts.c merged

userspace tag added to testcase.yaml

stack-allocated semaphore in test_sema_thread2thread now just uses
the global semaphore with the same name.

ISR tests run in supervisor mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie 39d55ac6a9 tests: alert_api: run in user mode
main.c and test_alert_contexts.c merged.

User threads can't look inside the alert structures, so an extra
variable 'htype' introduced to track expectations for any given
alert object in alert_recv().

Alert objects have to be initialized by supervisor threads since
they register callbacks. An array of toplevel alert objects created
and initialized in test_main(), replacing the ones that used to
live on thread stacks.

Added userspace tag to testcase.yaml

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie 776a084216 tests: mutex: run in user mode
Main thread grants itself access to objects it or its children need
and does the rest of the test case in user mode.

Statically defined threads now all run in user mode, with permissions
granted via K_THREAD_ACCESS_GRANT().

Added userspace tag to testcase.yaml.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Andrew Boie 610f5d1ce7 tests: obj_validation: add to userspace tests
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-19 15:07:45 -07:00
Tomasz Bursztyka 81b9c8fcf6 net/utils: Make net_hexdump_frags being able to print ll reserve
If requested only and with colors with right SYS_LOG Kconfig options.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-19 05:33:23 -04:00
Luiz Augusto von Dentz 15c115bc61 tests: fifo: Add prj_poll.conf
This enables testing k_fifo test with CONFIG_POLL=y.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-10-18 13:02:52 -04:00
Kumar Gala 3316b78268 tests: net: lib: dns_resolve: bump min memory to over 20k
We are failing on all systems with 20k of memory so bump up the limit
needed to build this test.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-18 09:47:19 -05:00
David B. Kinder 4600c37ff1 doc: Fix misspellings in header/doxygen comments
Occasional scan for misspellings missed during PR reviews

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-17 19:40:29 -04:00
Mariusz Skamra f1753ae0f3 Bluetooth: tester: Add Attribute Value Changed event implementation
This adds implementation of previously introduced BTP event.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 21:28:14 +03:00
Mariusz Skamra 204c468d16 Bluetooth: btp: Add new event to indicate GATT attribute value change
Attribute Value Changed Event will be used to indicate characteristic
or descriptor value change in local GATT Server database.
Event will be triggered when PTS performed ATT Write operation
successfully.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 21:28:14 +03:00
Jukka Rissanen faeab7f2bf tests: net: app: Simple testcases for net-app testing
These are simple tests for net-app testing. These do not try to
actually send anything to net but test mainly net-app setup and
close functionality.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-17 14:07:14 -04:00
Andrew Boie c5c104f91e kernel: fix k_thread_stack_t definition
Currently this is defined as a k_thread_stack_t pointer.
However this isn't correct, stacks are defined as arrays. Extern
references to k_thread_stack_t doesn't work properly as the compiler
treats it as a pointer to the stack array and not the array itself.

Declaring as an unsized array of k_thread_stack_t doesn't work
well either. The least amount of confusion is to leave out the
pointer/array status completely, use pointers for function prototypes,
and define K_THREAD_STACK_EXTERN() to properly create an extern
reference.

The definitions for all functions and struct that use
k_thread_stack_t need to be updated, but code that uses them should
be unchanged.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-17 08:24:29 -07:00
Mariusz Skamra 4d831a7bdd Bluetooth: tester: Fix include service attribute user data
GATT Server:
According to the API, include service declaration user data
points to the first service attribute to include.

bt_gatt_include structure is valid only for client role.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 17:30:50 +03:00
Anas Nashif 5c24704e1c tests: nffs: cleanup configs
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif d411eca92f tests: Bluetooth: simplify BT init test
Use common keys and simplify. Remove stray tmp file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif 40acd7e153 tests: timer: remove obsolete CONFIG_NANO_TIMEOUTS
Cleanup testcase as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif 7076613b22 tests: errno: using new extra_configs
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif 4bc6e27fda tests: aio: use depends on
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif 116aadf936 tests: adc_simple: use depends_on for testcase
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Anas Nashif 0b5c0498a5 tests: adc_api: use new testcase scheme and cleanup
Remove the many .conf files and use extra_configs instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-17 08:55:38 -04:00
Andrew Boie a2b40ecfaf userspace handlers: finer control of init state
We also need macros to assert that an object must be in an
uninitialized state. This will be used for validating thread
and stack objects to k_thread_create(), which must not be already
in use.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-16 19:02:00 -07:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Andrew Boie 3bfc80bc95 x86: disable the MMU on 'reg' and 'min' footprint
A space-constrained device wouldn't enable this feature.
Fixes build errors since these tests constrain the size of
the IDT.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-13 12:56:14 -07:00
Andrew Boie b2bce21572 ztest: add user thread support
We add macros to define test cases that should be run with the CPU
in user mode, if the CPU supports it.

ztest_test_suite() declarations are now static as they can't go on
the main thread stack; the data gets shared between multiple threads.
It's better here anyway as a large test suite could fill up the main
stack, which is by default reduced to 512 bytes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-13 12:17:13 -07:00
Tomasz Bursztyka ea0aee2bb3 drivers/ieee802154: Stop exposing old radio API functions
set_ieee_addr, set_short_addr and set_pan_id are now unused by L2, so
removing their exposure through the radio API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka b2726e14a6 drivers/ieee802154: Implement get_capabilities in existing drivers
Further support will need work per-driver basis, as soon as the L2 will
be able to make usage of such support.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Andrew Boie e5b5407ece tests: obj_validation: cleanup
Improved test coverage to reflect current policy and converted to
ztest.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Andrew Boie 7e3d3d782f kernel: userspace.c code cleanup
- Dumping error messages split from _k_object_validate(), to avoid spam
  in test cases that are expected to have failure result.

- _k_object_find() prototype moved to syscall_handler.h

- Clean up k_object_access() implementation to avoid double object
  lookup and use single validation function

- Added comments, minor whitespace changes

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Andrew Boie cee72411e4 userspace: move _k_object_validate() definition
This API only gets used inside system call handlers and a specific test
case dedicated to it. Move definition to the private kernel header along
with the rest of the defines for system call handlers.

A non-userspace inline variant of this function is unnecessary and has
been deleted.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie 22118bf772 tests: obj_validation: only run if HW supported
The test should only run on platforms where CONFIG_USERSPACE
dependencies are met.

Remove the whitelist, the filter will capture the right platforms.

Fixes: #4050

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 09:50:05 -07:00
Kumar Gala 0bfd810d13 i2c: deprecate use of union dev_config
There are several issues with the dev_config union used as a
convenience when calling the i2c_configure api.  One, the union is well
name spaced protected and doesn't convey use with just i2c.  Second
there are assumptions of how the bits might get packed by the union
which can't be guaranteed.  Since the API takes a u32_t lets change in
tree uses to using the macros to setup a u32_t and make the union as
deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-11 10:45:12 -04:00
Anas Nashif 15fdd5e072 ztest: add missing includes
ztest unit tests run on the host system, so provide those empty files to
make it build host tests. Those files are auto-generated and not
available when building unit tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-11 09:21:05 -05:00
Piotr Mienkowski c4688ea58c tests: tickless: Add support for Atmel SAM family
This patch updates tickless testcase replacing existing support
for Atmel SAM3X with support for the whole Atmel SAM family.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-10 10:50:55 -04:00
Tomasz Bursztyka dedecdaed8 tests/net: Add a test for net_mgmt_event_notify_with_info()
As previous test without info, this one will be thrown with/without
receiver 1 and 2 times.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-09 10:53:17 +03:00
Tomasz Bursztyka c3a7b4342d tests/net: Fixing parameters alignment in mgmt test
Commit be8a106cb3 messed up the alignment. Removing also the useless
comments.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-09 10:53:17 +03:00
Tomasz Bursztyka 8e25695937 net/mgmt: Make event notifiers able to pass info to listeners
Adding net_mgmt_event_notify_with_info() which lets the event notifier
to pass dedicated data along with the event. The size of data that can
be passed must be limited to the biggest data passed (which will be
currently IPv6 + prefix).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-09 10:53:17 +03:00
Ravi kumar Veeramally 86fe6a3bd6 net: tests: Update CoAP tests to use new API
ZoAP tests are modified to use new CoAP API. Also modified tests
name from 'zoap' to 'coap'.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-10-06 22:07:37 -04:00
Maureen Helm d5894a17d0 tests: adc: Remove custom hexiwear_k64 configuration
Instead of having a board-specific config for this adc test, enable the
required battery-sense circuit by default at the board level when the
adc driver is enabled.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-10-05 17:54:00 -04:00
Anas Nashif 6c8d01e6bb tests: nffs: fix include
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 14:50:14 -04:00
Anas Nashif a2a9622225 tests: add fs tag to filesystem tests
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Anas Nashif c6a8014e1c subsys: fs: consolidate elm FAT kconfig options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Anas Nashif 3580ba539e subsys: fs: consolidate nffs kconfig options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Aska Wu 7c60eadd58 tests: sockets: Add tests of sendto() and recvfrom()
- Add test cases of ipv4/ipv6 sendto() and recvfrom()
- Set the main stack size to 2048 to enable both ipv4 and ipv6 on
  qemu_x86.
- Use net app for network setup.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-10-03 14:40:05 +03:00
Savinay Dharmappa b4fc0738a4 tests: driver: adc: change the sampling delay
patch fix the issue of unable to read from adc by setting
appropriate sampling delay.

The sampling delay should be set to resolution of adc + 2.
In adc qmsi driver the sampling delay received form application
is subtracted from resolution of adc + 2 , if the resultant value
is less than zero then zero is set as sampling delay. So in the
adc_simple application when 12 is passed as sampling delay driver
sets it as zero. So 26 is the minimum sampling delay should be
set in application for a adc with resolution of 12. The reason
to choose 30 was to maintain same value of sampling
delay between adc_simple and adc_api application.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-09-30 13:40:59 -04:00
Jukka Rissanen 80bfd25a6c tests: net: Add IPv4 multicast address tests
These tests test the IPv4 multicast address add, lookup and
removal functions found for network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-29 11:34:06 +03:00
Johan Hedberg d712a4e1a3 Bluetooth: Mesh: Remove local network interface Kconfig option
From section 3.4.5.3 in the Mesh Profile Specification 1.0:

    "A node shall implement a Local Network Interface."

Removing the Kconfig option also helps clean up quite a lot of code.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-09-27 16:33:06 +03:00
Andrew Boie b60867fb32 tests: add CONFIG_APPLICATION_MEMORY test
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-25 19:22:02 -07:00
Andrew Boie 2450ce4867 tests: consolidate memory protection tests
All moved under tests/kernel/mem_protect to reduce clutter. Many more
tests are coming for 1.10 and 1.11.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-24 13:32:21 -04:00
Grzegorz Kolodziejczyk 4e916f40f7 tests: nffs_fs_api: Add performance test for nffs
This adds performance test for nffs with open, close, read, write and
unlink sub test cases.

Origin: Original

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-09-22 06:54:48 -04:00
Grzegorz Kolodziejczyk cb69933208 tests: nffs_fs_api: Add ported NFFS test suite
This patch adds NFFS test suite ported from Mynewt. The test cases are
pretty much the same as in original implementation, however some of
them had to be adjusted to cover differences in Mynewt and Zephyr
filesystem APIs. Also the code was reformatted in some places to make
checkpatch happy.

All test cases from "basic" group can be also run on nRF52840 (nRF52 and
nRF51 do not have enough RAM to run all tests as-is).

Origin: Apache Mynewt NFFS
URL: https://github.com/apache/mynewt-nffs/tree/master
Commit: 6639f7a432e70db00ef25d5e558aedbe503a3c9a
Purpose: NFFS test suite
Maintained-by: Zephyr

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-09-22 06:54:48 -04:00
Youvedeep Singh ca5e408aa1 tests: benchmark: Configure External timer to 32 bit mode for nrf SOCs
nrf SOCs use external timer for measuring benchmarking stats.
Earlier this timer is programmed in 24 bit mode, due to which
is is getting expired in some of benchmark stats like mutex
lock/unlock. So configuring to 32 bit mode to avoid overflow.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-09-20 22:23:30 -04:00
Youvedeep Singh 42add9b65c tests: benchmark: Fixing some of missing KPIs stats for ARM based SOC
Some of benchmark stats were not reported for nrf52/52 based SOCs.
This was because nrf based SOCs use external timer.
In timing info some of benchmark stats still use systick based APIs.
Due to which benchmarking number was not getting reported. So change
it to timer based for nrf.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-09-20 22:23:30 -04:00
Jukka Rissanen 43aa12fe25 net: dns: Do not resolve IPv6 address if IPv6 is disabled
If IPv6 is disabled, then it is useless to try to resolve
IPv6 address because "struct sockaddr" does not have enough
space to store IPv6 address.

Fixes #1487

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-20 08:55:06 +03:00
Jukka Rissanen 7830e60252 tests: Add testing for embedding a hex file
Add a simple test which generates a file that can be included
into a .c file. Then verify in zephyr that the file contains
the same bytes as the original file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-18 14:56:16 -04:00
Punit Vara b66a6acad7 tests: mesh: Convert legacy test to use ztest
This test case makes this test case use ztest apis and
adds CONFIG_ZTEST in all configuration

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-13 09:48:34 -04:00
Punit Vara 7ce27c6b49 tests: bluetooth: Use ztest apis
This patch converts legacy test case to use ztest apis.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-13 09:48:34 -04:00
Punit Vara c4c5eabc61 tests: init: use ztest APIs
This patch converts legacy test case to use ztest apis.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-13 09:48:34 -04:00
Jukka Rissanen 91b6964de1 tests: net: ipv6: Make sure test case compiles and runs
Fixing regression, address family is now called sa_family.

The testcase.yaml file was missing so no tests were actually run.

After making test to run, it was also failing because link address
was accessed before first fragment was set. This caused null pointer
access.

Fixes #1474

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-13 09:07:49 -04:00
Andrew Boie 6781e9908d tests: schedule_api: add extra stack size
Fixes a stack overflow on Xtensa.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-12 22:31:18 -04:00
Jukka Rissanen e71a31e22f net: Wrong networking defines used in the code
There were bunch of config options in tests/net, net-shell and
wpan_serial sample, and those options had wrong name so they
were ignored by the code.

Fixes #1428

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-12 08:37:53 -04:00
Anas Nashif 6fa67585e2 cleanup: remove obsolete nano_work.h
Empty file that is a left-over from the migration to unified kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 19:24:12 -04:00
Anas Nashif 46f66f4295 kconfig: generalised stack protection options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 09:42:35 -07:00
Anas Nashif b1991eba94 cleanup: remove the whitespaces before the # character
Indenting preprocessor directives reduces the code readability, because
it make preprocessor directives harder to spot.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 12:41:07 -04:00
Andrzej Puzdrowski 8e4e3e682f tests: subsys: Add tests for new DFU modules
Added tests for the mcuboot interface module and the image
storage module.
Both tests are checking flash content produced by modules verified.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-09-11 11:37:43 -04:00
Punit Vara de3f3a9bd4 tests: xip: Remove unnecessary prints
Remove unnecessary prints and update function name

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-11 09:53:14 -04:00
Punit Vara e04f8276ad tests: irq_offload: Use SYS_LOG_INF instead of TC_PRINT
Do not print messages by default on console for test cases.
Use SYS_LOG_INF which provides functionality to choose print whenever
require.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-11 09:53:14 -04:00
Punit Vara 425262aaf2 tests: ztest: add system logging header file
This patch eliminates need to add logging/sys_log.h in test
cases which required to use this header file.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-11 09:53:14 -04:00
Ricardo Salveti 9b453e0298 tests: kernel: threads: add specific test tags
Extend test tags to make it easier to filter threads related tests.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-09-10 10:02:18 -04:00
Nirmala Devi 8189330ca9 tests/object_footprint: fix path to Kconfig specification
This was failing to set the proper path to KBUILD_KCONFIG
and hence correcting it.

Signed-off-by: Nirmala Devi <nirmala.devix.m@intel.com>
2017-09-10 10:01:08 -04:00
Andrew Boie 7d627c5971 k_thread_create(): allow K_FOREVER delay
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>
2017-09-07 16:35:04 -07:00
Andrew Boie d76f0a9644 tests: add object validation test case
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-07 16:33:33 -07:00
Andrew Boie d182d0c298 tests: gen_isr_table: don't set compiler opt
Instead, just set -O0 for the particular function which needs it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-07 16:33:33 -07:00
Andrew Boie 6acd75b2b8 tests: gen_isr_table: set default BOARD properly
This test doesn't work on x86, which doesn't use gen_isr_tables.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-07 16:33:33 -07:00
Andrew Boie a0fd10facf arm_irq_vector_table: don't change optimization
This is unnecessary.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-07 16:33:33 -07:00
Ruslan Mstoi 47f4af4310 Bluetooth: tester: Fix bt-stack-tester to unix domain socket
/tmp/bt-stack-tester is not a pipe, but unix domain socket.
This commit fixes respective "make run" errors:

qemu-system-arm: -serial pipe:/tmp/bt-stack-tester: Could
not open '/tmp/bt-stack-tester': No such device or address

qemu-system-arm: -serial pipe:/tmp/bt-stack-tester: could
not connect serial device to character backend
'pipe:/tmp/bt-stack-tester

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2017-09-07 05:53:01 -05:00
Leandro Pereira fa5f231e4d tests: lib: json: Enable test case
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-09-07 05:49:17 -05:00
Andy Ross 637087cc56 tests/kernel/mem_pool/mem_pool_api: Fix stack sizes
The (artificially small) ISR stack was overflowing on this test when
CONFIG_DEBUG was enabled on qemu_x86.  Really there's no reason to be
restricting stack size at all in a memory pool test, just remove those
settings and use the defaults, which are fine.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-09-06 17:17:15 -07:00
Jukka Rissanen bd425e6857 net: dns: Do not resolve numeric IP address
If the query name is already in numeric format, there is no
need to send the query string to DNS server as we can just
convert it ourselves.

Jira: ZEP-2562

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-31 14:33:59 -04:00
Jukka Rissanen 0bde2df491 net: tests: Add tests for IP address parsing
Add IPv4 and IPv6 address parsing tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-31 14:33:59 -04:00
Youvedeep Singh 91063a33a4 tests: benchmark: timing_info: Add support for nrf series processors
nrf SOC uses nrf rtc timer (not sys tick), which is 32kHz,
whereas CPU runs at higher speed (nrf52 runs at 64MHz).
So 32Khz is too slow to measure critical kernel parameters.

This patch does :-
1. Add support for nrf SOC for timing_info benchmarking.
2. Uses SOC timer to measure kernel parameters.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Youvedeep Singh 76b577e180 tests: benchmark: timing_info: Change API/variable Name.
The API/Variable names in timing_info looks very speicific to
platform (like systick etc), whereas these variabled are used
across platforms (nrf/arm/quark).
So this patch :-
1. changing API/Variable names to generic one.
2. Creating some of Macros whose implimentation is platform
depenent.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Tomasz Bursztyka 3e2e1c3e09 tests/ieee802154: Fix a coverity warning
Jira: ZEP-2539
Coverity-CID: 173636

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-31 08:56:05 -04:00
Savinay Dharmappa 3c9fb93dc5 tests: bluetooth: tester: Make UART usage consistent
We use UART1 for UART pipe in a number of qemu tests, so lets do the
same thing for the bluetooth test and move the bluetooth uart to UART2.

Jira: ZEP-2412.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-30 10:07:07 -05:00
Carles Cufi b7a5fab4cf Bluetooth: controller: Add Read Static Addresses VS command
Implement the first Vendor-Specific Command of the Zephyr specification
other than the 3 mandatory ones already present in the codebase, along
with a Kconfig option to enable and disable the presence of the VS
commands.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-30 08:18:42 -04:00
Luiz Augusto von Dentz d229ec07ad Bluetooth: tester: Fix using invalid elements with k_fifo
The documentation of k_fifo_put mentions that the items must have 32
bits reserved for kernel use as that is where the sys_snode_t pointer
is placed but this detail was not taken into consideration when
designing the cmd_queue which access each element as a btp_cmd.

Note: This probably used to work just because k_fifo_get used to place
data directly into thread's swap_data so the kernel never really touched
the list but with the changes to use k_poll the list is always updated
exposing this issue.

Jira: ZEP-2568

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-30 08:16:16 -04:00
Anas Nashif de8b88bb0b license: fix license identifiers
Also add copyright headers and license tags where missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-29 07:42:09 -04:00
Inaky Perez-Gonzalez a132b2ac41 tests/object_footprint: fix build error due to bad Kconfig specification
This was failing to build when the PWD was not that of the
tests/benchmarks/object_footprint because it was asking to load
$(PWD)/Kconfig.

Kconfig shall be specified with no directory location, as the file
will be imported relative to to Zephyr app's directory.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-08-28 18:29:56 -04:00
Jukka Rissanen e0dd4ff74a tests: net: mld: Ignore already joined error when sending report
The verify_send_report() failed in quark_se_c1000_devboard because
the multicast group was already joined. We can safely ignore this
error for this specific test.

Fixes #1240

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-25 22:15:33 -04:00
Luiz Augusto von Dentz 26cd8cefd1 Bluetooth: shell: Enable CONFIG_BT_SHELL for arduino_101
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 15:32:38 -04:00
Luiz Augusto von Dentz 251a8a8c28 test: queue: Add test for multiple threads using k_queue_get
This tests the situation when there are multiple threads calling
k_queue_get which was causing issues when using k_poll.

Jira: ZEP-2553

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 09:00:46 -04:00
Luiz Augusto von Dentz 7d01c5ecb7 poll: Enable multiple threads to use k_poll in the same object
This is necessary in order for k_queue_get to work properly since that
is used with buffer pools which might be used by multiple threads asking
for buffers.

Jira: ZEP-2553

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 09:00:46 -04:00
Anas Nashif b8e2ed02b0 tests: kernel: mutex: minor rework
Rename task -> thread and use main as the entry thread saving 512
bytes of RAM.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 14:49:24 -04:00
Anas Nashif 5a938df11b tests: mslab: use main thread
Fix legacy naming and function names to be tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Anas Nashif 704f879f8a tests: ztest: call test_main() without arguments
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>
2017-08-24 09:29:14 -07:00
Anas Nashif a2affd75d2 tests: benchmarks: use main thread for benchmark
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Kumar Gala 9075e1e368 tests: crypto: mbedtls: set a code size constraint
We have a few systems with small amounts of flash that this test can't
fit into.  For now I set the limit right above 32k, however that might
need to get bumped up if we have any systems with flash sizes between
32k and 64k.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-24 10:26:33 -04:00
Leandro Pereira aa0e931ecc tests: gpio: Add support for ESP32
Adds an #elif for ESP32 boards.  Connect a wire from pin IO2 to pin IO4
so that the test can be executed.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Anas Nashif 67c83d8033 tests: footprint: add testcase.yaml to object tests
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-22 16:37:30 -04:00
Andrew Boie 176e48745e object_footprint: don't adjust IDT size
The size of the interrupt descriptor table is not really
relevant to this test.

If any driver enabled for the target board gets enabled and
has a priority level outside the IDT range, gen_idt.py is properly
reporting an error. The old C-based gen_idt seems to have allowed
this to slide by.

Issue: ZEP-2496
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 16:37:30 -04:00
Vinayak Kariappa Chettimada 6a39ed084f Bluetooth: controller: Add Minimum Number of Used Channels Proc
Add implementation to support Bluetooth 5.0 Minimum Number
of Used Channels Procedure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-08-21 08:41:56 -04:00
Leandro Pereira dd740c164b tests: crypto: Do not use unitialized variable
The `z` vector was not initialized in the call to
uECC_vli_nativeToBytes(), resulting in undefined behavior.  Use the
properly initialized `exp_z` array instead.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-19 07:48:07 -04:00
Paul Sokolovsky dcb80f7ab8 net: struct sockaddr should have field "sa_family"
POSIX requires struct sockaddr's field to be named "sa_family"
(not just "family"):
http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/socket.h.html

This change allows to port POSIX apps easier (including writing
portable apps using BSD Sockets compatible API).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-18 16:34:51 -04:00
Tomasz Bursztyka 9034d73f1d tests/dns_resolve: Fix possible NULL dereference
Coverity-CID: 173653

Jira: ZEP-2531

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 14:10:01 -04:00
Tomasz Bursztyka 8e77ef5493 tests/zoap: Fix possible NULL pointer dereference
Coverity-CID: 173648

Jira: ZEP-2535

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 14:10:01 -04:00
Punit Vara f381b421f0 tests: ztest: remove confusing tc_start() in ztest framework
This patch removes "tc_start()" string with "starting test" and
arranges PRINT_LINE appropriatly.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-16 21:29:00 -04:00
David B. Kinder 81f7c82625 doc: fix misspellings and missing EOF newlines
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-16 17:38:41 -05:00
Andrew Boie 5996bca13b schedule_api: fix stack overflow on xt-sim
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andrew Boie 222f37ded9 tests: schedule_api: fix variable shadowing
The array of k_thread "t" was declared non-static in 2 different
C files. Make them static.

Semaphores only used in local C file now declared static.

Use of variable 't' in thread_tslice() no longer shadows global
definition.

Fixes build errors with XCC compiler.

Increase RAM requirement to 20K.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andy Ross 40e669e798 tests/kernel: Add pthread API test
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-08-15 19:42:07 -04:00
Carles Cufi fc965e5554 Bluetooth: controller: Split Ext Scan Filter Policies out
Since Extended Scanner Filter Policies is an independent feature from
Controller-based Privacy, split it out so it can be built independently
and included without it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-15 22:55:15 +03:00
Gil Pitney 4f67a6c76d cc3200: Remove TI cc3200 SOC and LaunchXL board support
Per ZEP-1958, Phase 2 of adding CC3220sf LaunchXL support,
was to "deprecate the CC3200 launchxl support in Zephyr
(redundant to the CC3220)."

Effectively, the CC3220 SOC replaces the CC3200.

This patch removes the following:
* the imported CC3200 SDK
* CC3200 SOC, board, DTS files.
* adjusts other files where cc3200 was mentioned.

Also, it fixes explicit references to CC3200 in generic
CC32xx driver files.

Jira: ZEP-1958

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-08-15 11:02:48 -05:00
Luiz Augusto von Dentz 4c6007756c tests: work_q: Add test for k_delayed_work_cancel
This adds a test that attempts to submit a work with 0 timeout thus
causing it to immediatelly be submitted to the queue so it is pending
execution which is then cancelled with k_delayed_work_cancel.

Note this can only be done with coop threads with the same or higher
priority otherwise the work_q thread is wakeup before
k_delayed_work_cancel takes place, thus why test_delayed_cancel uses
K_HIGHEST_THREAD_PRIO.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz c1fa82b3c6 work_q: Make k_delayed_work_cancel cancel work already pending
This has been a limitation caused by k_fifo which could only remove
items from the beggining, but with the change to use k_queue in
k_work_q it is now possible to remove items from any position with
use of k_queue_remove.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz 84db641de6 queue: Use k_poll if enabled
This makes use of POLL_EVENT in case k_poll is enabled which is
preferable over wait_q as that allows objects to be removed for the
data_q at any time.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz 42d9aa785d tests: queue: Add tests for k_queue_remove
Add another list of elements which is removed before k_queue_get is
called.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Anas Nashif 2de59023dc tests: update min ram requirements and filters
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif e0e559001f tests: kernel: reduce thread stack size for pend
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif 4c7233b84d tests: json: reduce ztest stack size
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif 41febf2e7a tests: benchmarks: reduce message size
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03:00
Kumar Gala f319660ce5 tests: json: only build if newlib isn't configured
Right now we have various type conflicts between the json library and
newlib.  Until these are resolved only build the json test if newlib
isn't enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-13 09:06:10 -04:00
Michał Kruszewski 178191ce68 test: spi: Define asynchronous stack with K_THREAD_STACK_DEFINE.
Previous stack definition caused following warning: passing argument 2
of 'k_thread_create' from incompatible pointer type.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-08-10 13:55:17 -04:00
Wayne Ren f8d061faf7 arch: arc: add nested interrupt support
* add nested interrupt support for interrupts
   + use a varibale exc_nest_count to trace nest interrupt and exception
   + regular interrupts can be nested by regular interrupts and fast
interrupts
   + fast interrupt's priority is the highest, cannot be nested
* remove the firq stack and exception stack
   + remove the coressponding kconfig option
   + all interrupts (normal and fast) and exceptions will be handled
     in the same stack (_interrupt stack)
   + the pros are, smaller memory footprint (no firq stack), simpler
     stack management, simpler codes, etc.. The cons are, possible
     10-15 instructions overhead for the case where fast irq nests
     regular irq
* add the case of ARC in test/kernel/gen_isr_table

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-10 12:47:15 -04:00
Youvedeep Singh 1c856d2b10 tests: kernel: Stress test for preemptive scheduling.
Tests if preemptive threads are picked up as per priority.
This creates 10 threads with priority in increasing order
from 1 to N and each thread prints an Alphabet.
This test fails when threads are picked up out of order.

Jira: ZEP-2370

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-09 21:44:53 -04:00
Youvedeep Singh ee5d84ca9a tests: kernel: Stress test for round robin scheduling.
This creates 10 threads with equal priority and tests predictibility
of picking all threads in round robin fashion. Test fails when any
thread consumes more time than time slice allocated to it or threads
are not scheduled in round robin fashion.

Jira: ZEP-2371

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-09 21:44:53 -04:00
Punit Vara 3251b9036a tests: neighbor: convert normal test to use ztest
This patch convert net test cases to use ztest framework APIs
which makes output unified to other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-09 21:42:29 -04:00
Punit Vara 2acf077a3a tests: dhcpv4: convert normal test to use ztest
This patch convert net test cases to use ztest framework APIs
which makes output unified to other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-09 21:42:29 -04:00
Niranjhana N 49d2dea875 tests: utils: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size to 1024

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N e17ed87729 tests: udp: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 9f182e07b1 tests: http_header_fields: convert to ztest
- replaced test points with ztest APIs wherever possible
- added CONFIG_ZTEST_STACKSIZE=320

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 0ac077af60 tests: mqtt_packet: convert to ztest
- replaced test points with ztest APIs wherever possible

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N be8a106cb3 tests: mgmt: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size to 896

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 7d1c9184a8 tests: arp: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N fbb6cb4fdd tests: ip-addr: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced the size by half

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 456f7a4d90 tests: icmpv6: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size by half

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Johann Fischer afedfa95ee tests: dma: cleanup and add loglevel configuration
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-08-09 16:04:46 -05:00
Luiz Augusto von Dentz 035d7cf871 tests: shell: Fix string not null-terminated
shell_exec expects a string that is null-terminated but if line passed
to strncpy is equal or bigger than the buffer it will not produce a
null-terminated command.

Jira: ZEP-2474

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-09 10:10:45 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Marti Bolivar 86f23c8877 tests: spi_loopback: improve error logging
Print the entire memory areas of interest on error, instead of
stopping at the first null character.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar f95632a14e tests: spi_loopback: log start/end of test at INF level
This makes it easier to distinguish which lines come from which tests.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar b147c8f61b tests: spi_loopback: add 96b_carbon support
This includes files for both polled and IRQ-driven I/O. The log level
is deliberately kept to ERROR to try to shake out any timing-dependent
bugs which go away with extra logging.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 30ae3cb9b7 tests: spi_loopback: fix typos
Trivial fixups.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Michał Kruszewski 062360b596 test: spi: Use k_thread_abort to end asynchronous thread.
k_thread_cancel() is replaced with k_thread_abort() because
k_thread_cancel() is used to cancel threads that have not started yet.
Canceling asynchronous thread was returning an error.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-08-08 07:44:21 -04:00
Niranjhana N fef5ef74fa tests: sha256: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - sha256.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 4e40b843e4 tests: mbedtls: convert to ztest
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - mbedtls.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 26bacab162 tests: hmac_prng: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - hmac_prng.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N af3cd3bb62 tests: hmac: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - hmac.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 712e2a4dc0 tests: ecc_dsa: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ecc_dsa.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 763384bdb2 tests: ecc_dh: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ecc_dh.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 83f77de779 tests: ctr_prng: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ctr_prng.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N a1e98b01a8 tests: ctr_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ctr_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N c47d5fcee1 tests: cmac_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - cmac_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 98f69e1de5 tests: ccm_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ccm_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 0e53345b74 tests: cbc_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - cbc_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 851314ba8e tests: aes: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - aes.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 50f112cdc1 tests: xip: convert to ztest
- replaced a test point with ztest API
- separated the main file into two:
    - main.c, which has ztest entry
    - xip.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 7e5baf0495 tests: multilib: convert to ztest
- added a ztest test point
- separated the main file into two files:
    - main.c, which has ztest entry
    - multilib.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 502c7c0c83 tests: libs: convert to ztest
- file already had ztest functions
- separated the main file into two:
    - main.c, which has the ztest entry
    - libraries.c, which has the original routines

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N c235ff4959 tests: arm_runtime_nmi: convert to ztest
- file does not use ztest asserts
- separated the main file into two files:
    - main.c, which has ztest entry
    - arm_runtime_nmi.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 8dc47d6a3b tests: arm_irq_vector_table: convert to ztest
- file already had ztest functions
- separated the main file into two:
    - main.c, which has the ztest entry
    - arm_irq_vector_table.c, which has the original routines

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Johan Hedberg bf8e504588 Bluetooth: Mesh: Fix duplicate const declarations
Remvoe duplicate const declarations which may cause compiler warnings.

Jira: ZEP-2442

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-07 19:18:02 +03:00
Luiz Augusto von Dentz c4f632bd09 net: bt: app: Add NET_APP_BLUETOOTH_NODE option
This enables IPSP node role which requires IPSS GATT service to be
registered.

Jira: ZEP-2451

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-04 18:18:40 +03:00
Aska Wu e7acafd967 net: sockets: Fix a link error if CONFIG_NET_TCP is not enabled
Always support net_pkt_sent() and net_pkt_set_sent().

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-08-04 16:50:37 +03:00
Anas Nashif 3ac7b3a229 doc: qemu target was deprecated, use 'run'
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 11:48:55 -04:00
Andrew Boie 80e82e7205 x86: stack overflow improvements
As luck would have it, the TSS for the main IA task has
all the information we need, populate an exception stack
frame with it.

The double-fault handler just stashes data and makes the main
hardware thread runnable again, and processing of the
exception continues from there.

We check the first byte before the faulting ESP value to see
if the stack pointer had run up to a non-present page, a sign
that this is a stack overflow and not a double fault for
some other reason.

Stack overflows in kernel mode are now recoverable for non-
essential threads, with the caveat that we hope we weren't in
a critical section updating kernel data structures when it
happened.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-03 11:46:26 -04:00
Anas Nashif abb4b09a08 build: remove unused Kconfig variables
Removed unused variables
- CONFIG_NUM_TASK_PRIORITIES
- CONFIG_NUM_COMMAND_PACKETS
- CONFIG_NUM_TIMER_PACKETS

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 07:19:29 -05:00
Andrew Boie 507852a4ad kernel: introduce opaque data type for stacks
Historically, stacks were just character buffers and could be treated
as such if the user wanted to look inside the stack data, and also
declared as an array of the desired stack size.

This is no longer the case. Certain architectures will create a memory
region much larger to account for MPU/MMU guard pages. Unfortunately,
the kernel interfaces treat both the declared stack, and the valid
stack buffer within it as the same char * data type, even though these
absolutely cannot be used interchangeably.

We introduce an opaque k_thread_stack_t which gets instantiated by
K_THREAD_STACK_DECLARE(), this is no longer treated by the compiler
as a character pointer, even though it really is.

To access the real stack buffer within, the result of
K_THREAD_STACK_BUFFER() can be used, which will return a char * type.

This should catch a bunch of programming mistakes at build time:

- Declaring a character array outside of K_THREAD_STACK_DECLARE() and
  passing it to K_THREAD_CREATE
- Directly examining the stack created by K_THREAD_STACK_DECLARE()
  which is not actually the memory desired and may trigger a CPU
  exception

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-01 16:43:15 -07:00
Leandro Pereira e2ad85b696 tests: crypto: Update ECC Diffie-Hellman and DSA tests
These tests have been copied over from TinyCrypt and modified slightly
so that they compile on a non-POSIX system, with a minimal C library:
that's why it doesn't comply with Zephyr's coding style.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-01 10:35:06 -04:00
Leandro Pereira c0e9519d2e tests: crypto: Fix ccm_mode test after updating TinyCrypt to 0.2.7
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-01 10:35:06 -04:00
Punit Vara e379aed0f2 tests: irq_offload: Convert test case to use ztest
This patch reduces unnecessary output on console. Those things
are replaced by ztest framework APIs

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Punit Vara cbf40bc6d3 tests: errno: convert test case to use ztest
This patch convert normal test case to use ztest framework
APIs and remove unnecessary output.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Punit Vara a0fb3b4d67 tests: critical: Convert testcase into ztest
This commit uses ztest framework APIS to make ouput unified
with other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Anas Nashif b4598c19e3 tests: disable building of FXOS8700 sensor for all boards
This sensor was made dependent on certain boards, so building it with
all boards fails now. Disable until proper fix exists.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-28 09:40:38 -05:00
Aska Wu 545b17a03e tests: mqtt: Add a mqtt tls test case
This adds a "build-only" test case to check if any compile error
when CONFIG_MQTT_LIB_TLS is enabled.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-07-28 11:25:43 +03:00
Aska Wu fb79837862 net/mqtt: Convert mqtt lib to use net app API
Use net app API since we want to enable MQTT with TLS.
mqtt_connect() and mqtt_close() are added to build and close the
connection to the broker. The caller doesn't need to deal with
the net context anymore and the most of network setup code in
mqtt_publisher is removed.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-07-28 11:25:43 +03:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Inaky Perez-Gonzalez 3d498dd10c build: workaround build bug in tests
When an app uses a construct such as:

obj-y = main.o ../../../../samples/bluetooth/gatt/hrs.o

in its makefile, it causes said object module to be built in the
source tree, not in the object tree.

When building massively parallel, this usually resuls on the files
getting corrupted, leading to bugs such as:

https://jira.zephyrproject.org/browse/ZEP-2316
https://jira.zephyrproject.org/browse/ZEP-2317

src/../../../../samples/bluetooth/gatt/.gap.o.cmd:3: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:4: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:5: *** missing separator.  Stop.

as multiple build are trying to touch the same file in the source tree
and of course, race and causes a build bug.

We have known about this issue for a long time, but it requires
modifications in the build system that there is no time to tackle.

A suggested workaround is to include the source files into a local .c
file, so this is what this patch does, to remove the random noise.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-07-27 14:09:40 -04:00
Anas Nashif 85684d1737 tests: net: limit builds in a catch all test
This is a configuration that is unrealistic and used only to verify
Kconfig dependencies, trying to build this for every board fails due to
size limitations and due to unavailable device support on some of those
boards, building for qemu targets should be good enough.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 18:17:01 -04:00
Anas Nashif 52e7cdae57 tests: mqtt_subscriber: unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Anas Nashif 80010b04cb tests: mqtt_publisher: unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Anas Nashif ca0ad13a61 net: enable SLIP only on QEMU targets
In many networking tests we had to configure SLIP in the prj.conf
leaving those configurations Qemu specific. This change enables SLIP for
QEMU targets automatically and allows reuse of prj.conf for multiple
boards.

Additionally, the TUN options is removed. This option was not used
anywhere.

To enable self-contained networking tests that do not depend on SLIP, we
introduce the new option NET_TEST which disables TAP and allows testing
in QEMU without the need for a host interface.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Jukka Rissanen cb7b96bcc7 tests: net: trickle: Fix the Trickle parameters
The Imax doublings value was too large which caused overflow
of Imax_abs value, which then could cause Trickle test to fail.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-26 07:56:51 -05:00
Andrew Boie 5bcf3e97df timing_info: fix how stacks are referenced
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-26 05:53:14 -04:00
Kumar Gala dd6d34e7dc tests: net: second pass at cleanup tests to build on all platforms
The majority of these fixes adjust the memory limit needed to build the
various tests on systems with and without BLE support.  We also fixup
one test case that was able to run on platforms with 16k of memory.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-26 11:47:14 +03:00
Anas Nashif 1f9d8a9fd8 tests: trickle: exclude qemu_cortex_m3
Fails in CI, exclude while we investigate the issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-25 17:39:37 -05:00
Kumar Gala ebc948d818 tests: net: limit tests to boards with enough memory to build them
A number of the network tests have minimal memory requirements that not
all boards are able to meet.  Add in those memory requirements so we
don't attempt to build these tests for those platforms.  Utilized the
frdm_kl25z (with 16K of memory) and cc2650_sensortag (with 20K) to test
the limits.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-25 15:51:18 -05:00
Andrew Boie 416eca5b13 tests: fatal: enable x86 MMU stack protection
Show that this mechanism can detect stack overflows with the
guard page. We only do it once since are are in an alternate
IA HW task after it happens.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Andrew Boie 861b269128 sys_kernel: fix stack declaration
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Andrew Boie c3fce81d13 tests: fatal: fix stack size to k_thread_create
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Jukka Rissanen 45eac217a2 net: tests: Enable net tests for all suitable platforms
Instead of only running net tests in qemu_x86, enable those
tests in all suitable platforms. The tests are disabled for
bbc_microbit as that platform does not have enough memory.

The tests/net/arp and tests/net/ieee802154/l2 are disabled
for qemu_xtensa as the qemu crashed when running the tests.
For tests/net/all there was a weird build error for qemu_xtensa
so that test is also disabled for that platform.

Increased the trickle timeout to 3 secs in tests/net/trickle as
occacionally there was timeout error in qemu_cortex_m3 when the
test was run.

Jira: ZEP-2398

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-25 10:46:44 -04:00
Jukka Rissanen c99bc8cf53 tests: net: LLVM build warning from tests/net/dhcpv4
Duplicate config option in prj.conf file.

Jira: ZEP-2374

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-20 10:16:44 -05:00
Jukka Rissanen 5871fda709 tests: net: LLVM build warning from tests/net/udp
Missing (u8_t *) cast.

Jira: ZEP-2375

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-20 10:16:44 -05:00
Johan Hedberg 0ec2630882 Bluetooth: Mesh: Add initial implementation
Add an initial implementation for the Bluetooth Mesh Profile
Specification. The main code resides in subsys/bluetooth/host/mesh and
the public API can be found in include/bluetooth/mesh.h. There are a
couple of samples provided as well under samples/bluetooth and
tests/bluetooth.

The implementation covers all layers of the Bluetooth Mesh stack and
most optional features as well. The following is a list of some of
these features and the c-files where the implementation can be found:

 - GATT & Advertising bearers (proxy.c & adv.c)
 - Network Layer (net.c)
 - Lower and Upper Transport Layers (transport.c)
 - Access Layer (access.c)
 - Foundation Models, Server role (health.c & cfg.c)
 - Both PB-ADV and PB-GATT based provisioning (prov.c)
 - Low Power Node support (lpn.c)
 - Relay support (net.c)
 - GATT Proxy (proxy.c)

Notable features that are *not* part of the implementation:

 - Friend support (initial bits are in place in friend.c)
 - Provisioner support (low-value for typical Zephyr devices)
 - GATT Client (low-value for typical Zephyr devices)

Jira: ZEP-2360

Change-Id: Ic773113dbfd84878ff8cee7fe2bb948f0ace19ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-20 09:30:44 +03:00
Maureen Helm 719f1dac07 tests: adc: Add support for freedom and hexiwear boards
Adds support for freedom and hexiwear boards to the adc_api test.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Savinay Dharmappa cc48d40c5f tests: kernel: sprintf: Fix build warning.
As there is no suffix to represent a literal as unsigned short
it is typecasted. It is fix for Jira ZEP-2156

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-19 11:16:52 -04:00
Robert Chou 33c54ee6fd net: zoap: advance block context by checking M bit from block option
According to RFC7959 page 30, "The end of a block-wise transfer is
governed by the M bits in the Block options, _not_ by exhausting the
size estimates exchanges."

Therefore, we should check the M bit instead of total size (which
is not always available, too)

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-07-14 11:06:54 +03:00
David B. Kinder eeed8ce179 doc: fix wiki board references in non .rst files
Some README files referenced wiki articles that have been
moved to the doc area on the website.

Fixes #668

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-07-11 12:45:35 -05:00
Jukka Rissanen ee989be286 net: tcp: Fix sequence number validator
The sequence number validator was checking the seq numbers
incorrectly. This caused some valid RST packets to be dropped
and the TCP stream to hang.

Added also a TCP test case that tests the seq validator.

Jira: ZEP-2289

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-11 10:35:19 +03:00
Jukka Rissanen 0c5ef71c07 tests: net: 6lo: Remove CONFIG_MAIN_STACK_SIZE setting
No need to set the main stack size as the test runs just fine
without it.

Jira: ZEP-2341

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-11 10:31:11 +03:00
Andrew Boie e55fd562ec tests: protection: don't do exec tests on x86
The IA32 MMU has no concept of a "no execute" flag, this is
unfortunately only implemented in x86_64.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie ed1962a65c tests: net: remove overriden RAM size
The QEMU targets have plenty of RAM now and the current value
specified wasn't a multiple of a 4K page.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie 304f91c4cb tests: net: route: fix semaphore usage
A network stack thread was trying to use a semaphore before it was
initialized. Set it up at toplevel so it is ready to go.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie 65a9d2a94a kernel: make K_.*_INITIALIZER private to kernel
Upcoming memory protection features will be placing some additional
constraints on kernel objects:

- They need to reside in memory owned by the kernel and not the
application
- Certain kernel object validation schemes will require some run-time
initialization of all kernel objects before they can be used.

Per Ben these initializer macros were never intended to be public. It is
not forbidden to use them, but doing so requires care: the memory being
initialized must reside in kernel space, and extra runtime
initialization steps may need to be peformed before they are fully
usable as kernel objects. In particular, kernel subsystems or drivers
whose objects are already in kernel memory may still need to use these
macros if they define kernel objects as members of a larger data
structure.

It is intended that application developers instead use the
K_<object>_DEFINE macros, which will automatically put the object in the
right memory and add them to a section which can be iterated over at
boot to complete initiailization.

There was no K_WORK_DEFINE() macro for creating struct k_work objects,
this is now added.

k_poll_event and k_poll_signal are intended to be instatiated from
application memory and have not been changed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Tomasz Bursztyka dc33d8f49e tests/ieee802154: Fix accessing unmapped memory area
commit-id b07f20c143 had wrong fix.

Jira: ZEP-2331

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-10 09:25:32 -07:00
Geoff Gustafson 1405627c37 net: context: Use K_NO_WAIT instead of 0 for timeout
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2017-07-10 10:59:28 +03:00
Kumar Gala 9eddc82be3 i2c: remove I2C Slave Read config
The I2C Slave Read support isn't well defined and not actually supported
by any i2c driver at this point.  We can add this back when slave mode
is more thought out.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-07 10:01:38 -05:00
Jukka Rissanen 9c907fca43 net: tcp: Remove NET_TCP_HDR() macro and direct access to net_buf
Remove NET_TCP_HDR() macro as we cannot safely access TCP header
via it if the network packet header spans over multiple net_buf
fragments.

Fixed also the TCP unit tests so that they pass correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Jukka Rissanen 3604c391e6 net: udp: Remove NET_UDP_HDR() macro and direct access to net_buf
Remove NET_UDP_HDR() macro as we cannot safely access UDP header
via it if the network packet header spans over multiple net_buf
fragments.

Fixed also the UDP unit tests so that they pass correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Jukka Rissanen 8476da9d9b net: icmp: Remove NET_ICMP_HDR() macro and direct access to net_buf
Remove NET_ICMP_HDR() macro as we cannot safely access ICMP header
via it if the network packet header spans over multiple net_buf
fragments.

Jira: ZEP-2306

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Tomasz Bursztyka b07f20c143 tests/ieee802154: Fix a null pointer deferencing
Jira: ZEP-2331

Reported-by Andrew Boie <andrew.p.boie@intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-07 12:41:41 +03:00
Jukka Rissanen 90fc27e652 tests: net: ip-addr: Fix null pointer access in the test
IP-address test was accessing NULL pointer.

Jira: ZEP-2332

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-06 09:17:53 -07:00
Anas Nashif 5f63386c34 tests: crypto: fix coding style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-06 10:34:41 -05:00
Kumar Gala 8f77cddc77 tests: crypto: sha256: limit to systems with >48k of memory
We fail to build this test on stm32f3_disco which has 40k of SRAM.
Bump up the min_ram requirement to 48k.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-06 09:53:00 -05:00
Anas Nashif 8d108c9d59 tests: mbedtls: cleanup prj.conf
Remove platform specific option CONFIG_ARC_INIT and a copy/pasted
comment with "#nothing here".

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 52a4916cab tests: crypto: do not build when DEBUG is enabled
The external mbedTLS library seems to have some issues when DEBUG is
enabled, so disable this here becauase we will not change external 3rd
party code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 882c19ddbc tests: remove build_only tag
build_only is set to false by default, so remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif c364e06ccb tests: move spi test under tests/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif d7e15aa415 benchmark: footprint: fixed testcase
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 68d7a207ae ethernet: fix Kconfig option for ETHERNET
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif c01c074b5b net: fix wrong Kconfig
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT should be used instead of
CONFIG_NET_IFACE_UNICAST_IPV6_ADDR_COUNT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Johan Hedberg 30beef9419 Bluetooth: GATT Introduce BT_GATT_CCC_MAX helper define
The worst-case maximum number of CCC entries we need is actually
MAX_CONN + MAX_PAIRED. Provide a helper define for it and use it
whenever appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-04 17:30:40 +03:00
Tomasz Bursztyka 37af7b5096 tests/ieee802154: Fix how is initialized the driver lock in l2 test
The test starts the last one: after the driver and the net stack.
However, the net stack (due to DAD and else) will already try to send
some packet, resulting it giving a uninitialized semaphore. But once
properly initialized, this semaphore will end up with a non-zero count
when the test will start: thus reseting it to 0 before running the
tests.

Jira: ZEP-2319

Reported-by Andrew Boie <andrew.p.boie@intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-03 20:58:57 -04:00
Johan Hedberg 7a79101fd5 Bluetooth: tests: Remove unused prj_nimble.conf files
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-03 08:22:58 -04:00
Jean-Paul Etienne b31b41604e tests: crypto: include back riscv32 arch for ecc_dh, ecc_dsa and mbedtls
Issue fixed by commit "riscv32: fixed context restore upon exiting ISR"

Jira: ZEP-2020

Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-06-30 06:31:51 -04:00
Kumar Gala 8953db8008 tests: tickless: fix building of test
Build issues caused by commit fe882f407d
which missed camel case conversion of _TimestampOpen, _TimestampRead,
and _TimestampClose.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 13:14:18 -05:00
Kumar Gala 534beb34c9 tests: boot_time: cleanup boot_time test to work on ARM
Enabled the boot_time test on ARM SoCs, set __start_time_stamp on ARM
since we don't have a free running counter similar to TSC on x86.
Also moved to printing the values out as %u to increase the range of
values.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:08:59 -04:00
Kumar Gala d3d9abadbe tests: shell: Filter on UART_CONSOLE support to enable more boards
The shell tests were limited to running on just qemu_x86 platform, we
can run them on any platform with UART_CONSOLE support so move to using
a filter.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:07:31 -04:00
Punit Vara fe882f407d tests: Remove camel case and fix coding style
Test whichever had Camel case defined for functions and variables have
been replaced.

Following warnings have been fixed in test cases as well.
- line over 80 characters
- Macros with flow control statements should be avoided
- Macros with complex values should be enclosed in parentheses
- break quoted strings at a space character
- do not add new typedefs
- Comparisons should place the constant on the right
  side of the test
- suspect code indent for conditional statements
- Missing a blank line after declarations
- macros should not use a trailing semicolon
- Macros with multiple statements should be
  enclosed in a do - while loop
- do not use C99 // comments

JIRA: ZEP-2249

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-06-29 07:00:50 -04:00
Anas Nashif b3ae274a62 tests: fix PCI test using 'supported' keyword
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:51:40 -05:00
Anas Nashif d1e562c924 tests: replace filters in testcase files
Where possible, replace the use of filter with newly added keywords.
This will speed things up and in some cases add more coverage due to bad
filters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:51:40 -05:00
Anas Nashif 6c05ccb226 tests: convert testcase.ini to new format
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:20:36 -05:00
Paul Sokolovsky b650fa8a72 tests: net: Add test for Sockets API UDP socket/bind/connect/send/recv
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-06-28 16:07:55 +03:00
Andrzej Puzdrowski 8b7a8448ab Drivers: flash: NRF5x: synchronous mode for co-operation with BLE radio
In added mode flash operation are performed in timeslice
(in radio idle time).
Kconfig for mode enabling CONFIG_SOC_FLASH_NRF5_RADIO_SYNC.

Erase and write API implementations were rewritten and preserved against
concurrent execution.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-28 12:29:50 +02:00
Johan Hedberg e094560dbc Bluetooth: tests: Fix left-over issues from bt_gatt_service() removal
The new GATT service registration API is bt_gatt_service_register(),
which takes a bt_gatt_service object pointer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-27 19:10:43 -04:00
Anas Nashif 6ff291a174 tests: do not exclude quark_d2000_crb
quark_d2000_crb does not build net/bluetooth tests by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Anas Nashif 3c50f7aa12 tests: samples: remove duplicate filtering
We have many testcases doing filtering both on the architecture level
and the platform level, which is redundant. Also many testcases are
running the same test twice on the same SoC for no good reason, cleanup
the tests and cleanup the filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Johann Fischer 6dbe738d0e tests: dma: fix chan_blen_transfer
Use sizeof instead of strlen to get the correct buffer
length and initialize rx buffer with zeros before the dma
transfer.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-06-23 15:56:08 -04:00
Stephen Smalley 0ed343070c tests: protection: add testcase.yaml
commit d859295be9 ("tests: protection: convert to testcase.yaml")
removed testcase.ini but did not add an equivalent testcase.yaml.
Add it.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-22 16:15:32 -04:00
Vinayak Kariappa Chettimada 46f9489704 Bluetooth: controller: Add radio fast ramp feature
Added implementation to use nRF radio's fast ramp up mode.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-22 18:48:15 +03:00
Anas Nashif d859295be9 tests: protection: convert to testcase.yaml
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 22:25:14 -04:00
Stephen Smalley c997577670 tests: Add a self-protection test suite
Add a self-protection test suite with a set of tests
to check whether one can overwrite read-only data
and text, and whether one can execute from data,
stack, or heap buffers.  These tests are modeled after
a subset of the lkdtm tests in the Linux kernel.

These tests have twice caught bugs in the Zephyr NXP MPU
driver, once during initial testing/review of the code
(in its earliest forms on gerrit, reported to the original
author there) and most recently the regression introduced
by commit bacbea6e21 ("arm: nxp: mpu: Rework handling
of region descriptor 0"), which was fixed by
commit a8aa9d4f3dbbe8 ("arm: nxp: mpu: Fix region descriptor
0 attributes") after being reported.

This is intended to be a testsuite of self-protection features
rather than just a test of MPU functionality.  It is envisioned
that these tests will be expanded to cover a wider range of
protection features beyond just memory protection, and the
current tests are independent of any particular enforcement
mechanism (e.g. MPU, MMU, or other).

The tests are intended to be cross-platform, and have been
built and run on both x86- and ARM-based boards.  The tests
currently fail on x86-based boards, but this is an accurate
reflection of current protections and should change as MMU
support arrives.

The tests leverage the ztest framework, making them suitable
for incorporation into automated regression testing for Zephyr.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-21 21:52:50 -04:00
Stephen Smalley 083fdf352b tests/ztest: Add ztest_test_pass()
ztest provides a ztest_test_fail() interface to fail the currently
running test, but does not provide an equivalent ztest_test_pass().
Normally a test passes just by returning without an assertion failure
or other call to ztest_test_fail().  However, if the correct behavior
for a test is to trigger a fatal fault (as with tests/kernel/fatal or
protection or MPU tests), then we need a way for the test to pass the
currently running test before aborting the current thread.
Otherwise, ztest hangs forever in run_test() on the
k_sem_take(&test_end_signal, K_FOREVER) call.  Add
a ztest_test_pass() interface and implement it for kernel and
userspace variants of ztest.  This interface will be used in the
protection tests.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-21 21:52:50 -04:00
Anas Nashif 60e752a9f9 tests: dns: do not set as slow test
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen cc3cee0017 tests: net: context: Do not print error for passed test
It is confusing if we print timeout error when expecting
a timeout to happen. So for timeout test, do not print
an error message as the timeout is suppose to happen.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen 269e53609b tests: net: tcp: Fix tests and run them automatically
The TCP tests had several failures because of unnecessary
Kconfig options. These are now fixed and the TCP tests are
also run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen dcbe20dcb0 tests: net: mld: Fix tests and run them automatically
The MLD (Multicast Listener Discovery) tests had a failure.
This is now fixed and the MLD tests are also run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen e5337672e1 tests: net: ipv6: Fix tests and run them automatically
The IPv6 tests had failures and the tests did not pass
properly. These are now fixed and the tests are also
run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen e9368af1b4 tests: net: buf: Run the net_buf tests automatically
The test app works so it can be run automatically.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif cc24f4b03c tests: samples: convert testcase files to yaml
This will prepare test cases and samples with metadata and information
that will be consumed by the sanitycheck script which will be changed to
parse YAML files instead of ini.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Carles Cufi 4053470f62 Bluetooth: controller: Add inital support for Controller-based privacy
This initial commit adds the following:

* Handling of privacy HCI commands
* New Link Layer filter module for both whitelist and resolving list
* Advertising RPA generation with timeouts

Follow-up commits will expand the functionality.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-20 15:20:09 +03:00
Andrew Boie 0f669132a0 kernel: remove gdb_server
This is unmaintained and currently has no known users. It was
added to support a Wind River project. If in the future we need it
again, we should re-introduce it with an exception-based mechanism
for catching out-of-bounds memory queries from the debugger.

The mem_safe subsystem is also removed, it is only used by the
GDB server. If its functionality is needed in the future, it
shoudl be replaced with an exception-based mechanism.

The _image_{ram, rom, text}_{start, end} linker variables have
been left in place, they will be re-purposed and expanded to
support memory protection.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-19 14:29:40 -04:00
Anas Nashif af416a98b0 tests: pipe: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif dc57fa61bf tests: pipe: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif f6775bc67b tests: timer_monotonic: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a1ae2f929 tests: timer_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 00b55663f1 tests: schedule_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b593d35762 tests: thread_init: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 115ce02a3d tests: rename cdata -> custom_data
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c49dbe4e22 tests: threads_scheduling -> threads/scheduling
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 204e782c15 tests: threads_lifecycle/ -> threads/lifecycle
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 47e115a4b1 tests: threads_customdata/ -> threads/customdata
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif cff71db53b tests: queue: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 85cc533247 tests: profiling_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 183f045755 tests: poll: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 3521e2e5e7 tests: pending: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 93bcc957da tests: obj_tracing: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 3ad53365d6 tests: mutex_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif fbe4f16bc7 tests: mutex: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 0f4329780a tests: mbox: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 31ff9f2ad5 tests: move ipm test to drivers
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 73195eb196 tests: ipm: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b778ec3604 tests: fp_sharing: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a93489935 tests: fifo: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 52a38ffd8d tests: critical: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 072c3d110a tests: common: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 99b39a6ff3 tests: bitfield: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif adc4889afe tests: arm_runtime_nmi: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif e4a963c5d1 tests: arm_irq_vector_table: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a0875111c tests: alert_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c7cd5d260a tests: sleep: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 5a0842d5d2 tests: put tickless tests together
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif ffa850d86f tests: workq_api: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c31a11c591 tests: work_queue: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 520d3c0fbf tests: workq_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif f268b6acf2 tests: mem_heap: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 27f32b9d56 tests: mem_pool_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b787eff65b tests: mem_pool_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 16cfaac754 tests: mem_pool: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 26c7ac1f4f tests: mslab_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9da45a200 tests: mslab_concept: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif d744a2709e tests: mslab_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 9541ebc7a3 tests: rename test directory for mem_pool
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c51e80e3b7 tests: rename test directory for mem_slab
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1803009eb5 tests: rename test directory for fifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9fe253422 tests: rename test directory for lifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a6292a1615 tests: rename test directory for alert
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
David B. Kinder ddbf1255a9 test: fix misspellings
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-17 22:34:45 -04:00
Anas Nashif 2d970a2cbd tests: rename test directory test_bluetooth -> bluetooth
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif ea1addbb3c tests: rename test directory test_loop_transfer -> loop_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif fcb1d175e6 tests: rename test directory test_chan_blen_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1ac45f01 tests: rename test directory test_sha256 -> sha256
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 0772abff24 tests: rename test directory test_mbedtls -> mbedtls
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 38fca5cb5d tests: rename test directory test_hmac_prng -> hmac_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif abaa5cb42f tests: rename test directory test_hmac -> hmac
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 4ce66b728f tests: rename test directory test_ecc_dh -> ecc_dh
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif dfe3195db8 tests: rename test directory test_ecc_dsa -> ecc_dsa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif d8dfdceb65 tests: rename test directory test_ctr_prng -> ctr_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 3c3aac9e44 tests: rename test directory test_ctr_mode -> ctr_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif e10e013082 tests: rename test directory test_cmac_mode -> cmac_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 99b8dc0534 tests: rename test directory test_ccm_mode -> ccm_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1a4a1284 tests: rename test directory test_cbc_mode -> cbc_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif f18ef22824 tests: rename test directory test_aes -> aes
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Johan Hedberg 9703927f84 net: buf: Move net_buf_pool objects to dedicated linker area
Moving the net_buf_pool objects to a dedicated area lets us access
them by array offset into this area instead of directly by pointer.
This helps reduce the size of net_buf objects by 4 bytes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 72567677e7 net: pkt: Fix net_pkt_split()
The net_pkt_split() was incorrectly checking fragA pointer
even before it was allocated.

The unit test is fixed and converted to ztest.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 096a9984b2 tests: net: ipv6_fragment: Fix llvm compiler warning
llvm complains about char* -> u8_t* type conversion.

tests/net/ipv6_fragment/src/main.c:645:52: warning:
  passing 'char [11]' to parameter of type 'const u8_t *' (aka
  'const unsigned char *') converts between pointers to integer
  types with different sign [-Wpointer-sign]
        bool written = net_pkt_append_all(pkt, data_len, data,

Jira: ZEP-2274

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 16:07:08 +03:00
Adithya Baglody be1cb961ad tests: benchmark: boot_time: Reading time stamps made arch agnostic
1. Changed _tsc_read() to k_cycles_get_32(). Thus reading the
time stamp will be agnostic of the architecutre used.
2. Changed the variable names from *_tsc to *_time_stamp.

JIRA: ZEP-1426

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-06-16 07:37:37 -05:00
Kumar Gala 276794b0d7 tests: benchmarks: footprint: really enable floating point on arm
Update the arm.conf to enable CONFIG_FLOAT for the float test and use a
filter on that so we only run/build the test on SoCs/boards that support
floating point hardware.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2970ffff53 tests: benchmarks: footprint: build on ARM
Enable all footprint tests to build on ARM.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2f9478614a tests: benchmarks: footprint: fix tag typo
testcase.ini had a typo for footprint-float test.  tag was 'ootprint'
should have been 'footprint'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz d837a6ec4b Bluetooth: GATT: Add GAP service by default
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Vinayak Kariappa Chettimada 51d6bdb2ff Bluetooth: controller: LE Advertising Extensions PDU structs
Add Bluetooth v5.0 LE Advertising Extensions air interface
packet structures.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Luiz Augusto von Dentz aac4f488be tests: Add shell tests
This adds the following tests:

help tests:
shell_exec(help): 0
shell_exec(help dummy): 0
shell_exec(help invalid): -22

select tests:
shell_exec(select): 0
shell_exec(select dummy): 0
shell_exec(select invalid): -22

module tests:
shell_exec(dummy cmd1): 0
shell_exec(dummy cmd1 arg1): -22
shell_exec(dummy cmd2 arg1): 0
shell_exec(dummy cmd2 arg1 arg2): -22
shell_exec(dummy cmd3 arg1 arg2): 0
shell_exec(dummy cmd3 arg1 arg2 arg3): -22
shell_exec(dummy cmd4 arg1 arg2 arg3): -22
shell_exec(cmd1): 0
shell_exec(cmd1 arg1): -22
shell_exec(cmd2 arg1): 0
shell_exec(cmd2 arg1 arg2): -22
shell_exec(cmd3 arg1 arg2): 0
shell_exec(cmd3 arg1 arg2 arg3): -22
shell_exec(cmd4 arg1 arg2 arg3): -22

app handler tests:
shell_exec(cmd4 arg1 arg2 arg3): 0

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-09 18:54:27 -04:00
Andrew Boie 15ed8ec7ea tests: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie bcb4cfe9e4 tests: net: use main thread for test
The main thread was doing nothing but spawning another thread to perform
the test. Delete the alternate thread, and just do the test on the main
thread, adjusting stack size and priority as necessary.

Issue: ZEP-2236
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie 0b9f9f3023 tests: context: move idle test to the end
On some devices, when k_cpu_idle() was called we were getting
interrupts that were not the timer interrupt. On bbc_micro
a power clock control driver interrupt was happening instead
and k_cpu_idle() was returning without the system tick advancing,
failing the test.

The clock control interrupts seem to only happen early in device
boot; moving the idle test much later lets the test pass on this
board (and likely all other NRF5 based boards).

Issue: ZEP-2257
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 15:12:03 -04:00
Marti Bolivar 2a29bed8bb tests: json: add tests for arrays of objects
Add tests for the newly-added JSON_OBJ_DESCR_OBJ_ARRAY. These pass.

Note that this also adds test coverage for decoding an array of
maximum length, to avoid regressing the recently-introduced fix for
this edge case.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-06-08 15:11:23 -04:00
Anas Nashif 6e78701392 tests: remove obsolete usage of defrag
Also increase ISR stack to make it run on Quark D2000 CRB.

Jira: ZEP-2224
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 14:53:49 -04:00
Andrew Boie 000429c069 tests: fatal: increase coverage
- _SysFatalErrorHandler is supposed to be user-overridable.
The test case now installs its own handler to show that this
has happened properly.

- Use TC_PRINT() TC_ERROR() macros

- Since we have out own _SysFatalErrorHandler, show that
k_panic() works

- Show that _SysFatalErrorHandler gets invoked with the expected
reason code for some of the scenarios.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 13:49:36 -05:00
Anas Nashif 3405607d9e license: add missing licenses and copyright
We were missing license boilerplate in many files, add them

Jira: ZEP-1464

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 10:41:56 -04:00
Andrew Boie 68e8813896 tests: context: allow 2 ticks of slop
The hard-coded value of 10ms doesn't take the system configured
amount of ticks per second, nor does it account for an unlucky
tick advance which causes the test to fail very intermittently
in QEMU.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Andrew Boie 7a5150cd9f tests: context: make some failures less ambiguous
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Ravi kumar Veeramally 7a01988c64 net: 6lo: Fix source address uncompression
When src and dst addresses are compressed based on context
information, uncompression method should verify CID bit,
SAC and DAC bits and context ID's. But it has missed some
cases which resulted in invalid uncompressed IPv6 header.

e.g. CID is set, SAC is 0 and DAC is 1 and context id's provided.
Uncompression method assumed that src address is compressed based
on context information but it is not.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-06-06 09:06:01 -04:00
Andrew Boie 7b7504e2b9 schedule_api: don't exclude Nios II
Nothing about this test requires tickless idle and it's not even
turned on in prj.conf.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-02 14:47:01 -04:00
Anas Nashif 70b2a57d7a quark_d2000_crb: increase default stack size
Increase to 1024 to get more tests and sample running on this device
with only 8K of SRAM.

Change thread stack size in the mslab test to make it fit into this
board.

Jira: ZEP-2079
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-01 10:27:34 -04:00
Marti Bolivar 7a7bc707d1 tests: json: test JSON_OBJ_DESCR_*_NAMED
Add tests for new macro helpers that allow JSON field names to differ
from their corresponding C struct field names. These pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Marti Bolivar a8e08ecdad tests: json: fix sense of test result string
The other test strings are worded in the positive sense; keep things
consistent.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Adithya Baglody bee2b8499b tests: benchmark: Fixed build error from icx toolchain.
The error was generated by a piece of code that is
not currently being used. This piece of code was kept to measure
the overhead caused by the benchmarking code on x86.

JIRA:ZEP-2160

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-31 12:51:42 -04:00
Andrew Boie 5963904e4c printk: fix printing of long long types
64-bit types were not being handled properly and depending on the
calling convention could result in garbage values being printed.

We still truncate these to 32-bit values, the predominant use-case
is printing timestamp delta values which generally fit in a 32-bit
value. However we are no longer printing random stuff.

Test case for printk() updated appripriately to catch this regression.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-30 19:42:22 -04:00
Jukka Rissanen 3f46248bb5 tests: net: ipv6: Test IPv6 fragmentation sending
These tests make sure that the IPv6 fragments are build correctly
when a large IPv6 packet is being sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-30 11:21:51 +03:00
Luiz Augusto von Dentz e1a062e28b Bluetooth: shell: Use CONFIG_BLUETOOTH_SHELL
Remove existing commands supported by CONFIG_BLUETOOTH_SHELL and make
sure all .conf select it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Sharron LIU 189aa475e1 tests: kernel: added tests for k_mem_pool_alloc from isr
Added tests to invoke k_mem_pool_alloc() from isr context

Jira: ZEP-1631

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Sharron LIU ab6d4c1a42 tests: kernel: added tests for timeslice reset
Added test cases to verify timeslice reset among thread context
switching.

Jira: ZEP-948

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Adithya Baglody c0549aae75 tests: benchmark: app_kernel: Return values from kernel APIs are read.
Static code analysis reported some kernel APIs were used without
reading the return value. Since the benchmark doesn't need error
conditions, a simple read of the values followed by a ARG_UNUSED
is used to handle static code analysis errors.

JIRA: ZEP-2134

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-27 10:20:14 -04:00
Leandro Pereira 90a2d2fcba tests: clock: Initialize d64 value
CID: 167149
Jira: ZEP-2130
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-05-27 09:54:31 -04:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Paul Sokolovsky cc47918166 tests: net: ipv6: Fix possible NULL pointer dereference behind a macro
As this is a test, it's minor issue, but let's keep Coverity report
clean.

Coverity-CID: 169303

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-25 18:54:22 +03:00
Jukka Rissanen 3677caa37e tests: net: zoap: Add path uri matching tests
Test the match_path_uri() function that was fixed by previous
commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-25 18:49:56 +03:00
Inaky Perez-Gonzalez 13617b943d tc: remove */defaults.tc
These files are no longer used and can be removed.

Change-Id: I781256ab93b5364346d99cd4aac488762c437151
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-05-22 20:17:02 -04:00
Justin Watson 44f09663f9 tests: kernel: Fixed tickless test for Arduino Due.
Arduino Due now uses ASF. The timestamps.c file was still
using old register definitions.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-20 13:25:32 -04:00
Andrew Boie b1b58dc5ce bluetooth: at: enable CONFIG_SERIAL
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-19 16:33:16 -04:00
Michael Scott 5ace805097 tests/zoap: fix net_pkt leak in test_observer_client()
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-05-19 09:59:07 +03:00
Anas Nashif e9a7fa7fd7 tests: net: increase RAM for test
This tests enables all networking features and requires lots of RAM, so
increase the available RAM to avoid failures due to not enough RAM when
building.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 22:23:31 -04:00
Youvedeep Singh ff5b3249f4 tests: aio: Change reference voltage for AIO
Change reference voltage for Analog comparator to Internal reference
voltage.

Currently AIO is using External reference voltage (Reference A) and
external reference is set at 3.3V. In this usecase both reference
Voltage and AIO IP are set at 3.3V. So rising edge interrupt behaviour
will be unpredictable.

So by changing internal reference voltage to Internal (set at 1.09V)
interrupt will be generated as soon as Voltage on I/P will exceed it.

Jira: ZEP-1927

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 20:26:56 -04:00
Qiu Peiyang b0962e3bac tests: aio: port AIO cases to run on more platforms
AIO should be supported on more platforms. Adapt
this case to make it run on more platforms.
Also keep reference voltage for comprator as internal.

Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-05-18 20:26:56 -04:00
Maciek Borzecki fed96bf1bc misc: _char_out can be a static symbol
Fixes sparse warning:
<snip>/zephyr/zephyr/misc/printk.c:50:5: warning: symbol '_char_out' was not declared. Should it be static?

Change-Id: I5af0860e9f8f827002ae9a142b5924d3de8d51b6
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2017-05-18 12:41:56 -05:00
Jukka Rissanen 69b25c0788 net: conn: Check UDP and TCP checksum before accepting packet
We did not check UDP or TCP checksum to be valid after receiving
the packet. Fix this so that the checksum is validated when
packet is received in connection handler. As the checksum validation
can be resource intensive, do it after we have verified that
there is a connection handler for this connection.

The checksum calculation can be turned OFF if needed, but it is
ON by default.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-18 10:53:39 +03:00
Andrew Boie 2596daa4ae tests: fifo: extend cancel timeout limit
A non-tickless system with 10ms granularity was occasionally
taking up to 70ms for the cancellation to be propagated back.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-17 12:04:10 -04:00
Anas Nashif 876334c699 tests: net: reduce timeout of testcase
Use a reasonable timeout for the testcase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-17 16:35:26 +03:00
Vinayak Kariappa Chettimada a7afc75c8a Bluetooth: shell: Add GATT write cmd throughput measurement
Add shell command to test GATT write cmd throughput between
two test shell peers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-16 15:30:51 +03:00
Luiz Augusto von Dentz 4f019eab26 Bluetooth: shell: Remove forward declaration
It is possible to remove the forward declaration of l2cap_alloc_buf as
the recv pointer can be compared directly with chan pointer avoiding
using l2cap_ops directly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-14 17:54:46 +03:00
Vinayak Kariappa Chettimada 9fd04ea272 Bluetooth: shell: Add L2CAP throughput measurement
Added l2cap-metrics command to shell application which will
collect the rx-ed L2CAP CoC throughput.

Usage (local shell):
> l2cap-register <chan>
> l2cap-metrics on

  From peer shell:
  > l2cap-connect <chan>
  > l2cap-send 10

> l2cap-metrics
l2cap rate: 119225 bps.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-14 11:19:27 +03:00
Andrew Boie 636f609d66 tests: kernel: fatal: check stack overflow
For all arches except ARC, enable stack sentinel and test that
some common stack violations trigger exceptions.

For ARC, use the hardware stack checking feature.

Additional testcase.ini blocks may be added to do stack bounds checking
for MMU/MPU-based stack protection schemes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-13 15:14:41 -04:00
Andy Ross 73cb9586ce k_mem_pool: Complete rework
This patch amounts to a mostly complete rewrite of the k_mem_pool
allocator, which had been the source of historical complaints vs. the
one easily available in newlib.  The basic design of the allocator is
unchanged (it's still a 4-way buddy allocator), but the implementation
has made different choices throughout.  Major changes:

Space efficiency: The old implementation required ~2.66 bytes per
"smallest block" in overhead, plus 16 bytes per log4 "level" of the
allocation tree, plus a global tracking struct of 32 bytes and a very
surprising 12 byte overhead (in struct k_mem_block) per active
allocation on top of the returned data pointer.  This new allocator
uses a simple bit array as the only per-block storage and places the
free list into the freed blocks themselves, requiring only ~1.33 bits
per smallest block, 12 bytes per level, 32 byte globally and only 4
bytes of per-allocation bookeeping.  And it puts more of the generated
tree into BSS, slightly reducing binary sizes for non-trivial pool
sizes (even as the code size itself has increased a tiny bit).

IRQ safe: atomic operations on the store have been cut down to be at
most "4 bit sets and dlist operations" (i.e. a few dozen
instructions), reducing latency significantly and allowing us to lock
against interrupts cleanly from all APIs.  Allocations and frees can
be done from ISRs now without limitation (well, obviously you can't
sleep, so "timeout" must be K_NO_WAIT).

Deterministic performance: there is no more "defragmentation" step
that must be manually managed.  Block coalescing is done synchronously
at free time and takes constant time (strictly log4(num_levels)), as
the detection of four free "partner bits" is just a simple shift and
mask operation.

Cleaner behavior with odd sizes.  The old code assumed that the
specified maximum size would be a power of four multiple of the
minimum size, making use of non-standard buffer sizes problematic.
This implementation re-aligns the sub-blocks at each level and can
handle situations wehre alignment restrictions mean fewer than 4x will
be available.  If you want precise layout control, you can still
specify the sizes rigorously.  It just doesn't break if you don't.

More portable: the original implementation made use of GNU assembler
macros embedded inline within C __asm__ statements.  Not all
toolchains are actually backed by a GNU assembler even when the
support the GNU assembly syntax.  This is pure C, albeit with some
hairy macros to expand the compile-time-computed values.

Related changes that had to be rolled into this patch for bisectability:

* The new allocator has a firm minimum block size of 8 bytes (to store
  the dlist_node_t).  It will "work" with smaller requested min_size
  values, but obviously makes no firm promises about layout or how
  many will be available.  Unfortunately many of the tests were
  written with very small 4-byte minimum sizes and to assume exactly
  how many they could allocate.  Bump the sizes to match the allocator
  minimum.

* The mbox and pipes API made use of the internals of k_mem_block and
  had to be ported to the new scheme.  Blocks no longer store a
  backpointer to the pool that allocated them (it's an integer ID in a
  bitfield) , so if you want to "nullify" them you have to use the
  data pointer.

* test_mbox_api had a bug were it was prematurely freeing k_mem_blocks
  that it sent through the mailbox.  This worked in the old allocator
  because the memory wouldn't be touched when freed, but now we stuff
  list pointers in there and the bug was exposed.

* Remove test_mpool_options: the options (related to defragmentation
  behavior) tested no longer exist.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-05-13 14:39:41 -04:00
Vinayak Kariappa Chettimada 5effd68a9d Bluetooth: controller: Fix tests conf file to cover new features
Updated tests conf file with coverage for new feature Kconfig
options in the Controller. This is required to catch compile/
build regression.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-12 13:55:39 +03:00
Andrew Boie 68d3678abb tests: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 86468fc9a5 tests: kernel: common: adjust stack size
Use Kconfig for extra test case stack size, needed for Xtensa.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 12:47:23 -04:00
Paul Sokolovsky 2ddd620617 tests: kernel: errno: Add Newlib test config.
Added because previously, Zephyr used API incompatible with Newlib
for errno handling. Even with Newlib compatibility changes, we
override the function which is defined in Zephyr SDK libc.a, so
makes sense to ensure thsi works as expected.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 20:54:56 -04:00
Andrew Boie b1dd5ea50d tests: kernel: fatal: fix on ARC
Issue: ZEP-2114
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-10 20:13:07 -04:00
Paul Sokolovsky 3f50707672 kernel: queue, fifo: Add cancel_wait operation.
Currently, a queue/fifo getter chooses how long to wait for an
element. But there are scenarios when putter would know better,
there should be a way to expire getter's timeout to make it run
again. k_queue_cancel_wait() and k_fifo_cancel_wait() functions
do just that. They cause corresponding *_get() functions to return
with NULL value, as if timeout expired on getter's side (even
K_FOREVER).

This can be used to signal out of band conditions from putter to
getter, e.g. end of processing, error, configuration change, etc.
A specific event would be communicated to getter by other means
(e.g. using existing shared context structures).

Without this call, achieving the same effect would require e.g.
calling k_fifo_put() with a pointer to a special sentinal memory
structure - such structure would need to be allocated somewhere
and somehow, and getter would need to recognize it from a normal
data item. Having cancel_wait() functions offers an elegant
alternative. From this perspective, these calls can be seen as
an equivalent to e.g. k_fifo_put(fifo, NULL), except that such
call won't work in practice.

Change-Id: I47b7f690dc325a80943082bcf5345c41649e7024
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 09:40:33 -04:00
Sharron LIU 6c6182dba5 tests:kernel: added tests for printk left justifier
Added test case for printk the '-' indicator in format string
(left justifier).

Jira: ZEP-1599

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-08 09:43:37 -04:00
Marti Bolivar 88f33dcc1b tests: json: add json_escape() tests
These all pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-08 08:52:52 -04:00
Vinayak Chettimada fc6d8d1bc4 Bluetooth: controller: Scan Request Notifications
Implement the framework for LE Scan Request Received Event.
The feature is available under the Controller's advanced
features and will be selected implcitly when Bluetooth v5.0
LE Advertising Extensions feature is implemented.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-05 15:56:04 +03:00
Carles Cufi a1ff1a0933 Bluetooth: Consolidate flow control Kconfig
Since Controller to Host flow control is a feature that affects both
sides equally, move it to the top-level Kconfig file and consolidate its
use in both Controller and Host.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-04 18:09:31 +03:00
Luiz Augusto von Dentz ad4bb37b17 Bluetooth: shell: Fix deadlock when receiving L2CAP packet
The TX and RX pool needs to be split otherwise the TX code path may
consume all buffers causing the RX thread to deadlock which will
possible deadlock the TX thread as well in case it needs more credits.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-04 08:36:12 +03:00
Carles Cufi 7ebe7da736 Bluetooth: controller: Controller to Host flow control
The Bluetooth Specification allows for optional Controller to Host flow
control based on the same credit-based mechanism as the Host to
Controller one. This is particularly useful in 2-chip solutions where
the Host and the Controller are connected via a physical link (UART, SPI
or similar) where the Host is sometimes required to ask the Controller
to throttle its data traffic while still making sure that relevant
events get through the line.

This implementation is based on a simple queue of pending events and
data that is populated whenever the Controller detects that the Host is
out of buffers and then emptied whenever the Host notifies the
Controller that is ready to receive data again. Events relevant to the
connections are also queued to preserve the order of arrival.

At this point the Controller ignores the connection handle sent by the
Host and treats all connections equally, and it also queues events even
for connections that have no data pending in the queue. Both this items
can be improved if necessity arises.

Note that Number of Completed Packets will still flow freely from the
Controller to the Host regardless of the pending ACL data packets, which
might lead to inconsistencies in the sequential order of certain
operations that include bi-directional data transfer.

Jira: ZEP-1735

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-03 22:23:42 +03:00
Marti Bolivar 7e7a045fa9 tests: json: use JSON_OBJ_DESCR_PRIM
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-03 13:52:57 -04:00
Justin Watson 558281b096 arch: sam3x: update Kconfig options after move to SAM SoC family tree
The files for the Arduino Due needed to be updated to use the new
configuration when the SoC moved from the atmel_sam3 directory to
the atmel_sam/sam3x directory.

Jira: ZEP-2067

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-03 13:51:37 -04:00
Adithya Baglody d03b2496cd test: benchmarking: Timing metrics for the kernel
JIRA: ZEP-1822, ZEP-1823, ZEP-1825

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-03 08:46:30 -04:00
Rishi Khare f6f8fb0f47 kernel tests: fatal: added "ignore_faults" tag
This test generates a fault as part of the test,hence make the
 test-suite aware of that by tagging it.

Signed-off-by: Rishi Khare <rishi.khare@intel.com>
2017-05-03 08:16:38 -04:00
Paul Sokolovsky b7f6aaaa72 tests: uart_basic_api: Don't assume we can drink from IRQ firehose.
There're (at least) 2 UART TX interrupt causes: "tx fifo has more
room" and "transmission of tx fifo complete". Zephyr API has only
one function to enable TX interrupts, uart_irq_tx_enable(), so it's
fair to assume it enables interrupt for both conditions. But then
immediately after enabling TX IRQ, it will be fired with "tx fifo
has more room" cause. If ISR doesn't do anything to fill FIFO, on
some architectures, immediately after return from ISR, it will be
fired again (with no instruction progress in the main application
thread). That's exactly the situation with this test, and on ARM,
it leads to inifnite IRQ loop.

So, instead move call to uart_fifo_fill() inside ISR, and be sure
to disable TX IRQ after we transmitted enough characters.

Change-Id: Ibbd05acf96b01fdb128f08054819fd104d6dfae8
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-02 09:31:36 -04:00
Anas Nashif 1084bd5ed3 tests: crypto: reduce high timeout value
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Anas Nashif e40bd685f6 tests: net: set reasonable timeout on dns test
This test has been slowing daily tests for no good reason, timeout of
10800 is way too high.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Luiz Augusto von Dentz a03e068b03 Bluetooth: shell: Don't attempt to reuse channel
If the channel is already in use don't attempt to connect it a second
time.

Change-Id: I87bdaeadbe866b59c1a7975002699d9ef7a90c61
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-29 11:39:13 -04:00
Gil Pitney 70040f0e11 boards: Add support for the CC3220SF_LAUNCHXL board
CC3220SF_LAUNCHXL effectively replaces the CC3200_LAUNCHXL,
with support for the CC3220SF SoC, which is an update for
the CC3200 SoC.

This is supported by the Texas Instruments CC3220 SDK.

Jira: ZEP-1958

Change-Id: I2484d3ee87b7f909c783597d95128f2b45db36f2
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Ramesh Thomas c759ed1f94 samples: power: Time is passed as milliseconds in tickless kernel
In tickless kernel mode, time parameter of _sys_soc_suspend is in
milliseconds. Based on the kernel mode use the correct
mulitplier to convert to seconds.

Jira:1821
Change-Id: Idf156f56ece79a82729ebb124d1552a5eeb69e25
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:35 +00:00
Ramesh Thomas 700712f869 samples: tickless: Enables tickless kernel option in some apps
Adds changes to enable existing kernel and timer tests and samples to
be used to test the tickless kernel feature.

Updated samples/philosophers and tests/kernel/timer/timer_api apps

Run the tests using following commands
make pristine && make BOARD=<board> CONF_FILE=prj_tickless.conf qemu
Board could be any of the following
qemu_x86
quark_se_c1000_devboard

Jira: ZEP-339 ZEP-1812
Change-Id: I1530b19b79ddeb0e2181594caf15f3ac28ff51f4
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:33 +00:00
Andrew Boie 73abd32a7d kernel: expose struct k_thread implementation
Historically, space for struct k_thread was always carved out of the
thread's stack region. However, we want more control on where this data
will reside; in memory protection scenarios the stack may only be used
for actual stack data and nothing else.

On some platforms (particularly ARM), including kernel_arch_data.h from
the toplevel kernel.h exposes intractable circular dependency issues.
We create a new per-arch header "kernel_arch_thread.h" with very limited
scope; it only defines the three data structures necessary to instantiate
the arch-specific bits of a struct k_thread.

Change-Id: I3a55b4ed4270512e58cf671f327bb033ad7f4a4f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-26 16:29:06 +00:00
Andrew Boie ca441162a7 tests: add fatal test case
We want to show that if a non-essential thread gets a fatal exception,
that thread gets aborted but the rest of the system works properly.

We also test that k_oops() does the same.

Issue: ZEP-2052
Change-Id: I0f88bcae865bf12bb91bb55e50e8ac9721672434
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie 7827b7bf4a x86: exception-assisted panic/oops support
We reserve a specific vector in the IDT to trigger when we want to
enter a fatal exception state from software.

Disabled for drivers/build_all tests as we were up to the ROM limit
on Quark D2000.

Issue: ZEP-843
Change-Id: I4de7f025fba0691d07bcc3b3f0925973834496a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Kumar Gala eaaa175b92 tests: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:49 -05:00
Kumar Gala a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Jukka Rissanen f498a90b77 net: pkt: Make the debug print eye friendly
Print "pkt" instead of "Pkt" when printing network packet
pointer value.

Change-Id: Id4225be9c55807def3d892d372cdfc5c79c871fc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka f3ff4f7bd3 net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_
Only 2 attributes lacked this prefix, which makes sense to have, so
applying it accordingly and changing the helpers as well.

Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka e5896906f6 net: Rename all *_BUF() macros to *_HDR()
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.

Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Kumar Gala 3c454017b4 Merge "Merge bluetooth branch into master" 2017-04-20 16:55:36 +00:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Johan Hedberg c52fa3c424 Merge bluetooth branch into master
- newlib related fixes for the AT parser
 - Channel Selection Algorithm #2 support (Bluetooth 5.0 feature)
 - Better tracking of outgoing data (with callback support)
 - Various smaller cleanups & fixes

----------------------------------------------------------------
Carles Cufi (3):
      Bluetooth: HCI: Add Bluetooth 5.0 LE commands and events
      Bluetooth: HCI: Naming consistency tweaks
      Bluetooth: Use event masks instead of bits in controller and host

Johan Hedberg (8):
      Bluetooth: hci_raw: Fix ECC support
      Bluetooth: Add support for tracking transmitted packets
      Bluetooth: ATT: Enforce flow for incoming requests & indications
      Bluetooth: SMP: Track when last key distribution PDU has been sent
      Bluetooth: Introduce a timeout for synchronous HCI command sending
      Bluetooth: ATT: Fix bogus CONTAINER_OF() usage
      Bluetooth: Introduce flow control for outgoing ATT packets
      Bluetooth: ATT: Start response timer only after actual transmission

Kumar Gala (3):
      Bluetooth: AT: use explicit unsigned char to avoid array subscript error
      Bluetooth: AT: Fix building with newlib
      Bluetooth: AT: Unit: Fixup include search path

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Add TX pools for TCP
      Bluetooth: L2CAP: Try to allocate segment from the original pool
      net: buf: Add net_buf_reset
      Bluetooth: L2CAP: Reuse request buffer to respond

Vinayak Chettimada (5):
      Bluetooth: controller: Rename channel/chnl to chan
      Bluetooth: HCI: Add Bluetooth 5.0 FeatureSet field's bit mapping
      Bluetooth: Fix missing LE conn param req bit in set LE evt mask
      Bluetooth: controller: Support BT 5.0 feature set bit fields
      Bluetooth: controller: Channel Selection Algorithm #2

 include/bluetooth/hci.h                           | 495 +++++++++++++++--
 include/bluetooth/l2cap.h                         |   2 +-
 include/net/buf.h                                 |   9 +
 samples/bluetooth/ipsp/src/main.c                 |  15 +
 subsys/bluetooth/controller/Kconfig               |   7 +
 subsys/bluetooth/controller/hal/nrf5/radio.c      |   4 +-
 subsys/bluetooth/controller/hal/radio.h           |   2 +-
 subsys/bluetooth/controller/hci/hci.c             |  95 ++--
 subsys/bluetooth/controller/ll_sw/ctrl.c          | 622 ++++++++++++++++------
 subsys/bluetooth/controller/ll_sw/ctrl.h          |  71 ++-
 subsys/bluetooth/controller/ll_sw/ctrl_internal.h |  25 +-
 subsys/bluetooth/controller/ll_sw/ll.c            |  24 +-
 subsys/bluetooth/controller/ll_sw/pdu.h           |  12 +-
 subsys/bluetooth/host/Kconfig                     |  31 ++
 subsys/bluetooth/host/at.c                        |   2 +-
 subsys/bluetooth/host/at.h                        |   2 +-
 subsys/bluetooth/host/att.c                       | 230 ++++++--
 subsys/bluetooth/host/conn.c                      | 111 +++-
 subsys/bluetooth/host/conn_internal.h             |  23 +-
 subsys/bluetooth/host/hci_core.c                  | 163 +++---
 subsys/bluetooth/host/hci_core.h                  |   3 +-
 subsys/bluetooth/host/hci_ecc.c                   |   2 +-
 subsys/bluetooth/host/hci_raw.c                   |   4 +
 subsys/bluetooth/host/hfp_hf.c                    |   2 +
 subsys/bluetooth/host/l2cap.c                     |  79 ++-
 subsys/bluetooth/host/l2cap_internal.h            |  12 +-
 subsys/bluetooth/host/sdp.c                       |   2 +
 subsys/bluetooth/host/smp.c                       | 117 +++-
 subsys/net/buf.c                                  |  12 +-
 tests/bluetooth/init/prj_controller_4_0.conf      |   1 +
 tests/unit/bluetooth/at/src/Makefile              |   2 +-
 tests/unit/bluetooth/at/src/main.c                |   2 +-
 32 files changed, 1695 insertions(+), 488 deletions(-)

Change-Id: I17f9e49e1347a38bc78be3bdcaa596e41d83da56
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-20 18:45:15 +03:00
Anas Nashif 0b1d41d31d kernel: remove mentions of obsolete CONFIG_NANO_TIMERS
Change-Id: I0a2d6caae6d37b45968e61be8eaf7c4ebb6fdc46
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-20 12:27:36 +00:00
Vinayak Chettimada 392b5deacb Bluetooth: controller: Channel Selection Algorithm #2
Add Bluetooth 5.0 LE Channel Selection Algorithm #2 feature

Jira: ZEP-2033

Change-id: Ic1155b4399882b89cab33cac78b08b7b39ff6f9d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-20 08:58:09 +03:00
Kumar Gala a87e6e1cce Bluetooth: AT: Unit: Fixup include search path
Because of the way we build we can't expect relative paths back into the
Zephyr code base to work properlly.  This just happens to work on some
systems because of the various -I that exist and one hits the right
number of subdirs between it and where the "at.h" lives.  Lets instead
add the Zephyr root as a include path and explicit do a relative path
from the root to get the header.

We end up with a build failure with newlib enabled on galileo because it
ends up not having an include path that gets us to the proper spot with
the various ../../.. ...

Change-Id: I48b4dc2dffb76314f380efbcbbe25957ff5e9e07
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 08:58:09 +03:00
Anas Nashif 45a7e5d076 kernel: remove legacy.h and MDEF support
Change-Id: I953797f6965354c5b599f4ad91d63901401d2632
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 10:59:35 -05:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Andrew Boie 2d9a559df8 tests: crypto: enable on other arches
Some tests have large RAM requirements, appropriate filters added.
Redundant 'build_only = false' removed.

Issue: ZEP-1721
Change-Id: Id8b06b2ea8a63cf19cf155a75f1513810c383521
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-18 20:51:39 +00:00
Youvedeep Singh 76fc2f92df test_tickless: Change test_tickless location to tests/kernel/test_tickless/
Tickless test dependency on legacy API is resolved, Changing
test directory from tests/legacy/kernel/test_tickless to
tests/kernel/test_tickless/.

Jira: ZEP-2008

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Change-Id: I0b53ae6eff3a915d988d3234592eb5f8b425b371
2017-04-18 22:25:01 +05:30
Youvedeep Singh 576cfd9e74 test_tickless: replacing depreciated APIs with new one.
As part of Zephyr release 1.9 some APIs will be depreciated. This patch
replaces two of such APIs (task_sleep(ticks), sys_tick_get_32()) with
new ones (k_sleep(ms), k_uptime_get_32()).

Jira: ZEP-2008

Change-Id: Ic0e05906dadfb2ddaea9d0a8b738294dc81430f9
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 22:08:19 +05:30
Youvedeep Singh 9031c55566 test_sleep: move test_sleep from tests/legacy/kernel to tests/kernel
As test_sleep does not have dependency over legacy APIs.
So moving files from tests/legacy/kernel to tests/kernel.

Jira: ZEP-2009

Change-Id: I2439391ba6d0a194d07a0d1b48911d37b2f493b0
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:39:15 +05:30
Youvedeep Singh d353800879 test_sleep: replacing depreciated APIs with new one.
As part of Zephyr Release 1.9 some APIs will be depreciated.
This patch replaces APIs related to semophore init, kernel sleep,
task spawn etc.

Jira: ZEP-2009

Change-Id: I1fe09e9592f503c3413d51857fd740703173c042
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:26:58 +05:30
Sharron LIU eea12f6f14 tests: kernel: add tickless test
Added test cases to verify tickless idle concepts defined in
https://www.zephyrproject.org/doc/subsystems/power_management.html#tickless-idle

Test points:
verify system clock recovery after exiting tickless idle;
verify slicing scheduler behaves as expected

Jira: ZEP-339

Change-Id: Ic0a86d725e9692aa217375cedc7396372a026a88
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-18 01:50:47 +00:00
Kumar Gala 7fb0e36060 tests: sprintf: cleanup to work with newlib
newlib doesn't implement the internal buffer the same way that minimal
libc does, so only run that check with min libc (ie !CONFIG_NEWLIB_LIBC).
Also, reported the length we did get if the buffer is to big.  Finally
include <stdarg.h> since we are dealing with va_lists and such.

Change-Id: I6b23e448e5785df978ac8c2757099e2b8aaace54
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-18 00:27:33 +00:00
Kumar Gala ab8a3b2c0d tests: app_kernel: limit to systems with >32K of memory
We need a bit over 32k of memory to build/run the app_kernel benchmarks.

Change-Id: Iddfeb073f8ea87dc6323775a288b83efa88fdaea
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 16:12:57 -05:00
Anas Nashif 4c80a2fb71 tests: crypto: disable 2 tests that are ridiculously slow
Change-Id: I54194c06a1f3dfe1412dbfff50e9866134cf881a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e8abb973e1 tests: app_kernel: enable ARM for this benchmark
Change-Id: I7d45bd5e84f174a951170c7b4ab464110976a00f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e521d6e888 tests: remove legacy tag from ported tests
Change-Id: I77484a704062013577417e7d05ad65cf268d74b2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Kumar Gala 4ada031fb5 unit: Fixup crc unit test for zassert change
We renamed ztest's assert to zassert and the crc test case wasn't
updated to match so it doesn't build.

Change-Id: I67cd5bb6eef0875f31b8825d5c3aa5e1fa46af04
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 06:08:27 -05:00
Anas Nashif 0ac3a231f1 tests: rename ztests' assert > zassert
Change-Id: Ibccc5da75ad42bc035052e5946f977a49f6a7d2f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 00:07:06 -04:00
Anas Nashif d3af7f75c9 Merge "Merge net branch into master" 2017-04-14 01:43:34 +00:00
Kumar Gala c7bc909914 tests/ztest: rename assert macros to be zephyr specific
ztest has a number of assert style macros and used a baseline assert()
that varies from the system definition of assert() so lets rename
everything as zassert to be clear.

Change-Id: I7f176b3bae94d1045054d665be8b5bda947e5bb0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-13 21:17:33 +00:00
Andrew Boie b53145c6bc ztest: apply extra stack size to ztest stack
The directive exists for platforms that require more stack space than
usual. However, it wasn't being applied to the ztest thread stack
which ztest-enabled cases are run on.

Fixes numerous failures on xtensa simulator targets.

Change-Id: Iafa84de002421f03729c0f0cdeefdea51842ae32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:45:36 -07:00
Andrew Boie a883722fb6 tests: test_pipe_api: increase stack size
A recent patch added some new tests here. Unfortunately,
the current stack size value of 512 was too small for Xtensa.
Increase it to 1024.

Change-Id: I16c52b74412cbd7665e774ce3baed260885ddb9b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:51 +00:00
Andrew Boie d75fa6bc13 tests: sprintf: increase stack size
A recent patch pinned the stack size for this test at 1024
instead of the platform default. This value wasn't sufficient
on Xtensa. Set to 2048, which was the default on most platforms.

Change-Id: I9a9d5fd448d2377aaf782c2c093a16147f31886a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:24 +00:00
Jukka Rissanen bed1117423 net: tests: Enables all net kconfig options in one test case
This creates a test case that enables all the currently known
network related Kconfig options. This is useful so that we can
compile test various Kconfig options. Note that the result binary
is not meant to be run anywhere and it will probably not run as
some of the enabled options do not make sense in real life.

Change-Id: Iede36131b43d95acb78b4094004626e1b86e0f95
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:44 +03:00
Tomasz Bursztyka 000539ecd2 tests/net: arp_input() unref the buffer on success
Since commit-id 1ab40390c9 arp_input()
unrefs the buffer on success (NET_OK) so no need to do it afterward.

Change-Id: I84ab7e8eb07f50d52b329e4c025d88753a5de4db
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:43 +03:00
Tomasz Bursztyka 19a321090c tests/net: MQTT tests should be under lib
moving tests/net/mqtt_* tests under tests/net/lib/

Change-Id: I966a6b303ad4d0fb467f277a4a7379b29fe40e98
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:43 +03:00
Jukka Rissanen 31d3406efa net: rpl: Fix the statistics collection
The Kconfig.rpl file was missing option to actually collect
RPL statistics. Unified the config option name to be
CONFIG_NET_STATISTICS_RPL as there was two conflicting settings
in the code and both of them were missing from Kconfig file.

Change-Id: I4ce4fcbaa317b36cac315ea3b3f710fa7a344b25
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:42 +03:00
Wu Jiequan 0e3d582623 tests: net: Add mqtt testcases
Add two testcases for mqtt_publisher and mqtt_subscriber.
The combination of the two, covering most of the MQTT APIs.

Change-Id: Ib663ee1f550362ca493501046ddf8508a25ac956
Signed-off-by: Wu Jiequan <jiequanx.wu@intel.com>
2017-04-13 15:21:42 +03:00
Patrik Flykt 3f8f1ed3b0 unit: Create ztest unit test for CRC16 functionality
Ensure that the CRC16 functions compute a few test values properly.

Change-Id: Ie98049aefac8a330b9b81d3bf333deb09bc35c39
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2017-04-13 15:21:42 +03:00
Jukka Rissanen 1b2c16a498 net: nbuf: Add function to split a data fragment
Add net_nbuf_split() function that can be used to split
an existing net_buf fragment into two arbitrary length pieces,
and return the two new fragments to the caller. The data from
the original fragment is copied into these two new fragments.

Existing fragment is not modified.

Change-Id: I463e675232c6e19c2a42929f480893a6d1265873
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:41 +03:00
Jukka Rissanen f8c3467bde tests: net: tcp: Fix NULL pointer dereference
Incorrectly use variable even if it is null.

Coverity-CID: 157593

Change-Id: I883421a16870e5fe3c1d81e461f55f912ea168c0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:41 +03:00
Milosz Wasilewski deea71b3c6 tests: added TC_START to tests
TC_START was missing from some tests. For this reason automated testing
parsing wasn't unified for all tests. This patch fixes the issue and adds
TC_START to tests where it was missing.

Change-Id: I7e27a3fd8eaef9c3d0b0e0aeba9bca5b97eb0c58
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
2017-04-13 12:08:14 +00:00
Anas Nashif 6c77313a28 tests: benchmarks: increase timeout for app_kernel tests
This test takes a bit longe than specified and fails on a daily basis
due to the low timeout specified.

Change-Id: Id774c35cb1b0d0dcc5455e4121a8e9e1612baafd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-12 22:43:26 +00:00
Andrew Boie a313353344 xtensa: re-enable tinycrypt test cases
Tinycrypt 0.2.6 fixed the issue with the definition of 'bool'.

Issue: ZEP-1722
Change-Id: Ie470e25dfe02a58d9c3f2324cab85bc02f574b51
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-12 16:32:29 +00:00
ethan gao 8e22350651 tests: add AES cmac test to mbedtls test
it covers the story "Port AES-CMAC-PRF-128 [RFC 4615]
encryption library for Thread support"

ZEP-734

Change-Id: I6213309b51da435060c3e3cfadde67e21a927b2b
Signed-off-by: ethan gao <ethan.gao@intel.com>
2017-04-12 05:49:11 +00:00
Adithya Baglody abfbcc9318 tests: benchmarks: move app_kernel to unified kernel.
Deleted the instance of app_kernel in tests/legacy/benchmark.

JIRA: ZEP-1980
Change-Id: I5a6e073d9b0c870be0cc7d8ae5bb352b11d7f97e
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-04-11 21:07:01 -04:00
Anas Nashif bf382a59e0 tests: sprintf: increased main stack
This was failing when run on Quark D2000 CRB

Change-Id: I2d85fca15d1a89ad83fcb61a14a70ad94b5df373
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 16:41:06 -04:00
Anas Nashif b84dc2e124 kernel: remove all remaining references to nanokernel
Change-Id: I43067508898bc092879f7fe9d656ccca6fd92ab2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:10 +00:00
Anas Nashif d7bc60f096 kernel: remove remaining microkernel references
Change-Id: Ie648dbaaf714316c21395bd43e555618013dbd19
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:05 +00:00
Johan Hedberg 2ed8d83d4d Merge bluetooth branch into master
Controller:
	- Added duplicate filtering support
	- Added event mask support
	- Kconfig enhancements
	- Various cleanups

 Host:
	- IRQ locking fix to monitor protocol
	- Fixed potential deadlock in ECDH support
	- Fix to connection error reporting
	- Fix to GATT signing
	- Fix to LE CoC
	- AT command & HFP improvements

----------------------------------------------------------------
Carles Cufi (4):
      Bluetooth: controller: Implement scan duplicate filter
      Bluetooth: controller: Implement event masks
      Bluetooth: controller: Fix warning with no dup filter
      Bluetooth: test: Add "tiny" controller configuration

Johan Hedberg (11):
      Bluetooth: monitor: Drop data instead of holding IRQ lock for long
      Bluetooth: monitor: Add support for logging packet drops
      Bluetooth: HCI: Add define for success status
      Bluetooth: ECC: Fix command status emission from wrong thread
      Bluetooth: Controller: Introduce rate-limiting on stack analysis
      Bluetooth: Remove unnecessary controller-side buffers tracking
      Bluetooth: SMP: Remove redundant ';'
      Bluetooth: hci_ecc: Fix ECDH API usage
      Bluetooth: tests/shell: Limit BR/EDR configuration to Qemu for now
      Bluetooth: conn: Pass disconnect error properly to the conn struct
      Bluetooth: conn: Set initial responder address when connecting

Luiz Augusto von Dentz (4):
      Bluetooth: GATT: Fix using write command when signing was requested
      Bluetooth: GATT: Be consistent with error in case SMP is disabled
      Bluetooth: L2CAP: Fix accounting SDU header len as data
      Bluetooth: GATT: Use sys_slist_t to represent the database

Sathish Narasimman (5):
      Bluetooth: AT: Unit test application init
      Bluetooth: HFP HF: Lookup table for unsolicited commands
      Bluetooth: HFP HF: Add support for RING indication cb
      Bluetooth: HFP HF: Support to send hf AT command
      Bluetooth: AT: Fix - chance of missing UNSOLICITED state

Vinayak Chettimada (17):
      Bluetooth: controller: Kconfig for advanced event preparation
      Bluetooth: controller: Kconfig option for advanced scheduling
      Bluetooth: controller: Hide advance features in Kconfig
      Bluetooth: controller: Move comp id and subver to configuration
      Bluetooth: Kconfig: Move BLUETOOTH_CONTROLLER to Controller file
      Bluetooth: Kconfig: Group stack size related options
      Bluetooth: Kconfig: Group HCI_RAW related options
      Bluetooth: Kconfig: Move BLUETOOTH_MAX_SCO_CONN to BR/EDR
      Bluetooth: Compile BR/EDR independent of BLUETOOTH_CONN check
      Bluetooth: Permit connectionless host-controller combined build
      Bluetooth: controller: Cleanup redundant ticker busy loop
      Bluetooth: controller: Move nRF5 specific debug pins to hal/nrf5
      Bluetooth: controller: Remove util/config.h
      Bluetooth: controller: Make worker and job priority configurable
      Bluetooth: controller: Add BT 5.0 PDU structs
      Bluetooth: controller: Group dup filter Kconfig with buf options
      Bluetooth: controller: Use defined keyword in #if cond compiles

 include/bluetooth/gatt.h                      |   2 +-
 include/bluetooth/hci.h                       |  41 ++++++
 include/bluetooth/hfp_hf.h                    |  50 +++++++
 samples/bluetooth/handsfree/src/main.c        |   6 +
 subsys/bluetooth/Kconfig                      |  12 +-
 subsys/bluetooth/controller/Kconfig           | 120 ++++++++++++++-
 subsys/bluetooth/controller/hal/debug.h       | 199 +------------------------
 subsys/bluetooth/controller/hal/nrf5/debug.h  | 204 ++++++++++++++++++++++++++
 subsys/bluetooth/controller/hci/hci.c         | 132 ++++++++++++++++-
 subsys/bluetooth/controller/hci/hci_driver.c  |  24 ++-
 subsys/bluetooth/controller/ll_sw/ctrl.c      | 152 ++++++++-----------
 subsys/bluetooth/controller/ll_sw/ctrl.h      |  21 ++-
 subsys/bluetooth/controller/ll_sw/ll.c        |  14 +-
 subsys/bluetooth/controller/ll_sw/pdu.h       |  20 +++
 subsys/bluetooth/controller/ticker/ticker.c   | 127 +++++++---------
 subsys/bluetooth/controller/util/config.h     |  30 ----
 subsys/bluetooth/controller/util/mayfly.c     |   2 -
 subsys/bluetooth/controller/util/mayfly.h     |   7 +
 subsys/bluetooth/host/Kconfig                 | 120 +++++++--------
 subsys/bluetooth/host/Makefile                |  32 ++--
 subsys/bluetooth/host/at.c                    |  28 +++-
 subsys/bluetooth/host/at.h                    |   3 +-
 subsys/bluetooth/host/conn.c                  |  15 ++
 subsys/bluetooth/host/conn_internal.h         |  11 +-
 subsys/bluetooth/host/gatt.c                  |  66 ++++-----
 subsys/bluetooth/host/hci_core.c              |  11 +-
 subsys/bluetooth/host/hci_core.h              |   2 +
 subsys/bluetooth/host/hci_ecc.c               | 169 +++++++++++++--------
 subsys/bluetooth/host/hfp_hf.c                | 138 ++++++++++++++++-
 subsys/bluetooth/host/l2cap.c                 |   7 +-
 subsys/bluetooth/host/monitor.c               | 108 +++++++++++---
 subsys/bluetooth/host/monitor.h               |  13 +-
 subsys/bluetooth/host/smp.c                   |   2 +-
 tests/bluetooth/init/prj_controller.conf      |   4 +
 tests/bluetooth/init/prj_controller_4_0.conf  |   4 +
 tests/bluetooth/init/prj_controller_dbg.conf  |   4 +
 tests/bluetooth/init/prj_controller_tiny.conf |  21 +++
 tests/bluetooth/shell/src/main.c              |  39 ++++-
 tests/bluetooth/shell/testcase.ini            |   2 +-
 tests/unit/bluetooth/at/Makefile              |   4 +
 tests/unit/bluetooth/at/prj.conf              |   5 +
 tests/unit/bluetooth/at/src/Makefile          |   4 +
 tests/unit/bluetooth/at/src/main.c            |  76 ++++++++++
 tests/unit/bluetooth/at/testcase.ini          |   4 +
 44 files changed, 1408 insertions(+), 647 deletions(-)
 create mode 100644 subsys/bluetooth/controller/hal/nrf5/debug.h
 delete mode 100644 subsys/bluetooth/controller/util/config.h
 create mode 100644 tests/bluetooth/init/prj_controller_tiny.conf
 create mode 100644 tests/unit/bluetooth/at/Makefile
 create mode 100644 tests/unit/bluetooth/at/prj.conf
 create mode 100644 tests/unit/bluetooth/at/src/Makefile
 create mode 100644 tests/unit/bluetooth/at/src/main.c
 create mode 100644 tests/unit/bluetooth/at/testcase.ini

Change-Id: I3b0f10cdbc59bcaeaea0a1bd8f613e42c829b13f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-10 12:10:41 +03:00
Johan Hedberg ba7b6b1ced Bluetooth: tests/shell: Limit BR/EDR configuration to Qemu for now
The BR/EDR configuration doesn't fit e.g. the Arduino 101 anymore.
Limit it to Qemu for the time being, which is anyway the primary
target where the functionality is being tested.

Change-Id: I9a34c82157d56079e43acabe29eeadd6d99e03fe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-09 19:05:34 +03:00
Anas Nashif 24183ffe3e tests: tickless: remove unused code
Change-Id: I6bf2d0a5205c72c6a0cd2193fe97e60c45c83471
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-09 15:45:19 +00:00
Anas Nashif 2fceb7260d tests: move fs test to tests/subsys/
Change-Id: Ic9a02cb9dc2376b2818740d31eb8e8a71526cbb8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-09 15:45:18 +00:00
Sharron LIU 9de266d40c tests: kernel: add test point k_cpu_atomic_idle
tests/kernel/context:
added test point to cover k_cpu_atomic_idle.

Jira: ZEP-1242

Change-Id: Id09c89fd367d527ea1087e6eb2bdba29a338ceaf
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-09 15:45:02 +00:00
Qiu Peiyang 9f98bb44ae tests: driver: uart: fix unchecked return value
Coverity points out that uart_irq_update() return value
should be checked.

Coverity-CID: 166776

Change-Id: I3a754dae9e8f1563f4879e2fadfd89621785de8f
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-04-09 15:07:44 +00:00
Sharron LIU 34dc39d435 tests: kernel: added clock_test
tests/kernel/common:
added test case to cover kernel clocks service.
https://www.zephyrproject.org/doc/kernel/timing/clocks.html

Jira: ZEP-1242

Change-Id: I40a06dd9d4dcb1ed24d488088eb2e456740c3bad
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-09 15:06:59 +00:00
Carles Cufi b37f743a13 Bluetooth: test: Add "tiny" controller configuration
Add a configuration that strips the BLE controller down to its simplest
form to catch any issues when commonly used options are not enabled.

Change-Id: Ifbec01d62b7d45fe9139dadaba734eff3b7a72b6
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:55 +03:00
Carles Cufi 27e83660ff Bluetooth: controller: Implement scan duplicate filter
Implement the controller's ability to drop duplicate advertising reports
when instructed by the Host.

Jira: ZEP-1246

Change-Id: I2d1b7abf1ed950dde705e5df30a858c595f3834c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 7c22073195 Bluetooth: controller: Make worker and job priority configurable
Add Controller advanced Kconfig options to select IRQ
priorities of the Radio, Ticker's Worker and JOB IRQs.

This will provide an opportunity to have peripheral IRQ's
of higher level than Bluetooth Controller.

Change-id: Iaa128c1cd64a309a77d42d485fdefe68f31e4895
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada f38d57cba3 Bluetooth: controller: Kconfig option for advanced scheduling
Add Kconfig option to enable advanced scheduling in the
controller.

Enable non-overlapping placement of observer, initiator and
master roles in timespace. Uses window offset in connection
updates and uses connection parameter request in slave role
to negotiate non-overlapping placement with active master
roles to avoid slave roles drifting into active master
roles in the local controller.

This feature maximizes the average data transmission amongst
active concurrent master and slave connections while other
observer, initiator, master or slave roles are active in the
local controller.

Disabling this feature will lead to overlapping role in
timespace leading to skipped events amongst active roles.

Change-id: I16e4e6c3ca99f93987ab86924af0cb9d76bdbc7e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 646726518f Bluetooth: controller: Kconfig for advanced event preparation
Added Kconfig option to enable advanced event preparation
feature.

Enables advanced event preparation offset ahead of radio
tx/rx, taking into account predictive processing time
requirements in preparation to the event, like control
procedure handling and CPU execution speeds. Crystal
oscillator is retained between closely spaced consecutive
radio events to reduce the overall number of crystal
settling current consumptions.

This feature maximizes radio utilization in an average role
event timeslice when they are closely spaced by using a
reduced offset between preparation and radio event.

By disabling this feature, the controller will use a
constant offset between the preparation and radio event. The
controller will toggle crystal oscillator between two
closely spaced radio events leading to higher average
current due to increased number of crystal settling current
consumptions.

Change-id: I19e640f7395ac7938873ef4bfac38acf8d6f7e0e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Sathish Narasimman 95c4d0c1f3 Bluetooth: AT: Unit test application init
AT Module unit testing application to verify at_parse_input,
at_parse_cmd_input, at_get_number.

Change-Id: I256c0f9b62c13bc6f22eac4b94118b5fc7643462
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
2017-04-08 20:11:54 +03:00
Jukka Rissanen 5d7a7c253a ztest: Give error if user has not defined CONFIG_ZTEST
If user is trying to use ztest by including ztest.h but has
not defined CONFIG_ZTEST, then fail the compilation as the
result binary will not do anything.

There is no check for CONFIG_ZTEST for unit tests that are run
without qemu.

Change-Id: Ief9bba3a3a0f6acc6a264f17cde828b6d7e543a5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-08 12:13:50 +00:00
Jon Medhurst a89ed6d7d5 tests: dma: Initialise callback enable flags
The test failed to initilise these to known states, so fix this by
asking for end of transfer and error callbacks.

Change-Id: I523168381329062ec0c17aa41cb4033b78d8ed99
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-05 17:18:23 +00:00
Anas Nashif e5f150f0d9 tests: rename TICKS_UNLIMITED -> K_FOREVER
Change-Id: I1d65c7a0302b2dda0bc23e38f94f7be51de0f917
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-04 19:52:50 +00:00
Anas Nashif 7a90ab448b tests: port static_idt test to unified kernel
Change-Id: Ida4333b91ad322ff676cfbaa2ccaab0bdd38cd48
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-04 12:34:38 -04:00
Anas Nashif 7d5be2af73 Merge "Merge net branch into master" 2017-04-01 20:46:11 +00:00
Qiu Peiyang fe415dbf62 tests: drivers: spi: fix variable type mismatches
These were flagged by icx build.

Jira: ZEP-1887

Change-Id: Iaeedb13be23e86ebfb29a6441574b7384ae836e1
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-04-01 20:36:03 +00:00
Tomasz Bursztyka 8108a608ff net/mgmt: Mask vs event should be verified part by part
It needs to check if current event matches:

- cb's layer
- cb's layer code
- cb's command

If none match, it will not raise the event.

Fixing the unit test as layer must be always != 0.

Jira: ZEP-1940

Change-Id: Iadd63e751fa6e534a10e7da9cae0f5bb5a384461
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 12:15:29 +00:00
Tomasz Bursztyka dc7be7c54f net/ieee802154: Disable ACK reply handling by default
Most (if not all) 802.15.4 devices can handle ACK replies by
themselves.

Change-Id: I0319d59de767b20eb67c1592bacaa4a7b7015cad
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka 5e3354dad5 net/ieee802154: We don't get the MFR from device drivers
commit id 7a11439020 changed this.
Hopefully that changed did not affect anything.

Reducing minimal frame length and applying the change everywhere where
relevant.

Change-Id: I5ae203751bfcf70cef833620106d2c2d0e33b7a5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka 82709802a9 tests/net/ieee802154: Add a unit test for secured data frame validation
Change-Id: I3e35d13d1fdfacb6625dfe1b7b30cc2354a7ee93
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka cca117d8b9 tests/net/ieee802154: Switch l2 to ztest framework
Change-Id: Ibce93d4652e3991a06e870fc81e952788f0c6465
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka 7f50b56c0e tests/net/ieee802154: Add a simple CC2520 crypto dev test
It will first run the datasheet example.

Change-Id: Ic4da5ba9170a253cfdff4b17010d72dc86376555
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Jukka Rissanen a8dc0e60aa net: tests: Fix nbr lookup in route tests
The neighbor was added very fragile way into neighbor cache which
caused following queries to fail. This is now fixed by manually
adding neighbor to the cache.

Change-Id: I1831557fd5f9df5afd0a6c6833b0af769f5167eb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Jukka Rissanen 625870a2f6 net: rpl: Temporarily disable some of the RPL tests
Couple of tests started to fail without any apparent reason.
Disabling them temporarily until the root cause is found.

Change-Id: Id82e0eab60dc744c8ce6f02a5834e731be153883
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Anas Nashif e698c9c5aa tests: do not build with legacy API enabled
Change-Id: Ie1b6a808797774e5e04e1a1219861443e72cfeca
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-29 16:02:45 -04:00
Flavio Santes c3f79e1d46 test/crypto: Update ECC DSA test case
The ECC DSA test case was updated in TinyCrypt 0.2.6.

Fix the length of the random vector.

Change-Id: I7545a51c6855959afdefe00a1e0b53e5c3001a7c
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-25 15:42:13 +00:00
Flavio Santes 3692aed6a8 test/crypto: Update ECC DH test case
The ECC DH test case was updated in TinyCrypt 0.2.6.

This patch adds two helper arrays for the Monte Carlo routine.

Change-Id: If28292512b351feffc3fe470942cd97b18851a57
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-25 15:42:13 +00:00
Leandro Pereira a50c1d0620 test: Add test for JSON library
This adds a test suite for the JSON library, testing both encoding and
decoding of all supported data types, including arrays, nested objects,
and basic types such as booleans, numbers, and strings.

Jira: ZEP-1607
Change-Id: I4f6ad7e2859a142e06d405e0760e91751e01a31f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-03-25 13:11:55 +00:00
Anas Nashif 0505c9c881 benchmarks: convert latency_measure to unified kernel
Change-Id: If92833d699b95f5a7e813d0577f5467b06d3a1b6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:38:50 +00:00
Anas Nashif 25aa9e8e36 tests: enable syslog for sensors
Change-Id: If866083d5707a83b1df0a3411f3a848fdf40dbcb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:00:30 +00:00
Anas Nashif 2c04055970 Merge "Merge bluetooth branch into master" 2017-03-25 11:25:43 +00:00
Anas Nashif 8ec959a041 Merge "Merge net branch into master" 2017-03-25 11:25:33 +00:00
Johan Hedberg 93fbca0d16 Merge bluetooth branch into master
- Controller cleanups
 - Refactor controller for a cleaner Link Layer abstraction
 - SDP enhancements
 - Use sys_slist_t API wherever possible
 - Fix race condition in controller
 - Update controller to report Bluetooth 5.0 version

----------------------------------------------------------------
Carles Cufi (6):
      Bluetooth: controller: Remove unused H:4 tag macros
      Bluetooth: controller: Rename downstream API calls
      Bluetooth: controller: Introduce BLUETOOTH_LL_SW
      Bluetooth: controller: Move ll.h to an include folder
      Bluetooth: controller: Remove public address config option
      Bluetooth: controller: Move LL code from driver to ll_sw

Johan Hedberg (11):
      Bluetooth: Make bt_hci_driver instances link-time constants
      Bluetooth: shell: Fix missing initialization of param.own_addr
      Bluetooth: shell: Add command to start continuous passive scanning
      Bluetooth: Move crypto APIs to dedicated header file
      Bluetooth: Controller: Factor out ECB core code from ecb_encrypt()
      Bluetooth: Controller: Introduce big-endian variant for ECB
      Bluetooth: Introduce public big-endian AES API
      Bluetooth: Controller: Increase default TX buffer count
      Bluetooth: Use specific pointer type for conn->channels
      Bluetooth: ATT: Reorder handler struct for compactness
      Bluetooth: ATT: Refactor PDU handling

Kaustav Dey Biswas (5):
      Bluetooth: SDP: Server: Send service search response
      Bluetooth: SDP: Server: Handle ServiceAttributeRequest
      Bluetooth: SDP: Server: Find the attributes in the record
      Bluetooth: SDP: Server: Send ServiceAttributeResponse
      Bluetooth: SDP: Server: Support ServiceSearchAttributeRequest

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Fix checking for NULL pointer
      Bluetooth: L2CAP: Use sys_slist_t for connection channels
      Bluetooth: L2CAP: Use sys_slist_t for server channels
      Bluetooth: L2CAP: Use sys_slist_t for fixed channels

Mariusz Skamra (2):
      Bluetooth: L2CAP: Fix TX queueing for LE CoC
      Bluetooth: tester: Fix UART issue on qemu

Matthias Ringwald (1):
      Bluetooth: Controller: Kconfig company id and subversion number

Sathish Narasimman (5):
      Bluetooth: HFP HF: SCO: Handle synchronous_conn_complete
      Bluetooth: SCO: Rename 'conn' to 'acl'
      Bluetooth: HFP HF: SCO: Handle SCO Disconnect
      Bluetooth: HFP HF: SCO Initiate Audio connection
      Bluetooth: AT: Fix reset the state during error

Vinayak Chettimada (16):
      Bluetooth: Controller: Fix RSSI feature conditional compilation
      Bluetooth: Controller: Add advertisement event indication feature
      Bluetooth: Controller: Add Kconfig range check for public address
      Bluetooth: Controller: Version 5.0 and PDU type rename
      Bluetooth: controller: Use explicit paths to internal headers
      Bluetooth: controller: Move bt_rand into separate file
      Bluetooth: Make LE Encrypt helpers public
      Bluetooth: controller: Replace 0 for pointers with NULL keyword
      Bluetooth: Fix checks for changes in connection parameters
      Bluetooth: Support connection parameter update as central
      Bluetooth: shell: Reorder commands in logical order of use
      Bluetooth: shell: Add connection update command
      Bluetooth: controller: Move PDU macros from radio.h to pdu.h
      Bluetooth: controller: Cleanup makefiles
      Bluetooth: controller: Fix mayfly caller id for thread call path
      Bluetooth: controller: Fix race waiting for ticker job to complt

 drivers/bluetooth/hci/h4.c                         |   2 +-
 drivers/bluetooth/hci/h5.c                         |   2 +-
 drivers/bluetooth/hci/spi.c                        |   2 +-
 include/bluetooth/bluetooth.h                      |  15 +-
 include/bluetooth/conn.h                           |  11 +
 include/bluetooth/crypto.h                         |  77 ++
 include/bluetooth/hci.h                            |  24 +
 include/bluetooth/l2cap.h                          |   4 +-
 include/drivers/bluetooth/hci_driver.h             |   2 +-
 samples/bluetooth/ipsp/src/main.c                  |   6 +-
 subsys/bluetooth/Kconfig                           |   2 +-
 subsys/bluetooth/controller/Kconfig                |  39 +-
 subsys/bluetooth/controller/Makefile               |  23 +-
 subsys/bluetooth/controller/hal/Makefile           |   1 +
 subsys/bluetooth/controller/hal/ecb.h              |   3 +
 subsys/bluetooth/controller/hal/nrf5/Makefile      |   3 +
 subsys/bluetooth/controller/hal/nrf5/cntr.c        |   4 +-
 subsys/bluetooth/controller/hal/nrf5/ecb.c         |  64 +-
 subsys/bluetooth/controller/hal/nrf5/radio.c       |  17 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c        |   4 +-
 subsys/bluetooth/controller/hal/radio.h            |   5 -
 subsys/bluetooth/controller/hci/Makefile           |   4 +
 subsys/bluetooth/controller/hci/hci.c              |  76 +-
 subsys/bluetooth/controller/hci/hci_driver.c       | 217 +-----
 subsys/bluetooth/controller/include/ll.h           |  58 ++
 subsys/bluetooth/controller/ll/ll.h                |  29 -
 subsys/bluetooth/controller/ll_sw/Makefile         |   4 +
 subsys/bluetooth/controller/ll_sw/crypto.c         |  54 ++
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c   | 660 +++++++++--------
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h   |  54 +-
 .../controller/{ll => ll_sw}/ctrl_internal.h       |   6 +-
 subsys/bluetooth/controller/{ll => ll_sw}/ll.c     | 237 ++++++-
 subsys/bluetooth/controller/{ll => ll_sw}/pdu.h    |  64 +-
 subsys/bluetooth/controller/ticker/Makefile        |   3 +
 subsys/bluetooth/controller/ticker/ticker.c        |  12 +-
 subsys/bluetooth/controller/util/Makefile          |   1 +
 subsys/bluetooth/controller/util/memq.c            |   5 +-
 subsys/bluetooth/host/Kconfig                      |  16 +-
 subsys/bluetooth/host/Makefile                     |   2 +
 subsys/bluetooth/host/at.c                         |   7 +-
 subsys/bluetooth/host/att.c                        | 204 ++++--
 subsys/bluetooth/host/conn.c                       | 148 +++-
 subsys/bluetooth/host/conn_internal.h              |  12 +-
 subsys/bluetooth/host/crypto.c                     | 155 ++++
 subsys/bluetooth/host/crypto.h                     |   8 +
 subsys/bluetooth/host/hci_core.c                   | 150 ++--
 subsys/bluetooth/host/hci_core.h                   |   2 +-
 subsys/bluetooth/host/hci_ecc.c                    |   9 +-
 subsys/bluetooth/host/hci_ecc.h                    |   5 +-
 subsys/bluetooth/host/hci_raw.c                    |   8 +-
 subsys/bluetooth/host/hci_raw_internal.h           |   2 +-
 subsys/bluetooth/host/l2cap.c                      | 202 ++----
 subsys/bluetooth/host/l2cap_br.c                   |  97 +--
 subsys/bluetooth/host/l2cap_internal.h             |   5 +-
 subsys/bluetooth/host/sdp.c                        | 781 +++++++++++++++++++++
 subsys/bluetooth/host/sdp_internal.h               |  14 +
 subsys/bluetooth/host/smp.c                        |  36 +-
 tests/bluetooth/init/prj_controller_4_0.conf       |   1 +
 tests/bluetooth/init/prj_controller_dbg.conf       |   1 +
 tests/bluetooth/shell/src/main.c                   | 137 +++-
 tests/bluetooth/test_bluetooth/src/bluetooth.c     |   2 +-
 tests/bluetooth/tester/qemu.conf                   |   1 +
 62 files changed, 2583 insertions(+), 1216 deletions(-)
 create mode 100644 include/bluetooth/crypto.h
 create mode 100644 subsys/bluetooth/controller/hal/Makefile
 create mode 100644 subsys/bluetooth/controller/hal/nrf5/Makefile
 create mode 100644 subsys/bluetooth/controller/hci/Makefile
 create mode 100644 subsys/bluetooth/controller/include/ll.h
 delete mode 100644 subsys/bluetooth/controller/ll/ll.h
 create mode 100644 subsys/bluetooth/controller/ll_sw/Makefile
 create mode 100644 subsys/bluetooth/controller/ll_sw/crypto.c
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c (93%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h (84%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl_internal.h (98%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ll.c (58%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/pdu.h (77%)
 create mode 100644 subsys/bluetooth/controller/ticker/Makefile
 create mode 100644 subsys/bluetooth/controller/util/Makefile
 create mode 100644 subsys/bluetooth/host/crypto.c
 create mode 100644 subsys/bluetooth/host/crypto.h

Change-Id: Ic8bee0eb4f15c00ce5ca7b3b80133b1bbd0bdbf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-24 23:21:09 -07:00
Anas Nashif 898c8b639b tests: object_footprint: add missing file
Change-Id: I2d26f0770ac81482d70a8101c22745b2baef64ae
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 18:17:32 -04:00
Anas Nashif e994b0ab19 benchmarks: remove legacy tests already ported to unified
Change-Id: I002a462e06333b8540e96d4e4e166830b231d536
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 18:17:04 -04:00
Anas Nashif 7942eaee39 benchmarks: port object_footprint to unified kernel
Change-Id: Iaa39f60b9ef498059f0320631823a9d7d47a99de
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:17 +00:00
Anas Nashif 477a928134 benchmarks: move footprint benchmark out of legacy
Those can be used with unified kernel.

Change-Id: I4bd024f7e645b99ac1b8df6dfbbdd94f2fda99c4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:17 +00:00
Inaky Perez-Gonzalez 6db4a991b2 tests: tag with 'ignore_faults' testcases that provoke faults
This way we can monitor testcases for faults that should not be there;
however, in the case of these, a fault message is expected and shall
be ignored.

Change-Id: I63736723026c381c9fee7f24a751ceafc12f2a40
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-03-24 21:51:16 +00:00
Anas Nashif aa70533244 tests: remove legacy tests already ported to unified
Legacy APIs are to be deprecated, so getting rid of tests that have been
moved to unified kernel already.

Change-Id: I752e42bc498dfdd0ea29b0b5b7b9da1dac7b1136
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:15 +00:00
Jukka Rissanen c3b1070d10 tests: dns: Resolve API test cases
Change-Id: I090515c0e720c5779e3b5a9f2eb19e398ea0e987
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-24 17:31:42 +02:00
Tomasz Bursztyka 1e3dc0cbb4 net/ipv6: Renaming IPv6 neighbor state related macros and function
Refining the names around IPv6's neighbor states to differentiate them
easily from any net_nbr related names (which are not tighten to IPv6).

Change-Id: Ibc24df2a9485477a53fe5fe1c8f993f0fcd91635
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-24 17:31:41 +02:00
Mariusz Skamra ea8ca7d400 Bluetooth: tester: Fix UART issue on qemu
This fixes an issue introduced by bab3aafa2d,
which changed the default value of UART_PIPE_ON_DEV_NAME to the same
used by BLUETOOTH_UART_ON_DEV_NAME. Due to this, the BTP and HCI were using
the same UART.

Change-Id: Ib59819e49610f28f4c89c0304d024bb1b6aa506a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2017-03-24 10:16:08 +01:00
Jithu Joseph 2ddb968cbf tests: kernel: port work_queue test to unified kernel
Jira: ZEP-932

Change-Id: I79eb4cb20cd0e0df60f71cb73969a76e2c929b8e
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-03-23 12:02:35 +00:00
Sergio Rodriguez 9df2afc058 tests: kernel: test_pend: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_pend test case to
the unified kernel

Jira: ZEP-932

Change-Id: I81762b45ff7000ff9f6079c674b46d233b2645de
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-03-23 11:50:36 +00:00
Vinayak Chettimada 2037ec803d Bluetooth: shell: Add connection update command
Added conn-update command to btshell module to test
bt_conn_le_param_update Bluetooth API.

Change-id: I205df9ffc12a0ab062de5a779ab96bc91cbd9259
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:43 -07:00
Vinayak Chettimada 30a46529b2 Bluetooth: shell: Reorder commands in logical order of use
Reordered the commands in btshell to represent the logical
order of use. Moved advertise and scan before connect
command.

Change-id: Id64509e39848109a6df7ddb1306b6bd221b65c40
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Johan Hedberg e085ff49b9 Bluetooth: shell: Add command to start continuous passive scanning
Change-Id: I0d9c2f47014464a27ff24ac79a16ee956bbcf62c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Johan Hedberg 1ce1c3484e Bluetooth: shell: Fix missing initialization of param.own_addr
Add proper logging for errors in the same go.

Change-Id: I8bd4fa8d5b143e51024496bfba0056525ad35964
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Johan Hedberg 5517893543 Bluetooth: Make bt_hci_driver instances link-time constants
Declaring these as const lets the linker generate more optimal code.
Some extra care is needed with hci_ecc.c since it was overwriting the
send callback. Now the choice of send() call is done directly in the
bt_send() function

Change-Id: Iac74f5ee9bee097bbb34c11bd13d1d886700f5cc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Vinayak Chettimada 0d75faf02d Bluetooth: Controller: Add advertisement event indication feature
Add a Controller event that indicates everytime
advertisement event has been transmitted on air.

Change-id: I4722488bbfeca987e66983faf5b26467407a89c9
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Michael Scott 081246737c net/http: let HTTP_SERVER, HTTP_CLIENT and HTTP_PARSER select HTTP
Due to commit 8308b9bd2d ("net/http: Add the HTTP/1.1 API")
every user of CONFIG_HTTP_PARSER would need to add CONFIG_HTTP to
their .conf files.  Which is fine for intree samples/tests as they
have been adjusted, but the rest of world working on Zephyr apps
will need to make this changes as well.

Instead, we should have each of the following select HTTP instead of
depend on it, which will make future use of these configs and their
dependencies more intuitive:
HTTP_SERVER
HTTP_CLIENT
HTTP_PARSER

NOTE: As cleanup, this commit also removes the CONFIG_HTTP added to
samples and test .conf files.

Change-Id: I81cfaa19e37333b1bf98778f8147814780e7f77c
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-03-17 10:34:45 +02:00
Jukka Rissanen 157c383260 net: ipv6: Make config options more fine grained
Add CONFIG_NET_IPV6_NBR_CACHE option that is the base for both
neighbor discovery (ND) and duplicate address detection (DAD).

Both ND and DAD can be disabled if needed. If NBR cache is
disabled, then ND and DAD are disabled too.

Note that it makes not much sense to disable DAD or NBR cache
as IPv6 will not work properly without them. It is possible
to disable ND but then the neighbor information needs to come
via other sources like RPL.

Change-Id: I57c8668ad828b3a153dfc58eea78bf5f7ac3938a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen fc2542b88b net: tests: Fix the default MAC address
Use the proper MAC address space (00-00-5E-00-53-xx) dedicated
for documentation and specified in RFC 7042 ch 2.1.2.

Change-Id: If8ef9e4ee4e041ad005060664ebafe60df0a6bf9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Tomasz Bursztyka 87b80191b6 tests/net/mgmt: Add 2 unit tests around synchronous event listeners.
Test net_mgmt_event_wait() and net_mgmt_event_wait_on_iface()

Change-Id: I82ba70a697f0d13aa2e1eef2110e139b3621c119
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:42 +02:00
Tomasz Bursztyka 35e5aa8865 net/mgmt: Add a function to wait on a event synchronously
Instead of creating a handler and a related callback structure on an
event_mask: net_mgmt_event_wait() can be used to wait synchronously on
such event_mask. The core mgmt part will seamlessly reuse the struct
net_mgmt_event_callback so the whole internal notification mechanism is
using the same code.

Change-Id: I426d782c770e75e5222aa3c5b703172b1f1f2e5e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:42 +02:00
Ravi kumar Veeramally 8cb97ae47d net: Modify IPv4/6 packet finalize API's
Current finalize api's takes buf as input parameter and returns
the finalized buf. But if there are any issue while finalizing,
it failed to throw an error.

Change-Id: I6db54b7453eec41a8051fab50d5c0dc937debd54
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-17 10:34:42 +02:00
Ravi kumar Veeramally ad855fc31d net: ipv6: Fix handling of RA 6CO options
As per RFC 6775 4.2, context length holds number of leading bits
in the Context Prefix field that are valid. Rest are not valid
for compression.

Change-Id: Id21cc2d7a5d42980cf9295f85e75c4869ff6cb99
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-17 10:34:41 +02:00
Flavio Santes f1ec62ed75 tests/net/dns: Add routines to evaluate DNS responses
This patch adds some routines to evaluate DNS responses as specified
by RFC 1035.

Jira: ZEP-1876

Change-Id: Ia78a1175229962128a0bcee985e507d72ed26aea
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-17 10:34:41 +02:00
Jukka Rissanen 1274a229cc net: tests: nbuf: Fix compiler warnings
LLVM/icx compiler gives warnings for uint16_t vs. size_t
values.

Jira: ZEP-1886

Change-Id: I63c5deea672568946d91421a873c470af3cec6df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:41 +02:00
Flavio Santes 8308b9bd2d net/http: Add the HTTP/1.1 API
This patch adds the HTTP/1.1 API for Zephyr. This API consists of client
and server context structures enabled via Kconfig variables.
HTTP parser support is enabled via the CONFIG_HTTP_PARSER configuration
variable.

Currently, this API only includes support for writing HTTP requests
(client mode) and HTTP responses (server mode). TLS support is not
considered in this iteration.

Supported HTTP methods:
	GET, HEAD, OPTIONS and POST.

Supported HTTP responses:
	400, 403 404. The http_response routine may be used to write
	any HTTP status code, for example 200 OK.

Jira: ZEP-1701

Change-Id: Ic9ccd4d4578d6d0f3a439976ea332b031644ca7d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-09 20:33:49 +02:00
Flavio Santes bed2f43120 tests/net/dns: Add the test case for the DNS low-level routines
This patch adds the test case for the DNS API low-level routines.

The following routines are evaluated by this test case:

- dns_msg_pack_qname
- dns_msg_pack_query
- dns_unpack_header_id
- dns_header_qr
- dns_header_opcode
- dns_header_aa
- dns_header_tc
- dns_header_rd
- dns_header_ra
- dns_header_z
- dns_header_rcode
- dns_header_qdcount
- dns_header_ancount
- dns_header_nscount
- dns_header_arcount
- dns_unpack_query_qclass
- dns_unpack_query_qtype

Next iterations will consider IPv6 and DNS RR coverage.

Jira: ZEP-1499

Change-Id: I4ef46203e6fec57c6fe5a5db8132ed140b412fc2
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-09 20:33:49 +02:00
Jukka Rissanen e82f7a6a31 tests: net: Check allnodes and solicit node addresses.
Make sure that the network interface has proper allnodes and
solicit node multicast addresses set.

Change-Id: I2318d63df0b5d09dfaa8347b69c843b84ed63f4b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen 253e9a377f tests: net: Add MLD query tests
Add tests for verifying that we can receive Multicast Listener
Discovery query and act on it.

Change-Id: I926cf5e9f77cd250d2d7094f2379e320ef163540
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen 8d8e3772e6 net: ipv6: Respond to MLD query
If we receive MLDv2 (Multicast Listener Discover) query,
we send out information about the multicast groups that
we have joined.

Change-Id: If4ea9fa685319b2ad900e1949a5cbe12e7696b43
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen d0fc787c21 tests: net: Add unit tests for mld
MLD (Multicast Listerer Discovery) unit tests when joining
or leaving an IPv6 multicast group.

Change-Id: I7cd0f4c5f31c693d816fb5d27d3d23bb27679c35
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen ba5bb5a9df net: if: Join/leave pre-defined IPv6 multicast groups
When we setup the network interface, add predefined IPv6 multicast
groups into the network interface. When interface is taken down,
then leave all the multicast groups that joined.
See RFC 4291 ch 2.8 for details.

Change-Id: If17d3e8c75157a02aa93c92e2fb499619c1484cf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:47 +02:00
Jukka Rissanen 74e747a27f net: ipv6: Add support to join/leave multicast group
This and subsequent commits adds API to join or leave
an IPv6 multicast group.

Jira: ZEP-1673

Change-Id: I26dcfe16a4527dbf7886a30827a5d4ebfdeaac01
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:47 +02:00
Ravi kumar Veeramally 476f46f61b net: icmpv6: Remove unused variable 'len' from input calls
Variable len is not used in net_icmpv6_input() and if required
it can be obtained from 'buf'.

Change-Id: I4b0710e1cf16cff9837173ad9d6908ec54ebafae
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-09 20:33:45 +02:00
Jukka Rissanen 5032bdc46d net: nbuf: Pass ll_reserve when creating TX buffer
Instead of always calling net_nbuf_get_reserve_tx() with zero
ll_reserve (first parameter) and then setting the link layer
reserve separately, pass the reserve to that function which can
then set the ll_reserve in buf itself.

Change-Id: I21c14cb7e2e6c36d170c09998bca0207ecf65c75
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 189ec2b6ad net: Remove link layer reserve param from IP packet creator
The ll_reserve parameter is useless in net_ipv{4|6}_create_raw()
function as the reserve information is already stored in buf.

Change-Id: I7815a78c001e3da532478c04b3dac9b37bbc723c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 5197266768 net: nbuf: Use net_nbuf_get_frag() to allocate a fragment
The code used net_nbuf_get_reserve_{rx|tx}_data() function to
allocate a fragment. Instead of that low level function, use
net_nbuf_get_frag() instead. There are few places this is not
possible or is too big change like in few test programs.

Change-Id: Ied7e2b7db352de998b200ffa6ff82471bfa5ebe3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen d32503f57e net: nbuf: Split one global DATA pool to RX and TX DATA pools
If we receive lot of packets, it might happen that we exhaust
all the DATA buffers in the system. This would prevent from
us sending anything to the network.
Change this by splitting the DATA buffer pool into RX and TX
parts. This way RX flooding cannot consume all DATA buffers
that needs to be sent.

Change-Id: I8e8934c6d5fdd47b579ffa6268721b5eb3d64b6d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 4bcc2a47d0 net: nbuf: Fix net_nbuf_copy() so that original nbuf is not modified
It makes no sense to modify the original net_buf so change the
copy function not to touch the original buffer.

Change-Id: I5d22445ce50cee62994c36567f0e995a500cb89d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:42 +02:00
Jukka Rissanen 6a4372b0df net: nbuf: Fix the net_nbuf_copy() buf parameter
The first parameter of net_nbuf_copy() must be the head
of the buffer chain i.e., it must contain the user_data
part. If a fragment is given, then we do not know enough
information to allocate the data fragments.

Change-Id: I052b183d8c63d7326b320254f36f00b2fc48b0a0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:42 +02:00
Johan Hedberg 69d9985429 Merge bluetooth branch into master
- Assert fixes to controller state transitions
 - AVDTP fixes & improvements
 - SDP fixes & improvements
 - HFP improvements
 - GATT fixes
 - New GATT API for getting current MTU

----------------------------------------------------------------
Arun Jagadish (3):
      Bluetooth: AVDTP: Add AVDTP Receive Function
      Bluetooth: AVDTP: Fix discover param struct
      Bluetooth: AVDTP: Rename of variables

Carles Cufi (4):
      Bluetooth: controller: Use direct ISRs
      Bluetooth: controller: Set debug pins with macros
      Bluetooth: controller: Introduce debug pins Kconfig option
      Bluetooth: controller: Report 5.0 compliant controller

Jaganath Kanakkassery (1):
      Bluetooth: SDP: Server: Introduce private define for max services

Johan Hedberg (3):
      Bluetooth: Add support for Bluetooth 5.0 version specifier
      Bluetooth: Relax minimum advertising interval for 5.0 controllers
      Bluetooth: samples: Add combined observer & broadcaster app

Kaustav Dey Biswas (5):
      Bluetooth: SDP: Server: Fix MTU setting after l2cap connection
      Bluetooth: SDP: Server: Set security level to NONE
      Bluetooth: SDP: Server: Refactor data element structure header
      Bluetooth: SDP: Server: Handle Service Search request
      Bluetooth: SDP: Server: Filter records based on requested uuids

Luiz Augusto von Dentz (4):
      Bluetooth: GATT: Use __ASSERT for invalid parameters
      Bluetooth: GATT: Add bt_gatt_get_mtu API
      Bluetooth: L2CAP: Move functions in preparation for queuing
      Bluetooth: L2CAP: Add TX queueing for LE CoC

Maureen Helm (1):
      Bluetooth: samples: Add hexiwear_k64 and frdm_k64f to tests

Piyush Itankar (2):
      Bluetooth: A2DP: Stream End Point Registration
      Bluetooth: A2DP: Added Preset Structure

Sathish Narasimman (4):
      Bluetooth: AT: Fix 'signed' warning
      Bluetooth: HFP HF: Handling AG Network error
      Bluetooth: HFP HF: SCO: Add esco supported pkt type
      Bluetooth: HFP HF: SCO: Accept eSCO conn request

Szymon Janc (9):
      Bluetooth: shell: Fix accessing invalid memory
      Bluetooth: shell: Fix typo
      Bluetooth: SMP: Fix passkey entry for legacy pairing
      Bluetooth: shell: Don't echo LE CoC data
      Bluetooth: Fix connection object leak
      Bluetooth: shell: Simplify indication in gatt-subscribe
      Bluetooth: shell: Fix GATT long write support
      Bluetooth: GATT: Remove not needed variable
      Bluetooth: GATT: Fix subscriptions removal

Vinayak Chettimada (6):
      Bluetooth: Controller: Use direct ISR for Radio IRQ only
      Bluetooth: Controller: Fix LE Ping PDU dispatch
      Bluetooth: Controller: Run all enqueued mayfly before disable
      Bluetooth: Controller: Kconfig option to set public address
      Bluetooth: Controller: Fix assert on role stop/abort
      Bluetooth: Controller: mayfly enable to supercede over disable

 include/bluetooth/a2dp-codec.h               |  73 +++++
 include/bluetooth/a2dp.h                     |  61 +++++
 include/bluetooth/conn.h                     |   2 +
 include/bluetooth/gatt.h                     |  11 +
 include/bluetooth/hci.h                      |  50 ++++
 include/bluetooth/l2cap.h                    |   4 +
 include/bluetooth/sdp.h                      | 103 ++++---
 samples/bluetooth/peripheral_hr/testcase.ini |   2 +-
 samples/bluetooth/scan_adv/Makefile          |   5 +
 samples/bluetooth/scan_adv/README.rst        |  25 ++
 samples/bluetooth/scan_adv/prj.conf          |   2 +
 samples/bluetooth/scan_adv/src/Makefile      |   1 +
 samples/bluetooth/scan_adv/src/main.c        |  75 +++++
 samples/bluetooth/scan_adv/testcase.ini      |   4 +
 subsys/bluetooth/controller/Kconfig          |  15 +
 subsys/bluetooth/controller/hal/debug.h      | 124 ++++-----
 subsys/bluetooth/controller/hal/nrf5/radio.c |   4 +-
 subsys/bluetooth/controller/hal/radio.h      |   2 +-
 subsys/bluetooth/controller/hci/hci.c        |   2 +-
 subsys/bluetooth/controller/hci/hci_driver.c |  22 +-
 subsys/bluetooth/controller/ll/ctrl.c        | 229 ++++++++++++----
 subsys/bluetooth/controller/util/mayfly.c    |  58 +++-
 subsys/bluetooth/controller/util/mayfly.h    |   4 +-
 subsys/bluetooth/host/Kconfig                |   9 +
 subsys/bluetooth/host/a2dp.c                 |  19 ++
 subsys/bluetooth/host/at.c                   |  53 +++-
 subsys/bluetooth/host/at.h                   |  38 ++-
 subsys/bluetooth/host/avdtp.c                |  63 ++++-
 subsys/bluetooth/host/avdtp_internal.h       |  14 +-
 subsys/bluetooth/host/conn.c                 |  60 +++-
 subsys/bluetooth/host/conn_internal.h        |  10 +
 subsys/bluetooth/host/gatt.c                 |  86 +++---
 subsys/bluetooth/host/hci_core.c             |  92 ++++++-
 subsys/bluetooth/host/hci_core.h             |   8 +
 subsys/bluetooth/host/hfp_hf.c               |  15 +-
 subsys/bluetooth/host/l2cap.c                | 319 +++++++++++++---------
 subsys/bluetooth/host/sdp.c                  | 391 +++++++++++++++++++++++++--
 subsys/bluetooth/host/sdp_internal.h         |   2 +
 subsys/bluetooth/host/smp.c                  |   1 -
 tests/bluetooth/shell/src/main.c             |  98 ++++---
 40 files changed, 1728 insertions(+), 428 deletions(-)
 create mode 100644 include/bluetooth/a2dp-codec.h
 create mode 100644 samples/bluetooth/scan_adv/Makefile
 create mode 100644 samples/bluetooth/scan_adv/README.rst
 create mode 100644 samples/bluetooth/scan_adv/prj.conf
 create mode 100644 samples/bluetooth/scan_adv/src/Makefile
 create mode 100644 samples/bluetooth/scan_adv/src/main.c
 create mode 100644 samples/bluetooth/scan_adv/testcase.ini

Change-Id: I94f2f9f4431e21da9aae00c9e32581acb383ad49
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-08 22:21:41 +01:00
Qiu Peiyang 8d4f1bcb78 tests/gpio: enable gpio cases to run on more platforms
Add pin definitions to enable GPIO cases to run on
Quark D2000.
Add pin definitions to enable GPIO cases to run on
arduino_101_sss.

Change-Id: I97eadb8316b1f80b899b167a01effab815626dae
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:03:01 +00:00
Qiu Peiyang 935663f05e tests: fix disabling of GPIO interrupt issue
According to ZEP-1717, removing the callback from
the gpio is not enough to disable interruptions.
You also need to call gpio_pin_configure() on
the input pin without the GPIO_INT flag to totally
disable the interrupt for the pin.

This commit will stop level interrupt from being
fired constantly.

Change-Id: I019d7cea0bc0d5e5ff4b74165472ed11de1733bb
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:01:52 +00:00
Qiu Peiyang 2d033483de tests: add zephyr pinmux driver api test case
This commit verifies the following pinmux driver apis:
	pinmux_pin_set()
	pinmux_pin_get()

Change-Id: Iedf1b4e918b518b2205e9059b3b08f41cd243d37
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:01:28 +00:00
Qiu Peiyang 1124da16de tests: add zephyr SPI driver api test case
This commit verifies the below SPI driver apis:
	spi_configure()
	spi_slave_select()
	spi_write()
	spi_transceive()

Verify SPI work in SPI_MODE_CPOL, SPI_MODE_CPHA,
and SPI_MODE_CPOL | SPI_MODE_CPHA.

Jira: ZEP-1626

Change-Id: I1985ac6ff8269ac908817644a844720f2d7a125c
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-03-07 23:00:54 +00:00
Jithu Joseph fbde97d44a tests: drivers: uart: fix variable type mismatches
These were flagged by icx build.

Jira: ZEP-1864

Change-Id: I5b8fce64d9e20d768fabf02e2a799e9390e3679a
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-03-07 12:00:33 -08:00
Kaustav Dey Biswas c25df73c5a Bluetooth: SDP: Server: Refactor data element structure header
Separate out data element structure header into type and size fields

Change-Id: I869ee1ea82db1f6d669bb905055135b7d63f3fa2
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2017-03-07 12:21:29 +01:00
Szymon Janc dc2ce98088 Bluetooth: shell: Fix GATT long write support
Parameters and data must be permament for time of the operation.

Change-Id: Idd4eee948e62c2c80648116a339558042059f801
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 10ce50dc30 Bluetooth: shell: Simplify indication in gatt-subscribe
Instead of passing exact value allow to use 'ind' for enabling
indications instead of notifications.

Change-Id: I24306a321ed90b4bcb6300846218ff7214b39bc4
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 667e3af3dd Bluetooth: shell: Don't echo LE CoC data
Don't echo data from received callback as this can cause
deadlock. Just dump incoming data instead.

Change-Id: Iedbbafd0406ad46ba2c9d26fd8a70fff59de8143
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 691397023b Bluetooth: shell: Fix typo
Change-Id: I2c1a6e7cb61f65ce2292f128e73dc2d80372f773
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc af7d0c64a8 Bluetooth: shell: Fix accessing invalid memory
argc needs to be check before accessing argv.

Change-Id: I9cb70906a388b96df4e192dd4f31eafdab25127f
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Anas Nashif 4172b260c7 tests: sprintf: fixed sprintf usage
Change-Id: I2b55282a96d9df8f03be115a7e5c38f43fd5eca3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-03 18:38:06 +00:00
Anas Nashif 27e4fa0d7f tests: profiling: disable em_starterkit
Change-Id: Id31773e7355933476bad9f69669fa92dd2a32dad
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-02 19:39:46 -05:00
Kumar Gala 91e9f87499 libc: attribute minimal libc printf style functions with __printf_like
Add __printf_like attribute to printf style functions in minimal libc to
enable the compiler checking this provides.  We fixup the associated
issues that are now found by utilizing these checks.

Change-Id: I74ac0d0345782463d9fb454f7161d6b4af211ba5
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-03-02 08:46:30 -06:00
Benjamin Walsh 65ab86cf87 ztest: shorten line longer than 80 characters
Change-Id: I8156299180f027e95fe2858903de37abff09ba76
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:33 +00:00
Benjamin Walsh 67b816d74c ztest: rename end-of-test semaphore
It was named 'mutex', which is not representative of what it is used for
since it is not used for mutual exclusion, but rather for signaling.

Change-Id: Icfef0011f890b2546af1686ba6b57e3fc13c6576
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:33 +00:00
Benjamin Walsh 75e643d532 ztest: add comment about expected thread priorities
There is an implicit expectation that the priority of threads spawned by
a ztest suite is still higher than the main suite thread own priority
when a test signals the main suite thread that it has completed.

Change-Id: Id7caec3e9e553712c828a93c212b8e82bd16eabd
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:32 +00:00
Benjamin Walsh e307d9efa8 tests/common/timeout_order: reset test case thread to original prio
That was an oversight that should not have caused any problem. However,
the test harness expects the test's thread to be higher prio than the
test suite's thread that spawns it, because the test suite reuses the
stack space for the next test, if there is one.

Change-Id: Iad951118278abf0d9c23012d78ed56b75bc2958a
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:31 +00:00
Anas Nashif cd35c575ef Revert "sys_bitfield*(): use 'void *' instead of memaddr_t"
This reverts commit 1f2ee5c6bc.

Change-Id: I6d6662952450e54aea2ffbc43973a5ecc40767bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-28 16:06:22 -05:00
Inaky Perez-Gonzalez 1f2ee5c6bc sys_bitfield*(): use 'void *' instead of memaddr_t
Current users of sys_bitfield*() are bending over backwards to cast
what is most of the times a pointer into an integer.

Bitfields can be better described with an void *, so
uint{8,16,32,64}_t or any other container can be used. Most
sys_bitfield*() operations, by extension, can do the same. Note void *
has byte arithmetic, like char *.

This change will also make it implicit, for any future split of the
address space between virtual (what the SW is seeing) and physical
(what the HW is seeing) way clearer, as the functions dealing with
physical, non directly referentiable/mappeable addreses to use an
integer type, like mem_addr_t.

- include/arch/ARCH/*asm_inline*:

  - sys_bitfield*() all modified to take 'void *'

    Note 'void *' arihtmethic is byte based, which makes some things
    easier.

- include/sys_io.h:

  - introduces DEFINE_BITFIELD
  - update docs

- tests/kernel/bitfield: remove all the cast contortions, use DEFINE_BITFIELD
  PENDING: update other TCs

- include/arch/nios/nios2.h, drivers/interrupt_controller/ioapic_intr.c:
  remove cast contortions

Change-Id: I901e62c76af46f26ff0d29cdc37099597f884511
Jira: ZEP-1347
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-02-28 14:37:54 +00:00
Sharron LIU 9896f32445 tests: kernel: added test cases k_pipe_block_put
tests/kernel/pipe/test_pipe_api:
added test cases to cover k_pipe_block_put.
Also added test case to verify [get, put] API sequence.

Jira: ZEP-1242

Change-Id: I755def474592ea2bf36d8644c8f4a07a7a80bad0
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-28 13:35:31 +00:00
Sharron LIU 3abc1c5f23 tests: kernel: added testapp profiling_api
tests/kernel/profiling/profiling_api:
added testapp to cover k_call_stack_analyze.

Jira: ZEP-1242

Change-Id: I65de70b2c4e5a294763d625b2a45c990f99f9f90
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-28 13:33:39 +00:00
Anas Nashif c78a3485e2 Merge "Merge net branch into master" 2017-02-27 22:32:01 +00:00
Sharron LIU 83c7e2d862 tests: kernel: add test point k_delayed_work_remaining_get
tests/kernel/workq/workq_api:
added test point to cover k_delayed_work_remaining_get

Jira: ZEP-1242

Change-Id: I15055e9b11dfd28f3e33ac04151df8ccbed97027
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:22:16 +00:00
Sharron LIU 1087f0c29b tests: kernel: added test case k_fifo_is_empty
tests/kernel/fifo/test_fifo_api:
added test case to cover k_fifo_is_empty.

Jira: ZEP-1242

Change-Id: I9559df8661dbcd7d4885fa2db928120e945b3ae1
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:22:06 +00:00
Sharron LIU d15d264da9 tests: kernel: added test case k_is_preempt_thread
tests/kernel/threads_scheduling/schedule_api:
added test case to cover k_is_preempt_thread.

Jira: ZEP-1242

Change-Id: I4327438dffaa59abcfe1e41813b45abee88506b2
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:21:54 +00:00
Luiz Augusto von Dentz 0dc4dd46d4 lifo: Make use of k_queue as implementation
Once all users of k_lifo migrate to k_queue this should no longer be
needed.

Change-Id: Ib8af40c57bf8feba7b06d6d891cfa57b44faad42
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:53 +00:00
Luiz Augusto von Dentz e5ed88f328 fifo: Make use of k_queue as implementation
This makes k_fifo functions rely on k_queue and port k_poll to use
k_queue directly.

Once all users of k_fifo migrate to k_queue this should no longer be
needed.

Change-Id: Icf16d580f88d11b2cb89e1abd23ae314f43dbd20
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:52 +00:00
Luiz Augusto von Dentz d07a328a95 tests: Add queue tests
Change-Id: If4ffa10c8c63788e1c9f074b8761902b4bdf6f66
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:51 +00:00
Adithya Baglody 979f75053c Disabled BOOT_BANNER for boot time benchmarks.
Change-Id: Ife23cd784e684d667bf78b616c478c891860e6e2
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-02-27 14:54:17 +05:30
Vinicius Costa Gomes 8e304ef2e6 iot/zoap: Fix requiring that the buffer is unchanged for retransmit
It is possible that the buffer waiting for retransmission is modified
after it is sent, for example, it can be compacted by 6lo, and our
assumption of where is the message ID is located in the buffer is no
longer valid.

As the message ID is the only information that is necessary for
keeping track of retransmissions, we keep a copy of it in the pending
struct, as well as the destination address of the retransmission.

Change-Id: Id33d54353404628673541225a1a05e27ee08765f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-27 10:28:54 +02:00
Vinicius Costa Gomes 45fe87a425 tests/zoap: Adds test for the length of payload on the RX side
This unit test verifies that zoap_packet_get_payload() returns the
expected size for received packets.

Jira: ZEP-1662

Change-Id: Ibe011959f4d6593f4f20f0f5901c9033c76c9518
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-27 10:28:54 +02:00
Anas Nashif 33746d4b7c Revert "tests/crypto: Update testcase.ini to build on more platforms"
This reverts commit 7b652b1f84.

Breaks on many boards.

Change-Id: Ie74e7a656094a54b999b99de9a462093525202c3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-23 07:13:42 -08:00
Erwan Gouriou e895d576db tests: update uart driver api test case
Depending on test environment, termination character could
be '/r' instead of '/n'.
Enabling both possibilities.

Change-Id: I18b47e9055667e0a4f868416ee8d01226a879712
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-23 13:30:47 +00:00
Sergio Rodriguez b6cf56e5cc tests: watchdog: Interrupt reset mode modifications
In order for interrupt reset mode to work (reset the processor
after and interrupt) the interrupt does not has to be cleared,
and the qmsi hal layer clears the interrupt after the callback
has been invoked, the callback does not return and the processor
should reset.

Jira: ZEP-1566

Change-Id: Ic951a0f15fe95fb0ef5d752b831c62e6fa3ceea0
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-02-23 13:29:13 +00:00
Kuo-Lang Tseng 4533734dc6 aon_counter test: fix misspelling in the header include guard
The include guard has a misspelling.

Jira: ZEP-1746

Change-Id: I4d8000ef5c8e037f80acbf2491d0b9466670816a
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-23 13:23:35 +00:00
Flavio Santes 7b652b1f84 tests/crypto: Update testcase.ini to build on more platforms
This patch excludes qemu riscv32 due to the following msg:

qemu-system-riscv32: cannot set up guest memory
'riscv_sifive_board.ram': Cannot allocate memory

Jira: ZEP-1721

Change-Id: Ib1784fa57ad1e3d69871d4e216af1ad5dbe55a76
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-23 13:19:21 +00:00
Andre Guedes c7f01dc90d tests/power/multicorei/lmt: Fix RTC configuration
After QMSI 1.4 update, the alarm callback is not saved when
'alarm_en' is set to zero during RTC configuration. So this
patch fixes tests/power/multicore/lmt application according.

ZEP-1778

Change-Id: Ie1468458bc23a6394484aef2aeee97745d5d23b8
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2017-02-23 13:17:47 +00:00
Jukka Rissanen 4eb2020055 net: Set the network link address type when setting link address
The interface L2 address type is set at the same time as the
L2 address is set to the network interface. This is most
convinient place to set the address type.

Change-Id: I712d7357d075959eb79df3463141cfbc6d163a74
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-22 17:28:25 +02:00
Flavio Santes 216ccb7198 tests/mqtt: Fix compiler warnings in MQTT Packet test case
Cast to uint8_t * some char * values to avoid compiler warnings.

Jira: ZEP-1179

Change-Id: I9973eecbed357a2fc44958cad22f812d166f6756
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-22 17:28:24 +02:00
Jean-Paul Etienne 9acda0f695 tests: gen_isr_table: account for riscv32 architecture
Account for riscv32 SOCs supporting the riscv privileged architecture.

Change-Id: I8c26a2bcc2baded5db252896abe6e1b5ab052113
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-22 14:59:01 +00:00
Andrew Boie 9c48b54d65 tests: add timer monotonic test
k_cycle_get_32() needs to return a monotonically increasing value,
except in cases of 32-bit integer overflow. Enforce this with a
test case.

We also check that the number of cycles elapsed after sleeping for 1
second is at the expected value. This can help catch errors on platforms
that use different timer sources for the system clock and timestamps.

This test case adapted from some code provided by Sergey Arkhipov
when troubleshooting ZEP-1546.

Issue: ZEP-1546
Change-Id: If27fff026ea6de659f7b41b60ff26f4962b734d4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-21 22:31:07 +00:00
Anas Nashif fe118c4e95 license: replace APL2.0 license with SPDX
Some files made it through review process with full license header.

Change-Id: I2722b127c40b4b19500042c12e4fde85a165bae9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-20 16:59:46 +00:00
Kumar Gala d3d2fab1ba boards: Add panther & panther_ss to sanity
Change-Id: I08345fb1063a4ba38095fca6512c5b7eb3e96da8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-02-20 15:41:31 +00:00
Qiu Peiyang 34b53f181f tests: add zephyr uart driver api test case
This commit verifies the following uart driver apis:
	uart_irq_callback_set()
	uart_irq_rx_enable()
	uart_irq_rx_disable()
	uart_irq_rx_ready()
	uart_irq_tx_enable()
	uart_irq_tx_disable()
	uart_irq_tx_ready()
	uart_fifo_fill()
	uart_fifo_read()
	uart_irq_update()
	uart_poll_in()
	uart_poll_out()

Change-Id: I9be9341aee4357f86a2bc49f19733fb84273e89c
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-20 13:42:47 +00:00
Andrew Boie e08d07c97d kernel: add flexibility to k_cycle_get_32() definition
Some arches may want to define this as an inline function, or
define in core arch code instead of timer driver code.
Unfortunately, this means we need to remove from the footprint
tests, but this is not typically a large function.

Issue: ZEP-1546
Change-Id: Ic0d7a33507da855995838f4703d872cd613a2ca2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-16 19:27:59 +00:00
Chuck Jordan 674db4df9a test: repair test_tickless for ARC because _tsc_read is now present
A _tsc_read has been added for ARC targets.
This test can use that when ARC.

See ZEP-1413

Change-Id: Ib63aecbe9f3eb2b97ad1086fc79b57e8f0774fca
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2017-02-16 04:56:50 +00:00
Benjamin Walsh d2654d3143 tests/kernel/common: add test to verify same tick timeout expiry order
Timeouts, when expiring on the same tick, should be handled in the same
order they were queued.

Change-Id: I23a8e971a47ca056b32b8b48fe179d481bae27c0
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-16 04:56:26 +00:00
Benjamin Walsh 4e0d690f24 tests: add tests for SYS_DLIST/SLIST_ITERATE_FROM()
Change-Id: I52dc6fa081be588f627670543ca9e2022d74bc37
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-16 04:56:23 +00:00
Flavio Santes 057f31e7e9 net/mqtt: Remove length computations for some msg fields
Currently, for the following MQTT msg fields:

- client_id
- will_topic
- user_name
- topic

their length is computed inside the routine that receives the MQTT msg.

Although this simplifies development, also imposes one restriction:
data must be null-terminated. Sometimes, data is received from other
sources and not generated by the application, so the null-terminated
constraint may be considered problematic for the user.

This patch removes the assumption that string fields are null-terminated.
Current data structures are already prepared to handle this case, so no
API change is required.

Change-Id: I5a147a5b21e0da49541cbe62baac363c8737cd3e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-15 12:20:08 +02:00
Anas Nashif b62fbccce1 tests: gen_isr_table: disable for cortex-m0
Change-Id: Ic4c3ee2d319e60af166786b856384ee421526b81
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-15 00:05:14 -08:00
Anas Nashif 7ac0fd7aed tests: filter out tinytile, it is the same as arduino 101
Change-Id: Ifef85247e6bdb4e6a1de8f5d0fc8cf3c935bd280
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-14 23:22:58 -08:00
Andrew Boie 5c335ce55f tests: gen_isr_table: actually run the IRQ
So far, only implemented on ARM.
It's not possible to do this on Nios II and RISC-V.

Change-Id: I84c8d99cd163dff46de4bc4a7ae40768daf8e4ce
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-15 04:49:18 +00:00
Anas Nashif 15a6598691 Merge "Merge remote-tracking branch 'origin/core'" 2017-02-15 04:33:25 +00:00
Jithu Joseph b0f2e3ef14 tests: kernel: import obj_tracing test to unified kernel
obj_tracing test from legacy modified to use unified APIs
directly.

Jira: ZEP-932

Change-Id: Ib5d300334e527b842668be076c94c40b65d7cbe4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-15 01:08:34 +00:00
Sharron LIU bceabf6a4f tests: kernel: remove unsupported tests
Remove tests that assert due to invocation from ISR which is not supported.

Change-Id: Ib2313b8f75db0140aa475281bd76ba0414d6a481
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-14 06:45:40 +00:00
Jithu Joseph 4462509ea7 spi_test: fix variable type mismatches
This was reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: Ib97ed8da830126c9fbfa2269c8b2327d2f1be2f4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-14 02:13:53 +00:00
Jithu Joseph ecba9dee51 test_mpool_api: fix variable type mismatches
This was reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: I5700ff6b374815325fa858cfd11f8938c82d8337
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-14 02:13:52 +00:00
Andrew Boie da7864e727 REVERTME: tests: crypto: disable on Xtensa
Tinycrypt's definition of 'bool' does not work properly with
Xtensa's XCC compiler.

Issue: ZEP-1722
Change-Id: Id71b5f1bcf738c83e672b64a592a68751758dbc9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:53:24 -08:00
Mazen NEIFER 4713575cb1 tests: Introduced new config option to add extra stack size for tests.
This option is added in order to support Xtensa, which needs more stack than
other architecture. This allows having a centralized way to change stack
requirements for all tests.
This extra stack size is eaqual to 0 for most architectures, except Xtensa
which requires additional 768 bytes for each stack.

Change-Id: Ie5dcae1dfd29018d36ef35dae22dc4c1a2ecdc14
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:03 -08:00
Andrew Boie 555c60631a REVERTME: tests: stackprot: disable on xtensa
Issue: ZEP-1702
Change-Id: Id8606e2c72bf21e236a13f48839516626929c171
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:03 -08:00
Andrew Boie 46c7275831 REVERTME: disable xip test on xtensa
https://jira.zephyrproject.org/browse/ZEP-1676

Change-Id: I5570031479de5b1d1859876c9155bd1fd70664a1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:01 -08:00
Mazen NEIFER 8e3b86fe0a Xtensa port: Connect Xtensa timer to tick IRQ in legacy test_context.
The test will also need to increase the stack to run correctly for Xtensa cores.

Change-Id: If94f12a941dc8eccf879558bdebdc7ccb2d047f1
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER daf28fa339 Xtensa port: Fixed tests/kernel/context to compile with Xtensa internal timer.
Change-Id: I4293adf23b7d46851747e3bcdd41b4a09e8fff05
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Qiu Peiyang 0c87784c84 tests/gpio: fix test GPIO_INT_EDGE bug
When test GPIO_INT_EDGE, there is no code to skip GPIO_INT_LEVEL
and jump to the end of the function. So GPIO_INT_LEVEL will
always be checked (Besides, it't always true), even if it's
testing GPIO_INT_EDGE, which will cause GPIO_INT_EDGE cases fail.

Add a goto statement for GPIO_INT_EDGE to skip GPIO_INT_LEVEL.

Jira: ZEP-1685

Change-Id: I10ce21c04c49f34aafdc2cd2f60f3e5377d6f1f5
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 01:04:09 +00:00
Qiu Peiyang bc2faf3737 tests/pwm: enable PWM case to work on D2000 board
This test case uses PWM0 port to test PWM on Quark Se.
However PWM0 port on Quark D2000 is initialized as tdo,
not PWM0 and disabling tdo will kill JTAG on D2000. So
use PWM1 and add PINMUX setting code to configure PIN_24
as PWM1 port, then the case will work on D2000 board.

Change-Id: Ib28d4750dac7396529388b781fb64bde048139d6
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 01:04:08 +00:00
jing wang 484f07cec7 tests: add zephyr adc driver api test case
the commit test below adc driver api with different resolutions
and modes
    adc_enable()
    adc_read()
    adc_disable()

move original adc test to adc_simple folder

Change-Id: I016b5e67a5d89fc8d5ae76f33799e5d3eb3e1cf8
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-12 00:33:59 +00:00
Qiu Peiyang 45c579a271 tests: add zephyr counter and timer api test
The commit verifies below aon counter and timer apis:
	counter_start()
	counter_read()
	counter_set_alarm()
	counter_get_pending_int()

Change-Id: Iaac9a224372ee1c1dd12a223ca222f4485957575
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 00:26:43 +00:00
Anas Nashif f16f6ec2df tests: pipe: remove unsupported tests
Remove tests that assert due to invocation from ISR which is not supported.

Change-Id: Idd2360847a467af6afdd9fbed8f87a620d9ed2f7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 23:03:58 -08:00
Anas Nashif bab5534ff6 tests: memory pool: remove unsupported tests
Change-Id: I467e9feb995db22b137038422aea9e1976166fc4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 23:03:55 -08:00
Anas Nashif 6e6e94bc77 tests: disable qemu_riscv32 on test_ecc_dh test [REVERT ME]
Change-Id: Iafba43007ab8daf1652b038bfbec184fe92b5ffc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:42 +00:00
Anas Nashif c5e000b2c8 tests: xip: pulpino does not support XIP
Change-Id: I806c3b4cc218d501285174249f173e59e748bea7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:41 +00:00
Anas Nashif 73a6da0763 tests: benchmarks: add new boards
Change-Id: I54eba3e63091b3bae15cda226735f412490ad77a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:40 +00:00
Baohong Liu 59b8af5395 tests: dma: update dma loop transfer app
Update the dma loop transfer sample app to use the new
dma api interfaces. This change is based on the api change
and the updated dma driver.

A RFC was posted recently on this.

Jira: ZEP-873

Change-Id: I289e2e08d4c775a833bf3d585d2706a903edd0bc
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-11 05:18:22 +00:00
Andrew Boie 122467e9ee tests: add test for gen_isr_table
This test is intended to verify that the SW ISR and vector tables
have been populated correctly.

Change-Id: Ic7f50c02dc0807d7ddefa710da67f818ff707ad6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-11 01:28:00 +00:00
Andrew Boie e7acd3224c arm: use gen_isr_tables mechanism for interrupts
This replaces the hard-coded vector table, as well as the
software ISR table created by the linker. Now both are generated
in build via script.

Issue: ZEP-1038, ZEP-1165
Change-Id: Ie6faaf8f7ea3a7a25ecb542f6cf7740836ad7da3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-11 01:27:58 +00:00
Jithu Joseph 720400372b misc: fix more variable type mismatches
These were reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: Ic625749309773611c0c6ba2905e9420e98947dae
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-11 00:14:15 +00:00
Luiz Augusto von Dentz f7100f8092 tests/common: Add tests for sys_dlist_*
Change-Id: I95fbaf902968b71ce42fd6d04a10c41a0be4ff03
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:14 +00:00
Luiz Augusto von Dentz 2970771bbe tests/slist: Exercise CONTAINER macros
Change-Id: I8439febd605c50ee829f16bc68c53c7d5aebd5d2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:13 +00:00
Baohong Liu 00210386c6 tests: dma: update dma block transfer app
Update the dma block transfer sample app to use the new
dma api interfaces. This change is based on the api change
and the updated dma driver.

A RFC was posted recently on this.

Jira: ZEP-873

Change-Id: Icf3bec7260c2e499485b07a4a579956448a1a3fd
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-10 02:18:17 +00:00
Benjamin Walsh acece24eac tests/kernel/poll: verify .signaled is set correctly
Change-Id: I19b39d09c198ef7fee7d92d2d5847bd064057b61
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-09 23:54:27 +00:00
Benjamin Walsh 5bbd683b9b test/kernel/poll: fix putting wrong .signaled to 0
Change-Id: I7d7255fe85857ad3edb10070b585a6694d1d4b0b
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-09 23:54:26 +00:00
Ravi kumar Veeramally 3bb2f3b29a net: tests: Unref net_buf using net_nbuf_unref
Using net_buf_unref() technically works but debugging the network buffer
allocations is more difficult if done like that.

Change-Id: Ieaa0978aa69e2f0baa924fe842ca1f116c348ef1
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-09 12:29:29 +02:00
Qiu Peiyang 8a119a4319 tests: add filesystem api test
This commit verifies below FS APIs:
	fs_open()
	fs_close()
	fs_read()
	fs_write()
	fs_truncate()
	fs_seek()
	fs_tell()
	fs_sync()
	fs_unlink()
	fs_mkdir()
	fs_opendir()
	fs_closedir()
	fs_readdir()
	fs_stat()
	fs_statvfs()

Change-Id: I1a48b9e960b62a1c4986cc577f658199da7a28cd
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-08 13:25:35 +00:00
jing wang 4e5fa0ede2 tests: add systhreads test case
this commit check the priority of 2 system threads - main and idle

Change-Id: Ie57e7fdab3d15c0b69d85ed6282bfa6aa04133b4
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-08 13:22:49 +00:00
Anas Nashif 31f01f8ed6 Merge "Merge net branch into master" 2017-02-08 12:03:09 +00:00
Johan Hedberg 79883c9834 Merge bluetooth branch into master
- Use k_poll to consolidate all TX threads into a single one
 - Reuse HCI command buffers for storing their response
 - Improvements to SDP client support
 - New "volatile subscription" flag to GATT API
 - Various smaller fixes & cleanups here and there

----------------------------------------------------------------
Arkadiusz Lichwa (8):
      Bluetooth: SDP: Get ProtocolDescriptorList attribute internals
      Bluetooth: shell: Add SDP client support
      Bluetooth: uuid: Fix assigned UDP uuid value
      Bluetooth: SDP: Add API to get ProfileDescriptorList attribute
      Bluetooth: shell: Add getting ProfileDescriptorList attribute
      Bluetooth: SDP: Add API to get SupportedFeature attribute
      Bluetooth: shell: Use SupportedFeature attribute API
      Bluetooth: shell: Add support to retrieve A2SRC record

Arun Jagadish (2):
      Bluetooth: AVDTP: Remove buffer pool
      Bluetooth: AVDTP: Add AVDTP Discover Function Definition

Carles Cufi (1):
      Bluetooth: hci_core: Use nRF5x FICR address

Jaganath Kanakkassery (2):
      Bluetooth: RFCOMM: Fix session timer during acl disc
      Bluetooth: RFCOMM: Use common tx pool for control packets

Johan Hedberg (15):
      Bluetooth: Fix trivial coding style issue
      Bluetooth: Fix checking for invalid public address
      Bluetooth: Fix using correct variable type for interrupt mask
      Bluetooth: Fix buffer leak when HCI driver send() fails
      Bluetooth: drivers/h4: Add support for discarding certain events
      Bluetooth: Add convenience macros for common header sizes
      Bluetooth: Kconfig: Merge headroom reserve variables into a single one
      Bluetooth: Controller: Redesign response buffer allocation for commands
      Bluetooth: Reuse HCI command buffers for the command response
      Bluetooth: conn: Use delayed work for LE connection timeout
      Bluetooth: Merge bt_conn TX threads into a single one with k_poll
      Bluetooth: Merge HCI command and connection TX threads
      Bluetooth: samples: Add missing README.rst files
      Bluetooth: Controller: Use LL_ASSERT instead of BT_ASSERT
      Bluetooth: Fix incorrect checks for command buffer user data

Jonathan Gelie (3):
      Bluetooth: GATT: introduce volatile subscription flag
      Bluetooth: GATT: set subscribe value to zero for unsubscription
      Bluetooth: GATT: fixing unsubscription

Luiz Augusto von Dentz (1):
      Bluetooth: GATT: Fix not removing subscriptions safely

Sathish Narasimman (5):
      Bluetooth: HFP HF: Service level connection completed
      Bluetooth: HFP HF: Enable extended AG Error Result Code
      Bluetooth: HFP HF: Indicate disconnect to application
      Bluetooth: HFP HF: Disconnect rfcomm on SLC error
      Bluetooth: HFP HF: Remove unused variable 'buf'

Szymon Janc (5):
      Bluetooth: Use assert when getting net buf with K_FOREVER
      Bluetooth: Remove some dead code
      Bluetooth: L2CAP: Remove dead code
      Bluetooth: SDP: Make bt_sdp_create_pdu static
      Bluetooth: L2CAP: Make l2cap_br_send_conn_rsp return void

 drivers/bluetooth/hci/Kconfig                   |  13 +-
 drivers/bluetooth/hci/h4.c                      |  93 +++-
 drivers/bluetooth/hci/h5.c                      |  47 +-
 drivers/bluetooth/hci/spi.c                     |  13 +-
 drivers/bluetooth/nble/gatt.c                   |  76 +--
 include/bluetooth/buf.h                         |  13 +-
 include/bluetooth/gatt.h                        |  18 +-
 include/bluetooth/hci.h                         |   9 +-
 include/bluetooth/l2cap.h                       |  20 +-
 include/bluetooth/sdp.h                         |  51 ++-
 include/bluetooth/uuid.h                        |   2 +-
 samples/bluetooth/handsfree/README.rst          |  23 +
 samples/bluetooth/hci_uart/src/main.c           |  11 +-
 samples/bluetooth/hci_usb/src/main.c            |  11 +-
 samples/bluetooth/peripheral_sc_only/README.rst |  26 ++
 subsys/bluetooth/controller/hci/hci.c           | 153 ++++---
 subsys/bluetooth/controller/hci/hci_driver.c    |  23 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   2 +-
 subsys/bluetooth/controller/ll/ctrl.c           |   2 +-
 subsys/bluetooth/host/Kconfig                   |  10 +-
 subsys/bluetooth/host/at.c                      |   2 +-
 subsys/bluetooth/host/at.h                      |   3 +-
 subsys/bluetooth/host/avdtp.c                   |  81 +++-
 subsys/bluetooth/host/avdtp_internal.h          |   7 -
 subsys/bluetooth/host/conn.c                    | 178 ++++----
 subsys/bluetooth/host/conn_internal.h           |  15 +-
 subsys/bluetooth/host/gatt.c                    | 142 +++---
 subsys/bluetooth/host/hci_core.c                | 285 ++++++++----
 subsys/bluetooth/host/hci_core.h                |   6 +
 subsys/bluetooth/host/hci_ecc.c                 |   6 +-
 subsys/bluetooth/host/hci_raw.c                 |  12 +
 subsys/bluetooth/host/hfp_hf.c                  |  50 +-
 subsys/bluetooth/host/l2cap.c                   |  35 --
 subsys/bluetooth/host/l2cap_br.c                |  49 +-
 subsys/bluetooth/host/l2cap_internal.h          |   7 +-
 subsys/bluetooth/host/rfcomm.c                  |  31 +-
 subsys/bluetooth/host/rfcomm_internal.h         |   5 +-
 subsys/bluetooth/host/sdp.c                     | 584 +++++++++++++++++++++++-
 tests/bluetooth/shell/src/main.c                | 172 +++++++
 39 files changed, 1700 insertions(+), 586 deletions(-)
 create mode 100644 samples/bluetooth/handsfree/README.rst
 create mode 100644 samples/bluetooth/peripheral_sc_only/README.rst

Change-Id: I7589dbad8b97477c72d1b856121593bcf6d11339
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-08 13:03:20 +02:00
Ravi kumar Veeramally 58ba1d834e net: nbuf: Fix net_nbuf_compact() API
Current API description of net_nbuf_compact() is not very clear.
The first parameter needs to be the first net_buf in the chain.

The changes to this API are needed in order to clarify following
use cases:
1) User provides fragment that is not first of the chain and compact is
successfully done. In this case there is no free space in fragment list
after the input fragment. But there might be empty space in previous
fragments. So fragment chain is not completely compacted.

2) What if input fragment has been deleted and api returns the same
buf?

So this commit simplifies the API behavior. Now net_nbuf_compact()
expects the first parameter to be either TX or RX net_buf and then it
compacts it. It fails only if the input fragment is a data fragment.

Change-Id: I9e02dfcb6f3f2e2998826522a25ec207850a8056
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:36 +02:00
Ravi kumar Veeramally 999338ea94 net: nbuf: Remove unused net_nbuf_push() API
The net_nbuf_push() API is not used by anyone. Semantics are not
clear and following patch requires changes to push api, so removing
this API for now. If needed this can be re-introduced later.

Change-Id: I1d669c861590aa9bc80cc1ccb08144bd6020dac5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:36 +02:00
Ravi kumar Veeramally 70f7922cee net: tests: 15.4: Increase max data size and fix config option
Test with max data in order to test the fragmentation code better.

Change-Id: I301a96eae1dd637f0291354120389c2bd7575695
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:35 +02:00
Jukka Rissanen bd3908b2a9 net: nbuf: Add timeout to net_buf getters
This commit changes the net_buf getter functions in nbuf.h
by adding a timeout parameter. These function prototypes
are changed to accept a timeout parameter.
	net_nbuf_get_rx()
	net_nbuf_get_tx()
	net_nbuf_get_data()
	net_nbuf_get_reserve_rx()
	net_nbuf_get_reserve_tx()
	net_nbuf_get_reserve_data()
	net_nbuf_copy()
	net_nbuf_copy_all()
	net_nbuf_push()
	net_nbuf_append()
	net_nbuf_write()
	net_nbuf_insert()

Following convinience functions have not been changed
	net_nbuf_append_u8
	net_nbuf_append_be16
	net_nbuf_append_be32
	net_nbuf_insert_u8
	net_nbuf_insert_be16
	net_nbuf_insert_be32
	net_nbuf_write_u8
	net_nbuf_write_be16
	net_nbuf_write_be32
so they call the base function using K_FOREVER. Use the
base function if you want to have a timeout when net_buf
is allocated.

Change-Id: I20bb602ffb73069e5a02668fce60575141586c0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:35 +02:00
Andrew Boie e67828ba20 tests: remove old ARM vector table test
This was ported to the new kernel, no need to keep the old one around.

Change-Id: I02d39c8e39843cee1862448296e9c1d0dfde75b9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-07 19:52:09 +00:00
Arkadiusz Lichwa 9fff70dbe5 Bluetooth: shell: Add support to retrieve A2SRC record
Adds to BT shell app functionality to trigger to be found on remote
A2SRC UUID. Implements user callback to read resolved response data
and uses existing SDP client API to read attributes values.

> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 48
      Channel: 64 len 44 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 39
        Attribute bytes: 36
        Continuation state: 0
        Combined attribute bytes: 89
          Attribute list: [len 84] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010005
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Audio Source (0x110a)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0019
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  AVDTP (0x0019)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Advanced Audio Distribution (0x110d)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Unknown (0x0100) [len 2]
              Advanced Audio [len 15]
            Attribute: Unknown (0x0311) [len 2]
              0x0001
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 10 len 4
        Destination CID: 65

Change-Id: I8938d9eebda31f3d252ff49adc1a96abfcbc5751
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 658ea8cc4b Bluetooth: shell: Use SupportedFeature attribute API
BT shell app tries to retrieve supported features exposed by remote
HFPAG enabled SDP record.

Jira: ZEP-1112

Change-Id: Ic8e5e8bd7cdea822fcaea317e884233e3bf0b4f9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 4f8641990c Bluetooth: shell: Add getting ProfileDescriptorList attribute
Makes use ProfileDescriptorList atribute API to get remote Hands-Free
profile version.

Jira: ZEP-1112

Change-Id: I3752691057e15c3a9a681dd3277ac160096792e9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 7577a4ff7c Bluetooth: shell: Add SDP client support
Adds pool memory for storing SDP client query results and introduces
command allowing add HFPAG UUID to be resolved when connection to peer
is already set. When resolved data arrives, UUID callback handler
tries to identify RFCOMM protocol specific information, in this case
remote HFPAG Server Channel Number, stored in Protocol's Descriptor List
attribute data.

> HCI Event: Number of Completed Packets (0x13) plen
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 55
      Channel: 64 len 51 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 46
        Attribute bytes: 43
        Continuation state: 0
        Combined attribute bytes: 96
          Attribute list: [len 91] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010003
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Handsfree Audio Gateway (0x111f)
              UUID (3) with 2 bytes [0 extra bits] len 3
                Generic Audio (0x1203)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 3 bytes [8 extra bits] len 5
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
              Sequence (6) with 5 bytes [8 extra bits] len 7
                UUID (3) with 2 bytes [0 extra bits] len 3
                  RFCOMM (0x0003)
                Unsigned Integer (1) with 1 byte [0 extra bits] len 2
                  0x03
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Handsfree (0x111e)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0106
            Attribute: Unknown (0x0100) [len 2]
              Handsfree Gateway [len 18]
            Attribute: Unknown (0x0301) [len 2]
              0x01
            Attribute: Unknown (0x0311) [len 2]
              0x0027
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 5 len 4
        Destination CID: 64
        Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 12
      L2CAP: Disconnection Response (0x07) ident 5 len 4
        Destination CID: 64
        Source CID: 64

Jira: ZEP-1112

Change-Id: Ibda606fabe367ca3d0353f77c7093da8c4f175c8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Sharron LIU de7435a73f tests: kernel: mem_heap: added api and concept tests
<kernel.h> APIs covered:
    k_malloc
    k_free
Concept TESTPOINTs extracted from
https://www.zephyrproject.org/doc/kernel/memory/heap.html#concepts

ZEP-1242

Change-Id: I39edc809119984585d78d6abbe33f5be707c5818
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-04 19:36:50 +00:00
jing wang 61e5438c51 tests: add zephyr i2c driver api test
the commit verify below i2c apis by sensor
GY271 or HMC58831
    i2c_configure()
    i2c_write()
    i2c_read()
    i2c_burst_write()
    i2c_burst_read()

Change-Id: I072a9897a45636613e811baa7ff79b57206e4130
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-04 19:31:31 +00:00
Jean-Paul Etienne c989f0b408 riscv32: timer: replace riscv_qemu_driver by the generic riscv_machine_driver
riscv defines the machine-mode timer registers that are implemented
by the all riscv SOCs that follow the riscv privileged architecture
specification.

The timer registers implemented in riscv-qemu follow this specification.
To account for future riscv SOCs, reimplement the riscv_qemu_driver by
the riscv_machine_driver.

Change-Id: I645b03c91b4e07d0f2609908decc27ba9b8240d4
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-03 19:20:52 +01:00
Jukka Rissanen cc8eb4144b tests: net: Add tests for network interface
Change-Id: I35f0b3f1794c65b08d32ca561b6189ee59a7a76c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:18 +02:00
Jukka Rissanen 3c95a56c2a tests: net: rpl: Fix unicast NS sending
If we send unicast NS, then the destination IPv6 address needs
to be in the neighbor cache, otherwise we have a NS sending loop.

Change-Id: I11e8f5d5740248024a0becc77055786cd2e32199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen 6b069f1589 net: tests: Add unit tests for net_nbuf_compact()
The compact function was never really properly tested
but it is used by other routines that have unit tests.
This commit makes sure there is a special testing for
the buffer compact function.

Change-Id: I35c108fd8459a9482ccae68a51ffa28fb2e0ae99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Ravi kumar Veeramally 2de8bd928a net: tests: Add unit tests for net_addr_ntop() utils function
Change-Id: I72ee5f6444d2e45de0ee7a3aa96884282d41b72d
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:14 +02:00
Ravi kumar Veeramally 10e5162fc2 net: tests: Add unit tests for net_addr_pton() utils function
Change-Id: Ib1e89ce3bb7eff5afe14394062ee6f53a28cc4e6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:14 +02:00
Benjamin Walsh e440759dbb tests/kernel/poll: test object runtime init functions
Change-Id: I04eac2e5cf5e49ea92fd6195c94a25e783aab253
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-03 13:54:01 +00:00
Benjamin Walsh 31189d9ec8 tests/kernel/poll: verify tag is untouched by API
Change-Id: I56f0f0db64c20db40c26b197bba8f1e6bb80a499
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-03 13:53:59 +00:00
Jithu Joseph 1eba370efd tests: kernel: import pool/heap tests to unified kernel
Jira: ZEP-932

Change-Id: I4adf43f63db8dca7c252e40433f6ff0095dc1f26
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:46 +00:00
Jithu Joseph cacb2edfb7 tests: kernel: port mutex/priority inheritance test to unified
Jira: ZEP-932

Change-Id: I41728a1448998e32c9ad8217f132afbfafbae3d7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:46 +00:00
Jithu Joseph 10e36609b6 tests: kernel: import libs test to unified kernel
This tests access to standard libraries. Adapted
to use ZTEST.

Jira: ZEP-932

Change-Id: I3564bfa61221b2456323c1018402237b6129b5ca
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:45 +00:00
Anas Nashif 6ca73fb744 tests: legacy: resolve conflict with MON defined in HAL
Some header files were defining MON and causing a conflict, so call this
something unique and avoid future conflicts.

Change-Id: If9d2553a20b3afae50a09f4c0e10733ee1cdd58d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 04:50:10 +00:00
Jithu Joseph 9659fec761 tests: kernel: import errno test to unified
Jira: ZEP-932

Change-Id: I59b3d0aebc7df37c9b59e8bf1358d20500f24f57
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-03 03:21:05 +00:00
Jithu Joseph 5800f16484 tests: kernel: import floating point sharing tests to unified
This is the microkernel version of the FPU sharing test from legacy
modified to  use unified APIs directly.

Jira: ZEP-932

Change-Id: I133a1466ea75201a97c2f8b83c3586fea0a19447
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 03:20:32 +00:00
Benjamin Walsh ed536245f7 tests: add poll kernel test
Change-Id: I87af7c404b9c77fd82746e5bc2baf4df74d9380c
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-02 00:30:01 +00:00
Marcus Shawcroft 458e2ed133 libc/minimal: Fix definition of ssize_t
Each GCC target backend is at liberty to define its own SIZE_TYPE. GCC
uses this for various purposes, not lease it drives the machinery that
spits out format specifier diagnostics when format specifiers are
applied to objects with inappropriate type.  GCC exposes the current
definition of SIZE_TYPE via the preprocessor symbol __SIZE_TYPE__.
The GCC build processes also generates various standard library header
files that directyle expose stanard types in a form consistent with
the current configuration of GCC.  Conventionally standard library
build processes (for glibc and newlib) pick up the header files
generated by the GCC build.

In the minimal libc we have no such build process, we don't pick up
the header files that the GCC build process generated.  Instead we
define our own alternative header files and align them with GCC
manually.

The current definition of ssize_t in minimal libc is out of step with
GCC which means that any use of the %z[du] format modifier will issue
a diagnostic.

We replace the open coded architecture detection in minimal libc and
use GCCs __SIZE_TYPE__ directly.

Change-Id: I63b5e17bee4f4ab83d49e492e58efd3bafe76807
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>

tests: fs: Fix printf warning when using newlib

Current code uses %ld format specifier to print data of
type ssize_t. This causes type warnings when built with
newlib. The correct format specifier to be used for
ssize_t is %zd.

Change-Id: I02a3c628e3d6e8a36a09cd694220406d8faf1730
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-02-01 13:57:43 -08:00
Jithu Joseph b7180a4903 tests: benchmarks: put all benchmarks in the same folder
We ended up having "benchmark" and "benchmarks". This
fixes that.

Change-Id: I7ebc409e002e11f5bc9dc821310dd84f3982b8d4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-31 21:36:46 +00:00
Anas Nashif 58ccb64a74 benchmarks: boot_time: Move to unified kernel
Right now works only on x86, filed bug to address all architectures
(ZEP-1414).

Change-Id: Iba53b3688b2b78a4189df0b50578070a8d2ac8b2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-31 19:26:04 +00:00
Jithu Joseph 01652bd876 tests: kernel: import irq_offload test from legacy
This test was not using any legacy APIs, so simply
removed legacy from conf and ini's.

Jira: ZEP-932

Change-Id: I5a4b475ac5056b6d6aa64baef6bda53f20d8548e
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-31 12:20:50 +00:00
Jithu Joseph b636625a2b tests: benchmark: sys_kernel: Porting to unified
This change ports tests/legacy/benchmark/sys_kernel stuff to
use unified APIs.

Change-Id: If6fbaa5586502205e9f4dc6e79ff1c1a1c1b8102
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-30 21:33:47 +00:00
Jithu Joseph 7c118882d2 tests: include: Move timestamp.h into common location
These were part of latency_measure benchmark, but was
used in all benchmarks.

legacy symbols in timestamp.h were replaced to unified
ones. Tick based checks have been replaced with ms based
checks in line with the new APIs.

Change-Id: I1d27310023be4cafbceccf50cb87d72b6681443d
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-30 21:33:47 +00:00
Kumar Gala 434fad045a arm: cmsis: Convert _ScbNmiPend to use direct CMSIS register access
Jira: ZEP-1568

Change-Id: I56231084baaec4f6232f1ef4ebabe4f3fdb5175c
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-30 11:02:38 -06:00
Anas Nashif 66417c0246 Merge "Merge net branch into master" 2017-01-29 04:31:39 +00:00
Johan Hedberg eb07178236 Bluetooth: samples: Use Kconfig DEVICE_NAME variable when possible
Instead of using a hard-coded string, make the sample use the Kconfig
variable for the device name.

Change-Id: Ib09f594e1cba221f9064318572bd90d38bd2733a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Johan Hedberg 4153b6ca1f Bluetooth: Kconfig: Make device name variable generic
Change BREDR_NAME to DEVICE_NAME so it can also be used as the LE
device name.

Change-Id: I9ef55d9dff098372d47d9d5754ad7a7163a65bc0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Sergio Rodriguez fdf9238382 tests: context: Verify for out of bounds array
The for loop could exit with a out of bounds (variable j) value for
the delayed_threads array, we verify for the variable value before
operating on the array

This issue was reported by Coverity

Coverity-CID: 160078

Change-Id: I6aa1cc325cc363be48cd72b2a58d0a55ec3854bc
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-01-27 18:57:27 +00:00
Andrei Emeltchenko 6043dddd4a net: Remove unused CONFIG_NET_IPV6_NO_DAD option
Option CONFIG_NET_IPV6_NO_DAD is not used anymore, clean project
configuration files.

Change-Id: I368e076d2f79f1d4bc86edee11ff5befe37362c8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:54 +02:00
Andrei Emeltchenko 7ab5d4f572 net: tests: Correct project file for route tests
Routing tests uses ND so do not disable it, otherwise tests might fail
if disabling ND supported.

Change-Id: Ie020de8dac4447931d1067f1ed781a72cf05e8af
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:54 +02:00
Tomasz Bursztyka 83ed3a29be net/ieee802154: Modify radio TX function signature
The cause for this change is TCP. Until now, the radio strategy driver
(ALOHA or CSMA) was providing the actual nbuf, and not the buffer
fragment, counting on the fact that the loop was using
net_buf_frag_del() which made so, iteration after iteration, buffer
framgent to be always buf->frags. The problem with this logic is loosing
the fragments that might be still referenced by TCP, in case the whole
buffer did not make it so TCP can retry later and so on.

Instead, TX now takes the nbuf and the actual frag to send. It could
have been working with just a pointer on the data, and the whole length
of the frame. But it has been avoided due to possible future devices,
that will be smarter and run CSMA directly in the hw, thus it will
require to access the whole buffer list through the nbuf.

Change-Id: I8d77b1e13b648c0ec3645cb2d55d1910d00381ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Andrei Emeltchenko 5794d80c10 net: Remove CONFIG_NET_IPV6_NO_ND config option
The option is no longer used so it can be removed.
Use CONFIG_NET_IPV6_ND option instead.

Change-Id: Ibaa3d3deb52b8b176e85f8b9e1d8c80c1026aea1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:53 +02:00
Ravi kumar Veeramally 538d8d4032 net: tests: Use lighter printk() instead of printf()
Use printk(), snprintk() instead of printf() and snprintf().
CONFIG_STDOUT_CONSOLE is anyway disabled by default so printf()
will not output anything without it.

Change-Id: I5899741df2e187dae7b4602d074e9b4cbb9952aa
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-27 12:35:51 +02:00
Ravi kumar Veeramally b80878496d net: tests: Fix invalid config option in 6lo tests
The debug config was incorrect.

Change-Id: Id32cbcfb809acc9e4ab202b401d25e41a7531c42
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-27 12:35:50 +02:00
David B. Kinder d5bab09db6 license: fix SPDX headings on new tests
We're using SPDX tags for Apache 2.0 licensing instead of the
Apache 2.0 boilerplate comment block.

Change-Id: I9e56f918ab4ed4d127dbe64538c9fa62886386a8
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-26 20:01:39 +00:00
Anas Nashif 0a3738019f pinmux: unify galileo pinmux driver
Remove dev driver and integrate it in the default pinmux driver.

Jira: ZEP-958
Change-Id: I55670240f8a21749d3a6ae22e300e16ba80a2fb6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Anas Nashif 42e1c9ca34 pinmux: make pinmux_dev the default pinmux driver for quark
Jira: ZEP-958
Change-Id: Ib6c528a103372d5084efa5ae8635803e2912e0dd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Qiu Peiyang 41ffe0240d tests/gpio: fix test GPIO_INT_LEVEL bug
According to include/gpio.h, GPIO_INT_LEVEL is 0,
which means the branch to test GPIO_INT_LEVEL is
always false and GPIO_INT_LEVEL cases will always
pass.

This patch also fixes another minor bug in main.c.

Coverity-CID: 160074

Change-Id: I1fefa978e65bf801f244b4c2960cb87a26b0829e
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-25 14:25:48 +00:00
Qiu Peiyang cbeac3e97d tests/gpio: don't call risk function
According to Coverity, rand() is a risk function.
So we use another method to generate random value.

Coverity-CID: 160070

Change-Id: Icb7e06cd43cb8bade6596cc37e9d04bfc59e1de7
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-25 14:25:03 +00:00
Anas Nashif 1f55c8916d ztest: use an aligned stack size
1000 stack size was causing issues on architectures requireing aligned
stacks.

Change-Id: I57c06ef7eb09067d0312c27daad5d1300e6f43c6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-24 23:42:41 +00:00
Jean-Paul Etienne 2d1fd2c947 tests: kernel: threads_customdata: increase STACK_SIZE to 512 for riscv32
In RISCV, stack always grows by a multiple of 16 bytes, even if we are saving
data of size < 16 bytes onto the stack.

Hence, for riscv32 architecture increase stack size to 512 for
threads_customdata, otherwise we experience stack overflow.

Change-Id: I805bc346b8a2c2f4ad6d0db622eb262290af942b
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-24 23:03:30 +00:00
Jean-Paul Etienne bc81926b9a tests: kernel: test_mpool_concept: increase STACK_SIZE to 1024 for riscv32
In RISCV, stack always grows by a multiple of 16 bytes, even if we are saving
data of size < 16 bytes onto the stack.

Hence, for riscv32 architecture a bigger stack size is required for
test_mpool_concept, otherwise we experience stack overflow.

Change-Id: I938aa511efcae66f0131fa1bc23bd68600421885
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-24 23:03:29 +00:00
Kumar Gala 3ac51cd82b tests: newlib: disable bluetooth for now
When trying to build with newlib we get:

hci_driver.c: In function 'hci_driver_open':
hci_driver.c:389:10:
error: format '%d' expects argument of type 'int', but argument 2 has
type 'uint32_t {aka long unsigned int}' [-Werror=format=]
   BT_ERR("Required RAM size: %d, supplied: %u.", err,
          ^

This is because we have different types for {u}int32_t between newlib
and mini-libc.  We have to decide how we are going to handle this going
forward.  Various options include use of PRIu32, making mini-libc match
newlib's types, disabling the -Werror=format, etc.

Change-Id: I5df8fa05dd7658e1f6b2eeb8fa84e3270f3dd208
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-24 14:33:43 +00:00
Sharron LIU 110d58c055 tests: kernel: mbox_api: fix uninit variable and unchecked value
"struct k_mbox_msg mmsg" should be initialized before using.
"int" value returned by k_mem_pool_alloc() should be checked.

Coverity-CID: 160083
Coverity-CID: 160470

Change-Id: I35714bf9d76723c5fdd8c2963bf76b42ae1b1867
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:58 +00:00
Sharron LIU d9a3c92b5b tests: kernel: mpool: fix assert side effect
assert should not contain "i++" which might work differently in a non-debug
build.

Coverity-CID: 160469

Change-Id: Id8fd50127dd93de1676b812ac0888c9ec2e1b5de
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:41 +00:00
Sharron LIU 41d805a235 tests: kernel: mpool: fix unchecked return value
"int" value returned by k_mem_pool_alloc() should be checked.

Coverity-CID: 160471

Change-Id: I7ec19147e7a51997fed890075b06eba30bef9126
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:09 +00:00
Andre Guedes 6f141a5576 quark_se: PM: Add multicore support
This patch changes Quark SE power drivers to support multicore scenarios
e.g. both LMT and ARC core are enabled and manage power.

Handling LPS states in multicore scenarios are dead simple because LPS
states are core-specific states. It means that putting the LMT core in
LPS doesn't affect the ARC core, and vice-versa. DEEP_SLEEP state, on
the other hand, affects both cores since it turns power off from the SoC
and both cores are shutdown. It means that if LMT puts the system in
DEEP_SLEEP, ARC core is shutdown even if it is busy handling some task.

In order to support the multicore scenario, this patch introduces the
SYS_POWER_STATE_DEEP_SLEEP_2 state to both ARC and x86 power drivers.

On ARC, this state works as following:
1) Save ARC execution context;
2) Raise a flag to inform the x86 core that ARC is ready to enter in
   DEEP_SLEEP;
3) Enter in the lowest core-specific power state, which in this case is
   LPSS.

On x86, DEEP_SLEEP_2 is very similar to DEEP_SLEEP. The difference relies
in the post_ops() which calls _arc_init() in order to start ARC core so
it can restore its context.

This patch also adds the test/power/multicore/ directory which provides
sample application to x86 and ARC cores in order to easily verify the
multicore support. In test/power/multicore/README.rst you can find more
details regarding the applications.

Jira: ZEP-1103

Change-Id: Ie28ba6d193ea0e58fca69d38f8d3c38ca259a9ef
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2017-01-24 13:36:55 +00:00
Sharron LIU cd35f06de8 tests: kernel: msgq: fix unused value
"ret" returned from k_msgq_put() should be checked.

Coverity-CID: 160084

Change-Id: I192db3a67ab9489e8338f6636d4c2a6935e98d74
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:36:15 +00:00
Benjamin Walsh ee659ae1a1 build: add _ASMLANGUAGE to all asm files
This avoids asm files from having to explicitly define the _ASMLANGUAGE
symbol themselves.

Change-Id: I71f5a169f75d7443a58a0365a41c55b20dae3029
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-24 13:34:51 +00:00
Benjamin Walsh ed240f2796 kernel/arch: streamline thread user options
The K_<thread option> flags/options avaialble to users were hidden in
the kernel private header files: move them to include/kernel.h to
publicize them.

Also, to avoid any future confusion, rename the k_thread.execution_flags
field to user_options.

Change-Id: I65a6fd5e9e78d4ccf783f3304b607a1e6956aeac
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-24 13:34:50 +00:00
Kumar Gala 098f28983f tests: arm_irq_vector_table: Use CMSIS NVIC APIs directly
Convert testcases to use the CMSIS NVIC APIs or direct NVIC register
access rather than the internal ones so we can remove them in the future.

Change-Id: I2a5a3eae713e66944cf105e7fffa603b88522681
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:55 -06:00
Maureen Helm 06bd605da3 tests: Update spi driver test for mcux
Jira: ZEP-1374
Change-Id: Ibd66df42919d085666cfd7e98bea5c808d8d54e0
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:54 -06:00
Kumar Gala 2e0c2aff97 arm: nvic: kill _NvicSwInterruptTrigger
_NvicSwInterruptTrigger is only utilized by a testcase for irq handling
on ARM-V7M.  Just put the code into the testcase so we dont need to
support an additional interface.

Change-Id: I763c63c32a7a52918250458351d08b8fa54069dd
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:52 -06:00
David B. Kinder 516e155bb5 tests: update to Apache 2.0 SPDX tags on new tests
Some new tests were added that had the Apache 2.0 boilerplate licensing
instead of the SPDX licensing tag.

Change-Id: I4bde8c9c6e7a6d44bceeffb6bbcff9f62d417648
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-21 01:21:21 +00:00
Jukka Rissanen 088289ec28 net: context: Add status to connect callback
It is useful that the user API can know whether the connection
was established properly or not. So this commit adds status
parameter to connect callback in net_context API.

The call to connect callback needs to be set properly in TCP
code. This commit does not fix the connect callback call which
is not properly done right now in net_context.c.

Change-Id: I284a60ddd658ceef9e65022e96591f467a936a09
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:21 +02:00
Jukka Rissanen ba026941a1 net: ipv6: Fix IPv6 prefix comparision
If the prefix length % 8 is not 0, then the remaining
bit length was calculated incorrectly and the prefixes
were claimed to match even though they might not be the
same.

Adding a test cases for testing this properly.

Coverity-CID: 157591

Change-Id: I9cb5a73d5cc211ec183176400fa5e2dfd209e2da
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:18 +02:00
Michael Scott 4aad767328 net: linkaddr: calculate linkaddr storage addr size via config
- Introduce NET_LINK_ADDR_MAX_LENGTH which is either 6 or 8
  depending on whether CONFIG_NET_L2_IEEE802154 is used
- Instead of being a placeholder single index array of uint8_t,
  let's use NET_LINK_ADDR_MAX_LENGTH to assign the size of the
  "addr" array field in the net_linkaddr_storage structure.
- Now that the "addr" field of net_linkaddr_storage contains the
  true size of the link address, we can remove "storage" field
  which was hard coded to 8 bytes (2 uint32_t's).
- Fix 2 references to the "storage" field of the net_linkaddr_storage
  structure.

Change-Id: I2ea12058280b289f65085964eb7d503d4fd260c2
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:16 +02:00
jing wang 64579bc490 tests: add threads customdata api test case with unified kernel
the commit cover basic customdata apis:

k_thread_custom_data_set()
k_thread_custom_data_get()

Change-Id: Ide27cfd59230303767414c7f827d6ad627989a6f
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:41:56 +00:00
jing wang 6ffe10f50f tests: add pipe test cases which use unified kernel
Add kernel pipe test cases which cover basic pipe apis usage
across thread and isr

Change-Id: I11899411b305535297f2e25056678d5b7df8fb95
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:09:38 +00:00
jing wang e49480d590 tests: add fifo/lifo test cases with unified kernel
Add fifo/fifo test cases with unified kernel, which cover
basic apis across differnt contexts - thread and isr

Change-Id: Icb61d3dcd564167b0bd70419c652e0b000869959
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:09:11 +00:00
Sharron LIU c570efd63b tests: kernel: added memory pool threadsafe test
TestPurpose: verify API thread safe in multi-threads environment.

Jira: ZEP-1210

Change-Id: I1ff8231db8ebcd5713d6083379d0ebfbdabeeee0
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:47 +00:00
Sharron LIU 6ec8c6ef14 tests: kernel: added memory pool configuration options test
TestPurpose: verify memory pool configuration options.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/pools.html#configuration-options

Jira: ZEP-1210

Change-Id: Ia5379aabd60e490c4566def21eda600c4c1b08dd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:46 +00:00
Sharron LIU 61c53373ee tests: kernel: added memory pool concept test
TestPurpose: verify memory pool concepts.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/pools.html#concepts

ZEP-1210

Change-Id: I6250e4c26ddf361e74a76c23082cfdb376705560
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:45 +00:00
Sharron LIU 415e71e04c tests: kernel: added memory pool api test
TestPurpose: verify memory pool APIs.
All TESTPOINTs extracted from kernel-doc comments in <kernel.h>

ZEP-1210

Change-Id: I7dcc0638e7b9c4d6b5ffe282e4fe41ca520d003f
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:45 +00:00
Sharron LIU d7a9ac21ce tests: kernel: added memory slab threadsafe test
TestPurpose: verify API thread safe in multi-threads environment.
Thread safe test is explained with more details here:
https://gerrit.zephyrproject.org/r/#/c/9464/7/ test_mpool_threadsafe.c
Please comment if you think it necessary as an extensive kernel test.

Jira: ZEP-1209

Change-Id: I52a7ff393d72785622c047289e7d92286e131cc7
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:45:04 +00:00
Sharron LIU 9ebf3dc10c tests: kernel: added memory slab concept test
TestPurpose: verify memory pool concepts.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/slabs.html#concepts

ZEP-1209

Change-Id: I95c6cd666212218b9928356f9439e67a2fcf9b73
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:44:04 +00:00
Sharron LIU 37402b4161 tests: kernel: added memory slab api test
TestPurpose: verify memory slab APIs.
All TESTPOINTs extracted from kernel-doc comments in <kernel.h>

ZEP-1209

Change-Id: I80bc85e96110e7106b3fc5883b982d71c6a7e50b
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:43:42 +00:00
Sharron LIU 3cb55002b2 tests: kernel: re-path mslab test
tests/kernel/mem_slab --> tests/kernel/mem_slab/test_mslab
For the purpose to hold other mslab test apps.

Jira: ZEP-1209

Change-Id: I4a72b02a0a5095bb7cfbf73396b6d003ea63f92e
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 12:28:31 +08:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Johan Hedberg eccf03265f Merge bluetooth branch into master
- New SPI HCI driver for ST BlueNRG modules
 - More memory optimizations through TX buffer pool consolidation
 - Refactoring to take advantage of new IS_ENABLED() macro
 - Fixes to LE L2CAP Credit-based Flow Control
 - Various smaller fixes & enhancements here and there

----------------------------------------------------------------
Arkadiusz Lichwa (2):
      Bluetooth: UUID: Fix format specifier in 128-UUID
      Bluetooth: ATT: Fix redundant sys_slist call

Arun Jagadish (1):
      Bluetooth: AVDTP: Added params to AVDTP Request structure

Carles Cufi (1):
      bluetooth: hci_core: Fix conn params validity check

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement Aggregate Flow Control

Johan Hedberg (21):
      Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
      Bluetooth: Use the controller bt_rand() whenever possible
      Bluetooth: Controller: Rename hci_le_rand to bt_rand
      Bluetooth: hci_uart: Remove redundant idle & ISR stack size values
      Bluetooth: Remove unused bt_hci_driver_unregister() API
      Bluetooth: Add missing documentation to HCI driver APIs
      Bluetooth: GATT: Fix missing connection address comparison
      Bluetooth: ATT: Add new error code from CSSv7
      Bluetooth: Prefer struct bt_le_conn_param over individual values
      Bluetooth: Add documentation for connection callbacks
      Bluetooth: Remove ACL details from BT_BUF_RX_SIZE
      Bluetooth: L2CAP: Remove RECV_RESERVE from BT_L2CAP_RX_MTU
      Bluetooth: Introduce a new connection parameter request callback
      Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG
      Bluetooth: Add __printf_like annotation for bt_log
      Bluetooth: drivers/nble: Remove bogus BT_DBG manipulation
      Bluetooth: hci_core: Take advantage of IS_ENABLED whenever possible
      Bluetooth: conn: Take advantage of IS_ENABLED whenever possible
      Bluetooth: L2CAP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: SMP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: Don't select TinyCrypt RNG for combined builds

Lee Jones (5):
      pinmux/stm32l4: Add support for STM32L SPI1 and SPI3
      pinmux/nucleo_l476rg: Define pinmuxing for SPI1 and SPI3
      Bluetooth: Add HCI SPI driver
      Bluetooth: samples/beacon: Print message at start of sample
      Bluetooth: Kconfig: Specify stack size for Bluetooth SPI

Luiz Augusto von Dentz (4):
      Bluetooth: L2CAP: Fix using CONFIG_BLUETOOTH_RX_BUF_LEN as MTU
      Bluetooth: IPSP: Reuse buffer fragments instead of copying
      Bluetooth: L2CAP: Make sure state is correctly updated
      Bluetooth: L2CAP: Fix always using RX_BUF_COUNT as initial credits

Sathish Narasimman (1):
      Bluetooth: AT: Rename enum at_cmd_type elements

 drivers/bluetooth/hci/Kconfig                   |  81 +++
 drivers/bluetooth/hci/Makefile                  |   1 +
 drivers/bluetooth/hci/h4.c                      |   8 +-
 drivers/bluetooth/hci/h5.c                      |   8 +-
 drivers/bluetooth/hci/spi.c                     | 351 ++++++++++++
 drivers/bluetooth/nble/conn.c                   |   8 +-
 drivers/bluetooth/nble/gap.c                    |  13 +-
 drivers/bluetooth/nble/gatt.c                   |   8 +-
 drivers/bluetooth/nble/rpc_deserialize.c        |  27 +-
 drivers/bluetooth/nble/rpc_serialize.c          |   5 -
 drivers/bluetooth/nble/smp.c                    |   3 +-
 drivers/bluetooth/nble/uart.c                   |   6 +-
 drivers/bluetooth/nrf51_pm.c                    |   1 +
 .../pinmux/stm32/pinmux_board_nucleo_l476rg.c   |  12 +
 drivers/pinmux/stm32/pinmux_stm32l4x.h          |  10 +
 include/bluetooth/att.h                         |   1 +
 include/bluetooth/buf.h                         |   1 -
 include/bluetooth/conn.h                        |  81 ++-
 include/bluetooth/l2cap.h                       |   2 +
 include/bluetooth/log.h                         |  40 +-
 include/drivers/bluetooth/hci_driver.h          | 106 +++-
 samples/bluetooth/beacon/src/main.c             |   2 +
 samples/bluetooth/hci_uart/nrf5.conf            |   2 -
 samples/bluetooth/ipsp/src/main.c               |  35 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c     |   2 +-
 subsys/bluetooth/controller/hal/rand.h          |   2 +-
 subsys/bluetooth/controller/hci/hci.c           |   4 +-
 subsys/bluetooth/controller/hci/hci_driver.c    |  18 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   1 -
 subsys/bluetooth/controller/ll/ctrl.c           |   1 +
 subsys/bluetooth/host/Kconfig                   |  63 ++-
 subsys/bluetooth/host/a2dp.c                    |   7 +-
 subsys/bluetooth/host/at.c                      |  38 +-
 subsys/bluetooth/host/at.h                      |  10 +-
 subsys/bluetooth/host/att.c                     |  65 +--
 subsys/bluetooth/host/att_internal.h            |   6 +
 subsys/bluetooth/host/avdtp.c                   |  24 +-
 subsys/bluetooth/host/avdtp_internal.h          |  10 +-
 subsys/bluetooth/host/conn.c                    | 157 +++---
 subsys/bluetooth/host/conn_internal.h           |   4 +-
 subsys/bluetooth/host/gatt.c                    |  12 +-
 subsys/bluetooth/host/hci_core.c                | 504 +++++++++---------
 subsys/bluetooth/host/hci_core.h                |   5 +-
 subsys/bluetooth/host/hci_ecc.c                 |  11 +-
 subsys/bluetooth/host/hci_raw.c                 |   8 +-
 subsys/bluetooth/host/hfp_hf.c                  |   6 +-
 subsys/bluetooth/host/keys.c                    |   6 +-
 subsys/bluetooth/host/keys.h                    |   4 -
 subsys/bluetooth/host/keys_br.c                 |   6 +-
 subsys/bluetooth/host/l2cap.c                   | 108 ++--
 subsys/bluetooth/host/l2cap_br.c                |  32 +-
 subsys/bluetooth/host/l2cap_internal.h          |   8 +-
 subsys/bluetooth/host/log.c                     |   2 -
 subsys/bluetooth/host/monitor.c                 |   1 -
 subsys/bluetooth/host/rfcomm.c                  | 148 ++++-
 subsys/bluetooth/host/rfcomm_internal.h         |  15 +
 subsys/bluetooth/host/sdp.c                     |   6 +-
 subsys/bluetooth/host/smp.c                     | 211 ++++----
 subsys/bluetooth/host/smp_null.c                |   7 +-
 subsys/bluetooth/host/storage.c                 |   1 +
 subsys/bluetooth/host/uuid.c                    |   2 +-
 tests/bluetooth/shell/arduino_101.conf          |   2 +-
 tests/bluetooth/shell/prj.conf                  |   2 +-
 63 files changed, 1479 insertions(+), 852 deletions(-)
 create mode 100644 drivers/bluetooth/hci/spi.c

Change-Id: Ic11028e1f02636a48d95cbe03735af37cea94e25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-18 19:09:51 +02:00
Anas Nashif 566b3fa0a0 tests: footprint: set ARCH correctly and provide defaults
Change-Id: I57beaf70d3cf8f1ef4267f002d2e72df22b918b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:39 +00:00
Anas Nashif 9d0e6f08f2 tests: do not use RC_OK, use 0 instead
RC_OK is defined only in legacy.h

Change-Id: I760924285629e3fe567ca30755393ecc754f7c02
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:36 +00:00
Anas Nashif 92af5aecab ztest: enable coop/preempt configurations
Change-Id: I5688fca73155cbb341f766d84f2d240b7ec8d05e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 12:17:24 +00:00
Benjamin Walsh abaaf89d69 tests/context: fix Coverity warning about array overrun
Coverity was warning about an array overrun that should never happen.
Add an extra check to verify that is indeed the case.

Coverity issue 152017.

Change-Id: Ie6269acaa85387ba051dbff87b4bfaab860517a6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2017-01-17 11:49:23 +00:00
Johan Hedberg 767c92e176 Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
Having TX buffers split into numerous pools has the downside of
increased memory consumption. This patch takes the initial step to
consolidate these pools into a single one, saving about 248 bytes of
RAM for a basic configuration.

Change-Id: I449ba18b44a9a6af68e9a2c44f19a9286eb88b14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-17 08:44:21 +02:00
Benjamin Walsh 7ddec7b471 tests: add test for k_timer_user_data_set/get()
Change-Id: I1baaa4d1a4c1626b3acdbeb4b0bfe58c9b8fff0c
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-14 13:06:01 +00:00
Jean-Paul Etienne d65dae20e3 tests: kernel: threads_scheduling: increased stack size to 512 for riscv32 architecture
Otherwise, not passing sanitycheck

Change-Id: I6dba149750a7d4266fd52851f7e0b139efdba210
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 20:00:00 +00:00
Jean-Paul Etienne 142e3cb0f3 tests: legacy: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I2faa823226cd76d129d2bc3db961c9b862aaf784
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:44 +00:00
Jean-Paul Etienne fa12f10196 tests: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I43a5c5112d694efdc14c5a0bcb4cafdc196d2680
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:30 +00:00
jing wang 9dcd848faa tests: add timer test case with unified kernel
the commit verify basic timer apis, including
K_TIMER_DEFINE
k_timer_init()
k_timer_start()
k_timer_stop()
k_timer_status_get()
k_timer_status_sync()
k_timer_remaining_get()

Change-Id: I15e25e00b46fcfefe0a7b68a0a4befa96f657ead
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-13 02:46:24 +00:00
Anas Nashif a1ae7f565b Merge "Merge arm branch into master" 2017-01-12 18:23:39 +00:00
jing wang ae2cf51591 tests: Add PWM driver api test
The commit verify below PWM apis
    pwm_pin_set_cycles()
    pwm_pin_set_usec

test PWM apis under always-on, half-on and alway-off modes

Change-Id: I2251be23ad9c443703dac44e138651a63d2d7211
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-12 15:54:16 +00:00
Marcus Shawcroft ef8200dfcd arm: Replace CONFIG_CPU_CORTEX_M3_M4 with CONFIG_ARMV7_M
Precursor patches have arranged that conditional compilation hanging
on CONFIG_CPU_CORTEX_M3_M4 provides support for ARMv7-M, rename the
config variable to reflect this.

Change-Id: Ifa56e3c1c04505d061b2af3aec9d8b9e55b5853d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-12 09:46:25 -06:00
Maureen Helm acca033468 pinmux: Merge ksdk pinmux dev into regular ksdk pinmux driver
Merges the ksdk pinmux dev driver into the regular ksdk pinmux driver,
which now exposes the public pinmux API. Removes the private ksdk pinmux
API and converts the frdm_k64f and hexiwear_k64 boards to use the public
pinmux API.

Jira: ZEP-958, ZEP-1432
Change-Id: Ie5f60b604133093050b9c596050cad776d7b7cb3
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:25 -06:00
Kumar Gala 76480636f9 tests/sensors_n_z.conf: fix duplicated setting of CONFIG options
A few CONFIG options got set twice in sensors_n_z.conf, remove the
duplicates as we get warnings associated with this:

warning: override: reassigning to symbol GPIO
warning: override: reassigning to symbol SENSOR
warning: override: reassigning to symbol SPI
warning: override: reassigning to symbol SYS_LOG_SENSOR_LEVEL

Change-Id: I7a723218db8e365bdb45c004e93bd2c4f55ab5ac
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-11 19:40:01 +00:00
Anas Nashif 2bc9d69981 build: abstract emulation and replace qemu goal with run
This will replace the current goal of 'make qemu' with 'make run' and
moves Qemu handling into its own file and into the boards instead of
being architecture specific.

We should be able to add new boards that support some other type of
emulation (by adding scripts/Makefile.<emu type>) and allow the board to
define their own options for the use type of emulation.

'make qemu' will still work, however it will be deprecated, starting
with this commit it is recommended to use 'make run'.

Jira: ZEP-359
Change-Id: I1cacd56b4ec09421a58cf5d010e22e9035214df6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-10 20:20:47 +00:00
Kumar Gala d19910f685 samples/tests: reduce ram & code size for failing tests on nRF5x boards
These samples/tests fail to build on some of the nRF5x platforms.  We
don't need Bluetooth enabled for these tests so we can reduce footprint
by turning it off.

Change-Id: I87e62a1d70f80d2bc22414d6a9e591e36ad9fa06
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-10 02:23:23 +00:00
Kumar Gala 0314a4e287 Bluetooth: remove arduino_101_ble from test_controller_dbg
RAM size has increased on arduino_101_ble which causes it to no longer
be able to build test_controller_dbg.

Change-Id: Iab8ed2857db23d048cfa6b04e2d1fea31efbb13c
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-09 20:56:11 +00:00
Benjamin Walsh f955476559 kernel/arch: optimize memory use of some thread fields
Some thread fields were 32-bit wide, when they are not even close to
using that full range of values. They are instead changed to 8-bit fields.

- prio can fit in one byte, limiting the priorities range to -128 to 127

- recursive scheduler locking can be limited to 255; a rollover results
  most probably from a logic error

- flags are split into execution flags and thread states; 8 bits is
  enough for each of them currently, with at worst two states and four
  flags to spare (on x86, on other archs, there are six flags to spare)

Doing this saves 8 bytes per stack. It also sets up an incoming
enhancement when checking if the current thread is preemptible on
interrupt exit.

Change-Id: Ieb5321a5b99f99173b0605dd4a193c3bc7ddabf4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2017-01-09 20:52:24 +00:00
Anas Nashif 70a2e138b7 kernel: add LEGACY_KERNEL option
Add global option for legacy configurations and enable by default for
backward compatibility. Disable option on tests and keep it on legacy
samples and tests.

Jira: ZEP-964
Change-Id: I0831e2aa74d438b1ac74eb762186cb220a504beb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-09 19:42:13 +00:00
Jithu Joseph 89f4bf7c7e subsys: disk: Refactor disk_access stuff into a directory
Disk IO functions are used by both FS and USB Mass Storage.
This patch refactors those from FS directory to a separate one.
In addition existing, config options were modified to make
stuff meaningful.

Jira: ZEP-1276

Change-Id: Ia2a2e18f3dbbbdb964c3dc0427d8138ad86134cd
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-08 20:58:05 +00:00
Anas Nashif f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Andy Ross a5b694fbbc net: tcp: Select correct source address for SYNACK packets
The source address for a TCP SYNACK must (obviously) be the same as
the destination address of the SYN that produced it.  But the existing
IP packet creation routines would simply fill in a default address
from the net_context struct, which is correct for *established*
connections, but for the listening socket is generally INADDR_ANY
(i.e. all zeroes) and will result in an arbitrary choice for source
address (e.g. a link-local address on the same interface) which can
easily be wrong.

So we need to pass the correct address all the way down from the SYN
packet handler code through the net_ipv*_create() packet creation
functions.  This requires lots of API plumbing, but relatively little
logic change.

Change-Id: Ic368f8cef6689f8a27cbafd5933a4964d5cc457e
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-01-06 08:21:15 -05:00
Qiu Peiyang a6aa60f502 tests/gpio: fix typo
Change-Id: Ic93d1e5dcb46455abd3ea2d7fe8790b2163c1c67
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-05 23:54:18 +00:00
Vinayak Chettimada 27353bb655 Bluetooth: Controller: Kconfig connection RSSI measurement
Add Kconfig configuration and conditional compilation of
RSSI measurement during a connection.

Change-id: I5a2f23f76a7cbbd9569d53d31899a472bf39d3ee
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 08fcc44b8a Bluetooth: Controller: Kconfig Data Length Update feature
Add Kconfig configuration to conditionally enable Data
Length Update procedure support in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I4515c0c7cf9aeb333a289397ae3c9bac04a08e4e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada b37e285c03 Bluetooth: Controller: Kconfig LE Ping feature
Add Kconfig configuration to conditionally enable LE Ping
feature in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I5fbbdbe8f45ac01c9b0d7b11e002a0d1db4d272e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 04794ba1c1 Bluetooth: Controller: add init test for BT 4.0 only controller
Add a test configuration to build a controller that
supports only Bluetooth v4.0 features.

This is copy of prj_controller.conf, but Kconfig defines
will be added in subsequent commits to conditionally
compile out feature not in Bluetooth v4.0 specification.

Also, added nrf52840_pca10056 and arduino_101_ble board
builds be tested.

Change-id: I36891bfc54cc36a8588c9b019de582e3193e8aa3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada a591205045 Bluetooth: Controller: Kconfig radio ISR profiling
Add Kconfig configuration and conditional compilation of
radio ISR profiling.

Change-id: Ia80d6bc54810156be99b2e6a25327c30d0714697
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Johan Hedberg 63f71adc5f Bluetooth: Take advantage of new net_buf_add_mem() API
This helps simplify code that was previously combining net_buf_add()
with memcpy().

Change-Id: If44cf9cd651aba5e544e36567869f147468663eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:16 +02:00
Genaro Saucedo Tejada 2382cb8fa3 sanity: prevent stack corruption at test_static_idt
Stack for fiber idtSpurFiber at tests/legacy/kernel/test_static_idt
for nanokernel is not big enough since printk parse context refactor
(commit 3ab6046), causing sanity check to fail with CONFIG_DEBUG=y.

Change-Id: Iddc74a2800163a22be985067ce828ac859ae4a24
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2017-01-05 02:03:27 +00:00
Andrew Boie 0f08bd8cf8 gpio_basic_api: fix format codes
Change-Id: I006a0c3efe24a6d41a488a466cba97e9bbd1c164
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-01-03 20:37:40 +00:00
Inaky Perez-Gonzalez 57eb17a8ca tests/kernel/stackprot: 'fatal fault' is not a failure
By default, when a 'fatal fault' message is seen in the output of any
testcase, it is consider an inmediate fatal condition and the test
case is aborted.

However, this testcase is provoking the situation to verify the
condition is caught. This, it shall NOT be considered a fatal fault
and the default overriden to allow it to proceed.

This was done in the legacy testcases and now is moved to this
testcase, ported from legacy.

Change-Id: Icac6cf55cae2ffd9b071e9dd1f35918b7b30de5e
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-01-03 19:30:54 +00:00
Genaro Saucedo Tejada e3029f719f sanity: prevent stack corruption at test_sema
Stack for task tStartTask at tests/legacy/kernel/test_sema/microkernel
is not big enough since unfied kernel was enabled by default for all
test (since commit c2de216).

Change-Id: I3332cd5e14ca384428834697a1841fa680a68b00
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2017-01-03 19:30:31 +00:00
Juro Bystricky 5ec3a7d04a test_thread_init.c: fix build error
Fix build error (picked by GCC 6.x):

    error: ‘stack_size’ defined but not used [-Werror=unused-const-variable=]

Change-Id: I402324fedaea9d0a10ee6533ba957ce18fa0fb83
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-03 19:29:02 +00:00
Anas Nashif 66cfcc26bc tests: introduce Makefile.test
To customise test builds and support test related features such as time
stamps and a boot banner, introduce a Makefile variant that is dedicated
to testing.

Initially we introduce a new config overlay that is used for all tests, in
this case we enable BOOT_BANNER and BUILD_TIMESTAMP. This will print the
current version and the date, useful when reporting bugs and also an
indicator that the system has booted before the test has started.

For example:

[QEMU] CPU: qemu32
***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Dec 21 2016 19:57:13 *****
tc_start() - Test Nanokernel CPU and thread routines
Initializing nanokernel objects
...
..

Change-Id: I224318cdeb55a301964ea366dbc577e2e3a09175
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-03 17:48:44 +00:00
Tomasz Bursztyka a1aa08c288 net: ip: Improve logging by adding a dedicated sys_log level
Let's make net stack having its own level of debugging through sys_log.
It replaces NET_DEBUG by NET_LOG_ENABLED, which is then semantically
better: someone wanting to log the errors might want that not only for
debugging.

Along with it, CONFIG_NET_LOG_GLOBAL option is added, in order to enable
all available logging in network stack. It is disabled by default but
might be found useful when warning/errors need to be logged, so it is
then unnecessary to selectively enable by hand all CONFIG_NET_DEBUG_*
options.

It is possible, locally, to override CONFIG_SYS_LOG_NET_LEVEL by setting
the level one want to NET_SYS_LOG_LEVEL. This can be useful on samples
or tests.

Change-Id: I56a8f052340bc3a932229963cc69b39912093b88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:20 +01:00
Tomasz Bursztyka 4869dc9786 net: tests: Add platforms whitelist to http header unit test
quark_d2000_crb does not build as ROM and RAM space are way too little
for it.

Change-Id: I1a5992dcd49f90fa6604cd8ab76db7e170be7cd4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:20 +01:00
Flavio Santes ac7300611c net: Restructure network protocols
This commit restructures the network protocols. Changes applied are:

- Move lib/iot/ to subsys/net/lib
- Move network protocol headers to include/net
- Move lib/iot/zoap/link-format.h to include/net/zoap_link_format.h
  and link-format.c to zoap_link_format.c
- Move tests/iot/ to tests/net/lib/
- Adapt sample code
- Adapt build system
- Modify doxygen paths

Change-Id: I37085fa4cc76a8a8e19a499ecb4e87b451120349
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-01-02 10:03:19 +01:00
Vinicius Costa Gomes c538bb6602 tests/zoap: Add test for payload size
Add a test for the available space for the payload, so the problem with
the payload length doesn't regresses.

Change-Id: Ifef541d8428947eb482729aa773a7e9ddd2b6f81
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-02 10:03:19 +01:00
Tomasz Bursztyka 0a1617365f net: buf: Change NET_BUF_DEBUG to NET_BUF_LOG and add a level option
It will be thus possible to enable only the error logging, or the other
sys_log levels.

Change-Id: I0c0ed789f7cfbb4811320e8f8249151288274873
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:17 +01:00
Tomasz Bursztyka 56f25b49a9 tests: net: Fix format issues
Fixes:
error: format '%u' expects argument of type 'unsigned int'

Change-Id: I02aaaea79150967d7831d89d0c05427bf2685708
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:17 +01:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Anas Nashif fad7e2dd8d logging: move event_logger to subsys/logging
Jira: ZEP-1337
Change-Id: If1690e19a882cf53caaa3418ccabeb49c783f63d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
jing wang b008914e42 tests: add gpio driver test case
the commit include 5 ztest cases, cover the basic gpio APIs
including callback relevant and pin read/write functions.
It proves workable on intel quark c1000 and
arduino 101 platform

Change-Id: Iab30aa841cfa440c1f773b5a8c5ce0d68346c353
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:26 +00:00
jing wang 3d99a0c878 tests: add driver aio comparator test case
the commit cover below apis by testing callback under RISE polarity
    *) aio_cmp_configure
    *) aio_cmd_disabel

Change-Id: Idc9ec3a2694950d0074b69d164ee2c1edac35c9a
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:25 +00:00
Anas Nashif 0dd774df10 tests: import stack protection testcase to unified
Change-Id: I5a867b7bfed56ebfe79b3f14f772c6ab7482d229
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:25 +00:00
jing wang e23b0ab49f tests: add zephyr thread lifecycle test case with unified kernel
this commit cover zephyr thread lifecycle relavant apis testing
k_thread_spawn
k_current_get
k_thread_abort
k_thread_cancel
k_thread_suspend
k_thread_resume

Change-Id: I99bff0dd803f6e68e165f3388a3be09425c0596c
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:06 +00:00
jing wang 333e8d985d tests: add zephyr message queue test case with unified kernel
the commit cover basic message queue api testing across contexts
and some typical scenario

Change-Id: I82bb0c6a5df9d4436f5a98f78d1ad989e32282c8
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:05 +00:00
jing wang 3d20b9dad6 tests: add sem test cases which use unified kernel
add semaphore test case which cover basic sema apis
across thread/thread and thread/isr contexts.

Change-Id: I2041969fcdc70a4dfc95438f067fbef8ebb31b19
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:04 +00:00
jing wang 7553b4688b tests: add mutex api test cases which use unified kernel
add unified kernel mutext test cases which covere basic
mutex apis under different conditions - timeout,
no_wait, forever

Change-Id: Iaab5bba80a6eebd89bfe675352d67b27024ad7bb
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:03 +00:00
jing wang 3b03060579 tests: add stack test cases which use unified kernel
add stack test cases which cover basic api usage across
threads and thread/isr.

Change-Id: I1f42fa1139899c932a14da18753b93972f561bc8
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:03 +00:00
Jithu Joseph fb20912cb5 tests: kernel: test_slab: Porting memory map tests to unified
In unified kernel, memory maps are renamed as memory slabs.
This change ports tests/legacy/kernel/test_map stuff to
use unified APIs.

Change-Id: Ibf4d60fb53e45a119e6828a09f2638ee7def76b7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:02 +00:00
Sergio Rodriguez 5fbb695a01 tests: kernel: test_critical: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_critical test case to
the unified kernel, and to use the ztest framework

Change-Id: I10834cbb51446b4a12fc680c0b65438d550f4d85
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:00 +00:00
Sergio Rodriguez a6a1360b24 tests: kernel: test_context: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_context test case to
the unified kernel

Change-Id: I344ac240eb3b48042477f8875115fdc3fca1154a
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:00 +00:00
jing wang b10ab24c02 tests: add threads scheduling test case with unified kernel
this commit cover thread scheduling relevant apis

k_current_get()
k_sched_lock()
k_sched_unlock()
k_yield()
k_sleep()
k_wakeup()
k_busy_wait()
k_sched_time_slice_set()

Change-Id: Ie449db3dda910bc1bafc0b5a04633f284e7f1dc3
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:15:59 +00:00
Anas Nashif 1d3b16a74a tests: remove redundant test_ from test names
Change-Id: Ieeb2c44b2891b3cf451d9445b8959b1f338d731e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:46:50 +00:00
jing wang d15523f223 tests: Add watchdog timer test case
The commit cover Interrupt Reset mode and Reset mode by 2 test cases.
They can't be tested in one shot, but need test separately.
api converage:
    wdt_enable()
    wdt_disable()
    wdt_set_config()
    wdt_get_config()

Change-Id: I44b20cfe97d860e8b25b2cab76f9d9398cfd8e69
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:29 +00:00
jing wang ed754ecf6d tests: add rtc driver test case
the test include 2 ztest cases, verfy below apis:
    rtc_enable()
    rtc_disable()
    rtc_read()
    rtc_set_config()
    rtc_set_alarm()
    rtc_get_pending_int()

Change-Id: Ifca2541312c5ec8d450803f1b6e4f5064098e7fe
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:28 +00:00
LIU, Sharron 638066757f tests: kernel: added test_thread_init
This test case is under test set "lifecycle" against
https://www.zephyrproject.org/doc/kernel_v2/threads/lifecycle.html

Change-Id: I0d43c1a1798411c786efc45d76e6fd7c024c47dd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:28 +00:00
Sharron LIU 67af6f8844 tests: kernel: added test_workq_api
Change-Id: Iaadba1a720130a496a83c245c7da4b95dff168fd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:27 +00:00
LIU, Sharron 6afbd387bf tests: kernel: added mbox api test
tested APIs:
K_MBOX_DEFINE
k_mbox_init
k_mbox_put
k_mbox_async_put
k_mbox_get
k_mbox_data_get
k_mbox_data_block_get

Change-Id: I73e1bd27a69b23fb5b8a856ce092fb651066a6c6
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:27 +00:00
Szymon Janc ad8eee2788 Bluetooth: shell: Fix br-discovery help message
Timeout should be passed as decimal.

Change-Id: I9f772b918e33eded8e0328e655e83cca74166595
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Szymon Janc 17ea315e20 Bluetooth: shell: Add option to specify BR/EDR discovery length
This allows to specify length of discovery from command line.

Change-Id: I3ad80e74b5cdc263e549ce309b75c1f5c117b653
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Baohong Liu 83a388e6c8 tests: spi: correct a spi buffer length issue
Make the buffer length for tx and rx are the same for
spi_transceive API call. QMSI only supports equal length.
This is clearly specifed in spi header file.

Also correct some coding style issues.

Change-Id: Ifd34683e8813dae9b692ad453176a93cb3848427
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:20:42 +00:00
Benjamin Walsh a1622472c3 drivers: hp206 driver does not need 2000 ticks/s frequency
From code inspection, the driver always took timeouts in milliseconds.
The only sub-ms wait uses k_busy_wait(), which has microseconds
granularity, but its granularity does not depend on the system clock
tick rate.

Change-Id: If48363fd1fbeeb8e5ff0f0f2ca86e671d63bc571
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Flavio Santes d8083e92ab arch/arc, usb, ztest: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: Ie07f52e742bdb93fb35301bd50cce3865f229623
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:54 +00:00
jing wang 208fc48d81 tests: add zephyr alerts test case
the commit cover alert send and receive with 4 types -
DEFAULT, IGNORE, PENDING, CONSUMED which across thread and isr
context.

Change-Id: I41dae9ba2dc980bcd768f1220f55b5492bc8ae37
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-12-21 01:56:19 +00:00
Anas Nashif d3578bb2fc tests: GDB server only works on qemu_x86 now
Change-Id: Ie5ebb9d1be22cbb7c7cc3b54688cc957e49e786e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 15:48:51 -05:00
Anas Nashif 7e86380e63 tests: add gdb server test
Change-Id: If15b34ea24b68ea6527fc51c953451b656a10cf5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 14:59:35 -05:00
Anas Nashif 569f0b4105 debug: move debug features from misc to subsys/debug
Change-Id: I446be0202325cf3cead7ce3024ca2047e3f7660d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:40 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Anas Nashif cfbe9b05a1 kernel: rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED
rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED to
TICKLESS_IDLE_SUPPORTED and remove nanokernel occurances in Kconfig
files.

Make TICKLESS_IDLE depend on hardware that supports it.

Change-Id: I6a2e4fb0f7cf4b45475b48e71823ea089ee98759
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:35 +00:00
Flavio Santes a73a5bc41e tests/tcp: Initialize buffer to NULL
This commit initializes some net_buf variables to NULL to solve the
issue reported by Coverity: "Memory illegal accesses (UNINIT)".

Coverity-CID: 157610
Coverity-CID: 157611
Coverity-CID: 157612
Coverity-CID: 157617
Coverity-CID: 157619
Coverity-CID: 157620
Coverity-CID: 157622
Coverity-CID: 157624
Coverity-CID: 157626
Coverity-CID: 157627
Coverity-CID: 157628

Change-Id: I98a1ea5db4c169f69e3fa3d5de4c0ed7fdf1820a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-16 19:14:53 +01:00
Flavio Santes db04f43931 tests/iot/http: Initialize parser struct
This commit fixes the issues reported by Coverity:
	Declaring variable "parser" without initializer

Coverity-CID: 157613
Coverity-CID: 157614
Coverity-CID: 157615
Coverity-CID: 157616
Coverity-CID: 157618

Change-Id: Ib4ac2a663852fed3e40ce86af237d05b87f03a50
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-16 19:14:52 +01:00
Johan Hedberg 1c9da665c3 Bluetooth: Remove unnecessary runtime kernel object initialization
There are static initializer macros available for most kernel objects
which we should use whenever possible.

Change-Id: I496f4d05d26801eddd21fae53bdd4fcdc3246fe3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-16 10:27:48 +02:00
Anas Nashif fe958df4dd libc: rework libc selection and reduce Kconfigs
Moved all libc Kconfigs to where the code is and remove the default
Kconfig for selecting the minimal libc. Minimal libc is now the default
if nothing else is configured in.

Removed the options for extended libc, this obviously was restricting
features in the minimal libc without a good reason, most of the
functions are available directly when using newlib, so there is no
reason why we need to restrict those in minimal libc.

Jira: ZEP-1440
Change-Id: If0a3adf4314e2ebdf0e139dee3eb4f47ce07aa89
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 22:31:28 +00:00
Anas Nashif 6ce672d753 net: remove unused variable pkt1
Change-Id: I987765a6020b7d5b5ff8fd1213dfc4b9a13cdf7f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:33:02 +00:00
Anas Nashif 200c4031dd net: remove unused variable dis
Change-Id: Iec80bd13532b17d36fbe1b3d07f31b8f481859d9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:32:52 +00:00
Tomasz Bursztyka ca4ac62611 net: tests: Remove unused variables from dhcpv4 unit test
Fixes this:
error: ‘zero_addr’ defined but not used [-Werror=unused-const-variable=]
...

Change-Id: I5b0baf597e62f3206e15638a63e129503b76b048
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 14:34:16 +01:00
Julien Delayen 176d184fb8 power: Add ARC core suspend and resume support
When going into DEEP_SLEEP mode, the ARC core now saves
its context. This includes:
- All core registers
- Stack pointer
- Program counter (restored by jumping to the restore code)

The arc reset code now checks if the GPS0 bit 2 is set.
This is similar to the behavior of the x86 core done by
the QMSI bootloader which is setting GPS0 bit 1 in order
to call the restore path instead of cold boot path.

The sample has been adapted in order to support the ARC.

Jira: ZEP-1222

Change-Id: I375f03b16b8a5fd1f07ead55cf7e4947d6290c9f
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:33 +00:00
Johan Hedberg d659bb020e net: buf: Remove redundant user_data_size from buffers
Since the user data size is now stored in the pool there's very little
value in storing it as well per-buffer.

Change-Id: I17a99123b232423c52a2179b4eccd813728d51b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:17 +02:00
Johan Hedberg 71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Johan Hedberg 45bc46d42e net: buf: Introduce net_buf_destroy() wrapper
This is only for use with custom destroy callbacks, so that the
application gets isolated away from the details of how exactly the
buffers are managed. This opens up the possibility of switching away
from k_fifo to potentially better solutions, such as k_lifo.

Change-Id: I0d8322fdec3500d8ae060ae471b9448aeaa4572a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 08:45:05 +02:00
Genaro Saucedo Tejada 1589f2ccdd sanity: filter the build-all test for ethernet
Ethernet build-all test was not being filtered base on RAM size so
build step LINK was failing with "region `RAM' overflowed by 192
bytes" error when running daily sanitycheck.

Added filter so this test is not attempted for boards with smaller
RAM such as quark_d2000_crb, which was causing daily build failure

Change-Id: I4ed3bef4f1c78e83890331db34fb1f2b2b066414
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-12-14 17:25:10 +00:00
Anas Nashif 418058a123 kernel: remove NANOKERNEL and MICROKERNEL configs
Those are legacy and not needed anymore.

Change-Id: I8113114fd60880b3f538612db7702f6129af0a06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-14 13:45:52 +00:00
Marcus Shawcroft 954baea90b random: Restructure RANDOM Kconfig
Restructure the RANDOM Kconfig to match the structure used in other
drivers with a single top level menu.  Move the true random number
generators to appear first in the menu, with pseudo generators at the
bottom.  Do not present pseudo generators if a true random generator
is presented.

This change implies that tests, samples and applications that require
the random driver interface must now select CONFIG_RANDOM_GENERATOR.

In order for tests and samples to build (and run) on platforms that
have no random driver it remains necessary to select
the CONFIG_TEST_RANDOM_GENERATOR.

Note that CONFIG_TEST_RANDOM_GENERATOR retains its original purpose of
enabling a random driver that delivers non random numbers for the
purpose of testing only.

Change-Id: I2e28e44b4adf800e64a885aefe36a52da8aa455a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Marcus Shawcroft fe8d044d9a tests: Remove unnecessary CONFIG_TEST_RANDOM_GENERATOR
Remove CONFIG_TEST_RANDOM_GENERATOR from each test and sample where it
is not required.

Change-Id: I949f8e93c2cb1881622a5e48efeb87c43122a170
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Anas Nashif 0859df1eca kernel: disable MDEF by default
Disable MDEF option and set it only in legacy projects.

Change-Id: I2e1f011eb1f876af929140e36f71f0efb5e955c1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-12 20:25:07 +00:00
Marcus Shawcroft 409b754a15 Remove application calls to sys_rand32_init.
The random driver, if enabled, is initialized by the kernel
initialization function.  There is no need for applications or tests
to re-initialize the driver.

Change-Id: Ib4712dda937a7a83a8079c8aa662cec03c5416f8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-11 11:18:18 +00:00
Maureen Helm 4a1c31a790 k64: Change the default pinmux driver to the ksdk one
Stop using the specific k64 pinmux driver by default and start using the
more generic ksdk pinmux driver instead.

Jira: ZEP-1393
Change-Id: Id65b59518c386e6ba33cfa5c4c5bd541664d2b41
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-10 21:14:12 +00:00
Jaganath Kanakkassery 77753193d9 Bluetooth: shell: Add support for RFCOMM Disconnect
This is used to disconnect a dlc.

Syntax:
>br-rfcomm-disconnect

Change-Id: I8f345d9fbb1f1f84bfb1f697322d9a87ff531797
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-12-09 06:53:14 +00:00
Johan Hedberg a4b6b2417d Bluetooth: Switch from printf to printk functions
There's now snprintk available that's more light-weight on the stack
than snprintf.

Change-Id: I6b3e4409703ca92fe6b8f4146ff47c490ab826cb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-09 08:18:24 +02:00
Johan Hedberg c899cd0d12 printk: Add APIs to print into strings instead of default output
These correspond to the libc snprintf and vsnprintf APIs.

Change-Id: If3944972ed95934a4967756593bb2932c3359b72
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-05 20:08:40 +00:00
Anas Nashif 918740d15b tests: net: exclude quark_d2000_crb
Not enough memory on this device with 8K of SRAM

Change-Id: I359cce806098cac7e0e2a9e00ce40c91bc535c5b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-05 16:44:46 +00:00
Anas Nashif 70f9244db7 Merge "Merge net branch into master" 2016-12-05 15:56:26 +00:00
Benjamin Walsh 0e2451e3a0 tests: increase stack size on test_errno
The stacks are overrun on ARM.

Change-Id: Ic5f1555b138a732e409c92cff716278b33dfce5d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-02 22:57:30 +00:00
Anas Nashif bf83460725 tests: ipm: change init level from NANOKERNEL to POST_KERNEL
Change-Id: I86bbf50525018148689be9362c191d00324c595c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 15:52:35 +00:00
Vincenzo Frascino fc1071d91e tests/kernel: verify RUNTIME_NMI at runtime
This patch introduces a test that verifies the behavior of
CONFIG_RUNTIME_NMI at runtime.

The test is meant to be only for ARM Cortex-M targets.

Change-Id: I805a88e67fe47d396ac9e29e1275e5452a4b8a36
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-02 14:03:28 +00:00
Flavio Santes a1dc687b5d iot/http: Add test-case for HTTP header fields
This commit adds the following routines:

- test_invalid_header_content
- test_invalid_header_content
- test_invalid_header_field
- test_invalid_header_field
- test_preserve_data
- test_parse_url
- test_method_str
- test_header_nread_value
- test_double_content_length_error
- test_chunked_content_length_error
- test_header_cr_no_lf_error
- test_invalid_header_field_token_error
- test_invalid_header_field_content_error
- test_double_content_length_error
- test_chunked_content_length_error
- test_header_cr_no_lf_error
- test_invalid_header_field_token_error
- test_invalid_header_field_content_error

Origin:
https://github.com/nodejs/http-parser/releases/tag/v2.7.1
https://github.com/nodejs/http-parser/archive/v2.7.1.tar.gz

This patch reformats some http_parser files to reduce checkpatch
warnings.

See:
	https://gitlab.com/santes/http_parser/tree/refactoring1
Commit:
	c58dd8350fdf6ead0807ba37107b19f58e4f434c

Furthermore, method_str overflow test was updated to avoid compiler
warnings on some platforms.

Before:
	Line 627: http_method_str(1337)
After:
	Line 627: http_method_str(127)

Jira: ZEP-346
Jira: ZEP-776

Change-Id: If6163f59de21186f22f4f02d8c44f43ddbf9b59b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 3eaec41ab8 net: Moved net/ to subsys/net
* Moved networking code into subsys/net.
* Renamed net/yaip to net/ip at the same time.
* Fixed the tests/net to compile
* Fixed the Makefiles and Kconfig files in subsys/net
  to use the new location of the IP stack

Change-Id: Ie45d9e8cb45a93fefdf969b20a81e3b1d3c16355
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 368ef49331 tests: net: ipv6: Add test for neighbor advertisement
Check that we change the ll address in neighbor cache
properly when receiving NA.

Change-Id: Ib0373751abebdfe1c5e83fd38ec91b9587797e32
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Jukka Rissanen e2a4432e85 tests: net: ipv6: Wrong IP address was added to cache
Peer address is used when sending NS so that it is added
properly to neighbor cache.

Change-Id: I51c2e236a0b137f7ab086a782f3baced13aa3ee3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Jukka Rissanen bd9f9e7cde tests: net: ipv6: Fix prefix test
Also disable prefix lifetime overflow test as it does not work
properly.

Change-Id: I54c8716f6a6d4f5bec76b0a61fe0e18e983924f4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Anas Nashif 47b27514a3 test: net: remove nano/micro tests
Change-Id: I57898f5d9f050a2301504a3df43feb2bd1e6d4fc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:41:17 +02:00
Anas Nashif 3d97803c02 tests: net: remove qemu.pid file and bad filters
Change-Id: I26ef207fdebab674a89d54efeb3f4a1a3c4258f6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen 68ea9377e6 net: Make native IP stack the default
As the native IP stack is now the default, there is no need
for corresponding Kconfig option.

Change-Id: I08e4992f540f928a2b7378e8803e634e38725348
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen 6b43821f20 net: Remove legacy Contiki based uIP stack
This commit removes the legacy Contiki based uIP stack.
The new native IP stack must be used after this commit.

The commit also removes following things:
- legacy cc2520 driver
- legacy ethernet drivers
- legacy IP stack samples

and changes these things:
- disabled tests that only work for legacy IP stack
- select new IP stack by default
- enable random number generator by default as it is needed
  by the new IP stack

Change-Id: I1229f9960a4c6654e9ccc6dac14a7efb9394e45d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Ravi kumar Veeramally 72c71e8310 net: ieee802154: Add offset based reassembly feature
Current reassembly of 802.15.4 packets works only if fragments are
in correct order. But as per RFC 6282 reassembly should be based on
offset parameter in fragmentation header.

Change-Id: Icdcb10b9aa8f5837063b0201a64f8eb050c75681
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen f4be98b4bb tests: net: Change the tag of network tests to net
There were different tags defined in testcase.ini files for
networking tests. Unify these and change the tag to "net"
in all networking tests. This makes it easy to execute
all network tests via sanitycheck.

Change-Id: I8ce7ccf8cccca35234602e37f6568db0b986d181
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen d048b5c9d1 tests: buf: Do not depend on IP stack
The net_buf tests were including net_ip.h which requires some
extra config options to be usable when the new native IP stack
is used. In order to avoid this dependency, define struct in6_addr
locally in the source file.

Change-Id: Iafe0d2b5b507665baaed23f5e2c55a9d9a300d47
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka a54d5607ad tests: ieee802154: Fix compilation error in fragment test
Which happens only when internal DEBUG is set to 1

Change-Id: I175943f32065ae81b1a4453dde40f36738c28084
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:09 +02:00
Leandro Pereira 6b9b9a6f75 net: tcp: Provide NET_TCP_FLAGS macro
Instead of having to write "NET_TCP_BUF(buf)->flags & NET_TCP_CTL"
every single time, provide a NET_TCP_FLAGS macro that expands to this
expression.

Change-Id: Ie876c538599fabae6b800a53613b6ad17dc45620
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:08 +02:00
Tomasz Bursztyka 85a8f8e6fa net: trickle: Using unified kernel API
Dropping legacy API. This commit also contains updated
unit tests in order to pass the test.

Change-Id: Ibc7426837e2f4f23bb5f3ed3719635c5c3d0ed0f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:07 +02:00
Tomasz Bursztyka 06362ff5c6 tests: net: Using unified kernel API
Dropping legacy API.

Change-Id: Ife835e38fb03e909e89c3060771f42d1cfa12164
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:07 +02:00
Flavio Santes c55ca20ad4 iot/mqtt: Add support for frdm_k64f
This commit adds the frdm_k64f board to the testcase.ini while list.
It also updates the README file with the build instructions and
firmware version used in this test.

Change-Id: Ia0e989d483aede51aa53e7453bbd1c260223372d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:06 +02:00
Jukka Rissanen 1b58d970ca net: ipv6: Move unspecified address getter to ipv6.c
More logical place for net_ipv6_unspecified_address() is in ipv6.c
instead of net_if.c. Removing the net_if_ipv6_unspecified_addr()
variant as it is no longer needed.

Change-Id: Ib5b4f6748030a8bf50fb848a87eef2968e2bcbc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:04 +02:00
Flavio Santes 88c160021c iot/mqtt: Add test app for the MQTT packet handling routines
The following routines are evaluated in this test case:

- mqtt_pack_connect
- mqtt_pack_disconnect
- mqtt_pack_publish
- mqtt_pack_subscribe
- mqtt_pack_suback
- mqtt_pack_pingreq
- mqtt_pack_pingresp
- mqtt_pack_puback
- mqtt_pack_pubcomp
- mqtt_pack_pubrec
- mqtt_pack_pubrel
- mqtt_pack_unsuback

- mqtt_unpack_connect
- mqtt_unpack_disconnect
- mqtt_unpack_pingreq
- mqtt_unpack_pingresp
- mqtt_unpack_puback
- mqtt_unpack_pubcomp
- mqtt_unpack_pubrec
- mqtt_unpack_pubrel
- mqtt_unpack_unsuback

Future patches will extend this test case to cover the whole MQTT
packet library.

Origin: Original

Jira: ZEP-870

Change-Id: I4fee403c24d1eb0428fb18b413763e28b6b726d1
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:03 +02:00
Tomasz Bursztyka b52f8f1fa1 tests: net: TCP Context needs to be listening before running accept
Change-Id: I433ddac41afcb055cd45e2e7fc4c26ed8c56e3c2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka 64e7dc2caa tests: net: Unified kernel is now default and only one
Adapting all unit tests so:

- main task's prj.mdef is already provided by unified kernel with a
default stack of 2kb.
- unified is the only kernel to be used now, removing unecessary kernel
type make option.
- removing all NANOKERNEL/MICROKERNEL related #ifdefs and so on.

Change-Id: I9b853dbd2aef971d355188cbf7fe2ececaaa80c1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Leandro Pereira ad1a9d088d net: tcp: Add better type safety for connection handlers
This creates a `struct net_conn_handle` that's only used as an opaque
pointer.  The purpose is to avoid assigning a void* to a void** in
connection registering/unregistering functions, avoiding a
previously-caught bug by issuing an incompatible pointer types warning:

	warning: passing argument 7 of 'net_tcp_register' from
		incompatible pointer type [-Wincompatible-pointer-types]

Suggested by Andy Ross in 5beec6.  This particular commit didn't catch
any bugs, but the one caught in 5beec6 wouldn't exist if this were in
place at the time.

Change-Id: I5c13fb4c5826adce6397feb7b400d36e426c4a87
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:02 +02:00
Jukka Rissanen c15b467d42 net: tests: Send IPv6 hop-by-hop option to IP stack
Added a test to send HBH option to IP stack. Currently
the test will always pass, activate some more debugging
to see what the IP stack is doing with the option.

Change-Id: Id0ab1590eb8216f5f67c4d43ce2e882186334198
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:01 +02:00
Jukka Rissanen dffafbd290 net: tests: Unit tests for RPL
Change-Id: I5c2c4dd4eb8a8af77bd0d8db06b09a25871893b3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:00 +02:00
Jukka Rissanen cac9d1b3cf net: Add support for embedding extra data to routing entries
This can be used to store routing protocol specific data
into neighbor entry. By default no extra data is allocated.

Change-Id: Iabff0a1df676398a47b86adbc398c4f566dcc40a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:58 +02:00
Jukka Rissanen c38dd8870c tests: net: 6lo: Make sure no error in microkernel
Microkernel test for 6lo was giving error because the
prj.mdef file was refering to wrong function name.

Change-Id: I4197c509fb266a908eb03cc0bda34e39c66b229c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:57 +02:00
Tomasz Bursztyka 91c3f06e97 tests: net: Moving IEEE 802.15.4 fragmentation test in proper place
fragment is only about testing 15.4 6lo fragmentation, so let's put it
in dedicated tests/net/ieee802154/ directory.

Change-Id: Ib838600e571753ab976c74dac78ee774f628c2ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 593fc81bf4 tests: net: Multiple test will go inside ieee802154
So reordering files in order to put more specific tests in it.

Change-Id: I000bc5efb8442d02e9a50e1b85cb45e0bec12789
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 831bfcb048 net: ieee802154: Improve 6lo frag reassemble API
No reassembly logic is changed besides removing the final reassembled
pointer. Instead of requiring such pointer, let's just use the frag one.
Such changes will ease the usage of ieee802154_reassemble():
the given frag buffer, in case it finally got reassembled and thus
provided a NET_CONTINUE verdict, will directly be handled by net_core.

This makes things consistent as well with verdicts:
- in case of NET_OK, buf has been consumed and thus unrefed
- in case of NET_DROP, buf needs to be unrefed by caller
- in case of NET_CONTINUE, buf is updated with reassembled and
  decompressed data packet, up to net_core to handel it accordingly.

Change-Id: Ibd1588debd22a7f4571b36713dd46bf8b1d88329
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 34988043a4 net: ieee802154: Reverse 6lo fragmentation verdict
As soon as fragment is put into the cache and as long as it is not
identified to be the last one: let's return NET_OK to notifiy the
fragment has been consumed by ieee802154 L2.

That way, net_core will not try to interpret it - and fail - unnecessary
increasing the drop statistics.

On the contrary, once the buffer is fully reassemble, let's return
NET_CONTINUE in order to let net_core consume the buffer relevantly.

Change-Id: I715b687e451f4643656e122b0d119f114696340b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 2887bbf7fc tests: ieee802154: Make the test ready to handle multi fragments buffer
Buffer sent by 802.15.4 L2 might have more than one fragment, thus
handling it properly.

Change-Id: I12fef8a9c5de56615c3a084c57f438e71b320fcf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Vinicius Costa Gomes 86b1ef7b7b tests/zoap: Fix extra unref on net_buf fragments
Since "22e919872206b1d net: Adapt to new behavior of net_buf_frag_add"
net_buf_frag_add() takes onwership of the fragment, so this _unref()
after a net_buf_frag_add() is wrong.

Change-Id: I1559c2978cf8d800891d6e752478537fbee7c02b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes 3aa352e622 tests/zoap: Port observer tests to the native stack
This enables the tests for the observer feature to be run using the
native IP stack.

Change-Id: I325dcd1f5d9fffe3821eed1bd950a717e5f17b67
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Ravi kumar Veeramally 78502f1804 net: tests: Update DHCPv4 test results based on events
Earlier test results was updated as soon as test server ACK client
dhcpv4 request. But update results on IPv4 address add event on
interface.

Change-Id: I212309a4d1d2eae88f73470e00754db1d6fecda5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Marcus Shawcroft f903cb3763 net: dhcpv4: Implement XID
RFC2131 requires that a client must choose XIDs in order to minimize
the chance of collision with another client.  Selection of a random
XID at boot is a valid approach. Adjust the XID representation from
array of bytes to the more convenient uint32_t representation,
initialize the XID to a random number and increment for each request.

Refactor the dhcp test case to generate response messages with the XID
from the received message.

Change-Id: I93f180e6aa02430f807e0a97186577dc956fb653
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Jukka Rissanen 7f4275ef52 iot/zoap: Temporarily disable block size transfer test
The test "Test block sized transfer" does not work with
new IP stack so disable it temporarily for new stack.
This needs to be fixed later.

Change-Id: Ie89dd101270ab9b8a9b056757de79cd3da009180
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:53 +02:00
Ravi kumar Veeramally d3b21f0171 net: tests: Add unit tests for net_nbuf_write/insert utilites
Change-Id: I4df5672777af2c27511465b72ea17b7b5e0c8e8f
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:53 +02:00
Anas Nashif e6bbc5003c net: do not depend on ARCH
Rename project configuration to be architecture independent and do not use ARCH
in Makefile.

Change-Id: Ic793751e3187bc74fd14cec929754d691b01a799
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:40:52 +02:00
Jukka Rissanen 1c3c26a1f9 net: tests: Add TCP unit tests
This provides only initial set of functionality tests
for TCP. More tests are to be written.

Change-Id: I157fed85f561523bf063732ce86eaae551c2d384
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:52 +02:00
Ravi kumar Veeramally c689fd6f1a net: Rename net_nbuf_write to net_nbuf_append
Current net_nbuf_write() api just appends data to last fragment. And
doesn't write data based on offset. That's why renaming this api.

New net_nbuf_write() apis based on offset will be coming soon.

Change-Id: Ie8e13e5f6091a279b62b6d8b0b3928a5187e75b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Vinicius Costa Gomes dc45748d50 iot/zoap: Port to the native stack
This ports zoap to the native stack.

Just for reference, and totally not scientific, here are the numbers
using the old stack:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  34657	  10316	  16916	  61889	   f1c1	outdir/qemu_x86/zephyr.elf

With yaip:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  30575	   9148	   6164	  45887	   b33f	outdir/qemu_x86/zephyr.elf

Jira: ZEP-818

Change-Id: I7992a3e2af7d419081ee5a64d7cc2d49fb628ead
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Ravi kumar Veeramally ead511ddae net: Fix net_nbuf_read corner cases
Valid case:
 1) If the offset is more than current fragment length, adjusts offset
    from next relevant fragment and starts reading or skipping.
 2) If the read or skip length is more than available data length,
    then throw an error.

In case of an error, frag is 'NULL' pos is '0xffff'. Rest of the cases
are successful read and skip.

Change-Id: I88c4b85e14e5821f681966b5148ba9519b91cca4
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:49 +02:00
Ravi kumar Veeramally 712f0c90db net: tests: Add 6lo context based unit tests
Change-Id: I73e18d830d1dcd4f5181b0de74cb7818086504a3
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:48 +02:00
Ravi kumar Veeramally e68625345a net: Add support for 6lo context based compression
RFC 6282, 3.1.1 (If SAC == 1 and M = 0, DAC = 1).
Source and Destination address compression support if addresses are
based on context based information from Router Advertisement message.

Change-Id: I23a3bf4f111016a8e54be5f0181a113353ad4b88
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:48 +02:00
Ravi kumar Veeramally e8f40a970a net: tests: Add sample 6CO context data to IPv6 RA test
Test is only for parsing 6CO data. Nothing more than that.

Change-Id: I7e5851f389216473379a9e50b83dfb03fbe1e68e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:48 +02:00
Vinicius Costa Gomes 42c3969ad8 tests/net/nbuf: Fix invalid memory access
The memcmp() could reach after the buffer that is used for verification
ends, which was causing this test to fail on the qemu_cortex_m3 board.

Change-Id: Ia05df823f201d9017acb35c7634fa506389ae9f1
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:48 +02:00
Vinicius Costa Gomes 61bb244ab1 tests/net/nbuf: Fix wrong size to linearize() call
linearize() expects the amount of room available in the buffer.

Change-Id: I1062912f76951758177b7dd6588e7e0ae280dc03
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:48 +02:00
Vinicius Costa Gomes f2236bb2d7 tests/net: Exclude tests needing more RAM than available
Quark D2000 doesn't not have enough RAM for these tests.

Change-Id: Iba79eaadb15eb8f1eae4bfdbc6865985d3da3fd3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:48 +02:00
Ravi kumar Veeramally 918703cba3 net: tests: Decrease the required buffers count
Buffer leaks are fixed in 6lowpan compression and ieee802154
fragmentation. So lower the count in tests.

Change-Id: Ic9581f898156fedc20a3e445be8b7a466ee15d99
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:47 +02:00
Tomasz Bursztyka 08b748432b tests: Add network core event tests
A fake network device and interface are setup. Test implies add and
removing an IPv6 address which should trigger the related notification.

Change-Id: I6035cfbfaf80c8f4352b5d31b47ca1445434d926
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:47 +02:00
Tomasz Bursztyka af703e1106 net: Normalizing net_mgmt API names
While doing some documentation for it, I realized names were not all
good and it missed some stuff:

- what belongs to event should contain "event" in it
- we have a structur as callback so let's type the handler as a handler
- let's add the request handler signature

Change-Id: I18822cbcdc3c10e33600d6db38abab5ca73a228c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:46 +02:00
Flavio Santes 7e7f72b104 net: Fix tests/net/nbuf/Makefile
Use ?= for the CONF_FILE variable to match the default assignement for
BOARD ?= qemu_x86.

Change-Id: I0b6cf1e967eeb437d99aa7286cf560426d48fbf9
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka 8b1953f740 tests: net: Add net management event sender/receiver tests
It mimics how event could be thrown through a dedicated thrower (a
fiber). The amount and event it can throw is gived through parameters.

Change-Id: I484bc72bdb730a77ce976b0b2998411d9918b7fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka ec1d2c5a48 tests: net: Add a basic network management API test
Testing if net_mng() works.

Change-Id: I303cffa206859184a503ba8efe392b673b162e43
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:45 +02:00
Ravi kumar Veeramally 1ce3550779 net: tests: Add RA message unit tests.
Basic unit tests for Router Advertisement message handler.

Change-Id: Ia99cd160632972a12e2099a3ff6e41e6ea48ff9b
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen d8cb2fb161 net: Make sure buf is correct one in net_nbuf_write()
The buf parameter cannot point to a data fragment in
net_nbuf_write() because we need to use user data inside
that function and the fragments do not have that information.

Change-Id: I45b9c23869df08a0852bd99c0b453210ad2300b5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Ravi kumar Veeramally 913c1f29ca net: Add unit tests for new nbuf API's
Tests for net_nbuf_read, net_nbuf_write and net_nbuf_skip API's.

Change-Id: I77f702dda8c9df7892120f47ff03a6b256191d31
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen 338c2be888 net: tests: Add initial set of IPv6 tests
Change-Id: Ib68b38a809068ca14ee9307e9ea605f03611ebd3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen fb9af2523d net: tests: Increase the timeout of trickle tests
One second timeout seems to be too short as some test runs
fail when run in Jenkins.

Change-Id: Ifb01929148415961712468e3cc85387aac5eb2bb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen 66d3601dd5 net: tests: Add tests for route management API
Change-Id: Ic2f8d2d270f63baa0a16ae76f248485bc00eef08
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Tomasz Bursztyka 640d524f69 net: tests: Add a simple IEEE 802.15.4 Beacon frame test
It's an empty beacon frame, juste to validate the Beacon frame parsing
logic.

Change-Id: I90916eb87187c9eae9b2267f34dc93bee554d4b5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally 2a9d75ac1c net: tests: Add DHCPv4 client unit tests
Change-Id: Ief15927975bb0398c39c656068ec8c73c4f62e82
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally 846201d049 net: tests: Remove broadcast and multicast tests from ARP
If ethernet address is broadcast or multicast, l2 layer does not
send any ARP messages. Handle this scenario in ethernet tests.

Change-Id: I8e11832803e1539887152447090d1286c7fa3eb0
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Jukka Rissanen c427e9bbd6 net: Context accept cb needs to return failure code
If the connection establishment has an error, the accept
callback needs to be able to return that error to user space
so that the application can know about it.
This is especially important in TCP where application needs
to start to listen again if reset is sent during connection
establishment.

Change-Id: I55f36e4f101c7237c1288f09baf6e602b33da2b3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen 84ffca2eb1 net: tests: Add unit test for net_nbuf_pull functionality
Change-Id: I929f7c6eed21aca0f92975b96380a91e5e50587f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen 96e629c877 net: Fix remaining debug option naming issues
Some of the DEBUG options for the new IP stack still used
the CONFIG_NETWORK_IP_STACK_DEBUG_ prefix.

Change-Id: I8f039ac5e303a7c571a870403ce17d758db540d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka becf74743b net: Split debug Kconfig options from legacy to new stack
- new stack options are renamed and placed in their respective menus
- new stack Kconfig gets normalized (tabs vs spaces, etc...)

Change-Id: Ia68f6589fed464bbdd76dc0812775684b2f94a58
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Jukka Rissanen 58a7ada44c net: Add network address length to user API
Add socklen_t addrlen parameter to net_context_bind(),
net_context_sendto() and accept callback.

Currently the address length option is not really mandatory
as we can figure out the length from the address family.
But if we are going to support other protocol address families
it might be needed.

Change-Id: I59206465c3259050c469c5b2150221646a9a08d7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:24 +02:00
Jukka Rissanen 103a98d173 net: tests: Fix printf modifiers in new IP stack unit tests
Because of printk fixes in master, some of the networking
unit tests will fail in next merge.

Change-Id: I3e28aae72c0c10b402b78c0f406ecb3513b967a7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:23 +02:00
Ravi kumar Veeramally 0d76826a0d net: tests: Extented 6lo unit tests
Earlier all unit tests are with IPv6 and UDP as next header.
Modified tests with IPv6 only, IPv6 + UDP and IPv6 + IPHC next
headers.

Change-Id: Ie02cecb37e07ceae8a06a0653e2ccdfe0db91239
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:23 +02:00
Jukka Rissanen 2eb01fe191 net: tests: Enable unit tests for the new IP stack
We are not just checking the test build but this time
the tests are also run.

Change-Id: I7b0b24c51dfc2dc58f290cca7a593be431b8077f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:22 +02:00
Tomasz Bursztyka 9c62543f62 net: Follow file naming in ieee802154 l2 stack
For consistency as well as for helping when grepping etc.

Change-Id: Ib5e6b3369e510dd2b996f735d801c2b80291ad7f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:21 +02:00
Jukka Rissanen c03028f1f1 net: tests: Test Trickle algorithm
This is only meant for the new IP stack.

Change-Id: I643b0556f87423f09555274749db93397ef66c59
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:21 +02:00
Ravi kumar Veeramally ae1ce83dd1 net: tests: Add fragmentation unit tests for 802.15.4
Change-Id: I5722f86c00c76921e94f6f2a8e9add8960498107
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:21 +02:00
Ravi kumar Veeramally fe4a4efe78 net: Add support for IEEE 802.15.4 re-assembly
Reassembly IEEE 802.15.4 fragments as per it's datagram size
and datagram tag. Uncompress IP header fragment as soon as it
arrives. Size matches only after uncompression of IP header with
total length.

Support added for multiple IP packet reception. Default is one full
IP packet at a time. Cache size can be modified via Kconfig option
(NET_L2_IEEE802154_FRAGMENT_REASS_CACHE_SIZE).

Note: If you increase the size by 1 means, you should have N number
of data buffers available at max.
e.g. One full IP packet (1280 MTU) needs 15~16 data fragments means,
multiply size by same number of fragments. It requires more memory.

Offset based reassembly yet to be done (fragments can come in any order
[e.g. mesh]). Now assuming that fragments are in right order.

Change-Id: I17baee30a1087eb9ec6dc25f03ed64bbe0df2917
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:21 +02:00
Ravi kumar Veeramally dc36bdb89d net: Integrate 6lo and 802.15.4 fragmentation
Change-Id: I348656e0049d79f4dfdaba7909ad0b770f3ee922
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:21 +02:00
Ravi kumar Veeramally 8743ac7ec8 net: tests: Add unit tests for 6lo IPv6 dispatch
Change-Id: I962b1f94b6b2ba6ef2429ef0deca3ee5352df3d8
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally 1725ac66d7 net: Add 6lowpan without compression header support
Add support for IPv6 header dispatch (without IPv6 compression
and uncompression). Only IPv6 dispatch header will be added at the
beginning of the buffer.

Change-Id: I7400a4dd115ac3b4b3d9deecd3cdb9ea292573fb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally 9217b68f3c net: Change 6lo API returned parameter
6lowpan compression and uncompression done on original
input buffer. So no need to return paramter as net_buf *.
If the compression or uncompression fails, unref the buffer
as it cannot be used further.

Change-Id: I64f496e22b2008a91a358fff65de1b87659cd9eb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally 142ca7f01e net: tests: Fix 6lo tests
UDP length was wrongly set and test count was hardcoded.

Change-Id: Iade959e1b8c3580b43aa2a9ff1fc10eb5a462f2f
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Tomasz Bursztyka 4e7efd4bcb tests: net: Add a IEEE 802.15.4 ACK replies test
- Parsing a proper ACK reply
- Generating a ACK reply from a data packet requesting it, and comparing
  it to a proper one.

Change-Id: I1717fedc899eafa0aa849e1e253f02cd3dc3d4fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka 11c9b8dac7 tests: Add grounds for IEEE 802.15.4 stack tests.
First test is a unit test for frame parsing

Change-Id: I080d64a71fe4b6ff00e071a0cdee97ab9cd922d5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka 3560f58293 net: L2 might need private data per-interface
Allocate the right amount of space for L2's context.

Change-Id: Ia2f4f4162334e9e9c26dc95230abdfde5986e052
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Jukka Rissanen 04a65534e1 net: Change srctree to ZEPHYR_BASE in Makefiles
This is related to changes in commit 7dcbbc39e7
("build: move from srctree to ZEPHYR_BASE for app include paths")

Change-Id: Ie902ed66bb74188ed54aae44e2f4289f954ec351
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:17 +02:00
Jukka Rissanen 498f9e04de net: tests: Unit tests for user space socket API
Change-Id: Ifd149e4f4313abde4cead135f7533f26dec6bdf7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:15 +02:00
Jukka Rissanen 9331b2bc7b net: Add net_conn pointer to callback
When a UDP packet has been received and if a watcher match
is found, then a callback is called. It is useful to have
a pointer to net_conn when calling the callback.

Change-Id: Ifa97b37c22b1fc9cac7eadfba23aa68dfd473fda
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:15 +02:00
Jukka Rissanen 1932d4c3ec net: Convert network connection to use sockaddr
As the net_conn needs port information, use struct sockaddr
internally as it has the port numbers built in.

Change-Id: Idb1c87afa956dfe55dc8d533d867fa7845545b12
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:15 +02:00
Jukka Rissanen f88da0fa36 net: tests: UDP unit test had incorrect ll address length
Change-Id: Ie3231c6fda2faf49f4767a78250b923bedb2d293
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:14 +02:00
Jukka Rissanen 432f3b3914 net: tests: udp: Print debug info only when activated
No need to print debug prints if debugging is not activated.

Change-Id: I42a6453b4f3e11106119561b580ebea41e56452d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:14 +02:00
Jukka Rissanen 2658ac7a73 net: IP address lookup functions return interface
When checking the IP address from network interface, return
also the used network interface.

Change-Id: If7b8385193da4cb1b469f697e219cfae3b6477dd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:14 +02:00
Tomasz Bursztyka a1fde2bff8 net: Fix dedicated IPv4 function for net_if
IPv4/6 functions follows this scheme: net_if_ipv<4/6>_<name>.
Applying that to net_if_set_gw/net_if_set_netmask which are IPv4
functions.

Change-Id: I2dcbb16ce81cfdffbfbb5cae24ad76ddf2b9919a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:14 +02:00
Ravi kumar Veeramally c1ee601962 net: tests: Add unit tests for 6lowpan functionality
Change-Id: Ie13a05300e05fdc536fcb4ec64e323789704ba8b
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:14 +02:00
Tomasz Bursztyka 97daa51c80 net: Cleanup net_if's documentation
Change-Id: Idd139ee5f56c8b55119db69582393fe2906eae74
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:13 +02:00
Tomasz Bursztyka b8e3415264 net: Let's use inline function for type checking for net_nbuf
Using macros does not let the compiler verifying about the type we are
providing, which usually give an error easier to understand.
Also, this will let the compiler deciding how to actually optimize
(inline or not) the code.

Change-Id: Iba49590b620ef0a1bd0ed5621453524fcfea747c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:13 +02:00
Jukka Rissanen 55dcaf9e22 net: tests: Fix project file for IP address tests
Disable IPv6 DAD and ND for IP address test as there is
no need to do neighbor discovery in the test. We also
would like to see network interface debugging and use
dummy L2 driver instead of ethernet one.

Change-Id: Ia9f218c8d4c13afa1482302691d2ef72af4a7b13
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:13 +02:00
Jukka Rissanen 894e42d025 net: tests: Fix IP address test so that it will not crash
The driver_api pointer was set to NULL and send() pointer
was missing which caused a crash in TX fiber.

Change-Id: I7204c975691476dd9ab2c61bfd11b7664343e47c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:13 +02:00
Jukka Rissanen fe16af1e06 net: tests: ICMPv6 was missing random number config
Change-Id: Ibcfa6662f30727a31cc2fa371e8a3ec3923db3cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:12 +02:00
Jukka Rissanen b9b1dec6a3 net: tests: Turning off IPv6 for ARP tests
ARP is IPv4 only so no need to have IPv6 functionality.

Change-Id: Ie70242f5763ba4945c311898643414851f7e8660
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:12 +02:00
Jukka Rissanen f42c8126eb net: tests: Unit tests for net_nbuf_push()
These tests will verify that we can successfully insert
some space in front of the net_buf fragment chain.

Change-Id: Idf52ed56c52d66268783fb4fecd44b70fc852734
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:12 +02:00
Jukka Rissanen a1a17d5a98 net: tests: Fix ARP test so that it will not crash
The driver_api pointer was set to NULL which will cause
a crash in TX fiber.

Change-Id: If1c9a1e44904970f3a0019741eaaad4bf62d2c73
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:12 +02:00
Jukka Rissanen 87fd856041 net: tests: Unit tests for UDP handler
Simple UDP protocol testing.

Change-Id: I3ee37ff93127245a80fdf31856a95d9efc403862
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:12 +02:00
Jukka Rissanen f923adb038 net: tests: Add unit tests for net_nbuf_copy()
The tests will make sure net_nbuf_copy() works as expected.

Change-Id: I48dc3b794c70ec4d6436feb76508952c88bbf09b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen 9818cc7b1d net: ARP unit test needs to be run from fiber
The ARP unit test is not able to pass packets between fiber
and task. Because of this the test is run from fiber.

Change-Id: I1825a0abdc1b04a78de76d58425f4d2a2ce26ab7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen 53caa13652 net: Refactored ARP packet header handling
The ARP packet header contained ethernet header. This is very
confusing so separate the link layer header. Fixed also the
unit tests to run properly.

Change-Id: I8b00bde280ad9f49494766370acb2a8e9cade033
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen e04639cb66 net: tests: Fix unit test for IP utils
Change-Id: I7e14ec17656fdcc985000dba6fb67e90a053dfde
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen 21a491c065 net: tests: Fix unit test for IP addresses
Change-Id: Ia0b3b2846078a18b9b342c3aa99ea201d06d1642
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen f1532fe647 net: tests: Fix unit test for ARP
Change-Id: I962c00500c57f0f49314d10765b821976679e39b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen 4695e53391 net: tests: Add unit tests for neighbor cache handling
Change-Id: I1518c102232a607a9c0f91bf5fd71e4b3183a419
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen feaef3626e net: tests: Additional tests for ICMPv4 checksum verification
Change-Id: I21566c9365b8abc5753f6bedba55a3fb494745b9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:05 +02:00
Jukka Rissanen f6dc86c678 net: tests: Fixed the ARP test
Now uses net_nbuf_ll() to point to link layer header.
Also the ARP req test passes properly.

Change-Id: If649ff19a064490bff33d03b4ce70ef11bfa7cd5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:05 +02:00
Jukka Rissanen 7eff526e3b net: tests: Unit tests for the IPv4 ARP code
Change-Id: I607ffdbffc7348fae70272c7add57456fcaf79af
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:04 +02:00
Jukka Rissanen 6e3c12a820 net: tests: Add tests for IPv4 netmask, gateway and subnet compare
Unit tests added for checking network interface netmask, gateway
and IPv4 subnet compare utility functions.

Change-Id: I5b4a07d6a064097ab41ad6552d14181b1631eb53
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:04 +02:00
Jukka Rissanen 1bf6a529a1 net: tests: Tweak the IP address test to use new net_if API
Instead of using hard coded net_if, get the default network
interface using net_if_get_default() function.

Change-Id: I6248555ce57ae5196adea7baa9db325660a71255
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:04 +02:00
Jukka Rissanen 5580cdcc54 net: Add unit tests for ICMPv6 handler
Change-Id: Ibdbe82ed56f110e2e0c6443700863632ee1ef56b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:03 +02:00
Jukka Rissanen 4445e53f1e net: tests: Unit tests for network utilities
Right now there are tests for IP packet checksum calculation.

Change-Id: I1e9e72d01d4690728269c4484f8628350cf95729
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:03 +02:00
Jukka Rissanen e467c009e5 net: tests: Add more IPv6 address getters unit tests
Change-Id: I0ab22af76073c02c93eb205686472f69b58a1107
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen 7851aecc1c net: tests: Add IPv4 address unit tests
These tests will check that caller is able to set IPv4 address
to a network interface and check if an address is one of the
assigned to a network interface.

Change-Id: I8aa748c40fbc02eef50ccf76d10a0057ef29021b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen c3deb96dd7 net: tests: Add IPv6 address manipulation unit tests
Change-Id: Ide3bce35dcfd3ec31bfe3cd842a87ca3b639ba4f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen 2ade6ddb60 net: tests: Add unit test for IP and MAC address printing
Change-Id: Ida0901fa9687814932119d006459de12e6a229d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen 9821cb6eb4 net: tests: Temporarily remove nbuf unit test
Tests have issues right now so these will be activated later.

Change-Id: Ib5549f9ed5600a20b2cfddbddcde8e7f7b297eef
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen 69b8c675a6 net: Add nbuf buffer API
User should use the net_nbuf API that is supporting a concept
of RX, TX and DATA buffers, instead of using directly the net_buf
low level API.

Change-Id: I3b8f5f13cd37d42d2322a58b35573e117d520c54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Benjamin Walsh cb21e03ebb tests: adjust some stack sizes when running debug loads
Having CONFIG_ASSERT=y and CONFIG_DEBUG=y was causing these tests to
overflow their stacks and crash.

Change-Id: Ibcd57abe044a2203d1a954a4c5755218af48f302
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-30 23:47:46 +00:00
Anas Nashif e868a80a5c samples: tests: tag all legacy test cases and samples
Tag all legacy kernel tests and samples as such.

Change-Id: I43b24acb71c282ed14ff6e6ef06c9542bad86f6a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-30 21:45:22 +00:00
Inaky Perez-Gonzalez 462c6efca4 tests/ztest/mock: remove usage of legacy k_fifo_get()
Legacy FIFO operations were failing and thus the TC was failing to run.

Stop using k_fifo_get() for allocation and use a bitmap allocator. A
couple of the bitmap operations should be moved to a common header
once ZEP-1347 is completed.

Passes on all arches and boards, whitelist removed; ARM excluded
though due to missing bitfield implementation as per ZEP-82.

Note there is a false checkpatch positive in the decl of
sys_bitfield_find_first_clear().

Change-Id: I1d3ce8e988bf799573041026e419e3946d153590
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-28 20:50:38 +00:00
Inaky Perez-Gonzalez b53e6d7774 libc/minimal: snprintf(): KILL negative len parameter
snprintf() implements the ability to foce a negative value through the
(unsigned) size_t len parameter to allow the formatter to use a
maximum size string.

This is point less, we don't have as much memory and this is a recipe
for all kinds of vulnerabilities.

Kill the whole thing, the testcase it represents and thank Coverity
for finding this thing. Whatever use it had before, it has no more.

Change-Id: If422246548664699d8aa328a1b9304ef13cab7ea
Coverity-ID: 131625
Coverity-ID: 131626
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-28 20:49:37 +00:00
Vincenzo Frascino 1ce435b646 tests/kernel: Test CONFIG_RUNTIME_NMI behavior
This patch provides a test that verifies the correct functionality of
CONFIG_RUNTIME_NMI at build time.

Change-Id: I92c8af78d327f6f2b8b87573dbf132068ff80a45
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-28 20:30:47 +00:00
Anas Nashif e5b157bc1e net: buf: move test to unified kernel
Change-Id: I6757d32c8e9c713b73f160d46d4fbe4111ac73c1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-28 20:17:23 +00:00
Szymon Janc bde20d5447 printk: Add basic support for width modifier and zero padding
This adds basic support for width modifier when printing integers.
Supported specifiers are u,i,d,x,X. Width '*' is not supported.
Flag '0' for left-pading number with zero is also supported.

examples:
printk("0x%x 0x%02x 0x%04x 0x%08x\n", 1, 1, 1, 1);
0x1 0x01 0x0001 0x00000001

printk("0x%x 0x%2x 0x%4x 0x%8x\n", 1, 1, 1, 1);
0x1 0x 1 0x   1 0x       1

This should make printk usable for pretty printing u8 and u16 integers.

Change-Id: I58fa869e9c295a052f97fbf052291ef4d132811e
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2016-11-27 19:26:55 +00:00
Flavio Santes f6f60dc2c8 tests/drivers: Update pinmux application
This commit updates the pinmux test case application
to match with the hello_world sample app.

Change-Id: I86f459062527b7e2831bd7a3dfaf6bf8b28ef132
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-26 10:46:11 +00:00
Flavio Santes 1818d6addc tests/multilib: Update README file
Remove nano kernel references found at the README file.

Change-Id: Ib71a9a2900a5cb02a3b6038f74e51e5f860792be
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-26 10:46:10 +00:00
Ramesh Thomas eec187e11e tests: power_mgmt: Fix wrong value being passed to post_ops func
The app passes the index into an array storing power states
instead of the power state to _sys_soc_power_state_post_ops

Jira: ZEP-1341
Change-Id: I6ddf0a2dbadfd06aafbcafa88be7441e99694a51
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-23 00:21:52 +00:00
Anas Nashif 9f884155ab Merge "Merge bluetooth branch into master" 2016-11-19 01:52:15 +00:00
Anas Nashif 8f0057a05f tests: test CONFIG_KERNEL_DEBUG and CONFIG_ASSERT
Enable this option to test any usage of structs and variables inside
macros.

Change-Id: I6ec64fb865e87fc0771ae10f0c4eb63f6144c88a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-18 23:08:48 +00:00
Inaky Perez-Gonzalez db0e9aea51 test_static_idt: fix unininitialized variable
The divide-by-zero test was using an uninitialized variable that
Coverity was unhappy about. Simple fix to just initialize to any non
zero value.

Change-Id: I9e5865a99e7a8eb3ee52421cc3dcb6717dca1ad1
Coverity-ID: 152053
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:04:50 +00:00
Inaky Perez-Gonzalez 324f8d7a41 tests/legacy/kernel/test_libs: use memcpy() vs strncpy()
Coverity complained about the use of strncpy() to fill up a buffer of
size N with a string of the same size didn't leave room for the final
\0.

This is a valid concern; however, the usage is valid too, as the
writer intended to create a pattern that later can be tested--addind a
\0 would break the pattern.

So instead, use memcpy() for the same function.

Change-Id: If52d02ce41731348f4a2d750c79f9e1c51f3afcf
Coverity-ID: 151947
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:04:43 +00:00
Inaky Perez-Gonzalez c9aabcf282 test_fp_saring/nanokernel: fix uninitialized variable
Coverity complains about using an uninitialized variable; there is no
reason to do so; thus fixed to avoid maintaining a whitelist.

Change-Id: I657f9e7d46b1b9b091e36638c1951b93903fbec3
Coverity-ID: 152048
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:03:58 +00:00
Inaky Perez-Gonzalez 2612e7518e test_map: initialize memory block
This is not a strictly necessary initialization, as the data is not
used, but will keep Coverity happy. It being a testcase, there are no
size or speed penalties to the overall kernel and avoids having to
manage a whitelist for an issue in scanning tools.

Change-Id: I0ddcf43ca1114356d58f93de57232864246ffe07
Coverity-ID: 152052
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:03:33 +00:00
Inaky Perez-Gonzalez dd87d9b595 test_map: fix uninitialized area
Coverity complained about the code using an uninitialized chunk of
memory; harmless, but fixed to avoid having to whitelist.

Change-Id: I5c890ff78fab2799b882b8e4a25c15476702d132
Coverity-ID: 152049
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:03:09 +00:00
Inaky Perez-Gonzalez c7e7089c36 test_static_idt: fix uninitialized variable
Coverity complains about an easy-to-fix uninitialized variable.

Change-Id: I04bf670c7137df25165d4e37f2f7df2d4004c478
Coverity-ID: 152050
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 23:03:08 +00:00
Inaky Perez-Gonzalez 03940d4c6a test_fp_sharing: fix uninitialized variable
Coverity complains about this (harmless) issue, so simple fix.

Change-Id: Ibac952157cb0541dbd150d681515280091409864
Coverity-ID: 152051
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-18 20:58:13 +00:00
Szymon Janc cb67b35c5a Bluetooth: tests: Fix Makefiles comments
Those tests are now build with unified kernel.

Change-Id: Idbc42bb77060cea0130d62cccdf2e40aeee89128
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-18 07:47:50 +02:00
Javier B Perez 0ad8f517f7 test: power states: fix dead code issue
Coverity detected some constant value in the vars, due to the
exclusive config select in the code.

Change-Id: Id27b658f3cd70dce626fef054457a9c726b3b957
CID: 151974, 151972 and 151971
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-11-18 02:05:00 +00:00
Flavio Santes 8d2a511557 tests/tinycrypt: Solve style issues in test_ccm_mode
This commit fixes some style issues detected by checkpatch:

- Lines over 80 characters
- Comment block

Furthermore test legends are homogenized.

Change-Id: If92bbbdcf915164da945a60c8bcdbb7452ad0da0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:33 +00:00
Flavio Santes 6a3ca408cf tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode (2nd)
This commit fixes an issue in the test_ccm_mode.c file:

sizeof(data) is used to compute the length of the array pointed to
by the 'uint8_t *data' pointer.

At the same function scope, there is a variable (dlen) that already
specifies the required length, so we use that variable instead of
the 'sizeof' function call.

This issue was not reported by Coverity, although is worth to fix it.

Change-Id: I27cbf8c7000a4189a42d193f6445996d4b852aa6
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:32 +00:00
Flavio Santes 5b47ca7395 tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode
This commit fixes the wrong sizeof argument error reported by
Coverity.

Coverity-CID: 152032

Change-Id: I2ee3089b4b840f4a1b8ba0303e92a3311c07ffeb
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:31 +00:00
Flavio Santes 0f231c70d3 tests/tinycrypt: Fix dead code issue (2nd)
This commit fixes the dead code issue reported by Coverity.

Coverity-CID: 151977

Change-Id: Iaa31c032456f48e1af1d1c9d722f051ac5519ccf
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:30 +00:00
Flavio Santes 7ac025ea14 tests/tinycrypt: Fix dead code issue (1st)
This commit fixes the dead code issue reported by Coverity.

Coverity-CID: 151975

Change-Id: I449341d1f540abe149e8ad9197a64d52cd5722cd
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:29 +00:00
Flavio Santes 9c426ba3f8 test/tinycrypt: Solve style issues in test_hmac_prng
Style issues fixed by this commit:

- Comments
- Variable declaration/definition
- Space between cast

Change-Id: Ia6eb7718c55b976cd0899ede742d89483db191b3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:31:10 +00:00
Flavio Santes 9c2c57b730 tests/tinycrypt: Fix wrong sizeof argument
Fix the issue reported by Coverity: wrong sizeof argument.

Coverity-CID: 152042

Change-Id: I5d593ba54bf8f69f3c9d41a8b2878827d1cc186a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:31:09 +00:00
Flavio Santes bb8f324d94 tests/tinycrypt/aes: Replace spaces by tabs
This commit replaces spaces by tabs in the TinyCrypt AES test.

Three 'space required before the open brace' issues are also
fixed by this commit.

Change-Id: I27e961484899873a25847452d569b50322dba74d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:23 +00:00
Flavio Santes 455ed30fee tests/tinycrypt/aes: Solve style issues in comments
This commit solves some style issues found in comment blocks.

Change-Id: I1f4f7344e33b5898ac7d1fb2cd13d75946b4ee5e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:23 +00:00
Flavio Santes ef86c7d6f3 tests/tinycrypt/aes: Variable declarations at the beginning of a block
This commit moves variable declarations at the beginning of the test
routines.

Change-Id: Id1382b64aad4130e9a939c5e51301b75c6958fe5
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:22 +00:00
Flavio Santes 32f04293ca tests/tinycrypt/aes: Remove struct declaration inside function
This commit removes the declaration of a data type inside the tests
3 & 4. The new data type 'struct kat_table' is declared at the
beginning of the file.

Change-Id: I7662cd164a865fe0e70f984b9b494d96b4a72af9
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:21 +00:00
Jithu Joseph e8c7c0b400 tests: libs: Fix string overflow
This fixes a string overflow past the end of a buffer
which was reported by coverity.

Coverity-CID: 152044

Change-Id: I5b331135e338fa43b5589a9488b06367e8cad5a7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-18 00:21:58 +00:00
Baohong Liu df08319473 tests: benchmark: fix a string format issue
A popular issue "format is not a string literally" was
caught by LLVM. Let's make it a string literally.

Jira: ZEP-1179

Change-Id: I2b4a5aef750b772504bf0e6f005dab2ff9ac3e7c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:02:11 +00:00
Baohong Liu d5ccac16be tests: spi: add return value check
Add function return value check. This was caught by
Coverity.

Coverity-CID: 151950

Change-Id: Iee550e15d124f05f0b0514fdad22d06c617beac2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-17 14:42:58 -08:00
Flavio Santes da5dd09875 tinycrypt: Update CTR PRNG test case
This commit updates the TinyCrypt CTR PRNG test application.

See: https://github.com/01org/tinycrypt/
Commit: 601f6a26ab4505ac82a2fb13ae4757c2b8d3eba8

Change-Id: I9f5d92b9abbcf9608065992b05f114667a768c76
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-16 16:52:04 +00:00
Flavio Santes f73c86d096 tinycrypt: Fix style issues
This commit solves some style issues found at the
tests/include/test_utils.h file:

- Lines over 80 characters
- Unused arguments
- Missing {} in if-else

Change-Id: Ifaee81ec7c57a250b2c368b2efda38dc69d02c81
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-16 16:51:57 +00:00
Sergio Rodriguez 575adb6060 tests: crypto: Fix unchecked return value on CTR PRNG test case
This issue was reported by Coverity (CID 151952)

Change-Id: I59a20a3ccbe606ef634db98ac6cc6889a3973ec3
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-16 12:37:32 +00:00
Ramesh Thomas 4944c3e705 tests: power_states: Update testcase.ini to include arc
testcase.ini was not building for ARC. This app would
run on x86 and arc.

Change-Id: I961d56079aa1db7d84e0fcc87780ba11d7f4d831
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-16 02:18:45 +00:00
Baohong Liu 16b62051fb tests: spi_test: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I37934ef2ee47c521a78086564876843794688d55
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-16 00:17:52 +00:00
Inaky Perez-Gonzalez da5f3a5c89 legacy/kernel/test_{static_id,stackprot}: 'fatal fault' is not a failure
By default,  when a  'fatal fault'  message is seen in the output of any
testcase,  it is consider an inmediate fatal condition and the test case
is aborted.

However,  in all such cases,  the testcase is provoking the situation to
verify the condition is caught.  In this case it shall NOT be considered
a fatal fault and the default overriden to allow it to proceed.

Change-Id: Id4e9138e5f0fcb8cd77efbb1831897fb0946ba20
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-15 00:40:17 +00:00
Inaky Perez-Gonzalez 9e1df6f21f tests/drivers/adc: move to ztest to actually test
This TC is only exercising the API, as we don't have a feedback loop
mechanism to verify whichever values are fed to the ADC.

Fixed the loop to complete after 10 runs; on each run, print the
values and actually report the difference between them. With no inputs
connected (aka: floating), they should be reporting noise relatively
close to the previous reading, so we might want to use this delta as a
testing pattern (assert if the delta is higher than some value, but
I've seen variations as high as 40M units). For now, the test is just
happy with being able to read them.

The buffer has been re-typed to uint32_t so we can iterate over it
without casting tricks -- it requires then only a single cast when
initializing sample.buffer (which shall be a void* anyway).

Duplicated the buffer, so we can flip/flop between two buffers to
compare against the entries read in the previous run.

v4: fixed missed warnings

Change-Id: If6b48b92231007202d74f5c042f6d0cf3fdcb60a
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-14 03:27:50 +00:00
Inaky Perez-Gonzalez bcb6ed95e7 tests/drivers/pci_enum: move to ztest and run in HW when possible
This test case just exercises the PCI enumeration and there is no real
way to test success/failure other than running it and the kernel not
crashing.

Moved to ztest.

Retag so it is actually ran on QEMU/x86 and galileo once we deploy in
the HW pool. Note this means that we need to force CONFIG_PCI on
Qemu/x86, which can run this testcase.

Change-Id: I85b64800f7d989357927b4a25777041047293b34
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-14 03:27:37 +00:00
Anas Nashif 2367df8d59 drivers: update ipm driver to use unified kernel
Move away from legacy APIs and use unified kenrel instead.

Change-Id: Icae86beec66df1b041405cbe3455913630fc8ad1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:53 +00:00
Johan Hedberg 1e20e8dc04 Bluetooth: Fix left-over usage of TICKS_NONE and TICKS_UNLIMITED
Switch left-over usage of TICKS_NONE and TICKS_UNLIMITED to the new
unified kernel counterparts K_NO_WAIT and K_FOREVER.

Change-Id: I2f2a16360e816f9f8791eb216deb3c70b8cc87df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-12 19:27:34 +02:00
Benjamin Walsh f6ca7de09c kernel/arch: consolidate tTCS and TNANO definitions
There was a lot of duplication between architectures for the definition
of threads and the "nanokernel" guts. These have been consolidated.

Now, a common file kernel/unified/include/kernel_structs.h holds the
common definitions. Architectures provide two files to complement it:
kernel_arch_data.h and kernel_arch_func.h. The first one contains at
least the struct _thread_arch and struct _kernel_arch data structures,
as well as the struct _callee_saved and struct _caller_saved register
layouts. The second file contains anything that needs what is provided
by the common stuff in kernel_structs.h. Those two files are only meant
to be included in kernel_structs.h in very specific locations.

The thread data structure has been separated into three major parts:
common struct _thread_base and struct k_thread, and arch-specific struct
_thread_arch. The first and third ones are included in the second.

The struct s_NANO data structure has been split into two: common struct
_kernel and arch-specific struct _kernel_arch. The latter is included in
the former.

Offsets files have also changed: nano_offsets.h has been renamed
kernel_offsets.h and is still included by the arch-specific offsets.c.
Also, since the thread and kernel data structures are now made of
sub-structures, offsets have to be added to make up the full offset.
Some of these additions have been consolidated in shorter symbols,
available from kernel/unified/include/offsets_short.h, which includes an
arch-specific offsets_arch_short.h. Most of the code include
offsets_short.h now instead of offsets.h.

Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-12 07:04:52 -05:00
Allan Stephens dd07b4779f kernel: Eliminate use of KERNEL_V2 configuration option
The unified kernel is now the only supported kernel, so this
option is unnessary. Eliminating this option also enables
the removal of some legacy code that is no longer required.

Change-Id: Ibfc339d643c8de16a2ed2009c9b468848b8b4972
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-12 12:04:39 +00:00
Jon Moeller 8358468fed ext qmsi: Add config support and kernel events for enabling SoCWatch
tests: power_states app updated to support SoCWatch collection

Add CONFIG_SOC_WATCH option for enabling the SoCWatch
 QMSI driver and associated instrumentation hooks.

Bug fix for soc_watch.c to use local irq_lock/unlock
 This will be put into QMSI as well.

JIRA: ZEP-1121

Change-Id: I0514324e81ca02c1d01ffc2d6cf4d31aee491544
Signed-off-by: Jon Moeller <jon.moeller@intel.com>
2016-11-12 01:36:49 +00:00
Anas Nashif 336e82bee8 tests: fix filter for cortex-m3/m4
This test does not work for cortex-m0+ yet, so make
it run only on m3/m4 for now.

Change-Id: I0a90335d264cf88f3a62057860d6f129085c558f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:37:52 +00:00
Anas Nashif 3fe2575f0d drivers: sensors: use unified kernel threads
convert all sensor drivers to use threads and the unified kernel API and
remove all legacy APIs.

Change-Id: Ica43ea74ecbbf85273f718f182c413a9dcd8abc6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:00:19 +00:00
Ramesh Thomas 8367056efa power_mgmt: Rename _sys_soc_resume notification disabling API
The API to disable _sys_soc_resume notification is currently
called _sys_soc_disable_wake_event_notification. This is
misleading because it is possible that the ISR from which
_sys_soc_resume is called could be from a different interrupt
with higher priority that happened before interrupts were
enabled. More accurately, it is a notification of exit from
kernel idling after pm operations.

Jira: ZEP-1271
Change-Id: I83747f2cacac1bc17f135d12f4aa4478970fc02d
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-11 20:40:54 +00:00
Anas Nashif 8ac0e85da6 tests: Move ipm test from legacy, it is not using legacy APIs
This test is not a kernel object test and does not use any legacy kernel APIs,
so declare it non-legacy.

Change-Id: I430ac296334dbb8ff2b2d6576f7007a5dcc6f546
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 20:29:05 +00:00
Anas Nashif ec56025301 tests: added native test for irq_vector_table
Change-Id: I7d76b07e11a06f56227173c3d4ce77d9f2f466d8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 20:28:59 +00:00
Anas Nashif 68f087cee9 ztest: Do not print garbage if message is NULL
Change-Id: If79f4b92b2c494bf5fd44cb1855bba61029f7ac7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 20:28:33 +00:00
Kumar Gala 68b89aa752 tests: fix duplicate Kconfig symbol in prj.conf
remove duplicated CONFIG_IRQ_OFFLOAD option in prj.conf

Change-Id: I0bdc34ef3629eab648d75c9a61f982d4750e705b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:12:33 +00:00
Johan Hedberg 63a8f3b824 Bluetooth: tests/tester: Convert left-overs to unified kernel APIs
Convert fiber_start to k_thread_spawn and nano_fiber_fifo_put to
k_fifo_put.

Change-Id: If1ec405ec602e28a538f4c9569ede87519346559
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:00:45 +02:00
Szymon Janc 2b16287286 Bluetooth: Use proper timeout defines for net_buf_get_timeout
Use defines from k_fifo intead of legacy API.

Change-Id: Ib8cf0d88240ef145da550b8cf83d2580e7140521
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:28 +00:00
Szymon Janc 2f45faba8c net: buf: Use unified k_fifo API for FIFOs
Only net_receive() is using non-special value for net_buf_get_timeout
so this change is included here. Other users are using special values
which are already correctly handling ticks vs ms change.

Change-Id: Ib12d34ac5a546b36fa7b35615f082c82a256bd07
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:17 +00:00
Szymon Janc 051f97bd7a Bluetooth: samples: Fix use of deprecated sleep API
Use new sleep API or remove sleeps where not needed.

Change-Id: I88c0973e57eb4970b68b3f4fa428683191b1a7f0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc 0a38788c92 net: buf: Use new API for checking if executing from ISR
CC      net/buf.o
zephyr/net/buf.c: In function 'net_buf_get':
zephyr/net/buf.c:103:2: warning: 'sys_execution_context_type_get' is
     deprecated [-Wdeprecated-declarations]
  if (buf || sys_execution_context_type_get() == NANO_CTX_ISR) {
  ^

Change-Id: I580469d4958451cfa05f56c579eae340ec003a3d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc 47eaaf9f96 Bluetooth: Use unified k_fifo API for FIFOs
Change-Id: I6ddc24575e4bf3c3040945a2bdb62f153b15cdb3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Jaganath Kanakkassery f2b1ffbedb Bluetooth: shell: Add support for RFCOMM Connect
This can be used to initiate an outgoing connection
Syntax:
>br-rfcomm-connect <channel>

Change-Id: I7ac7aeb61e7ae7e3f55c7cd7e815bdb604b27fb3
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg c583a9f43b Bluetooth: Kconfig: Restructure for a more logical hierarchy
Restructure the Bluetooth options more logically.

- Both host and controller are now behind the same high level
  CONFIG_BLUETOOTH.

- Selecting controller support disables other HCI driver selection, so
  the controller isn't in the same list as HCI drivers any more.

- Under the top-level there's a "Custom stack" option, which when
  enabled opens up the option of choosing CONFIG_NBLE.

There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.

Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Julien Delayen f540cbc5c5 power: Add ARC power states and update sample
Add Low Power States support to the power shim layer
and show the usage in the quark_se sample.

States are defined as follow:
- SYS_POWER_STATE_CPU_LPS: SS2 with LPSS enabled
- SYS_POWER_STATE_CPU_LPS_1: SS2 with LPSS disabled
- SYS_POWER_STATE_CPU_LPS_2: SS1 with LPSS disabled

Jira: ZEP-994

Change-Id: Ie4b93f6e539cb53fc035be00280b66b2cb0d9fea
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-11 03:28:54 +00:00
Baohong Liu c9e295932b tests: aonc: skip counter stopping
Leave the aon counter in running state after the test.

Arduino 101 loader assumes the counter is running.
Stopping the counter will cause the next app to
not start without a hard reset or power cycle.

Jira: ZEP-961

Change-Id: Ia88f0c642b1df8dc5e2b1ee6c55ff0618b6127d0
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 17:56:13 -08:00
Baohong Liu ab96d3648a tests: dma: update to unified kernel
Use k_sleep instead of nano timer.

Change-Id: Ic1cc68cefa23b2e291e3605f4795cbe21ad98fc0
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-11 00:47:59 +00:00
Genaro Saucedo Tejada eeea5de171 fix: change group name on debug setting
Debug setting is using another mdef file that was no changed by
commit 5b1b2d6123

Change-Id: I406b45e37a112352c88629cf7d494c70784930aa
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-11-10 18:31:14 -06:00
Baohong Liu 5e2f899bad tests: adc: update to unified kernel
Use k_sleep instead of nano timer.

Change-Id: Iba88b93c71dedd60bdbb842fd8e44a55593f54bf
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 23:16:55 +00:00
Inaky Perez-Gonzalez b618d001b4 tests/compiance/checkpatch: force the format to 'email'
Otherwise, local settings in the account will cause headache and
randomly alter the result of the testcase.

Change-Id: I758966a7fe9335a13ce237aea7d6df2ddc5733ce
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-10 19:30:32 +00:00
Inaky Perez-Gonzalez 5b7bfdaf48 tests/drivers/aon_counter: make a ztest testcase
Reorganize the code tree so no forward declarations are needed
(basically, move main() to the bottom).

Retag as not build only so it can be run on Quark*

Convert to actually verify counter readouts are increasing /
decreasing over busy empty loops and the alarm is being called.

Change-Id: I746efe595b8d1ac4471dccc2e87f8b36f5cc8ebe
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-10 01:08:14 +00:00
Inaky Perez-Gonzalez f37065bf84 ztest: add assert_not_equal()
Assertion for complementing assert_equal()

Change-Id: Ie3066f3b00ea3145a62ffb7e0d6c2c4de1719b4c
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-10 01:08:14 +00:00
Anas Nashif ba714dc6c2 tests: test_task: rename task group from TEST to TESTGROUP
Change-Id: I32b9470f8eb958e1ef60e11142799882bc6ad89a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-09 18:33:25 +00:00
Anas Nashif c3552e6624 tests: test requires kernel to provide printk
Change-Id: I9ee3eb6cf67c7390a0ade07ace67de64de30bb94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-09 18:33:25 +00:00
Anas Nashif 5b1b2d6123 tests: test_sema: rename task group from TEST to TESTGROUP
Avoid conflicts with redefinition of TEST

Change-Id: I309a1056053d2a998748bbc68f368f2c61d13b70
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-09 18:33:25 +00:00
Andrew Boie 183a79cf6e tests: unit: remove -Werror
sanitycheck already sets this and we need to allow deprecation
warnings.

Change-Id: I3d6bf652403bcbdba47663c8cd0d17682a8a842d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:33:01 +00:00
Johan Hedberg 77dcd7151d Bluetooth: tests/shell: Add Arduino 101-specific configuration
Add an Arduino 101-specific configuration that enables flash-based
storage support as well as the file system shell.

Change-Id: Ic10ea958dd2446df4942a8dfd3cce1e3368852b2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 09:15:46 +00:00
Johan Hedberg 7e1234b44b Bluetooth: tests/shell: Implement "clear" command
Implement a new "clear" command to exercise the bt_storage API. The
command can either take an address parameter to clear storage for a
specific device, or, if called with the parameter "all", to clear the
entire storage.

Jira: ZEP-181

Change-Id: I1ebd17033f2062951abeeb7d7c448a34a3672577
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 08:57:52 +02:00
Jithu Joseph 2fe288b4aa fs: expose generic ramdisk/flash disk access functions
This patch removes "FAT" from  files names, config names and
symbol names so as to avoid confusion, when other modules use
them in a more generic way.

Also flash_disk_access.c and ram_disk_access.c now exports generic
disk_access symbols as defined in include/disk_access.h rather
than FAT specific ones in fs/fat_diskio.h. Thus modules like
USB which need to use disk_access interface is not dependent
on symbols from ELMChan FAT module. Also fat_diskio.h
is removed.

Further the shim between ELM chan and Zephyr is modified as
per these changes.

Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:45 +00:00
jing wang 2c311431fc tests: add a dma transfer test with different channel and burstlen
This TC cover dma transfer with different channel and burst length
It support 2 ways to execute
*) full-auto: by default, it run all sub test cases defined in array
   once flashing done and reset.
*) interactive: when CONFIG_CONFIG_CONSOLE_HANDLER_SHELL=y, it go into
   shell first, user can input test command one by one for debugging.

move original test under drivers/dma to test_loop_transfer/

Change-Id: I7e78b730592c80bf2c23b20c8b0eb65a9b353acd
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-11-09 02:38:57 +00:00
Benjamin Walsh c7ba8b17e1 kernel: rename k_am_in_isr() to k_is_in_isr()
Change-Id: Ie312da34dbbfbeb2c76bbf38905d8f334da28b63
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 20:27:31 -05:00
Andrew Boie 84a92048cf test_ipm: increase stack size
The main task uses stack-hungry() printf(), and the switch to the unified
kernel pushed the necessary space over the edge.

Change-Id: I7b64e7f09d91c5050ffe7fb18506ff24289169fc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-08 22:45:56 +00:00
Dmitriy Korovkin 44af016810 tests: Add configuration for small frequency dividers for system clock
For systems that have both high base (CPU, bus, etc.) frequency and
small divider of the base frequency for system clock and this way,
do not allow 1 second period for the system clock, set the system
clock period to 0.1.

Change-Id: Iafb4604112d4adb8430f8bf57a5a31de3f6cf91d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-08 21:34:31 +00:00
Dmitriy Korovkin e0509bc79e unified/tests: Unlock the mutex exactly same time as it was locked
Since the mutex can not be unlocked if it is not locked, fix the test
and make sure that it unlocks the timer exactly same times as it locked
it before.

Change-Id: Ie29d308b789ed00f4fd3cf2faef3aa1f4bc89e3e
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-08 21:34:30 +00:00
jing wang 4ee0b6b589 tests: provide MACRO to easily wrap test function to shell command
usage is as below:

TC_CMD_DEFINE(test_func_1)
TC_CMD_DEFINE(test_func_2)

static const struct shell_cmd commands[] = {
		TC_CMD_ITEM(test_func_1),
		TC_CMD_ITEM(test_func_2),
		{ NULL, NULL }
};
SHELL_REGISTER("runtest", commands);

Change-Id: I4eab67113954f373d5a2cbfaa729be180fd31444
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-11-08 14:25:59 +00:00
Johan Hedberg c1485fe2f8 boards: arduino_101: Set sensible default for SPI_0_CS_GPIO
The SPI_0_CS_GPIO and SPI_0_CS_GPIO_PIN values were defaulting to
something not very usable, because of which e.g. the file system
test app was having to explicitly set the right values in its sample
configuration. Having a proper defaults in the board defconfig means
this isn't needed anymore.

Change-Id: I1399914451c1616588322e25304d40d3dd1151e7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-08 14:24:25 +00:00
Genaro Saucedo Tejada 12740a2314 sanity: add DEBUG setting for test_sema
Test was not completing on CONFIG_DEBUG=y setting, current filter
sets custom stack size for such setting

Jira: ZEP-1203

Change-Id: I3a6ada88bc2e8a1fee757773c4b19b72551926a7
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-11-08 01:23:36 +00:00
Andrew Boie d4e0b41665 ztest.h: add required definition for unified kernel
Change-Id: I21a3b7ce8aefc69193f362a5b299fa83da303eb5
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 19:29:02 +00:00
Andrew Boie ef09f8dd5f tests: remove errant -O0
Should never be necessary.

Change-Id: I8c7d1be3e9c9279e12ed6f26d8ab8404ee7d6cb0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 19:29:01 +00:00
Anas Nashif 12ffc58d4b benchmarks: rename _NanoTscRead -> _tsc_read
Change-Id: Id5687f79ac13136f14a14d250e149436a0173f04
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-07 15:39:15 +00:00
Kumar Gala 773a3b08de tests: tests: Mark a bunch of testcases that are memory (RAM) limited
We the unified kernel now sizes have gone up and we have some more
testcases that are RAM limited on small memory systems.

Change-Id: I4716a779fac86a420607ba716edd012976d14254
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-07 02:18:13 +00:00
Genaro Saucedo Tejada 607edcf066 sanity: dont run footprint on quark_d2000_crb
Commit 4187822d08 removed some filters
at sanitycheck script that were previously preventing foot print test
to run on board quark_d2000_crb.

Added filter excludes such board from min and reg footprint tests.

Change-Id: I2a32e34b1af6d16b3da418cd3113c52b2369eb97
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-11-04 23:32:27 +00:00
Benjamin Walsh 8cf56bcac7 unified: dissociate system workqueue from common workqueue module
Making a reference to the common work queue code should not necessarily
drag in the system workqueue, since it is possible to use a workqueue
that is not the system workqueue. This is done by moving the system
workqueue into its own code module.

Moving the system workqueue to its own code module allows removing the
NANO_WORKQUEUE and SYSTEM_WORKQUEUE kconfig options, and compiling the
common workqueue code and system workqueue all the time. They are only
linked in the final image if a reference to them exist, same as the
other kernel modules.

Change-Id: I6f48d2542bda24f4702e7c2e317818dd082b3c11
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-04 22:39:54 +00:00
Mariusz Skamra 0c8ea2037e Bluetooth: tester: Enable privacy for QEMU configuration
Change-Id: I9030f94bb42bfc0aa3e39dac52570eae1d2121a0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra d1b8d25068 Bluetooth: tester: Increase number of available L2CAP channels
This increases number of available L2CAP channels for the test purposes.
This is needed for TC_COS_CFC_BV_05_C test case.

Change-Id: I5df099fb64632e1a0e557852ca55ee45a9cc89ed
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 3b27f9857d Bluetooth: tester: Fix configuration file name
This fixes configuration file name in testcase.ini file.

Change-Id: I6496f98694415bfc3a76308aa9ee6dfd008e1691
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 00f4f2f66c Bluetooth: tester: Set Zephyr-based BLE configuration as default
This updates README as well as makefile to choose Zephyr BLE firmware
configuration as a default one.

Closes: ZEP-1187

Change-Id: I78dec2a4e2b5bfe634a8b7b8897d4f6ab6b37b44
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 8f2ffb6a45 Bluetooth: tester: Add configuration file for Zephyr BLE firmware
This adds sample configuration file for tester application that
supports controllers with Zephyr-based BLE firmware.

Change-Id: I8b63f93d1395837b8485aba7060b6626be1daab1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:07 +02:00
Mariusz Skamra 79b5e7e6fa Bluetooth: tester: Rename config files
This removes redundant prj_* prefix from configuration file name.

Change-Id: I9867fa345791e68b64f83bb0cd75634cf1cde887
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:07 +02:00
Johan Hedberg ac844cf687 Bluetooth: Remove misleading NBLE mentions from sample README files
The README files provided with the samples contain references to NBLE,
which is not a publicly supported solution for Bluetooth. Simply
remove these files. If the need arises to provide application-specific
information in the future we can add back per-application README
files.

Jira: ZEP-1183

Change-Id: I81b3ea5491d50fb16062ccd5a421ddc8fcb7ea42
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-04 22:05:05 +02:00
Anas Nashif d622b09bc0 samples: tests: remove obsolete KERNEL_TYPE and kernel variables
Remove those from Makefiles and testcase.ini, we now support unified kernel
only and sanitycheck script now knows how to deal with this.

Change-Id: I853ebcadfa7b56a4de5737d95f2ba096babb2e13
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 15:47:25 -04:00
Genaro Saucedo Tejada d26b47bd9b sanity: Exclude platform cc3200_launchxl from test_xip
Test tests/kernel/test_xip does not fit FLASH region of new platform
cc3200_launchxl that was added by commit 10ea5d0, hence it must be
excluded from such test so daily sanitycheck script completes
successfully.

Jira: ZEP-1201

Change-Id: I01ec2b9af45e34934d91922bd749a83f305746b1
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-11-04 19:07:09 +00:00
Anas Nashif 5e68ba972f tests: crypto: remove microkernel reference
Change-Id: Ia38de789108b60c08da659ecfc4aae578de9f698
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 13:47:18 +00:00
Ramesh Thomas 4b754315d8 tests: fs: Make file system test unifief kernel based
Port FS test app to use unified kernel

Change-Id: If81158beffb1d31227a8f5d73ea781036b46b7dd
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-04 00:45:33 +00:00
Benjamin Walsh 5c2731f27f tests: for the system workq in for obj tracing tests
The test relies on the workq thread being in the system. It is possible
for the workq to not be in the system even if CONFIG_SYSTEM_WORKQUEUE is
enabled, if nothing makes references to the symbols in the object file,
so we cannot rely on the kconfig option to know if the system workq
thread is in the system or not. So, force it in.

Change-Id: I1ae2613fbd32928b673fc4c74a9dc56502255763
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-03 23:06:42 +00:00
Ramesh Thomas ded076d175 tests: power_mgmt: Make power test unified kernel based
Port the power management test app to use unified kernel.

Change-Id: I2f10748be5ca7d9792f6e97c35f5f2aabab769e7
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-03 14:47:56 -07:00
Julien Delayen fec01af64a power: Update Quark SE PM layer with QMSI 1.3
QMSI 1.3 natively supports restoring the SoC and peripherals
after sleep.

The Zephyr Power Management shim layer is updated
in order to support QMSI functions.

The following functions have been added:
void _sys_soc_set_power_state(enum power_state);
void _sys_soc_power_state_post_ops(void);

In order to fully support deep sleep, the function
_sys_soc_set_power_state now support saving and
restoring CPU context and returns to the application.

_sys_soc_set_power_state function also abstracts
QMSI cpu states and enable the application to choose
between C1/C2 or C2LP states.

The QMSI power states are mapped as follows:
SYS_SOC_POWER_STATE_CPU_LPS -> power_cpu_c2lp
SYS_SOC_POWER_STATE_CPU_LPS_1 -> power_cpu_c2
SYS_SOC_POWER_STATE_CPU_LPS_2 -> power_cpu_c1
SYS_SOC_POWER_STATE_DEEP_SLEEP -> power_soc_deep_sleep
SYS_SOC_POWER_STATE_DEEP_SLEEP_1 -> power_soc_sleep

The following functions have been removed:
void _sys_soc_set_power_policy(uint32_t pm_policy);
int _sys_soc_get_power_policy(void);
FUNC_NORETURN void _sys_soc_put_deep_sleep(void);
void _sys_soc_put_low_power_state(void);
void _sys_soc_deep_sleep_post_ops(void);

Those changes are propagated to the samples.
All calls to QMSI are removed.

Jira: ZEP-1045, ZEP-993, ZEP-1047

Change-Id: I26822727985b63be0a310cc3590a3e71b8e72c8c
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-03 21:31:30 +00:00
Kumar Gala 6f6632ddc5 tests: Mark a bunch of testcases that are memory (RAM) limited
These testcases can't build on common platforms with 16K or less of
memory.

Change-Id: Iade2aa423f42a1f174a5ebb5d183b362917f503e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-03 19:20:19 +00:00
Kumar Gala c610dea725 tests: only run the printk test if CONFIG_PRINTK is enabled
Not all platforms enable CONFIG_PRINTK so lets only test if its enabled

Change-Id: I0fc83e21b4be1ff0e8fef94e66793a0b725a3db2
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-03 19:20:19 +00:00
Inaky Perez-Gonzalez 374dff69ac test_obj_tracing: filter for enough memory
QD2000, for example, can't run this.

Change-Id: I86c7ca22e4724844ffc5e64329063baf762470c9
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-03 19:17:04 +00:00
Anas Nashif 4b31b0c5f9 test: sprintf: remove bogus test when building with float enabled
This test is checking for the wrong results and testing for broken/missing
feature that is actually working.

Jira: ZEP-1124
Change-Id: I7b5f87ac7b47e33e7bbcd4d3967b289f6631cb37
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-02 22:05:30 +00:00
Anas Nashif 886677c3de samples: synchronization: move to legacy/
Change-Id: I72d6fcba0c747e27c0e9cb9fade7abcf8bd077bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-02 22:05:29 +00:00
Allan Stephens ee842535a4 unified/test: Adapt object tracing tests to unified kernel
Change-Id: I657410d64432d2d09938bd19a4db482bc1f23529
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-02 21:56:27 +00:00
Allan Stephens 7dabe23485 kernel/test: Use custom code in object tracing tests
Microkernel and nanokernel versions of the test now use distinct
sets of source files. This eliminates the dependency on the
MICROKERNEL and NANOKERNEL configuration options, which the
unified kernel doesn't set correctly in all cases.

Change-Id: I59e1d4a73265a433f526d030d2fd04d4b8de1973
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-02 21:56:25 +00:00
Inaky Perez-Gonzalez 52b519d471 tests/crypto/test_tcc_dh: increase timeouts for real HW
Some HW needs longet timeouts for this TC to complete succesfully.

Change-Id: If6cd4ad93b6e15293f1f8d8e606e159271f0e4d1
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-02 21:56:03 +00:00
jing wang 2c3346ae73 ztest: fix ztest syncronization issue when execution
ztest execute syncronization depends on sem take and give
between TC. Current issues are
*) test execution go to next one before current TC finish
*) one TC failure will block whole testing.

Fix this issue by move k_sem_take from init_testing to
run_test and add k_sem_give in run_test_fail.
Meanwhile, set init sem value range from 0 to 1

Issue: ZEP-1164
Change-Id: I7b2d38501d0965455a71863a4729ee81472a63ec
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-11-02 18:07:25 +00:00
Inaky Perez-Gonzalez 2c48278be7 tests/kernel/test_fifo: filter unified kernel for small memory
As we transition to the unified kernel, we need to check on there
being enough memory in said case (nano kernel always had it based on
higher granularity filtering with 'kernel = nano').

Change-Id: Ie21aea2773feb9337d8d34dcf45858e4df879469
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-02 18:06:18 +00:00
Inaky Perez-Gonzalez a64ea3d62f tests/crypto/test_mbedtls: increase timeouts for HW
When running in real HW, testcases take more time to execute than the
default 60s. 200s seems to work for all HW types as of this commit
(FRDM k64f, Arduino Due, Arduino 101 / x86, EMSK 9d).

Change-Id: I663a67161bd7b4c349a483efb8e9cbf14c09421c
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-02 09:38:03 -07:00
Yael Avramovich d5db35204a console: shell: Support multiple modules
Ability to use Zephyr shell by multiple modules simultaneously, each
module for its own usage.

Old shell implementation enabled the user to call only one module
commands, not all of the modules simultaneously.

Change-Id: I0ef8fa2fd190b7490c44fe91d1016363258302c9
Signed-off-by: Yael Avramovich <yael.avramovich@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-02 00:23:18 +00:00
Andrew Boie 25ce056279 tests: benchmark: enable for V2 kernel
Not completely ported to V2 APIs yet, but enough that we pull in
all the kernel.h APIs for the microkernel test, bypassing the legacy
layer.

We pull in a lot more than the legacy test did, so results are not
directly comparable.

Change-Id: I35e74bfd1aa15ee59951f68fb7dd8d811619c3f8
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-02 00:00:29 +00:00
Dmitriy Korovkin b4db06615d unified/tests: Remove nanokernel test part from latency_measure
Nanokernel part of the latency_measure test is a subset of the
microkekernel tests. For unified kernel there is no reason to
have nanokernel test - for unified kernel we have to run whole
the set of tests.

Change-Id: Ief176fd9d25e7355e3d3697c3bbc1e953b16655c
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-01 23:39:34 +00:00
Anas Nashif e7e5701aea Merge "Merge bluetooth branch to master" 2016-11-01 23:21:21 +00:00
Andrew Boie 389dc9f96e tests: app_kernel: exclude call_test() on unified
The unified kernel doesn't use the KERNEL_ENTRY() mechanism,
it doesn't do kernel calls in a special context. So there's
no reason to test this on the unified kernel and we can omit it.

Change-Id: I2b8aa2495385a39130e9b87c0d0324f2f205a2c8
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-01 21:47:22 +00:00
Luiz Augusto von Dentz 2538811fa9 Bluetooth: shell: Add support for setting security level to l2cap_register
This adds support for setting the minimun required security level to
l2cap_register command:

l2cap-register <psm> [sec_level]

Note that entering the security level is optional and the default is
BT_SECURITY_LOW(1).

Change-Id: Ib6dea92919357f41fe2f4de3050b9a10a7f553d6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-01 21:40:39 +02:00
Johan Hedberg 079030718f Bluetooth: Move hci_driver.h to include/drivers/bluetooth
This header file is not intended for applications, rather than for
drivers, so move it to the appropriate place.

Change-Id: I7ff8158418e7e839b538c6cccbb32f3af43c12c6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 21:40:39 +02:00
Johan Hedberg 900fbc20ba boards: x86: Don't default to 'y' with NRF51_PM and WAIT_NOP
These options were only needed for a MyNewt-based nRF51 firmware on
these boards (the MyNewt BLE stack is called Nimble, hence the
prj_nimble.conf sample config files). With a Zephyr-based nRF51
firmware these options are no-longer needed, so it's not appropriate
to have them default to enabled. Instead, if they are needed, require
the app-specific configuration to enable them.

Change-Id: Iefbee4d97590af4e11bcedea05fe61f32a147b83
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 19:37:26 +00:00
Andrew Boie cc5be1eb96 tests: move benchmark tests to legacy/
These are using old kernel APIs and need to be converted.

Change-Id: I7457270fb5e93e290023756316e82a384712e82b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-01 19:23:48 +00:00
Inaky Perez-Gonzalez 43f788a6eb tests/kernel/test_{fifo,lifo,stack}: filter unified kernel for small memory
As we transition to the unified kernel, we need to check on there
being enough memory in said case (nano kernel always had it based on
higher granularity filtering with 'kernel = nano').

Change-Id: Ic36c352f06be09407cd3aac74a1dfe73bb2fc61d
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-01 11:07:41 -07:00
Anas Nashif f7bb11a54b tests: stub: we should not be testing this
This code is part of the infrastructure, it does not test any features really.

We are wasting cycles on a stub that does basically nothing.

Change-Id: I130f320d1b365abdac118e5c44b80fd866e5f502
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Anas Nashif f431084619 tests: common: add rand32 test
Change-Id: I499586a3be1f9794b68b5cf2e5047a762ea11104
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Anas Nashif 5058bb75bc tests: move individual common tests into one test
We have many tests that are being built as stand-alone binaries for no good
reason. Those can be put in one single test to speed up testing and CI
verification.

Currently we do support the following in test_common:

- byteorder
- printk
- intmath
- slist
- atomic
- ring_buf

In addition, the test now uses the ztest framework.

Change-Id: I656ac7f4acf48b7de4ec81c9f5dafc9dea3da911
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Anas Nashif 90937df6e9 tests: make generic kernel tests unified
Tests that do not use any of the legacy kernel APIs can be moved to unified
kernel to avoid double testing.

Change-Id: Ic2353feb23ee20d9d93f5459432d3b3739df8e03
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Anas Nashif be4fe7f4e5 tests: move kernel tests to tests/legacy
Move all kernel tests using legacy APIs into tests/legacy to continue testing
old APIs and compatibility. We keep in tests/kernel those tests that do not use
any kernel APIs and generic in nature, those should not be affected by the
unified kernel API change.

In tests/kernel we will start adding tests that are unified kernel only. Later
and when deprecation period is over the legacy tests would be dropped.

Change-Id: Icc7d8c7e5f2af65af350b75da3117f72396925f4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Anas Nashif 649ba4f619 benchmark: sys_kernel: do not build on systems with little RAM
Change-Id: Ic566e247441426918fafb63eea8d2f75f9b8a3b1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-01 13:42:17 -04:00
Benjamin Walsh 1952ac1611 unified/test Adapt sys_kernel test to unified kernel
As unified kernel starts main() application function, remove test
thread.

Remove nanokernel part of the test since their code base is
identical.

Change-Id: I2afb4c0da2d139b159c89186166afdb5d9813d61
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-01 16:52:44 +00:00
Kumar Gala bfcf575cbb tests: exclude quark_d2000_crb from net/buf test
Currently the net/buf test fails on quark_d2000_crb due to RAM
overflow:
	region `RAM' overflowed by 2256 bytes

Change-Id: I854960a3c22c7318f5f5e9341ca7aaaf8743d30d
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-01 15:03:04 +00:00
Johan Hedberg ee0412a7d1 net: tests: Fix net_buf_unref() tests for fragment chains
The net_buf_unref() API will unref all associated fragments, so it's
wrong to assume that no fragment destroy callbacks would be called
when the head buf is unreffed. Instead the right expectation is that
all fragments get unrefed as well.

Change-Id: I00530e4c1cfa5dddbfcbeab9609347873010ff4d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 23:53:40 +00:00
Anas Nashif fcb54aa96b tests: crypto: convert all tests to unified kernel
Change-Id: Id7c1c6bbb0b04eb190cc44c1fbb557722871fc0f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-31 21:38:49 +00:00
Anas Nashif a32579749b ztest: move ztest to unified kernel
ztest was not working with unified kernel and v1 APIs and not many tests are
using ztest right now, so instead of making it work with old APIs, convert it
to unified kernel completely so that new tests written using ztest would be
unified kenrel based.

Change-Id: Ibfcc7783dcb266abbd388662ba61c4b55d32b10c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-31 21:38:04 +00:00
Anas Nashif 6043c30aa4 tests: samples: exclude quark_d2000_crb from large applications/tests
Change-Id: I108639966d5bb66fb08d745155d692b82c304de1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-31 16:10:45 -04:00
Peter Mitsis 5f8fa677b5 unified: Fix boot_time nanokernel benchmark
Enables boot time timestamps for unified kernel.

Also Splits the source code into microkernel and nanokernel versions
instead of having common code. Not only does this make the code for
each project easier to read, but it also easily allows the nanokernel
version to link against the correct version of main().

Change-Id: Ie0afa2272c3347ebdacc0e3daeebbfe9583fe596
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-31 17:06:26 +00:00
Anas Nashif 5d317a0eb5 tests: do not build sensors for system with < 32k {S}RAM
Change-Id: I9cc87da7c32d9ffde5dd8f3419fdedd4683d3f0d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-31 12:54:35 +00:00
Johan Hedberg 7f62a95f93 fs: tests: Use 'fs' instead of 'filesystem' as directory name
The convention everywhere else in the tree is to use 'fs' for file
system related code (e.g. subsys/fs and include/fs) so follow this
also for the tests.

Change-Id: I32b9918cbba95e7b219c2d9f3e3a079e664390ab
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 08:08:27 +02:00
Johan Hedberg b108d02eba fs: Make API naming adhere to the appropriate namespace
The namespace allocated for the filesystem API is fs_* and FS_*. That
means all symbols and defines should adhere to it.

Jira: ZEP-1155

Change-Id: I422310448b7c7c347f621aea6d7b1d97ef25c94d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-31 08:08:10 +02:00
Johan Hedberg f4d7538187 Merge bluetooth branch into master
Main changes:

 - Fixes to build with unified kernel
 - Switch to unified kernel for all Bluetooth samples
 - Fixes to controller HCI interface
 - Fix net_buf leak in controller
 - Initial skeleton for AT command support (for Hands-Free Profile)
 - Rename bt_driver API to bt_hci_driver

----------------------------------------------------------------
Anas Nashif (2):
      Bluetooth: cleanup testcase.ini and adapt to current platforms
      Bluetooth: tests optimize testcase.ini for shell and init

Arkadiusz Lichwa (2):
      Bluetooth: L2CAP: Minor cleanup in naming
      Bluetooth: L2CAP: Minor cleanup in conn request

Carles Cufi (6):
      Bluetooth: Controller: Set HCI version to 4.2
      Bluetooth: hci-uart: Use a fiber to offload TX from ISR
      Bluetooth: HCI: Remove "EDR" and "HS" marketing terms from macros
      Bluetooth: hci-uart: Add a sample configuration file for nRF5x
      Bluetooth: Controller: Fix net_buf memory leak in RX path
      Bluetooth: hci-uart: Match controller buffers in UART RX

Johan Hedberg (10):
      Bluetooth: samples/README: Document hci-usb and hci-uart
      Bluetooth: Expose BLUETOOTH_MAX_CONN for controller-only build
      Bluetooth: samples: Remove redundant CONFIG_ARC_INIT=n
      Bluetooth: Rename bt_driver to bt_hci_driver
      Bluetooth: samples/hci-uart: Make sure we yield in tx_fiber
      Bluetooth: drivers/Kconfig: Fix inconsistency issues
      Bluetooth: Fix license header in l2cap.h and rfcomm.h
      Bluetooth: tests/init: Limit controller+host for 32kB RAM platforms
      Bluetooth: samples: Limit tests to just qemu platforms
      Bluetooth: samples/hci-uart: Add arduino_101_ble to tests

Luiz Augusto von Dentz (3):
      Bluetooth: L2CAP: Delete fragments as they are processed
      Bluetooth: GATT: Add helper to discover next range
      Bluetooth: GATT: Add proper check for connection state

Sathish Narasimman (1):
      Bluetooth: Generic AT command implementation

Szymon Janc (12):
      Bluetooth: Include zephyr.h instead of kernel specific headers
      Bluetooth: A2DP: Cleanup headers includes
      Bluetooth: Remove not needed includes
      Bluetooth: L2CAP: Fix build with unified kernel
      Bluetooth: L2CAP: Use helper for accessing nano_sem count
      Bluetooth: RFCOMM: Use helper for accessing nano_sem count
      Bluetooth: A2DP: Remove includes from internal header
      Bluetooth: hci-uart: Don't include nanokernel.h
      Bluetooth: drivers: Remove usued variables from H5 driver
      Bluetooth: drivers: Fix non-ASCII characters in NBLE code comments
      Bluetooth: Use unified kernel build for tests and samples
      Bluetooth: drivers: Include zephyr.h instead of nanokernel.h

 doc/api/bluetooth.rst              |   2 +-
 drivers/bluetooth/Kconfig          |  99 +--
 drivers/bluetooth/Makefile         |   3 +-
 .../bluetooth/controller/hci/hci.c |   2 +-
 .../controller/hci/hci_driver.c    |  20 +-
 drivers/bluetooth/hci/Kconfig      | 116 ++++
 drivers/bluetooth/hci/Makefile     |   2 +
 drivers/bluetooth/{ => hci}/h4.c   |  16 +-
 drivers/bluetooth/{ => hci}/h5.c   |  25 +-
 drivers/bluetooth/nble/Kconfig     |   2 +-
 drivers/bluetooth/nble/gap.c       |   2 +-
 drivers/bluetooth/nble/gatt.c      |   4 +-
 drivers/bluetooth/nble/smp.c       |   2 +-
 drivers/bluetooth/nble/uart.c      |   4 +-
 include/bluetooth/hci.h            |  11 +
 .../{driver.h => hci_driver.h}     |  38 +-
 include/bluetooth/l2cap.h          |  32 +-
 include/bluetooth/rfcomm.h         |  32 +-
 net/bluetooth/Kconfig              |  17 +-
 net/bluetooth/Makefile             |   2 +-
 net/bluetooth/a2dp.c               |   6 +-
 net/bluetooth/a2dp_internal.h      |   8 -
 net/bluetooth/at.c                 | 334 +++++++++++
 net/bluetooth/at.h                 |  82 +++
 net/bluetooth/att.c                |   6 +-
 net/bluetooth/avdtp.c              |   4 +-
 net/bluetooth/conn.c               |   6 +-
 net/bluetooth/gatt.c               | 146 +++--
 net/bluetooth/hci_core.c           |  17 +-
 net/bluetooth/hci_core.h           |   2 +-
 net/bluetooth/hci_ecc.c            |   2 +-
 net/bluetooth/hci_raw.c            |  10 +-
 net/bluetooth/hfp_hf.c             |   2 +-
 net/bluetooth/keys.c               |   2 +-
 net/bluetooth/keys_br.c            |   2 +-
 net/bluetooth/l2cap.c              |  27 +-
 net/bluetooth/l2cap_br.c           |  11 +-
 net/bluetooth/log.c                |   2 +-
 net/bluetooth/monitor.c            |   2 +-
 net/bluetooth/rfcomm.c             |  17 +-
 net/bluetooth/smp.c                |   3 +-
 net/bluetooth/smp_null.c           |   2 +-
 net/bluetooth/uuid.c               |   2 -
 samples/bluetooth/README           |  13 +-
 samples/bluetooth/beacon/Makefile  |   3 +-
 samples/bluetooth/beacon/prj.conf  |   1 -
 samples/bluetooth/beacon/prj.mdef  |   5 -
 .../bluetooth/beacon/prj_nble.conf |   1 -
 .../bluetooth/beacon/testcase.ini  |  12 +-
 samples/bluetooth/central/Makefile |   3 +-
 samples/bluetooth/central/prj.conf |   1 -
 samples/bluetooth/central/prj.mdef |   5 -
 .../bluetooth/central/testcase.ini |  12 +-
 .../bluetooth/central_hr/Makefile  |   3 +-
 .../bluetooth/central_hr/prj.conf  |   1 -
 .../bluetooth/central_hr/prj.mdef  |   5 -
 .../central_hr/testcase.ini        |   3 -
 .../bluetooth/eddystone/Makefile   |   3 +-
 .../bluetooth/eddystone/prj.conf   |   1 -
 .../bluetooth/eddystone/prj.mdef   |   5 -
 .../eddystone/prj_nble.conf        |   1 -
 .../eddystone/testcase.ini         |  12 +-
 .../bluetooth/hci-uart/Makefile    |   4 +-
 .../bluetooth/hci-uart/nrf5.conf   |  13 +
 .../bluetooth/hci-uart/prj.conf    |   1 -
 .../bluetooth/hci-uart/src/main.c  |  43 +-
 .../hci-uart/testcase.ini          |   9 +-
 samples/bluetooth/hci-usb/Makefile |   2 +-
 samples/bluetooth/hci-usb/prj.conf |   1 -
 samples/bluetooth/ipsp/Makefile    |   3 +-
 samples/bluetooth/ipsp/prj.conf    |   1 -
 samples/bluetooth/ipsp/prj.mdef    |   5 -
 .../bluetooth/ipsp/testcase.ini    |   1 -
 .../bluetooth/peripheral/Makefile  |   3 +-
 .../bluetooth/peripheral/prj.conf  |   1 -
 .../bluetooth/peripheral/prj.mdef  |   5 -
 .../peripheral/prj_nble.conf       |   1 -
 .../peripheral/testcase.ini        |  12 +-
 .../peripheral_csc/Makefile        |   3 +-
 .../peripheral_csc/prj.conf        |   1 -
 .../peripheral_csc/prj.mdef        |   5 -
 .../peripheral_csc/prj_nble.conf   |   1 -
 .../peripheral_csc/testcase.ini    |  12 +-
 .../peripheral_dis/Makefile        |   3 +-
 .../peripheral_dis/prj.conf        |   1 -
 .../peripheral_dis/prj.mdef        |   5 -
 .../peripheral_dis/testcase.ini    |  12 +-
 .../peripheral_esp/Makefile        |   3 +-
 .../peripheral_esp/prj.conf        |   1 -
 .../peripheral_esp/prj.mdef        |   5 -
 .../peripheral_esp/prj_nble.conf   |   1 -
 .../peripheral_esp/testcase.ini    |  12 +-
 .../peripheral_hids/Makefile       |   3 +-
 .../peripheral_hids/prj.conf       |   1 -
 .../peripheral_hids/prj.mdef       |   5 -
 .../peripheral_hids/prj_nble.conf  |   1 -
 .../peripheral_hids/testcase.ini   |  12 +-
 .../peripheral_hr/Makefile         |   3 +-
 .../peripheral_hr/prj.conf         |   1 -
 .../peripheral_hr/prj.mdef         |   5 -
 .../peripheral_hr/prj_nble.conf    |   1 -
 .../peripheral_hr/testcase.ini     |  12 +-
 .../peripheral_sc_only/Makefile    |   3 +-
 .../peripheral_sc_only/prj.conf    |   1 -
 .../peripheral_sc_only/prj.mdef    |   5 -
 .../testcase.ini                   |  12 +-
 tests/bluetooth/init/Makefile      |   3 +-
 tests/bluetooth/init/prj.mdef      |   5 -
 tests/bluetooth/init/prj_17.conf   |   2 +-
 tests/bluetooth/init/prj_20.conf   |   2 +-
 tests/bluetooth/init/prj_21.conf   |   2 +-
 .../init/prj_controller_dbg.conf   |   2 +-
 .../bluetooth/init/prj_h5_dbg.conf |   2 +-
 tests/bluetooth/init/testcase.ini  |  81 +--
 tests/bluetooth/shell/Makefile     |   3 +-
 tests/bluetooth/shell/prj.mdef     |   5 -
 .../bluetooth/shell/prj_nble.conf  |   1 -
 .../shell/prj_nimble.conf          |   1 -
 tests/bluetooth/shell/testcase.ini |  49 +-
 .../test_bluetooth/Makefile        |   3 +-
 .../test_bluetooth/prj.mdef        |   5 -
 .../test_bluetooth/src/bluetooth.c |   8 +-
 .../test_bluetooth/testcase.ini    |   8 +-
 tests/bluetooth/tester/Makefile    |   3 +-
 tests/bluetooth/tester/prj.mdef    |   5 -
 .../bluetooth/tester/prj_nble.conf |   1 -
 .../tester/prj_nimble.conf         |   1 -
 .../bluetooth/tester/testcase.ini  |   2 -
 128 files changed, 893 insertions(+), 752 deletions(-)
 create mode 100644 drivers/bluetooth/hci/Kconfig
 create mode 100644 drivers/bluetooth/hci/Makefile
 rename drivers/bluetooth/{ => hci}/h4.c (95%)
 rename drivers/bluetooth/{ => hci}/h5.c (96%)
 rename include/bluetooth/{driver.h => hci_driver.h} (73%)
 create mode 100644 net/bluetooth/at.c
 create mode 100644 net/bluetooth/at.h
 delete mode 100644 samples/bluetooth/beacon/prj.mdef
 delete mode 100644 samples/bluetooth/central/prj.mdef
 delete mode 100644 samples/bluetooth/central_hr/prj.mdef
 delete mode 100644 samples/bluetooth/eddystone/prj.mdef
 create mode 100644 samples/bluetooth/hci-uart/nrf5.conf
 delete mode 100644 samples/bluetooth/ipsp/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_csc/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_dis/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_esp/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_hids/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_hr/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_sc_only/prj.mdef
 delete mode 100644 tests/bluetooth/init/prj.mdef
 delete mode 100644 tests/bluetooth/shell/prj.mdef
 delete mode 100644 tests/bluetooth/test_bluetooth/prj.mdef
 delete mode 100644 tests/bluetooth/tester/prj.mdef

Change-Id: I4ddbfc4dfd66231770dbff937636ca1392fd74bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 23:17:44 +03:00
Johan Hedberg 6c54c92e84 Bluetooth: tests/init: Limit controller+host for 32kB RAM platforms
The combined controller & host build takes up too much RAM for the
16kB arduino_101_ble target, so limit it to the 32kB nRF52 & nRF51
DevKits.

Change-Id: Ib9d04765697b7f5c748633cb6244474d92f96995
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 19:27:39 +00:00
Inaky Perez-Gonzalez 3ad37fbebc tc_util: protect macro arg expansion
Calling TC_END_REPORT(complex_expression) might have side effects when
complex_expression is later put inside (result == TC_PASS? A : B)
evaluation, because result will be replaced verbatim.

To avoid operator assignment order changing things, protect
replacement of result by adding parenthesis.

Change-Id: I8fd07d97d4b49b4cd48a1c6ad345bf49fb2537b5
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-10-28 15:40:37 +00:00
Marcus Shawcroft db20018bad tests: Add FXOS8700 sensor to driver build_all test.
Change-Id: I60f62d54b3743335ae80bbb58b2c4ce690b43f41
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:45 +00:00
Szymon Janc fb5424392b Bluetooth: Use unified kernel build for tests and samples
This makes all Bluetooth samples and tests being build with unified
kernel. main() is now executed from init thread and specifying task
for it in mdef file is no longer needed. By default main stack is
1024 bytes and this should be enough for BT samples.

Change-Id: I6674eea2c028b78ada5190acef72937186738af2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 08:30:57 +02:00
Johan Hedberg 6989bf88e1 Bluetooth: Rename bt_driver to bt_hci_driver
The bt_driver API was created when Zephyr only had a Bluetooth host
stack, but no controller-side functionality. The only "driver" that
was needed for the host was the HCI driver, and hence "HCI" was
omitted from the name.

With support both for host and controller Zephyr will be getting more
Bluetooth driver types, in particular radio drivers. To prepare for
this, move all HCI drivers to drivers/bluetooth/hci/ and rename the
bt_driver API bt_hci_driver.

Change-Id: I82829da80aa61f26c2bb2005380f1e88d069ac7d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Johan Hedberg 19138eb2f4 Bluetooth: samples: Remove redundant CONFIG_ARC_INIT=n
CONFIG_ARC_INIT defaults to 'n' now days so there's no reason to try
to explicitly disable it in the sample config files.

Change-Id: I88df06ba23bdac697f0767384f7b88e3bd9fced9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Anas Nashif 465de4a1a0 Bluetooth: tests optimize testcase.ini for shell and init
Change-Id: Ia3f09e33684075394bf5d3e91ade53aaf4443a17
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-28 08:09:08 +03:00
Anas Nashif 27043d71e0 tests: move quark_se boot stub to tests
Lets not confuse user with this code, it is clearly not a sample.

Change-Id: I3a0209fb34b2c97383b0f5382f156b80470fdaf7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-27 22:14:53 +00:00
Anas Nashif cc7b36cd70 test: test_hmac: cleanup excludes
Change-Id: Ib973339191a15b1dbb4fd5f3fa2fc5fe886521a3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-27 22:13:36 +00:00
Anas Nashif 36e1e2dbaf move tests from samples to tests/
Change-Id: Ib183936134d27ff84d9af57e8e2e2d9f0cc2670f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-27 22:13:36 +00:00
Benjamin Walsh b452817b67 kernel: merge _IS_IN_ISR() with _is_in_isr()
They were the same, standardize on the lowercase one.

Change-Id: I8bca080e45f3e0970697d4451e468b9081f96f5f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-27 21:45:03 +00:00
Dmitriy Korovkin 6072e455f3 unified/tests: Adapt test_aes for unified kernel
Unified kernel invokes main() function in the init thread. This
eliminates the need for a separate thread for the test.

Change-Id: I4ff2e160213d152ca7c5d8422162f3464d935119
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-10-27 21:03:07 +00:00
Dmitriy Korovkin 81c94161f5 unified/tests: Adapt test_sha256 for unified kernel
Unified kernel invokes main() function in the init thread. This
eliminates the need for a separate thread for the test.

Change-Id: I4e6c4f212615d2135adf7971df32db1ad392c0e2
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-10-27 21:01:53 +00:00
Flavio Santes 36c09442d9 test/crypto: Fix RAM overflow error in ISSM
According to feedback received in ZEP-1130, decreasing the stack
size in the prj.mdef file solves the RAM overflow issue reported
by ISSM.

Jira: ZEP-1130

Change-Id: I761531e535a9e54ccd024b397d5d92d7666be817
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-10-27 19:56:15 +00:00
Allan Stephens 0eae13d6de unified/test: Fix typo in kernel's test_task application
The wrong tag name was used to mark the test as compatible
with the unified kernel.

Change-Id: Idda5d5e0993447270e7131c42c224df8dcd59282
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-27 08:14:51 -05:00
Marcus Shawcroft e7a943385d test: drivers/build_all support HP206C
Change-Id: Ifad32d59a9786e5b1334532c5c6e7f29657c2a77
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:10 +00:00
Marcus Shawcroft f201b2e79a test: drivers/build_all add CONFIG_WATCHDOG
Change-Id: Ie28877dcb07136cf088b151d8394de606603bfa7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:08 +00:00
Marcus Shawcroft b5dba510d0 test: drivers/build_all refactor, impose some order...
Change-Id: I2fc6c43d489193e39f643d8cac1a8ba6ea57a896
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:07 +00:00
Marcus Shawcroft 1be63f3526 test: Add PINMUX to drivers build_all
Change-Id: I6d115ca5726bcc9e7b4100a3fce7fcc965b37cae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:55 +00:00
Vinicius Costa Gomes cc9da10aab iot/zoap: Add unit tests for block-wise transfers
Change-Id: Ie529d2989481a6be674632dc256fb3995a9953c3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-25 12:56:51 +00:00
Flavio Santes 73d4929886 test/context: Fix style issues
Fix some style issues found at the 'test_context' source code.
Issues detected:

- Naming convention
- Lines over 80 characters

Change-Id: I2f121fce7b00aaf805da44a9aa33cd5aa8d3d6ac
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-10-25 12:13:50 +00:00
Marcus Shawcroft f603981707 sensor/th02: Add missing build_all test.
Change-Id: Ib19ab95389e8867c306d44cd542e062c081bad9b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 11:31:08 +00:00
Marcus Shawcroft d70d0f93e2 sensor/sht3xd: Fix build_all sensor test.
Change-Id: Ic0f1dd745762d94bdb6ab9277a475d41fc148fd0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 11:31:07 +00:00
Allan Stephens f4ba3b1d5d unified/test: Adapt floating point sharing test
Microkernel and nanokernel tests now use customized source code
to eliminate use of MICROKERNEL and NANOKERNEL config options.

Change-Id: I7f9aff4729a7a257c4a0a0f5939ba0f5525af460
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-25 00:10:35 +00:00
Allan Stephens 514be49072 kernel/test: Add testing of heap memory pool support
Enhances the microkernel memory pool test application to
include tests for dynamic memory allocation and freeing
from the heap memory pool using kernel APIs that behave
like malloc() and free().

This enhancement works under both the microkernel and
unified kernel.

Change-Id: Ibc485877ea9d60307edb8f93c54a0b94ebacb017
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-25 00:10:34 +00:00
Kumar Gala 5680681ed9 tests: Rename test_arm_m3_irq_vector_table test since it is not M3 specific
Drop the _m3 from the test name since this can run on M0, M3, M4, etc.

Change-Id: Ia12ece62fc7b42e28f37e191c90c0dead48d40d0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-24 22:56:19 +00:00
Anas Nashif 6d0a0ab337 tests: mbedtls: mark nios2 as slow
Change-Id: I95ac7c82ccdc6abb1cb7c345bea517ea48dceb8c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-24 21:17:16 +00:00
Marcus Shawcroft 81da76e39b tests: Add sensor HTS221 to driver/build-all test case.
Change-Id: Ifd5acf8bfaa75a44458b448001c0f2335fd6364d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:15 +00:00
Marcus Shawcroft f6403ecee0 tests: Add CONFIG_COUNTER to build_all driver tests.
Change-Id: I721832c86322acdb2b9d103586f9f783b9a63c77
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:14 +00:00
Marcus Shawcroft 9a60286f41 tests: Adjust drivers/build_all to build for more boards.
The build_all tests contain an ever growing list of device drivers to
build.  Ideally we minimize the number of images we build, but we
already observe that some of the tests, notably sensors, is too big
for some of our supported boards.

Rather disable an ever growing list of boards as the build_all tests
get bigger it would be better to split the tests into smaller chunks
that can reasonably be expected to run on any supported board.

We split the sensor test set into two, the division is arbitrary,
based on the name of the driver.  This allows us to remove the filter
on the quark_d2000.

The current split into two groups is arbirary, in the future it is
inevitable that as the list of supported drivers grows, we will need
to further subdivied the larger tests.

Change-Id: If7ee00b3c8e1749c4c827f83d7cbc2feb70e56ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:14 +00:00
Anas Nashif bf5fdfbe43 tests: fix testcases for cortex-m0+ platforms
Change-Id: Idf6f5e38354aa5f1801ec0c0db63a4e19243918c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-22 16:54:19 -04:00
Anas Nashif b37dc99033 tests: sha256: filter by RAM size
Change-Id: Ie4e995006afc1281bee22e5b2d7f2a6a3b3bac28
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-22 16:54:19 -04:00
Dmitriy Korovkin 3ef74d4fea unified/arc: Add tickless idle test for Arduino 101 ARC core
Change-Id: I19375d70e875ea94570956598409a28b1f237b13
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-10-22 01:27:02 +00:00
Andrew Boie 1c25f49ac5 x86: arm: add support for custom data at start/end of RAM
This is used by a test case, and it's better to just put this
here instead of forking the linker scripts.

Change-Id: Ifbb90b73bb26118ae2422cc6feccb3db58a26f2c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-10-21 23:30:06 +00:00
Andrew Boie 662df128cd x86: remove references to .intStubSect in linker script
This has been unused for a long time.

Change-Id: Ie251d60d1cf9f3806292e3c150dbedf5f99d6410
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-10-21 23:30:06 +00:00
Andrew Boie 327017fb92 x86: remove unused linker-defs-arch.h
Change-Id: Ib57cced30569adf2ae72f32d27baf30a5ca4fe71
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-10-21 23:30:05 +00:00
Kaustav Dey Biswas 0ecbbc8a7b Bluetooth: SDP: Shorten Service Class macro name
This change shortens the Service Class macro name from
BT_SDP_*_SVCLASS_ID to BT_SDP_*_SVCLASS

Change-Id: I1150baae24428c6b76f005d11003291016e0a03e
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2016-10-21 07:47:31 +03:00
Kaustav Dey Biswas 148b0a2d35 Bluetooth: shell: Add sample SDP service registration
This change adds SPP as a sample SDP service during RFCOMM
server registration. The SPP channel is now used as the
fixed channel for RFCOMM register command.

Change-Id: I3b5ad3995725adca55db1497d4a35099f6311f3b
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2016-10-21 07:47:31 +03:00
Luiz Augusto von Dentz ee9f5c1784 Bluetooth: GATT: Pass CCC attribute to changed callback
This way the application can reuse the same callback for multiple CCC
since it can track what CCC is affect by checking the attribute pointer.

Change-Id: I608da643aea07de26b65d67e6db3268d717d0f53
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-21 07:47:31 +03:00
Allan Stephens 45bfa37f97 unified: Revise timer code to conform to new API specification
Provides users with a more compact and intuitive API for kernel
timers.

Provides legacy support for microkernel timers and nanokernel
timers by building on the new kernel timer infrastructure.
Each timer type requires only a small amount of additional
wrapper code, as well as the addition of a single pointer
field to the underlying timer structure, all of which will be
easily removed when support for the legacy APIs is discontinued.

Change-Id: I282dfaf1ed08681703baabf21e4dbc3516ee7463
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-19 18:14:58 +00:00
Inaky Perez-Gonzalez 7c4584c901 tests/benchmark/latency_measure: use TC_PRINT_RUNID when reporting success
In order to print the proper strings that the test case execution
frameworks expect, use the macros defined in tc_util.h.

Change-Id: I841c5454fbcf4f679e6285538e838f039442b1f8
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-10-19 14:29:09 +00:00
Genaro Saucedo Tejada 9cb925dc70 filter: exclude sensor tests from assert build
When running sanity with asserts turned on the following tests don't
fit the ROM region of CONFIG_SOC_QUARK_D2000:
- test_build_sensor_triggers
- test_build_sensors
Added filters prevent these test from being executed when asserts are
on.

Jira: ZEP-1063

Change-Id: Ib046bcb227f4a49b524894aa5aea80debe159aae
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 23:39:30 +00:00
Maureen Helm 342e09c463 pinmux: Rename frdm_k64f pinmux driver to k64
The k64 pinmux driver can be used for any k64 board, not just frdm_k64f,
therefore renaming the driver accordingly.

Change-Id: I45e96d4a5ff6aa859d0f57fe098e44a8ae5283d1
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-18 21:42:31 +00:00
Allan Stephens b5c6cec4c2 unified/test: Tag early sleep test as 'unified capable'
This application now executes successfully.

Change-Id: Ib3c2673fd7e8f0ff001a8355b4f7c8ddd808da94
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-18 15:30:01 +00:00
Inaky Perez-Gonzalez 61ed9b8853 tests/bluetooth/init/testcase.ini: add missing kernel=micro
This testcase was being ran on Quark D2000 because it failed to
identify itself as micro. There is not enough RAM for that.

Properly tag.

Change-Id: I9fd4235f4436b914b89b10616cbed0cfb3e97b40
Jira: ZEP-1014
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-10-18 13:53:57 +00:00
Genaro Saucedo Tejada 9021ead890 filter: Set special stack size for ecc_dsa debug
When the debug option is enabled ECC DSA test doesn't have enough stack
space so qemu fails. Adding double stack size for special case of qemu
and CONFIG_DEBUG.

Jira: ZEP-1066

Change-Id: Ib14d853de2b1c755a6171787845433648d61b75b
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 11:04:57 +00:00
Genaro Saucedo Tejada af18a34a6a filter: Exclude failing drivers test at debug build
Some of tests/drivers/build_all/ test are failing link step only
when debug is enabled, these filters prevent those tests from being
executed under such configuration.

Jira: ZEP-1063

Change-Id: Ib2ff649794a1d73b133fbf998bbe8143a822c753
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 11:04:52 +00:00
Genaro Saucedo Tejada dbfc696437 filter: Exclude failing crypto test at debug build
Some of tests/crypto/test_ecc_dsa test are failing link step only
when debug is enabled, these filters prevent those tests from being
executed under such configuration.

Jira: ZEP-1063

Change-Id: I4b7376c49a401e21c413427918be549934ce03d5
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 11:04:49 +00:00
Genaro Saucedo Tejada 24b2bf40a4 filter: Exclude failing bluetooth test at debug build
Some of tests/bluetooth test are failing link step only when debug
is enabled, these filters prevent those tests from being executed
under such configuration.

Jira: ZEP-1063

Change-Id: I87fa73710d78346b1b2ce587e9055b0732d9cb49
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 11:04:21 +00:00
Johan Hedberg a2ee2b7eca Bluetooth: tests: Clean up platform whitelisting
Clean up left-overs from this getting fixed first in master.

Change-Id: Ief41ecfdeeb51fbc76f2fe045a412ff1643f69c9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 09:03:30 +03:00
Mariusz Skamra 11b9d98bd2 Bluetooth: tester: Add GAP Unpair command handler
This implements GAP Unpair command handler used to remove pairing
information.

Change-Id: Ia2e2400ea06b2b904f89ec3ee88527d1ea8f7f38
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Mariusz Skamra c1ba7644f7 Bluetooth: tester: Add Identity Resolved event implementation
This event will be used to inform tester about PTS identity address.

Change-Id: I3d25c69c3fc9a8d8a728497d1dc1d57084373e97
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Mariusz Skamra 09c3d8641d Bluetooth: tester: Rework discovery procedure
This moves discovery logic to the tester application.
BTP Start Discovery command flags have been extended with
"Use observation procedure" bit.
For now, Tester can search for devices in limited/general discoverable
mode or those that are broadcasters by setting corresponding flag bits.

Change-Id: I7142e8fdf40a9081787538e433067335d3ee0564
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Szymon Janc 8661b7c258 Bluetooth: tests: Add init config for BR/EDR SMP testing
This test build where BR/EDR SMP support is enabled without
LE central or singing support.

Change-Id: I61bc17e989a5752500a7d29557609d9e54b6006d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-16 09:00:57 +03:00
Anas Nashif 6ce68cb6cb Bluetooth: tests: Limit BR/EDR tests to only qemu
No other board has BR/EDR support at the moment, and we're too easily
hitting RAM limits on them.

Change-Id: I81c800f979d34bd58f73a34c1038a9327556adb2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-15 16:49:04 -04:00
Marcus Shawcroft f163e11034 tests: Add ethernet drivers to drivers/build_all
Extend the driver build_all tests to include a test for ethernet
drivers.

Change-Id: I2b01d547001d3fae45cda3bc95a74c35fd75ab2b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 16:44:07 +00:00
Marcus Shawcroft e1a7b47111 tests: test_ipm: Make device config structures static.
Change-Id: Ief7a411af8dd48b9c6b7122d3062c12f3fa28c66
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:16 +00:00
Tomasz Bursztyka fb24857b5c tests: Add a unit test for the byteorder buffer swap utilities
sys_memcpy_swap() and sys_mem_swap are tested.

Change-Id: Ib7ee9bd5e58a17cb41960c1834510d6643dc8271
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-10-15 10:13:36 +00:00
Allan Stephens 1d07bd1bff unified: Eliminate support for dynamic timers
Gets rid of official support for dynamic timer allocation
in the unified kernel, since users can easily define and
initialize timers at any time. Legacy support for dynamic
timers is maintained for backwards compatibility reasons
for the time being ...

Change-Id: I12b3e25914fe11e3886065bee4e96fb96f59b299
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-13 13:54:00 +00:00
Allan Stephens f0d6c033aa unified/test: Fix issues affecting LIFO object test application
Revises the test to account for changes in LIFO object behavior
in the unified kernel.

Note: A LIFO object shouldn't really be used to try and pass
data items between two different threads in an ordered manner,
as this test is doing. Ordered behavior should only be expected
when a single thread is adding and removing items from a LIFO.
A LIFO is typically used to pass data items between different
threads when ordering doesn't matter -- for example, when using the
LIFO to implement a shared pool of data items that can be allocated
and returned by a bunch of threads. (A LIFO object is more efficient
than a FIFO object for implementing this kind of pool.)

Change-Id: Ic4cbd8b8368477e72c1bf0bca35600b78f963933
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens 8472a63317 unified/test: Fix issues affecting XIP test applications
The nanokernel version of this application now uses its own source
files to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ie7254cce314dc8d55ab325f784bd4f3309329baa
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens b5f9543535 unified/test: Fix issues affecting static idt application
The nanokernel version of this application now uses its own source
files to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ief1d90251df62b54a6814e82cb95730088d40d99
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens 98e1e0674c unified/test: Fix issues affecting stack canary applications
The nanokernel version of this application now uses its own source
file to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ife27f8172b2be33b95136ccdfa29522c8a6fba0b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens 16376d00e6 unified/test: Fix issues affecting test_critical application
Adjusted thread priorities to lie within the default priority
range for the unified kernel.

Change-Id: I130c60b382a6205c4c41b6f74f77679c87e6dc4d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens 6f96335a39 unified/test: Fix issues affecting task test applications
Fixes bug with the private definition of the helper task
that incorrectly added task to the EXE task group.
(This is problematic because the regression task also
starts the helper task!)

Revises test code to use legacy kernel types for task id and
task priority values, rather than using "int", since these
types are not necessarily integer values in the unified kernel.

Revises task/thread priorities used by test so they fit within
the unified kernel's default priority range.

Change-Id: I431120e5d1b44c65f423addfff1330f994fed71b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens 0cdcc6c08c unified: Extend unified kernel sanity test coverage
Updates unified kernel sanity test to include more
applications that are known to work properly.

Change-Id: Ice15bd1034f92269ef6ce9e3cd08599497814bd8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:54:44 -05:00
Anas Nashif 698ef0e3c0 test: build all possible drivers on all platforms
This also removes sensor and sensor2 tests, both are now included in this
single test.

Additionally, set footprint tag to show foorprint changes in gerrit.

Change-Id: I81a9357052adcc4fd910476e0ffc66bfdbdd3bce
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-10 21:26:33 +00:00
Marcus Shawcroft 0a83707410 tests: Add build test for quark clock driver.
Change-Id: I2863d5dc481aedf8015777dbd022f34a7f2c1070
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:14 +00:00
Marcus Shawcroft bf49fee348 tests: Add build test for enc28j60 SPI standalone ethernet driver.
Change-Id: Ieba53e625b2231ef9c492dbe6bfb8b01a5371226
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:12 +00:00
Marcus Shawcroft 9b131c7f2d tests: Build test for nsim uart.
Change-Id: Iacfee9cc21b4f4e58d525bde11cdf6feb5a79d30
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:10 +00:00
Marcus Shawcroft cfb5196f07 sensor/lsm9ds0_gyro: Fix failure to compile, undefined CONFIG_LSM9DS0_SENSOR_INIT_PRIORITY
Change-Id: Ibaeaa1a7df692c044310ba116285e1898d806d0e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:34:00 +00:00
Marcus Shawcroft dee749b213 sensor/lsm64s0: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: If977cc39bab3e838d1ff6d8de2cb4b667974ee17
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:59 +00:00
Marcus Shawcroft db35cc6838 sensor/bmi160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ia4639d65ab4ee64a2ee0ba41677bab40894d65b4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:55 +00:00
Marcus Shawcroft a6f681c782 sensor/bmg160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I2e9b7e7e8245e60e66554b4d631d71a453cf7ffd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:54 +00:00
Marcus Shawcroft 68b89da299 tests: Adding more sensor build tests.
Add another group of sensors tests.  Ideally these would be added to
the existing sensor test, however we are at the ROM limit of the
default board, enabling the rest of the bmc150 driver code is
sufficient to break the link.  Ideally these build tests would succeed
on as larger group of boards as possible, therefore rather than switch
the default board to something with more ROM it seems more appropriate
to create more, smaller tests.

Moving the current partial bmc150 build test from its current home to
a new test and adding the missing parts of the driver.

This split of sensor tests into multiple groups is arbitrary,
suggestions for a systematic approach welcome.

Change-Id: I4d33bff00e483558c4a8486afb96c1906e2d2281
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:52 +00:00
Anas Nashif e1675424f8 tests: sensors: expand coverage with logging enabled
Change-Id: Icf99288444afb2154b32902e805abf3f9bdf36bf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 16:15:54 +00:00
Anas Nashif 98eb3b26a0 tests: expand sensor build testing by enabling more sensors
This will help catch build issues with sensors by enabling all sensors
we have into one single application using all supported IOs.

Change-Id: Id8c201b8ae9b74dccc62d6440899ff487ea09d43
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 14:07:26 +00:00
Marcus Shawcroft d6b88b95e0 tests: Provide build test for sensor lsm9ds0_mfd
Provide a minimal build test for the lsm9ds0_mfd driver.

Origin: Original.

Change-Id: I5e6015ce2f5998a4c200cf582c39ed91e4e171aa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 10:34:36 +01:00
Anas Nashif b88f2e9e6a Merge "Merge bluetooth branch into master" 2016-10-05 09:26:37 +00:00
Peter Mitsis 223b962e0b unified: Enable tickless idle test
Change-Id: I4cd1603266686f907dbc4398b6bc3dfea1e4502c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-04 20:02:50 +00:00
Johan Hedberg 41d60dc3ed Merge bluetooth branch into master
Main changes:

 - Initial A2DP support
 - Initial SDP support
 - Controller code cleanups
 - Improved RFCOMM support
 - Minor fixes & cleanups here and there

----------------------------------------------------------------
Arkadiusz Lichwa (9):
      Bluetooth: RFCOMM: Shuffle up Kconfig's RFCOMM_L2CAP_MTU
      Bluetooth: HFP HF: Fix getting inaccessible internal
      Bluetooth: HFP HF: Enforce Kconfig's HFP_HF relation to RFCOMM
      Bluetooth: init: Add HFP to automated tests
      Bluetooth: A2DP: Remove internal stack headers
      Bluetooth: AVDTP: Remove internal headers
      Bluetooth: AVDTP: Fix getting inaccessible internal
      Bluetooth: L2CAP: Fix sending double connection request
      Bluetooth: Refactor distribution of security procedure status

Arun Jagadish (2):
      Bluetooth: AVDTP: Module Initialization
      Bluetooth: AVDTP: Connect and Disconnect API

Carles Cufi (6):
      Bluetooth: Controller: Clean up naming in the HCI driver
      Bluetooth: Controller: Use net_buf for HCI RX
      Bluetooth: Controller: Use net_buf for CC/CS TX
      Bluetooth: Controller: Use net_buf for evt and ACL RX
      Bluetooth: Controller: Remove unused macro
      Bluetooth: Controller: Fix __packed placement

Itankar, Piyush T (2):
      Bluetooth: A2DP: Initialization of A2DP
      Bluetooth: A2DP: Added Connect API

Jaganath Kanakkassery (5):
      Bluetooth: RFCOMM: Handle dlc disconnection from peer
      Bluetooth: RFCOMM: Handle session disconnection from peer
      Bluetooth: RFCOMM: Introduce rfcomm_send_dm()
      Bluetooth: RFCOMM: Introduce dlc destroy
      Bluetooth: RFCOMM: Replace tabs with spaces

Johan Hedberg (6):
      Bluetooth: L2CAP: Extend bt_l2cap_create_pdu() with 'reserve' parameter
      Bluetooth: tests: Fix name of Quark SE C1000 SS devboard
      Bluetooth: RFCOMM: Remove reference counting
      Bluetooth: RFCOMM: Fix some remaining white-space issues
      Bluetooth: Adjust maximum connections & paired devices range
      Bluetooth: Fix compiler warnings/errors related to string casts

Kaustav Dey Biswas (1):
      Bluetooth: SDP: Server: Initialize and accept incoming connections

Luiz Augusto von Dentz (7):
      Bluetooth: eddystone: Add missing characteristics
      Bluetooth: init: Add CONFIG_BLUETOOTH_RFCOMM to prj_20.conf
      Bluetooth: init: Add CONFIG_BLUETOOTH_AVDTP to prj_20.conf
      Bluetooth: AVDTP: Add missing BLUETOOTH_DEBUG_AVDTP
      Bluetooth: init: Add CONFIG_BLUETOOTH_A2DP to prj_20.conf
      Bluetooth: GATT: Fix locking RX fiber
      Bluetooth: Enable CONFIG_BLUETOOTH_DEBUG_AVDTP with prj_20.conf

Mariusz Skamra (2):
      Bluetooth: tester: Fix advertising data
      Bluetooth: Enable privacy for nimble

Szymon Janc (5):
      Bluetooth: SMP: Remove unused static const
      Bluetooth: SMP: Fix unused static variable
      Bluetooth: Add debug keys support to HCI ECC emulation code
      Bluetooth: L2CAP: Cleanup flags names for BR/EDR channels
      Bluetooth: L2CAP: Rename br_channels to br_fixed_channels

Vinayak Chettimada (2):
      Bluetooth: Controller: Fix SCHED_ADVANCED cond, compilation
      Bluetooth: Controller: Remove custom irq implementation

 drivers/bluetooth/controller/Makefile             |   1 -
 drivers/bluetooth/controller/hal/ccm.h            |   4 +-
 drivers/bluetooth/controller/hal/clock.c          |  18 +-
 drivers/bluetooth/controller/hal/ecb.c            |  17 +-
 drivers/bluetooth/controller/hal/irq.c            |  53 --
 drivers/bluetooth/controller/hal/radio.c          |  14 +-
 drivers/bluetooth/controller/hal/rand.c           |   7 +-
 drivers/bluetooth/controller/hci/hci.c            | 903 ++++++++-----------
 drivers/bluetooth/controller/hci/hci_driver.c     | 290 +++---
 drivers/bluetooth/controller/hci/hci_internal.h   |   9 +-
 drivers/bluetooth/controller/ll/ctrl.c            |  32 +-
 drivers/bluetooth/controller/ll/ctrl.h            |   8 +-
 drivers/bluetooth/controller/ll/pdu.h             | 110 +--
 drivers/bluetooth/controller/util/work.c          |  69 +-
 drivers/bluetooth/controller/util/work.h          |   2 +-
 include/bluetooth/a2dp.h                          |  47 +
 include/bluetooth/bluetooth.h                     |   2 +-
 include/bluetooth/l2cap.h                         |  15 +-
 include/bluetooth/rfcomm.h                        |  29 +-
 .../hal/hal_irq.h => include/bluetooth/sdp.h      |  35 +-
 net/bluetooth/Kconfig                             |  58 +-
 net/bluetooth/Makefile                            |   6 +-
 net/bluetooth/a2dp.c                              | 126 +++
 net/bluetooth/a2dp_internal.h                     |  36 +
 net/bluetooth/att.c                               |  40 +-
 net/bluetooth/avdtp.c                             | 180 ++++
 net/bluetooth/avdtp_internal.h                    | 158 ++++
 net/bluetooth/conn.c                              |   2 +-
 net/bluetooth/hci_core.c                          |  25 +-
 net/bluetooth/hci_ecc.c                           |  71 +-
 net/bluetooth/hfp_hf.c                            |   2 +-
 net/bluetooth/l2cap.c                             |  28 +-
 net/bluetooth/l2cap_br.c                          | 115 +--
 net/bluetooth/l2cap_internal.h                    |  16 +-
 net/bluetooth/rfcomm.c                            | 173 +++-
 net/bluetooth/rfcomm_internal.h                   |  82 +-
 net/bluetooth/sdp.c                               | 294 ++++++
 net/bluetooth/sdp_internal.h                      |  56 ++
 net/bluetooth/smp.c                               |  21 +-
 net/bluetooth/smp_null.c                          |   2 +-
 samples/bluetooth/eddystone/src/main.c            |  79 ++
 tests/bluetooth/init/prj_20.conf                  |   6 +
 tests/bluetooth/init/testcase.ini                 |   2 +-
 tests/bluetooth/tester/prj_nimble.conf            |   1 +
 tests/bluetooth/tester/src/gap.c                  |   2 +-
 45 files changed, 2116 insertions(+), 1130 deletions(-)
 delete mode 100644 drivers/bluetooth/controller/hal/irq.c
 create mode 100644 include/bluetooth/a2dp.h
 rename drivers/bluetooth/controller/hal/hal_irq.h => include/bluetooth/sdp.h (59%)
 create mode 100644 net/bluetooth/a2dp.c
 create mode 100644 net/bluetooth/a2dp_internal.h
 create mode 100644 net/bluetooth/avdtp.c
 create mode 100644 net/bluetooth/avdtp_internal.h
 create mode 100644 net/bluetooth/sdp.c
 create mode 100644 net/bluetooth/sdp_internal.h

Change-Id: I22864805bbb931fe9150ccd84d389b3e30794f7e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-04 18:48:00 +03:00
Ramesh Thomas 773dcc34ae sample: fs: Fix a compile error flagged by llvm
printk format specifier used for size_t (%lu) was not compatible
with llvm because it sees size_t as unsigned int. Using %zu
makes it portable acroos compilers.

Change-Id: If0e732fbaada5f50a975ec912b8147d6b252a2de
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-10-04 12:27:39 +00:00
Mariusz Skamra d363e384f3 Bluetooth: Enable privacy for nimble
This enables privacy feature for nimble configuration.

Change-Id: I3ffb1f6c54ac0825c73e3943c5634905b4908f16
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-04 09:12:25 +02:00
Luiz Augusto von Dentz e889e2ae87 Bluetooth: Enable CONFIG_BLUETOOTH_DEBUG_AVDTP with prj_20.conf
This ensures ADVTP patches are build tested with debug enabled.

Change-Id: I5c09afea4a9df84b054d2383f0b53ff85fa5dcd5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Johan Hedberg 566780ca91 Bluetooth: tests: Fix name of Quark SE C1000 SS devboard
This board was recently renamed, but apparently this reference was
left out.

Change-Id: I9789fa45eab6a9b3118f0f0857ef2207311597f3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-04 08:12:14 +03:00
Arkadiusz Lichwa 71163ac9dc Bluetooth: init: Add HFP to automated tests
Adds HFP HF stack code to automated tests during build coverage.

Change-Id: Ic7bf5f0077b38bbe0feed167935dee73c989a523
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-10-04 08:12:14 +03:00
Mariusz Skamra c76da25cac Bluetooth: tester: Fix advertising data
This fixes data passed to the BTP Device Found event.

Change-Id: I1ab465b87ce24f3ea10b7217c254aafaee494c91
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 85f82d7985 Bluetooth: init: Add CONFIG_BLUETOOTH_A2DP to prj_20.conf
This makes sure A2DP support is build tested on each patch.

Change-Id: I9dba5c20d44d8ac92910e80c1ad97ac8d2207652
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 4c44e66a5c Bluetooth: init: Add CONFIG_BLUETOOTH_AVDTP to prj_20.conf
This makes sure AVDTP support is build tested on each patch.

Change-Id: Ia7cf94ca84fa01bd676a99b0df58ac745bbfc8c7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 324b3a2948 Bluetooth: init: Add CONFIG_BLUETOOTH_RFCOMM to prj_20.conf
This makes sure RFCOMM support is build tested on each patch.

Change-Id: I9cd60da1b0ab0db2b41487393fb59fe1b415ea01
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Anas Nashif 315862f59a tests: remove redundant PRINT definition
Change-Id: I0ac5b3730a9a84b89f392c58e3b65e47cbdf132b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:22 +00:00
Andy Ross 6b3c5e8bb2 x86 link: Specify ALIGN_WITH_INPUT for XIP data sections
Binutils ld has an annoying misfeature (apparently a regression from a
few years ago) that alignment directives (and alignment specifiers on
symbols) apply only to the runtime addresses and not, apparently, to
the load address region specified with the "AT>" syntax.  The net
result is that by default the LMA output ends up too small for the
addresses generated in RAM.  See here for some details:

    https://sourceware.org/ml/binutils/2013-06/msg00246.html
    https://sourceware.org/ml/binutils/2014-01/msg00350.html

The required workaround/fix is that AFAICT any section which can have
inherit a separate VMA vs. LMA from a previous section must specify an
"ALIGN_WITH_INPUT" attribute.  Otherwise the sections will get out of
sync and the XIP data will be wrong at runtime.

No, I don't know why this isn't the default behavior.

A further complexity is that this feature only works as advertised
when the section is declared with the "AT> region" syntax after the
block and not "AT(address)" in the header.  If you use the header
syntax (with or without ALIGN_WITH_INPUT), ld appears to DOUBLE-apply
padding and the LMA ends up to big.  This is almost certainly a
binutils bug, but it's trivial to work around (and the working syntax
is actually cleaner) so we adjust the usage here.

Note finally that this patch includes an effective reversion of commit
d82e9dd9 ("x86: HACK force alignment for _k_task_list section"), which
was an earlier workaround for what seems to be the same issue.

Jira: ZEP-955

Change-Id: I2accd92901cb61fb546658b87d6752c1cd14de3a
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-10-01 01:41:50 +00:00
Vinicius Costa Gomes 08e0e86bb0 tests/zoap: Add tests for the observe feature
Change-Id: I993437169715ce57f6c5c9f3e95689f785db65c4
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:26 +00:00
Jaakko Hannikainen 54c90bcbd5 tests: Add gcov support
If the -C flag is given to sanitycheck, generate gcov files for unit
tests and render them with lcov.

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: Ic25eae6a3cfc2c45595bd6aa235df2c483aaf6ec
2016-09-30 21:17:42 +00:00
Jaakko Hannikainen bdfe417020 tests: Add a sample for testing natively
This simple unit test runs basic sanity checking on buffers from
net_buf_get. It demonstrates the mocking support in a real-world case,
where it is used to remove the dependency to nano_fifo.

Origin: Original

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: If2757823bebbc0fa22b3064a432032cdbccdfe2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:42 +00:00
Jaakko Hannikainen 6f8e7b33b1 tests: convert tests/net/buf to the new framework
This is a sample how to use the framework in an integration test
environment.

Change-Id: I01619fce06759ed523c8c878e8bbda6d8d87d604
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:41 +00:00
Jaakko Hannikainen 349a6c5c28 ztest: Add simple integration and unit tests
These tests mainly test the stack whether it compiles and runs fine
under normal conditions. They do not test most failure conditions.

Origin: Original

Change-Id: Iaac73511a0664abd84685112b4e526eab3eb5748
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:41 +00:00
Jaakko Hannikainen 891c369807 ztest: Add documentation
Origin: Original

Change-Id: I0927c25fbbba5d4863f199d058d311c10d52d784
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:40 +00:00
Jaakko Hannikainen ca505f8452 ztest: Add native building support
This commit allows building tests using the ztest framework without
including Zephyr. This can be used to enable unit testing single
functions, even static ones.

Origin: Original

Change-Id: Ib7e84f4bd9bbbf158b9a19edaf6540f28e47259f
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:39 +00:00
Jaakko Hannikainen 9167a0305f tests: Add a generic testing framework
This framework makes testing in most parts a lot easier, since it gives
an unified base to work with, removing a lot of unnecessary code from
tests. This framework currently features simple assertions and basic
mocking support. The framework works both with and without Zephyr
running, so it can be used for real unit testing.

Origin: Original

Change-Id: I8c5bf2e6b8d6656b6197ee91699b61e730c1cfe3
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:39 +00:00
Andrew Boie e56f61f5aa x86: exceptions: simplify exception stubs
Exception stubs now just push the handler and in some cases a dummy
error code before jumping to the exception handling code, never to
return.

Change-Id: I6a79d9243deb3fc7ccdae003dd0917364c0aa304
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:07 +00:00
Andrew Boie edeb1f1c52 x86: interrupts: optimize and simplify IRQ stubs
Interrupt stubs now just push the ISR and parameter onto the stack
and jump to the common interrupt code, never to return.

Change-Id: I82543d8148b5c7dfe116c43f41791f852614bb28
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:06 +00:00
Dmitriy Korovkin 5a92f4b54f unified: Make test_pend unified capable.
test_pend test checks task_offload_to_fiber() routine.

Change-Id: I1d23e371accd633cce94db71b94f224b9b99a385
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-23 18:51:07 +00:00
Andy Ross 8d8b2acb26 k_timer: Don't allocate dynamic timers by default
Most apps run fine with static k_timer objects.  Don't pay the cost
for the timer pool if no one asks for it.

Also turn off the allocate/free API in the header if it can't possibly
work at runtime as it's an obviously-detectable error that would
otherwise be visible only at runtime.

Change-Id: I492e6e01c4213e3544f707247eea6e4bc601fefd
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-23 18:25:37 +00:00
Ramesh Thomas 98357de7a3 sample: fs: Add tests for fs_truncate and fs_statvfs
Adds tests for the new APIs fs_truncate() and fs_statvfs()

Jira: ZEP-636 ZEP-622 ZEP-635
Change-Id: Ic1c6dfa4e9592a362b67129df389b4b78cc5f250
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-23 00:06:33 +00:00
Anas Nashif 179ce1c891 boards: remove obsolete board basic_minuteia
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: I01c825c7eb44d6c321f2ffb88e8899da528921dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:34 +00:00
Anas Nashif 572f4a1a14 boards: remove obsolete board basic_cortex_m3
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: Ied681b6059ad74f9d019054292c919a9f938e7d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:33 +00:00
Benjamin Walsh bee1c0655f test_mem_safe: fix breakage in unified kernel
Linker scripts had not been updated following the addition of
_k_mem_pool sections.

Change-Id: Ic58e893b5296d0f814253e714f8858c272e79913
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-22 21:09:44 +00:00
Vinicius Costa Gomes 47e8893654 tests/zoap: Add simple test for retransmission
Change-Id: I3a552f10e02e3880bbeb00b31f31c31414c6f163
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-09-22 00:54:36 +00:00
Dmitriy Korovkin e3be818115 unified: Make memory pool test unified capable
Add the tag for unified kernel

Change-Id: I56953ade864580a68786fd39c459ed70bde0787c
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-20 22:04:47 +00:00
Dmitriy Korovkin 7f14618227 unified: Enable memory pools in mailbox tests
Change-Id: I216fbff4db7e97bfca3574f6bfc5294d73ae8e9c
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-20 22:04:46 +00:00
Benjamin Walsh 3fb21ac39c test_mem_safe: bring x86 linker script up-to-date
Some modifications to the base linker scripts were not propagated.

Change-Id: I73ab016d861779ad7e633ce8602d2e57845bde85
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-20 21:45:07 +00:00
Andrew Boie 757dae5b7d x86: introduce new segmentation.h header
This header has a bunch of data structure definitions and macros useful
for manipulating segment descriptors on X86. The old IDT_ENTRY defintion
is removed in favor of the new 'struct segment_descriptor' which can be
used for all segment descriptor types and not just IRQ gates.

We also add some inline helper functions for examining segment registers,
descriptor tables, and doing far jumps/calls.

Change-Id: I640879073afa9765d2a214c3fb3c3305fef94b5e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-20 20:46:45 +00:00
Peter Mitsis a4b4f5ca20 unified: Enable semaphore group use in test_mail
Change-Id: I4b8821480d2d03fa1dfc4602c00fef12da59a1a2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-20 11:45:28 -04:00
Peter Mitsis 95b75d7e6e unified: Fix semaphore group tests
Threads usings semaphore groups require a larger stack.

Also suppresses warnings in test_sema/microkernel due to Zephyr's
__printf_like() toolchain macro as variable types being printed
have changed between the microkernel and unified kernel.

Change-Id: If7490e0c68c299cc7a45010b9e6db7c01c826a6c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-20 11:45:28 -04:00
Flavio Santes 19d22dc389 tinycrypt: Add test case for the ECC DH algorithm
This commit adds the test-case for the ECC DH algorithm.

Origin: https://github.com/01org/tinycrypt/tree/v0.2.0

The code was refactored to eliminate function calls and checkpatch
errors. Furthermore, the PRNG was replaced by sys_rand32_init.
 Refactoring history is available at:

Repo:       https://gitlab.com/santes/tinycrypt/tree/refactoring
Commit:     f71fc46403e90be0c54a77150e0539756d8314e7

Jira: ZEP-614
Jira: ZEP-861

Change-Id: I884f26ef8e9ff8e79ed0858678c4f51a37796e02
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-09-20 12:54:21 +00:00
Flavio Santes 062489f873 tinycrypt: Add test case for the ECC DSA algorithm
This commit adds the test-case for the ECC DSA algorithm.

Origin: https://github.com/01org/tinycrypt/tree/v0.2.0

The code was refactored to eliminate function calls and checkpatch
errors. Furthermore, the PRNG was replaced by sys_rand32_init.
Refactoring history is available at:

Repo:	https://gitlab.com/santes/tinycrypt/tree/refactoring
Commit:	f71fc46403e90be0c54a77150e0539756d8314e7

Jira: ZEP-614
Jira: ZEP-862

Change-Id: Ief3c317f3d370a073f07307e53018991b03d9229
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-09-20 12:54:21 +00:00
Paul Sokolovsky 824fd85b1c tests/kernel/test_multilib: Test for proper multilib selection.
This test is prompted by incorrect multilib selection for Cortex-M4
(armv7e-m subarchitecture) in Zephyr SDK 0.8.1 toolchain. The idea
is do an operation which guaranteedly results in a call to a support
routine in libgcc, which is part of multilib set. Long long division
is used as such, with a fault produced (see README) when built for
BOARD=frdm_k64f.

This test now passed with SDK 0.8.2 for frdm_k64f, but is added in
the hope of preventing/easing diagnosis of future regressions.

Change-Id: I07f01b0e70921703fc0d261fc6c48a2b13b29873
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-09-19 13:58:11 +03:00
Johan Hedberg 5cc5141371 Merge bluetooth branch into master
Main changes:

 - Cleanups & refactoring to the native controller code
 - Support for cross-transport pairing from BR/EDR to LE
 - Fix potential deadlock in TX fiber when disconnecting
 - Initial skeleton for the Hands-Free Profile (HFP)
 - Fix to Resolvable Private Address (RPA) updates
 - Added flow control support to RFCOMM

----------------------------------------------------------------
Carles Cufi (21):
      Bluetooth: HCI: Fix the length of supported commands
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: HCI: Add handle to LTK command complete events
      Bluetooth: HCI: Add handle to conn param update command complete
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Unify handling of async events
      Bluetooth: HCI: Fix and extend advertising report events
      Bluetooth: HCI: Add auth payload expiry event
      Bluetooth: Controller: Use hci.h for control event handling
      Bluetooth: HCI: Add read remote version info event
      Bluetooth: Controller: Use hci.h for data-control evt handling
      Bluetooth: Controller: Use hci.h for num complete
      Bluetooth: Controller: Remove HCI event definitions from hci.c
      Bluetooth: Controller: Use hci.h for ACL data
      Bluetooth: Controller: Clean up HCI macros
      Bluetooth: Controller: Implement LE_RAND command
      Bluetooth: Controller: Make HCI endianness-independent
      Bluetooth: Controller: Refactor HCI files

Grzegorz Kolodziejczyk (3):
      Bluetooth: tester: Add support for L2CAP connect command
      Bluetooth: tester: Add support for L2CAP disconnect commands
      Bluetooth: tester: Add support for L2CAP listen command

Itankar, Piyush T (1):
      Bluetooth: Init: Updated filiter options for test_20

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement RX flow control

Johan Hedberg (2):
      Bluetooth: GATT: Fix potential bt_conn reference leak
      Bluetooth: Fix giving back pkts semaphore when disconnecting

Luiz Augusto von Dentz (3):
      Bluetooth: ATT: Fix not handling error response properly
      Bluetooth: HCI: Fix updating RPA too early
      Bluetooth: eddystone: Fix byteorder of advertisement

Mariusz Skamra (1):
      Bluetooth: tester: Add support for L2CAP send data command

Sathish Narasimman (1):
      Bluetooth: HFP HF: Initialize Handsfree profile

Sukumar Ghorai (1):
      Bluetooth: Pre-allocated RFCOMM Channels

Szymon Janc (16):
      Bluetooth: SMP: Move smp_create_pdu function up in a file
      Bluetooth: SMP: Add initial code for BR/EDR support
      Bluetooth: SMP: Clear keys on timeout when running over BR/EDR
      Bluetooth: SMP: Support Pairing Request over BR/EDR
      Bluetooth: SMP: Support Pairing Failed over BR/EDR
      Bluetooth: SMP: Distribute local keys over BR/EDR
      Bluetooth: Add support for reading encryption key size for BR/EDR
      Bluetooth: SMP: Fix encryption key size check in BR/EDR pairing req
      Bluetooth: SMP: Support Pairing Response over BR/EDR
      Bluetooth: SMP: Allow to force BR/EDR without SC support
      Bluetooth: SMP: Add support for LTK derivation from LinkKey
      Bluetooth: SMP: Add support for sending Pairing Request over BR/EDR
      Bluetooth: SMP: Add support for Identity Information over BR/EDR
      Bluetooth: SMP: Add support for Signing Information over BR/EDR
      Bluetooth: SMP: Add helper for reporting BR/EDR pairing complete
      Bluetooth: SMP: Factor out BR/EDR encryption check to helper

Vinayak Chettimada (4):
      Bluetooth: ATT: Remove unnecessary call to BT_ASSERT
      Bluetooth: log: Call _SysFatalErrorHandler in BT_ASSERT()
      Bluetooth: log: Include nanokernel.h to use BT_ASSERT()
      Bluetooth: Controller: Use BT_ASSERT instead of custom impl.

 drivers/bluetooth/controller/Makefile             |    2 +-
 drivers/bluetooth/controller/hal/clock.c          |    8 +-
 drivers/bluetooth/controller/hal/debug.h          |   27 +-
 drivers/bluetooth/controller/hal/ecb.c            |    2 +-
 drivers/bluetooth/controller/hal/radio.c          |    2 +-
 drivers/bluetooth/controller/hal/rand.c           |    2 +-
 drivers/bluetooth/controller/hal/rtc.c            |    2 +-
 drivers/bluetooth/controller/hci/hci.c            | 2380 +++++++-----------
 .../controller/{main.c => hci/hci_driver.c}       |   23 +-
 .../controller/hci/{hci.h => hci_internal.h}      |   14 +-
 drivers/bluetooth/controller/ll/ctrl.c            |  332 +--
 drivers/bluetooth/controller/ll/ticker.c          |    3 +-
 include/bluetooth/hci.h                           |   56 +-
 include/bluetooth/hfp_hf.h                        |   61 +
 include/bluetooth/log.h                           |   17 +-
 include/bluetooth/rfcomm.h                        |    8 +
 net/bluetooth/Kconfig                             |   23 +
 net/bluetooth/Makefile                            |    2 +
 net/bluetooth/att.c                               |    4 +-
 net/bluetooth/conn.c                              |   45 +-
 net/bluetooth/gatt.c                              |    7 +-
 net/bluetooth/hci_core.c                          |   18 +-
 net/bluetooth/hci_core.h                          |    4 +-
 net/bluetooth/hfp_hf.c                            |  123 +
 net/bluetooth/hfp_internal.h                      |   43 +
 net/bluetooth/l2cap_br.c                          |   15 +
 net/bluetooth/l2cap_internal.h                    |    1 +
 net/bluetooth/rfcomm.c                            |   49 +-
 net/bluetooth/smp.c                               |  953 ++++++-
 samples/bluetooth/eddystone/src/main.c            |    4 +-
 tests/bluetooth/init/testcase.ini                 |    7 +-
 tests/bluetooth/tester/src/bttester.h             |   71 +
 tests/bluetooth/tester/src/l2cap.c                |  306 +++
 33 files changed, 2785 insertions(+), 1829 deletions(-)
 rename drivers/bluetooth/controller/{main.c => hci/hci_driver.c} (94%)
 rename drivers/bluetooth/controller/hci/{hci.h => hci_internal.h} (68%)
 create mode 100644 include/bluetooth/hfp_hf.h
 create mode 100644 net/bluetooth/hfp_hf.c
 create mode 100644 net/bluetooth/hfp_internal.h

Change-Id: I7bc41fb1c53c0f5128a1e4ab38815d19018b603f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-16 13:28:24 +03:00
Anas Nashif 5363d14a9e boards: rename Quark SE Devboard to Quark SE C1000
This board now has an official name and will be available soon:

http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html

Jira: ZEP-758
Change-Id: Ia16d33722308cf81471321c3063bdc75055a4d50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:31 +00:00
Anas Nashif 5e4b62c35c boards: rename Quark SE Devboard to Quark SE C1000 (Sensor Subsystem)
Jira: ZEP-758
Change-Id: I8ee5a2f9e4a6ecbd15214e59321bf27a502ef6ee
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:30 +00:00
Anas Nashif 2aa754497d tests: fp_sharing: removing dependency on ARCH
Change-Id: I389f93aad4b785f286bd83be6c5ed688115592f8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-15 21:16:40 +00:00
Anas Nashif 50492618e6 tests: remove dependency on architecture and use one prj.conf
No need for architecture based configuration, they are the same
for ARM and X86.

Change-Id: Iea7a62221a09bcc035bb8c81e4f49cd4c9b02229
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-15 21:16:39 +00:00
Benjamin Walsh 0e6aebf2c9 tests/mem_safe: place test buffers at the edges of RAM
This test checks if it can write at the edges of RAM within the kernel
image. The problem is that this memory is not meant to be trampled on.

With the help of custom linker scripts, place 32-byte buffers at those
edges.

Only linker scripts for QEMU on x86 and Cortex-M3 are provided, to avoid
having to maintain too many of them, in case the reference linker
scripts in the kernel change.

JIRA: ZEP-707

Change-Id: Icd5d680ce2cf064cce083c3d244a196e292bd453
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-15 09:42:24 -04:00
Flavio Santes 5306a00190 tinycrypt: Rename current tests to avoid confusions with new algorithms
Rename test_ctr to test_ctr_mode to avoid confusions with any CTR-based
algorithm. For example, currently TinyCrypt v0.2.0 supports the
CTR PRNG algorithm.

Rename test_prng to test_hmac_prng to avoid confusions with the test
case for the CTR PRNG algorithm or any test-case related to PRNGs.

Rename test_cbc to test_cbc_mode. TinyCrypt test case for CBC mode is
"test_cbc_mode.c", so it makes sense to keep the same name for the
directory.

Furthermore, README files are also updated to reflect the previous
described changes.

Change-Id: If0af4dcffe8917a7c29608231d3954b73dff5e10
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-09-15 10:34:05 +00:00
Flavio Santes 0baadc030a tinycrypt: Solve style issues
This commit solves some indentation issues detected in the following
test-cases/files:

- test_cbc/src/test_cbc_mode.c
- test_ctr/src/test_ctr_mode.c
- test_prng/src/test_hmac_prng.c

Change-Id: I0f184ae4b510e4552a061523ea3e1216ae1f6f2a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-09-15 10:34:05 +00:00
Itankar, Piyush T d17a803dc9 Bluetooth: Init: Updated filiter options for test_20
Added filter options to avoid building for the Arduino_101
and Quark_se ARC core as there is not enough RAM to run this
test.

Change-Id: I0c1172714c9827e632648fcedc67555251f25769
Signed-off-by: Itankar, Piyush T <piyush.t.itankar@intel.com>
2016-09-15 14:48:22 +05:30
Flavio Santes 73b086caa7 tinycrypt: Add test case for the CTR PRNG algorithm
This commit adds the test case for the CTR PRNG algorithm.

Origin: https://github.com/01org/tinycrypt/tree/v0.2.0

The code was refactored to eliminate malloc and free function
calls and checkpatch errors. However, many warnings are still
present. Refactoring history is available at:

Repo:	https://gitlab.com/santes/tinycrypt/commits/refactoring
Commit:	5d0482c26c4ad69e7854dde58d15bb57a3e5f18f

Jira: ZEP-614
Jira: ZEP-860

Change-Id: I0620868d092941931762718c81fe13fc01f251b2
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-09-15 03:36:14 +00:00
Anas Nashif 01a3e442e8 tests: move test code from samples to tests
Jira: ZEP-760
Change-Id: I3afa847864f9a593696ee832f291f438fd291f8e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-14 15:34:17 +00:00
Mariusz Skamra 044e15743d Bluetooth: tester: Add support for L2CAP send data command
Adds support for handling L2CAP send data command.

Change-Id: I120a9ed56506ce205e32c5efe15c5d967d7726b6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk a4f526fb6b Bluetooth: tester: Add support for L2CAP listen command
This patch adds support for handling L2CAP listen command.

Change-Id: I2c9c27f925c923a14ddb28b41fbefd612b32d63a
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk c4957ea0e8 Bluetooth: tester: Add support for L2CAP disconnect commands
This patch adds support for handling L2CAP disconnect command.

Change-Id: If6f8f3a7485dc8ae270481ed6af4f0a4d4c69fac
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk 086eac4344 Bluetooth: tester: Add support for L2CAP connect command
This patch adds support for handling L2CAP connect command.

Change-Id: I95d27831f65ed6a3e02e1d6e7583baa6890b588c
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Benjamin Walsh 87f1232770 unified/tests: tag working some tests kernel as 'unified_capable'
This allows running the sanitycheck with:

  --tag unified_capable -x KERNEL_TYPE=unified

to run the unified kernel with the tests it is currently known to be
able to run.

Change-Id: Ic145fc6adca162745887672372226fd67447b34a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 8011221712 unified/test_mutex: adapt to run on unified kernel
- Use a more limited range of priorities, since the current
  implementation of the unified kernel only works with 32 priorities
  total. Instead of starting at 10 and going up by 5 up to  50, start
  at 5 and go up by 1 up to 12.

- The definition of kmutex_t has changed from a uint32_t to a struct
  k_mutex *, causing this to not work anymore:

    const kmutex_t private_mutex;

  since this makes the object constant instead of the reference to it.
  Private object must be referenced like this instead:

    kmutex_t const private_mutex;

  since const is left-associative.

Change-Id: I9d70bfa3944ea46033a6b49251a4993e9bd2b588
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 2a669da7bc unified/test_fp: mark test so that it runs the nanokernel version
The test does not run out-of-the-box currently, mark it with a #error.

Change-Id: Ia720c674290e59e95db1c2948c508c0464caa672
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 68a8059603 unified/test_sema: fix isr wrapper names
isr wrapper names conflicted with real kernel APIs.

Change-Id: Ia85245fcd3025f9d15175523982883e16e97010c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 45054a6e02 unified: Fix test_sema/microkernel
Fixes test_sema/microkernel so that the variable assigned the return
value from task_sem_group_take() is of type 'ksem_t' instead of 'int'.

Work by: Peter Mitsis <peter.mitsis@windriver.com>

Change-Id: Iee9f321a6bd51ca3bc0cd8b0c7eceae8a5bf7ce0
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 3bcd880594 unified/test_timer: adapt for unified kernel
Test is poking into microkernel private data structuresa, but the
unified kernel provides an API to retrieve that value.

Abstract the call in the microkernel case to minic the unified kernel
API.

Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>

Change-Id: Ic3195d470fda178164268d9c71c55a2a6daa61a3
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh c24d844eec unified/test_pipe: adapt to not use sem groups
Not available yet on unified kernel.

Change-Id: I70c7c07ab26a66b7a89246a335fa2af0db2ec72c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh cda52c7adb unified/test_mail: adapt test to not use sem groups and mem pools
Not available on unified kernel yet.

Change-Id: I834482f3ad94d1c6ecc67c70c1fce78e43db31c5
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Benjamin Walsh 6f4b9a64cf unified/test_context: adapt test to run on unified kernel
Fixing issues with the test itself really:

- reply_timeout semaphore was not initialized, causing its limit value
  to be 0 on unified kernel

- There is no API to set a fiber's priority after it is started in a
  nanokernel. However, tcs.prio can be written to and this works without
  issues. On unified kernel, this does not work however because the
  thread has to move between linked lists representing each priority in
  the ready queue.

Change-Id: I3c5585da05cbc4ac3d2f0f9ae0297d24d41b1309
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Andrew Boie c579ca43ac test_context: use correct timer IRQ for mint valley
LOAPIC timer driver is used by both LOAPIC and MVIC, but the
correct #define needs to be used for the IRQ line.

Issue: ZEP-848
Change-Id: Ib682dd95c08ba437d1ff409e0e0352944d13b633
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-12 17:53:21 +00:00
Anas Nashif 44362df31d boards: ia32_pci is long gone, use galileo instead
Change-Id: Id60593cfa900a7a14a3a3be6f3870112bd506b2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-12 12:28:46 +00:00
Anas Nashif c7faacf3d6 samples: move pci tests to tests/
Change-Id: Ibeb50b25b2f897dc1be87aa0739ef3f31d9015e8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-12 12:26:06 +00:00
Anas Nashif 1ecbea283c samples: move spi tests to tests/
Change-Id: I8d4a50bcbf479c35ccb209fbb04b5b1095075933
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-12 12:26:06 +00:00
Vinicius Costa Gomes 3a53a73d8f tests: Add simple CoAP tests
Change-Id: I3d7b11ac5a623eab8e07d484b60c24c8a9a824f1
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-09-12 12:25:24 +00:00
Genaro Saucedo Tejada 59b06e2860 fix: previously uninitialized variables break DEBUG sanity
Fix several compiler warnings that were preventing sanity from
completing successfully when running with the CONFIG_DEBUG=y setting.
(related to compiler flag -Werror=maybe-uninitialized)

JIRA: ZEP-735

Change-Id: I3cb79eb0f254f15d18f18ace50b0cf24e9ef5f10
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-09-12 02:25:22 +00:00
Qiu Peiyang cf0efbb51f drivers/pinmux: delete deprecated PINMUX_DEV_QUARK_MCU
CONFIG_PINMUX_DEV_QUARK_MCU is deprecated and QUARK MCU support
is replaced by CONFIG_PINMUX_DEV_QMSI. So delete this deprecated
CONFIG option.

Change-Id: I2cad6cfd4344386a00d45a579e8cc586935b041f
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-09-12 02:08:08 +00:00
Johan Hedberg 5ada33a862 Merge bluetooth branch to master
Main changes:

 - Introduce support for a native Bluetooth controller implementation. Current
   supported controller is the nRF52, with nRF51 soon to follow.
 - Initial support for the RFCOMM protocol
 - New raw HCI interface to enable exporting HCI externally
 - New sample application to expose HCI over USB (using the new raw API)
 - Close-to-complete BR/EDR L2CAP implementation
 - Cross-transport key derivation support from LE to BR/EDR

-----------------------------------------------------------------------------
Andrei Emeltchenko (8):
      Bluetooth: Simplify configuration and fix warnings
      Bluetooth: Add RAW API interface to Bluetooth
      Bluetooth: Add documentation to HCI RAW interface
      Bluetooth: Export USB HCI controller using RAW HCI channel
      Bluetooth: Include btusb sample to sanity check
      Bluetooth/drivers: Fix missing argument in printf for h5 driver
      Bluetooth/samples: Fix missing argument in printf for btusb
      drivers/nble: Rename nrf51 power management functions

Arkadiusz Lichwa (8):
      Bluetooth: L2CAP: Make common RTX commands timer
      Bluetooth: L2CAP: Initialize & cleanup RTX timer on BR/EDR
      Bluetooth: L2CAP: Add RTX timer for 'get info' command
      Bluetooth: L2CAP: Add RTX timer for 'configuration' command
      Bluetooth: L2CAP: Add RTX timer for 'disconnect' command
      Bluetooth: L2CAP: Refactor connection security handler
      Bluetooth: L2CAP: Fix reset channel state context
      Bluetooth: L2CAP: Implement connect command on BR/EDR

Carles Cufi (7):
      Bluetooth: Cleanup and extend HCI header
      Bluetooth: Controller: Use offsetof() in memory sizing
      Bluetooth: Controller: Unify handling of unknown command
      Bluetooth: Controller: Unify handling of CC and CS
      Bluetooth: HCI: Rename cmd complete struct
      Bluetooth: HCI: Add definitions and macros
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling

Grzegorz Kolodziejczyk (1):
      Bluetooth: tester: Add L2CAP init method

Jaganath Kanakkassery (23):
      Bluetooth: L2CAP: Implement bt_l2cap_br_chan_send()
      Bluetooth: RFCOMM: Initialize and register to L2CAP
      Bluetooth: RFCOMM: Implement Register Server channel API
      Bluetooth: RFCOMM: Init buffer for outgoing signalling packets
      Bluetooth: RFCOMM: Handle signalling connection request
      Bluetooth: RFCOMM: Handle PN request
      Bluetooth: RFCOMM: Handle incoming dlc request
      Bluetooth: shell: Add support for RFCOMM test
      Bluetooth: RFCOMM: Move rfcomm_make_uih_msg() up
      Bluetooth: RFCOMM: Perform MSC transaction after dlc
      Bluetooth: RFCOMM: Handle data and credit from peer
      Bluetooth: RFCOMM: Fix cr bit of address in MSC response
      Bluetooth: L2CAP: Disable fragmentation of rx pdu
      Bluetooth: RFCOMM: Implement send data API
      Bluetooth: shell: Add support for RFCOMM send data
      Bluetooth: Kconfig: Add default for L2CAP_IN_MTU if BREDR is enabled
      Bluetooth: RFCOMM: Introduce helper to create rfcomm pdu
      Bluetooth: RFCOMM: Introduce Kconfig for max L2CAP MTU
      Bluetooth: shell: Use bt_rfcomm_create_pdu() in RFCOMM send
      Bluetooth: RFCOMM: Fix BT_RFCOMM_BUF_SIZE to include FCS and len
      Bluetooth: RFCOMM: Remove BT_RFCOMM_SEND_RESERVE
      Bluetooth: RFCOMM: Implement TX flow control
      Bluetooth: RFCOMM: Modify bt_rfcomm_dlc() to return dlc

Johan Hedberg (13):
      Bluetooth: monitor: Fix condition for disabling UART interrupts
      Bluetooth: Fix race condition when initializing ECC FIFO
      Bluetooth: Add missing guards to hci_raw.h header file
      Bluetooth: Controller: Fix coding style in ctrl.c, util/ and main.c
      Bluetooth: Kconfig: Remove unnecessary default conditionals
      Bluetooth: Make lmp_ext_feat_capable() more generic
      Bluetooth: Fix reading local features
      Bluetooth: Fix feature page count for single-mode configuration
      Bluetooth: Clean up feature test macros
      Bluetooth: ATT: Fix usage of unsupported %zu format specifier
      Bluetooth: Kconfig: Be consistent with the use of tabs vs spaces
      MAINTAINERS: Fix path for BLUETOOTH CONTROLLER
      Bluetooth: GATT: Fix unaligned access to CCC value

Jonathan Gelie (1):
      Bluetooth: Enable and disable BLE chip sleep mode dynamically

Kaustav Dey Biswas (1):
      Bluetooth: UUID: Add 32bit UUID support

Luiz Augusto von Dentz (7):
      Bluetooth: eddystone: Add timeout to deactivate configuration mode
      Bluetooth: GATT: Add queuing support
      Bluetooth: UUID: Add HID Service
      Bluetooth: Add service sample for HoG
      Bluetooth: Add sample implementing HIDS
      Bluetooth: HoG: Require authentication for connections
      Bluetooth: GATT: Fix unaligned accesses

Mariusz Skamra (1):
      Bluetooth: btp: Extend BTP specification to cover L2CAP tests

Ricardo Salveti (1):
      board: nrf52_nitrogen: Include BLE controller by default

Szymon Janc (22):
      Bluetooth: Split keys into LE and BR/EDR specific storage
      Bluetooth: SMP: Remove not needed stubs from NULL backend
      Bluetooth: Mark AES encrypted BR/EDR link as FIPS security level
      Bluetooth: SMP: Add helper for notifying pairing complete
      Bluetooth: SMP: Refactor keys distribution bitfields
      Bluetooth: SMP: Add support for Link Key derivation
      Bluetooth: SMP: Add self test for H6 function
      Bluetooth: Fail on init if BR/EDR is enabled but not supported
      Bluetooth: L2CAP: Remove mask from struct bt_l2cap_fixed_chan
      Bluetooth: L2CAP: Use BIT macro for supported BR/EDR fixed channels
      Bluetooth: L2CAP: Make bt_l2cap_br_fixed_chan_register global
      Bluetooth: Set BR/EDR device name on init
      Bluetooth: tests/shell: Set same name on BR/EDR and LE
      Bluetooth: tests/shell: Add dedicated BR/EDR config
      Bluetooth: tests/shell: Remove not needed RFCOMM option from config
      Bluetooth: Fix typo in code comment
      Bluetooth: Build RFCOMM documentation
      Bluetooth: Refactor Link Key notification event handling
      Bluetooth: Add support for P256 Link Keys
      Bluetooth: Read local extended features on init
      Bluetooth: Enable Secure Connections if supported
      Bluetooth: Move reading extended features to BR/EDR section of init

Vinayak Chettimada (22):
      soc: Use nrf.h instead of nrf52.h and nrf52_bitfields.h
      Bluetooth: Fix race condition between ecc_send and ecc_task
      MAINTAINERS: Add BLUETOOTH CONTROLLER section
      Bluetooth: Controller: Hardware abstraction layer for nRF5x radio
      Bluetooth: Controller: Add a util folder with basic primitives
      Bluetooth: Controller: Add initial HCI implementation
      Bluetooth: Controller: A full, hardware-agnostic BLE Link Layer
      Bluetooth: Controller: Add BLE controller driver
      board: nrf52_pca10040: Include BLE controller by default
      Bluetooth: tests: Add BLE controller init tests
      Bluetooth: Controller: Fix coding style, use of (void)
      Bluetooth: Controller: Fix assert on advertise start
      Bluetooth: Controller: Fix memory required calculation macro
      Bluetooth: Controller: Fix deadlock in recv fiber
      Bluetooth: GATT: Fix notifications to non-bonded peers
      misc/byteorder.h: Add sys_get_le64 interface
      Bluetooth: Add LE read supported states
      Bluetooth: Controller: Measure and use correct stack size
      Bluetooth: Controller: Enable all supported LE states
      Bluetooth: GAP: Support multiple peripheral role connections
      Bluetooth: GATT: Fix ccc cfg leak
      Bluetooth: Controller: alternate ticker compare set logic

 MAINTAINERS                                     |    6 +
 arch/arm/soc/nordic_nrf5/nrf52/soc.h            |    3 +-
 boards/nrf52_nitrogen/nrf52_nitrogen_defconfig  |    4 +
 boards/nrf52_pca10040/nrf52_pca10040_defconfig  |    4 +
 doc/api/bluetooth.rst                           |   19 +
 drivers/bluetooth/Kconfig                       |   13 +-
 drivers/bluetooth/Makefile                      |    1 +
 drivers/bluetooth/controller/Kconfig            |   39 +
 drivers/bluetooth/controller/Makefile           |   18 +
 drivers/bluetooth/controller/hal/ccm.h          |   31 +
 drivers/bluetooth/controller/hal/clock.c        |  230 +++++
 drivers/bluetooth/controller/hal/clock.h        |   26 +
 drivers/bluetooth/controller/hal/cpu.h          |   30 +
 drivers/bluetooth/controller/hal/debug.h        |  233 +++++
 drivers/bluetooth/controller/hal/ecb.c          |  188 ++++
 drivers/bluetooth/controller/hal/ecb.h          |   45 +
 drivers/bluetooth/controller/hal/hal_irq.h      |   27 +
 drivers/bluetooth/controller/hal/hal_rtc.h      |   27 +
 drivers/bluetooth/controller/hal/hal_work.h     |   33 +
 drivers/bluetooth/controller/hal/irq.c          |   53 +
 drivers/bluetooth/controller/hal/radio.c        |  552 ++++++++++
 drivers/bluetooth/controller/hal/radio.h        |  108 ++
 drivers/bluetooth/controller/hal/rand.c         |  125 +++
 drivers/bluetooth/controller/hal/rand.h         |   25 +
 drivers/bluetooth/controller/hal/rtc.c          |   68 ++
 drivers/bluetooth/controller/hci/hci.c          | 1979 ++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/controller/hci/hci.h          |   26 +
 drivers/bluetooth/controller/ll/ctrl.c          | 7407 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/controller/ll/ctrl.h          |  255 +++++
 drivers/bluetooth/controller/ll/ctrl_internal.h |  239 +++++
 drivers/bluetooth/controller/ll/ll.c            |  295 ++++++
 drivers/bluetooth/controller/ll/ll.h            |   39 +
 drivers/bluetooth/controller/ll/pdu.h           |  260 +++++
 drivers/bluetooth/controller/ll/ticker.c        | 1538 ++++++++++++++++++++++++++++
 drivers/bluetooth/controller/ll/ticker.h        |  138 +++
 drivers/bluetooth/controller/main.c             |  400 ++++++++
 drivers/bluetooth/controller/util/defines.h     |   34 +
 drivers/bluetooth/controller/util/mem.c         |  196 ++++
 drivers/bluetooth/controller/util/mem.h         |   35 +
 drivers/bluetooth/controller/util/memq.c        |   96 ++
 drivers/bluetooth/controller/util/memq.h        |   25 +
 drivers/bluetooth/controller/util/util.c        |  134 +++
 drivers/bluetooth/controller/util/util.h        |   26 +
 drivers/bluetooth/controller/util/work.c        |  168 ++++
 drivers/bluetooth/controller/util/work.h        |   38 +
 drivers/bluetooth/h5.c                          |    2 +-
 drivers/bluetooth/nble/gatt.c                   |    5 +-
 drivers/bluetooth/nble/gatt_internal.h          |    6 +-
 drivers/bluetooth/nble/uart.c                   |   10 +-
 drivers/bluetooth/nrf51_pm.c                    |    6 +-
 drivers/bluetooth/nrf51_pm.h                    |    4 +-
 include/bluetooth/att.h                         |   18 +
 include/bluetooth/gatt.h                        |   27 +-
 include/bluetooth/hci.h                         |  653 ++++++++----
 include/bluetooth/hci_raw.h                     |   64 ++
 include/bluetooth/l2cap.h                       |    6 +-
 include/bluetooth/rfcomm.h                      |  162 +++
 include/bluetooth/uuid.h                        |   50 +
 include/misc/byteorder.h                        |   15 +
 net/bluetooth/Kconfig                           |  121 ++-
 net/bluetooth/Makefile                          |   21 +-
 net/bluetooth/att.c                             |  298 +++---
 net/bluetooth/att_internal.h                    |   13 +-
 net/bluetooth/conn.c                            |   50 +-
 net/bluetooth/conn_internal.h                   |   16 +-
 net/bluetooth/gatt.c                            |   60 +-
 net/bluetooth/hci_core.c                        |  405 +++++---
 net/bluetooth/hci_core.h                        |   18 +-
 net/bluetooth/hci_ecc.c                         |   19 +-
 net/bluetooth/hci_raw.c                         |  142 +++
 net/bluetooth/keys.c                            |   96 +-
 net/bluetooth/keys.h                            |   55 +-
 net/bluetooth/keys_br.c                         |   85 ++
 net/bluetooth/l2cap.c                           |   29 +-
 net/bluetooth/l2cap_br.c                        |  431 +++++++-
 net/bluetooth/l2cap_internal.h                  |   18 +-
 net/bluetooth/monitor.c                         |    2 +
 net/bluetooth/rfcomm.c                          |  728 ++++++++++++++
 net/bluetooth/rfcomm_internal.h                 |  125 +++
 net/bluetooth/smp.c                             |  241 ++++-
 net/bluetooth/smp_null.c                        |    9 -
 net/bluetooth/uuid.c                            |   10 +
 samples/bluetooth/README                        |    5 +
 samples/bluetooth/btusb/Makefile                |    5 +
 samples/bluetooth/btusb/prj.conf                |   10 +
 samples/bluetooth/btusb/src/Makefile            |    3 +
 samples/bluetooth/btusb/src/btusb.c             |  725 ++++++++++++++
 samples/bluetooth/btusb/testcase.ini            |    5 +
 samples/bluetooth/eddystone/src/main.c          |   40 +-
 samples/bluetooth/gatt/hog.c                    |  178 ++++
 samples/bluetooth/gatt/hog.h                    |   21 +
 samples/bluetooth/peripheral_hids/Makefile      |    7 +
 samples/bluetooth/peripheral_hids/prj.conf      |    7 +
 samples/bluetooth/peripheral_hids/prj.mdef      |    5 +
 samples/bluetooth/peripheral_hids/prj_nble.conf |    5 +
 samples/bluetooth/peripheral_hids/src/Makefile  |    4 +
 samples/bluetooth/peripheral_hids/src/main.c    |  155 +++
 samples/bluetooth/peripheral_hids/testcase.ini  |   19 +
 tests/bluetooth/init/prj_controller.conf        |   13 +
 tests/bluetooth/init/prj_controller_dbg.conf    |   25 +
 tests/bluetooth/init/testcase.ini               |   16 +
 tests/bluetooth/shell/prj.conf                  |    3 +-
 tests/bluetooth/shell/prj_br.conf               |   18 +
 tests/bluetooth/shell/src/main.c                |  115 ++-
 tests/bluetooth/shell/testcase.ini              |    9 +
 tests/bluetooth/tester/btp_spec.txt             |  149 +++
 tests/bluetooth/tester/prj.conf                 |    1 +
 tests/bluetooth/tester/prj_nimble.conf          |    1 +
 tests/bluetooth/tester/src/Makefile             |    4 +-
 tests/bluetooth/tester/src/bttester.c           |    9 +
 tests/bluetooth/tester/src/bttester.h           |    3 +
 tests/bluetooth/tester/src/gatt.c               |    9 +-
 tests/bluetooth/tester/src/l2cap.c              |   14 +
 113 files changed, 19979 insertions(+), 860 deletions(-)
 create mode 100644 drivers/bluetooth/controller/Kconfig
 create mode 100644 drivers/bluetooth/controller/Makefile
 create mode 100644 drivers/bluetooth/controller/hal/ccm.h
 create mode 100644 drivers/bluetooth/controller/hal/clock.c
 create mode 100644 drivers/bluetooth/controller/hal/clock.h
 create mode 100644 drivers/bluetooth/controller/hal/cpu.h
 create mode 100644 drivers/bluetooth/controller/hal/debug.h
 create mode 100644 drivers/bluetooth/controller/hal/ecb.c
 create mode 100644 drivers/bluetooth/controller/hal/ecb.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_irq.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_rtc.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_work.h
 create mode 100644 drivers/bluetooth/controller/hal/irq.c
 create mode 100644 drivers/bluetooth/controller/hal/radio.c
 create mode 100644 drivers/bluetooth/controller/hal/radio.h
 create mode 100644 drivers/bluetooth/controller/hal/rand.c
 create mode 100644 drivers/bluetooth/controller/hal/rand.h
 create mode 100644 drivers/bluetooth/controller/hal/rtc.c
 create mode 100644 drivers/bluetooth/controller/hci/hci.c
 create mode 100644 drivers/bluetooth/controller/hci/hci.h
 create mode 100644 drivers/bluetooth/controller/ll/ctrl.c
 create mode 100644 drivers/bluetooth/controller/ll/ctrl.h
 create mode 100644 drivers/bluetooth/controller/ll/ctrl_internal.h
 create mode 100644 drivers/bluetooth/controller/ll/ll.c
 create mode 100644 drivers/bluetooth/controller/ll/ll.h
 create mode 100644 drivers/bluetooth/controller/ll/pdu.h
 create mode 100644 drivers/bluetooth/controller/ll/ticker.c
 create mode 100644 drivers/bluetooth/controller/ll/ticker.h
 create mode 100644 drivers/bluetooth/controller/main.c
 create mode 100644 drivers/bluetooth/controller/util/defines.h
 create mode 100644 drivers/bluetooth/controller/util/mem.c
 create mode 100644 drivers/bluetooth/controller/util/mem.h
 create mode 100644 drivers/bluetooth/controller/util/memq.c
 create mode 100644 drivers/bluetooth/controller/util/memq.h
 create mode 100644 drivers/bluetooth/controller/util/util.c
 create mode 100644 drivers/bluetooth/controller/util/util.h
 create mode 100644 drivers/bluetooth/controller/util/work.c
 create mode 100644 drivers/bluetooth/controller/util/work.h
 create mode 100644 include/bluetooth/hci_raw.h
 create mode 100644 include/bluetooth/rfcomm.h
 create mode 100644 net/bluetooth/hci_raw.c
 create mode 100644 net/bluetooth/keys_br.c
 create mode 100644 net/bluetooth/rfcomm.c
 create mode 100644 net/bluetooth/rfcomm_internal.h
 create mode 100644 samples/bluetooth/btusb/Makefile
 create mode 100644 samples/bluetooth/btusb/prj.conf
 create mode 100644 samples/bluetooth/btusb/src/Makefile
 create mode 100644 samples/bluetooth/btusb/src/btusb.c
 create mode 100644 samples/bluetooth/btusb/testcase.ini
 create mode 100644 samples/bluetooth/gatt/hog.c
 create mode 100644 samples/bluetooth/gatt/hog.h
 create mode 100644 samples/bluetooth/peripheral_hids/Makefile
 create mode 100644 samples/bluetooth/peripheral_hids/prj.conf
 create mode 100644 samples/bluetooth/peripheral_hids/prj.mdef
 create mode 100644 samples/bluetooth/peripheral_hids/prj_nble.conf
 create mode 100644 samples/bluetooth/peripheral_hids/src/Makefile
 create mode 100644 samples/bluetooth/peripheral_hids/src/main.c
 create mode 100644 samples/bluetooth/peripheral_hids/testcase.ini
 create mode 100644 tests/bluetooth/init/prj_controller.conf
 create mode 100644 tests/bluetooth/init/prj_controller_dbg.conf
 create mode 100644 tests/bluetooth/shell/prj_br.conf

Change-Id: I98253a11e4ca6953def3d7a764ca6aa60a7f29ff
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 16:21:38 +03:00
Anas Nashif 0699191d33 tests: fixed resulting binary name in README
We no longer produce nanokernel.elf or microkernel.elf.

Change-Id: I37cb985ddc90f4129f122b9209d306898a71a596
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-07 12:56:03 +00:00
Grzegorz Kolodziejczyk 81e10314ef Bluetooth: tester: Add L2CAP init method
This adds method which initialize data pool for L2CAP data.

Change-Id: I2b170489aa4b2afc3c1f962591f377e23d147161
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 09:08:47 +00:00
Mariusz Skamra de124844b3 Bluetooth: btp: Extend BTP specification to cover L2CAP tests
This adds commands to the Bluetooth Testing Protocol for L2CAP.

Change-Id: Ie9ea180c4db62c238ce1450e5714ffd7b0ca2f5f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery 2a3a95b24d Bluetooth: shell: Use bt_rfcomm_create_pdu() in RFCOMM send
Remove BT_RFCOMM_SEND_RESERVE usage since it will be removed
eventually.

Change-Id: Iada20cf0692ae12996e7ed820601bb77fe47d438
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery eb443ddffc Bluetooth: shell: Add support for RFCOMM send data
Sets new command in BT shell app to send data to peer
Syntax:
>br-rfcomm-send <number of packets>

Change-Id: Ic795d007a03f657afb833719ae0e800ca0ac6e0b
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz 50997f2ccd Bluetooth: GATT: Add queuing support
This adds queueing support for requests that requires a response making
it simpler to use the API. The storage is keep in the parameters of the
request so it is up to the application to define how many can be queued
but in case the application don't want a request to block waiting for
a buffer it can use BLUETOOTH_ATT_REQ_COUNT to control the available
buffers which is recommended in case the requests will be sent from the
RX fiber.

Change-Id: I407c3982a7ecdc4a9eff7172d9d0addd46949783
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 8e722ef545 Bluetooth: tests: Add BLE controller init tests
Jira: ZEP-702

Origin: Original
Change-Id: I55fa102069db155e8fd461513abbe898f64d8977
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Szymon Janc 1c81bdffc4 Bluetooth: tests/shell: Remove not needed RFCOMM option from config
prj.conf is for single mode LE controllers.

Change-Id: I138a560f4e33f6663135bbcbb4d8aeb5955342a1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc ada1b0a594 Bluetooth: tests/shell: Add dedicated BR/EDR config
BR/EDR support in chip is mandatory if BR/EDR is enabled so add
separate config for it. This is to avoid problems when using
single mode LE controller.

Change-Id: I9d9692b89883dd1980803d66818fb6e3a368afb0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery d19752b955 Bluetooth: shell: Add support for RFCOMM test
Sets new command in BT shell app to allow register one RFCOMM server.
Syntax:
>br-rfcomm-register <Channel>

It also accept the connection from remote and provides dlc object

Change-Id: I99f672ee68785338f3bf22948d4f33b3e1aecd2e
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc 0b67e04922 Bluetooth: tests/shell: Set same name on BR/EDR and LE
This sets BR/EDR name with same value used over LE.

Change-Id: I29407b0b44907b520b0f39afe868fc612c5e47d4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Andrew Boie c545e19a00 x86: remove dynamic interrupts and exceptions
Change-Id: I7e9756e9a0735a7d8257ee2142d5759e883e12cc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:24 +00:00
Andrew Boie 0279d9b2cb test_context: don't test dynamic exceptions
This API has been deprecated and scheduled for removal.
It was only implemented on X86, and ARM systems that
aren't XIP.

Static exceptions (only implemented on x86) will
continue to be tested by test_static_idt.

Change-Id: I6d63347ead8200002ee1edd8dd4572b418800400
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 16:15:59 +00:00
Anas Nashif 8229904a00 checkpatch: fix ERROR:POINTER_LOCATION
Change-Id: I1daf382281f50c2fb1254d340dd499ae76513a5d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-08-29 08:47:05 -04:00
Andrew Boie 02261ae401 tests: benchmark: fix incorrect printk() usage
Change-Id: Id08d2e55399401244bfc52277415bc5d4167b288
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 2a8aee133a tests: bluetooth: fix incorrect printk() usage
Change-Id: I9493fddf9d7d1120ae54a58673835c64d2042188
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie d89ddc6441 tests: net: fix incorrect printk() usage
Change-Id: Iee5b94c24e1cce1f3a0e607deee2c5bc73e22d7b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 73e5bfda5a tests: kernel: fix incorrect printk() usage
Change-Id: Id7c18edd93eac71d31eaba628158a2badc306238
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 7853e0a1af tests: crypto: fix incorrect printk() usage
Change-Id: Iec8a3277952287e1a54d0ae67b56e88edc3068a9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 6d2ab0ea11 test_cbc: fix indentation
Spaces were used instead of tabs. Fix up by using Lindent from
Linux kernel since we use same coding style.

Change-Id: Iece925ae40cad342fde1e33c240cb2ac23a15a9b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 474a52f730 test_ctr: fix indentation
Spaces were used instead of tabs. Fix up by using Lindent from
Linux kernel since we use same coding style.

Change-Id: I7aa5c3f25a800fdaec6852e0d36daa07f1424f9a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 9153996f90 test_hmac: fix indentation
Spaces were used instead of tabs. Fix up by using Lindent from
Linux kernel since we use same coding style.

Change-Id: I7294d1cef98031ba4ca1c202e0f19dbb7e504e16
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 5aa94cdd68 test_sha256: fix indentation
Spaces were used instead of tabs. Fix up by using Lindent from
Linux kernel since we use same coding style.

Change-Id: I7ecb6dfd602ea4768d6a53e509f29b208d96c479
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 0ef0136a04 tests: test_printk: crude printk test case
Print some stuff, and verify that the output is as expected.
Not comprehensive (yet).

Change-Id: Ib1ce8dff8165d8ee6b02ff6272513fd76a7be842
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andy Ross 72f00d930e Make outdir board-specific to avoid build collisions
Casual building in the tree leads to regular messups where I forget to
clean up the outdir first when switching platforms and the build fails
in strange ways.

Put a $(BOARD) subdirectory under outdir, and use that at $(O) when
the user does not provide an output directory.

Note that "make pristine" continues to remove the entire outdir,
including other architecutres (so as to make the tree pristine).

Also update a few spots where outdir was mentioned in documentation to
clarify the new scheme.

Change-Id: I365eec06ea440f17380b9f9ace5f5d34b9bed4dc
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-08-27 11:48:05 +00:00
Benjamin Walsh e1dad060c3 tests/crypto: rename MICROKERNEL entry from 'mainloop' to 'main'
Microkernels now support 'main' as a task entry point.

Change-Id: I39b07c191a98748191536ade6f87ec02da064bf1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-08-27 10:49:02 +00:00
Benjamin Walsh ab3babcff7 latency test: remove references to unused legacy "KERNEL" preproc flag
Change-Id: I53e9338ecaa42f57e5a58dfecfa36dd6d5ff5815
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-08-27 10:49:01 +00:00
Andrew Boie d02b96d5a7 test_ipm: disable on Quark SE ARC core
This test can't run properly because it already defines
an IPM console sender, and instantiating the dummy one
prevents any messages from being forwarded to the x86 side.

Issue: ZEP-708
Change-Id: Ib13c5df5db67f3d9fde960f8e5cda354c60efae1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 20:52:30 +00:00
Andrew Boie d6fb8d3611 Revert "REVERTME exclude test_sha256 on Nios2"
The QEMU bug in the SDK has been fixed.
This reverts commit eb63710960.

Change-Id: Ic405c9df0f7aebb2a9d20180c7b0c04889669610
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 20:20:13 +00:00
Andy Ross 5c1011a30a test_sleep: More latency workarounds
We are also seeing qemu failures in the synchronous wakeup tests,
where the fiber should be resuming instantly but in practice sees a
one-tick delay due to the emulation environment not being
deterministic.  Allow one tick of slop in those too.

Change-Id: Idab7c45ea0b10bd955b90a98d3884b5fe0571187
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-08-12 20:36:11 +00:00
Andy Ross 5a8add7821 tests/kernel/{test_task,test_sleep}: Less aggressive timer testing
On some hardware (Qemu) the timer guarantees aren't honored as well as
we like, and these tests are observed to spuriously fail in practice
(e.g. CI testing).  Allow for one tick of slop when testing sleep
durations.

Change-Id: I4b694c0a9ddfc1ee48510fa5deda2bb31499debf
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-08-10 16:42:51 +00:00
Szymon Janc 114985a8a8 Bluetooth: tester: Use SYS_LOG_ERR instead of printk
Change-Id: Ideadc7344dcf7d1cdd550623a02d74c8ad9414f5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-08-10 14:54:19 +00:00
Szymon Janc ffe8f0ccf4 Bluetooth: tester: Fix extra new lines
Change-Id: Ie3de7d7baeaff386f8683624ee1284834495d6de
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-08-10 14:54:19 +00:00
Genaro Saucedo Tejada 58f88179ef sys_log: replace old debug macros at bluetooth tester
Bluetooth tester is now using new system log macros.

JIRA: ZEP-311

Change-Id: I6398f2de12d5ba1073e40fd45aa8e0177d1e279d
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-08-01 18:39:50 +00:00
Andrew Boie 7027231e9a test_mbedtls: exclude platforms with insufficient RAM/ROM
This will un-break the daily build.

Change-Id: I516ddab4a905d51fb1fd59f7fa009df3511c7076
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-28 21:22:19 +00:00
Andrew Boie 17c0b372a2 x86: improve exception APIs
Previously, exception stubs had to be declared in assembly
language files. Now we have two new APIs to regsiter exception
handlers at C toplevel:

 _EXCEPTION_CONNECT_CODE(handler, vector)
 _EXCEPTION_CONNECT_NOCODE(handler, vector)

For x86 exceptions that do and do not push error codes onto
the stack respectively.

In addition, it's now no longer necessary to #define around
exception registration. We now use .gnu.linkonce magic such that
the first _EXCEPTION_CONNECT_*() that the linker finds is used
for the specified vector. Applications are free to install their
own exception handlers which will take precedence over default
handlers such as installed by arch/x86/core/fatal.c

Some Makefiles have been adjusted so that the default exception
handlers in arch/x86/core/fatal.c are linked last. The code has
been tested that the right order of precedence is taken for
exceptions overridden in the floating point, gdb debug, or
application code. The asm SYS_NANO_CPU_EXC_CONNECT API has been
removed; it was ill- conceived as it only worked for exceptions
that didn't push error codes. All the asm NANO_CPU_EXC_CONNECT_*
APIs are gone as well in favor of the new _EXCEPTION_CONNNECT_*()
APIs.

CONFIG_EXCEPTION_DEBUG no longer needs to be disabled for test
cases that define their own exception handlers.

Issue: ZEP-203
Change-Id: I782e0143fba832d18cdf4daaa7e47820595fe041
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-28 18:13:24 +00:00
Kumar Gala 58647277ed tests: test_tickless: Fix NXP K64 symbol dependency
We filtered on CONFIG_SOC_FSL_FRDM_K64F which doesn't exist change it to
CONFIG_SOC_MK64F12 to allow this testcase to run on the K64 platform

Change-Id: Ifdd89e66aa403c3bb28c07d3a546037275a5118d
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 07:20:12 -05:00
Sergio Rodriguez 950f45b532 samples/net : Adding mbedTLS self test routine
This contain the run of the self test for the ciphers, crypto
algorithms and utilities of mbedTLS.

Jira: ZEP-327
Jira: ZEP-340
Jira: ZEP-495

Origin: https://tls.mbed.org/download/start/mbedtls-2.3.0-apache.tgz

Change-Id: Ic1bb30b7ed691f17421510cd914ec5096e4e70ea
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-27 22:19:06 +00:00
Andrew Boie 96cadd1a9a arc: move special-purpose irq priorities to flags
We have already done this on x86 and ARM. The policy is as follows:

* IRQ priority levels starting at 0 all have the same semantics and
do not have special properties. The priority level is either ignored
on arches which do not support programmable priority levels, or lower
priority levels take precedence over higher ones.
* Special-case priorty levels are specified via flags, in which case
the supplied priority level is ignored.

Issue: ZEP-60
Change-Id: Ic603f49299ee1426fb9350ca29d0b8ef96a1d53a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-26 15:06:28 +00:00
Inaky Perez-Gonzalez 68e0c50211 testcases: introduce defaults to build/deploy/evaluate
This introduces the default language to use for building, deploying
and evaluating testcases on real hardware in the automation framework.

To be able to filter testcases out based on .config values, we split
the build process into generating the configuration file, filtering
and then the actual building.

The configuration step is done first, to be able to skip as soon
as possible.

This file is in the top level as the test runner will look for
defaults in parent directories.

Note that the default's entry in tests/.tcdefaults takes advantage of
the fact that all:

- the test cases under tests/ print standarized strings for success
  or failure.

- the tc_util.h kernel header will print the passed runid if specified
  when finalizing the testcase. We will make sure it is found to deem
  the TC succesful, ensuring that the right image is flashed and
  verified.

Change-Id: If40b226aef9583f7ce4064405d9334de379f2b00
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-23 18:31:18 +00:00
Mariusz Skamra 602724a91a Bluetooth: tester: Expose device address
This adds device address to the controller_info data. This address
may be used then by PTS for establishing connection etc.

Change-Id: Ic2319c452d94ac79376659ba37b4c9d812ccf9ae
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:16:14 +00:00
Mariusz Skamra c06a13a93d Bluetooth: tester: Set privacy flag in current_settings
If CONFIG_BLUETOOTH_PRIVACY is set in Kconfig, current settings
shall indicate it's usage.

Change-Id: I0645aedf1b774617c9d97cec0070908aef919ca7
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:16:09 +00:00
Mariusz Skamra 7fe81b92a6 Bluetooth: tester: Add missing GAP_SETTINGS_* defines
Based on BTP specification following GAP_SETTINGS_* flags were added:
GAP_SETTINGS_CONTROLLER_CONFIG,
GAP_SETTINGS_STATIC_ADDRESS

Change-Id: Ic87d13772c0ef9c9bc8bba331c8bc9f3ffc93f87
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:15:48 +00:00
Mariusz Skamra a028e43a97 Bluetooth: tester: Send IUT ready event on tester_init
When tester application has been initialized, send this event
to indicate that Upper Tester can send first BTP command.

Change-Id: Id3f4dd246c4e67982057f9518b4b0036e79a6a01
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-22 20:03:28 +00:00
Mariusz Skamra 3c15027799 Bluetooth: btp: Add IUT ready event
Before sending any command, the tester shall wait for this event
indicating that IUT is ready to accept first BTP command.
This is needed, because some devices need more time to initialize
their stacks, so that the first BTP command can be lost.

Change-Id: I92d1c6ea8be905734037eb29f7f270a70ab1583e
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-22 19:19:28 +00:00
Szymon Janc d2549115ca Bluetooth: Rename connectable_addr member in struct bt_le_oob
Depending on advertising options this can be non-connectable address.
NFC pairing application document also allows broadcaster/observer
roles.

Change-Id: I9b104ac8fb9752a083a7a31fc20598c66f23f608
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-22 13:09:30 +02:00
Johan Hedberg 1668624a2f Bluetooth: tests/shell: Remove unnecessary redefinition of AD types
Change-Id: I411618b1cc8ecdf67f84d6debb43bde314eaed10
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-22 09:18:02 +00:00
Inaky Perez-Gonzalez 3e63a74514 net/yaip: revert merge
Follow up to TSC decission for further discussion in the networking
WIG.

Change-Id: I148b484dfe308661573e47ed3e60cceed673bddf
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 04:43:09 +00:00
Andrew Boie eb63710960 REVERTME exclude test_sha256 on Nios2
Daily build failing due to this test case timing out
execution after 3 hours. Locally this test takes about
a minute, the issues with CI are being looked into.

Change-Id: I27e40846dde25fc65281b4aea61d10b403c6512d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-21 16:31:31 +00:00
Szymon Janc c8cb32c462 Bluetooth: shell: Add support for getting OOB data
This allows to query LE and BR/EDR OOB data.

Change-Id: I8bc281a9549092c1c4b40c346580abb5fd51d02d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-20 20:20:44 +02:00
Johan Hedberg 211ae314e8 Bluetooth: Pass net_buf_simple to scan callback
This lets the callback take advantage of the powerful net_buf API for
parsing the advertising data content.

Change-Id: Id65e6e83efd60c0f36c47bc5446a2e8ec2833d7c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-20 16:19:01 +00:00
Luiz Augusto von Dentz c51bcbb9d9 Bluetooth: GATT: Add write struct parameter to its callback
This makes bt_gatt_write consistent with the rest of the API where the
parameters are passed back to its callback.

Change-Id: Ie94208aa661d3620d0cbc5be4a4fb5b3c3ef061c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-20 13:40:55 +00:00
Luiz Augusto von Dentz d84dcb9626 Bluetooth: shell: Loopback L2CAP data
This can be used to test if receiving and sending simultaneously is
working properly with tools such as BlueZ's l2test.

Change-Id: Ic6bcd00a4e1448bebd3ae74bcc58986872332bbe
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-20 05:34:50 +00:00
Andrew Boie afaba4a98b altera_max10: enable and use 16550 UART
The 16550 will now be the default console device.

Change-Id: I92a6b49984b055e7d5f5c97e5192150be0d5c5c7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-15 19:31:44 +00:00
Andrew Boie 8c524a291e x86: merge IAMCU and SYS V core arch code
Having two parallel implementations is a maintenance issue, especially
when some strategically placed #ifdefs will suffice.

We prefer the ASM versions for SYS V, as we need complete control of
the emitted assembly for interrupt handling and context switching.
The SYS V code is far more mature. IAMCU C code has known issues with
-fomit-frame-pointer.

The only difference between the two calling conventions is that the
first three function arguments are provided in eax, edx, ecx instead
of on the stack.

Issue: ZEP-49
Change-Id: I9245e4b0ffbeb6d890a4f08bc8a3a49faa6d8e7b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-13 17:56:39 +00:00
Mariusz Skamra d98b9bd139 Bluetooth: Get the included service 128bit UUID
This adds reading of included service attribute 128bit UUID.
The limitation of this solution is that if several attr handle-range
pairs will be received, this will read first attribute UUID and then
start discovery from the the succeeding handle.

ZEP-373

Discovery related test results:

 2/76   GATT   TC_GAD_CL_BV_02_C   PASS
 3/76   GATT   TC_GAD_CL_BV_03_C   PASS
 4/76   GATT   TC_GAD_CL_BV_04_C   PASS
 5/76   GATT   TC_GAD_CL_BV_05_C   PASS
 6/76   GATT   TC_GAD_CL_BV_06_C   PASS

Change-Id: I27185b3a3ae96c9c03b0f356492df18ba83b183a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-13 14:18:03 +00:00
Jukka Rissanen 19dc87ea7d net: tests: Additional tests for ICMPv4 checksum verification
Change-Id: I21566c9365b8abc5753f6bedba55a3fb494745b9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:12 +00:00
Jukka Rissanen 99fd48acdd net: tests: Fixed the ARP test
Now uses net_nbuf_ll() to point to link layer header.
Also the ARP req test passes properly.

Change-Id: If649ff19a064490bff33d03b4ce70ef11bfa7cd5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:11 +00:00
Jukka Rissanen a5b96021a7 net: tests: Unit tests for IPv4 ARP code
Change-Id: I607ffdbffc7348fae70272c7add57456fcaf79af
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:08 +00:00
Jukka Rissanen 9924b41297 net: tests: Add tests for IPv4 netmask, gw and subnet compare
Unit tests added for checking network interface netmask, gateway
and IPv4 subnet compare utility functions.

Change-Id: I5b4a07d6a064097ab41ad6552d14181b1631eb53
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:07 +00:00
Jukka Rissanen dd42617b2f net: tests: Tweak the IP address test to use new net_if API
Instead of using hard coded net_if, get the default network
interface using net_if_get_default() function.

Change-Id: I6248555ce57ae5196adea7baa9db325660a71255
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:04 +00:00
Andrew Boie dd2273146c test_pool: exclude on olimexino_stm32 and nucleo_f103rb
These two boards don't have enough RAM to effectively run this
test case without making the stacks so small they don't work
on other platforms. ARM is sill covered by other boards.

Change-Id: Ibf20eefaf29f989cbb6da6cd3a8eeed2faa1950b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 19:29:19 +00:00
Jukka Rissanen 663ba2b7f0 net: yaip: Add unit tests for ICMPv6 handler
Change-Id: Ibdbe82ed56f110e2e0c6443700863632ee1ef56b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:56 +00:00
Jukka Rissanen 441a054a07 net: tests: Unit tests for network utilities
Right now there are tests for IP packet checksum calculation.

Change-Id: I1e9e72d01d4690728269c4484f8628350cf95729
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:55 +00:00
Jukka Rissanen cedd655cdb net: tests: Add more IPv6 address getters unit tests
Change-Id: I0ab22af76073c02c93eb205686472f69b58a1107
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:49 +00:00
Jukka Rissanen 03294c3f75 net: tests: Add IPv4 address unit tests
These tests will check that caller is able to set IPv4 address
to a network interface and check if an address is one of the
assigned to a network interface.

Change-Id: I8aa748c40fbc02eef50ccf76d10a0057ef29021b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:48 +00:00
Jukka Rissanen eb87a36e44 net: tests: Add IPv6 address manipulation unit tests
Change-Id: Ide3bce35dcfd3ec31bfe3cd842a87ca3b639ba4f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:47 +00:00
Jukka Rissanen cf673cf585 net: tests: Add unit test for IP and MAC address printing
Change-Id: Ida0901fa9687814932119d006459de12e6a229d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:45 +00:00
Jukka Rissanen 2d7d86bdde net: tests: Temporarily remove nbuf unit test
Tests have issues right now so these will be activated later.

Change-Id: Ib5549f9ed5600a20b2cfddbddcde8e7f7b297eef
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 11:23:04 +00:00
Jukka Rissanen b7bc53ece9 net: yaip: Add nbuf buffer API
User should use the net_nbuf API that is supporting a concept
of RX, TX and DATA buffers, instead of using directly the net_buf
low level API.

Change-Id: I3b8f5f13cd37d42d2322a58b35573e117d520c54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:24 +00:00
Jukka Rissanen 95f5cd2b9a net: buf: Add tests for net_buf fragmentation
More realistic IPv6 packet creation tests created.
One test creates one big IPv6 packet and manipulates that.
Second test creates a list of IPv6 header + data fragments
and sets some user data in those fragment buffers.

Change-Id: Ic8309ff115e1d735e98c30b3c8292b0d6ffc5f42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 18:06:11 +00:00
Jukka Rissanen 7d6197cf94 net: buf: Add fragmentation API tests
Add tests for checking that the net_buf fragmentation works ok.

Change-Id: I778f79bae971314b6f19c1bf00ed42e1c2128e99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 18:05:41 +00:00
Andrew Boie 8a80ce5c6f Revert "REVERTME: test_pool disable due to memory corruption bug"
Allan fixed the underlying issue, re-enable.

This reverts commit 19fa82ab91.

Change-Id: I6e517f76a6650a3e9ba5a09118187e6c965a147a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-11 17:53:45 +00:00
Juan Manuel Cruz 655a2c89f8 tracing: test includes ipc console fiber if enabled
The test test_thread_monitor fails when a platform enables
the IPC console.
This commit fixes the test to count the IPC console fiber
if it is enabled in the project or the platform.

Change-Id: I9faf9d120b35d9211e558be8f5788885f30c3081
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-07-08 20:34:30 +00:00
Andrew Boie ef29812d51 nios2: support more global pointer scenarios
We now allow use of -mgpopt=global and -mgpopt=data. The 'global'
option is now the default instead of compiler-default local, expanding
global pointer usage to all small data in the system.

For systems where all RAM is less than 64K, the 'data' option may be
appropriate.

Some fixes had to be made to the system in order to get around some
issues:

* prep_c.c no longer uses fake linker variables to figure out the size
of data or BSS, as these gave the linker fits as it tried to compute
relative addresses to them.

* _k_task_ptr_idle is create by sysgen and placed in a special section.
Any small data in a special section needs to be declared extern
with __attribute__((section)) else the compiler will assume it's in
.sdata.

* same situation with extern references to k_pipe_t (fixed pipe_priv
test)

For legacy applications being ported to Nios II which do things that
freak out global pointer calculation, it can be disabled entirely.

Change-Id: I5eb86ee8aefb8e2fac49c5cdd104ee19cea23f6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-06 18:14:31 +00:00
Andrew Boie 19fa82ab91 REVERTME: test_pool disable due to memory corruption bug
See ZEP-514

Change-Id: I7e9c2c5f81c01e73f1f7ce892fe835ebe3a7a36b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-01 19:44:30 +00:00
Peter Mitsis b4eee20e4b test_fp_sharing: Enable for Cortex-M4
Update the FP sharing test project for use with the Cortex-M4.

Change-Id: If04a191b26291058bd7002ce8a0939eda8a5eb48
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-07-01 19:44:16 +00:00
Peter Mitsis 3490627a97 test_fp_sharing: clean up test code
Clean up test code in preparation for adding Cortex-M4 support.

Change-Id: I64a32e8aa2808b4e0348601e2fc0f7f39cdb413c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-07-01 19:44:15 +00:00
Andrew Boie 571ccee400 test_pool: increase task stack sizes
We were getting a stack overflow on Nios II.

Change-Id: Id2c9be27552f31f5cdbf72dc31e77a106082746b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-01 19:01:58 +00:00
Mariusz Skamra 997765def2 Bluetooth: tester: Increase prepare write buffers pool for qemu and nble
Buffers pool has to be increased for all configurations.

Change-Id: Id24caced5043c1672ca5f753d1e86d9a72c728ea
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-01 14:57:02 +02:00
Mariusz Skamra 940ee5e6e5 Bluetooth: tester: Increase prepare write buffers pool
TP/GAW/SR/BV-10-C test case requires two long values to perform
nested prepare write operation. Using one ATT Execute Write command
this two values are going to be written simultaneously.

Change-Id: I2950409ed8f1d121dcc706b432cdf071b9af00c0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-01 12:34:06 +02:00
Genaro Saucedo Tejada c8d9b6b5e3 tags: basic kernel objects test for actual hardware
Tagged some tests/kernel testcases with 'bat_commit'. Only test that
work on actual hardware are tagged, while tests with known issues
were left not tagged, test meant for emulator or build only were
also not tagged.

Change-Id: Icede6bc76788aba60d8f1fdcf624e95a7d3116a2
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-01 00:38:31 +00:00
Andrew Boie e3ffa67bde test_stackprot: disable for Nios II
No compiler support for -fstack-protector on this arch with the
current toolchain.

Change-Id: Ifa793599b6760c318f16748f9e71c31e0d4edbe7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-30 18:51:51 +00:00
Andrew Boie 5da328b07b tests: test_tickless: exclude on Nios II
Tickless idle will not be enabled on Nios II due to the
lack of a powersaving instruction.

Change-Id: Ib3c23d803d6335aeb791983e31ad7da2d0deb118
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-30 18:51:51 +00:00
Andrew Boie fe40d1071e REVERTME test: bluetooth: init: exclude Nios II JTAG UART
This driver does not yet support interrupt-driven console.
Revert when ZEP-280 is implemented.

Change-Id: Ib430c39138194ab441c95a1b1856c3661102a625
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-30 18:51:50 +00:00
Kumar Gala 7dcbbc39e7 build: move from srctree to ZEPHYR_BASE for app include paths
$srctree for the application might not be set to be $ZEPHYR_BASE, use
$ZEPHYR_BASE instead to be more explicit in the build.

Change-Id: Iefa5ff59f246b584949329044f7a6531adc6ed62
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-06-30 14:36:39 +00:00
Tomasz Bursztyka 83c82e6cd6 tests: Allow tc_util to use printf when requested
printk() is too simplistic and does not handle byte precision on formats
like %02x etc... printf does, so letting the possibility to use it when
relevant. This might be useful when dumping out some network packets,
byte by byte where a precision of 1 byte (thus 2 0's) is necessary.

It's better to have this output:
	41 d8 ...
instead of:
	00000041 000000d8 ...

Change-Id: Idc15bbae67830f41388373e2ca1947bb274fb550
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-06-29 05:19:26 +00:00
Andrew Boie ab5f6de4af test_context: build/run on ARC and Nios II
Change-Id: If3e03fef8ed9448bdba82b442ac976bfd6a7ddce
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-29 00:08:13 +00:00
Andrew Boie 30db3401e8 nanokernel: tests: increase stack size from 256 bytes
A recent change modified the fiber stack size of these tests
to 256 bytes, which causes a stack overflow on Nios II. (This
arch has lots of registers)

Increase to 384 bytes, which still compiles well on RAM-constrained
targets like Quark SE SS, Nucleo, etc.

Change-Id: I2152ea9fc1fac693638b8f7a00a6b6628e0c42d3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-29 00:08:08 +00:00
Andrew Boie 2ecb9d45d5 test_irq_offload: unit test for running functions in IRQ context
This is used in many other test cases. However when implementing this
function it's helpful to have a testcase dedicated for it, without
dependencies on other kernel objects.

Change-Id: I66a7cdd0b13712665384d5ad4e79050c82d32e3a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-28 15:56:05 -07:00
Andrew Boie 54b58827b0 test_intmath: new Nios II test case for integer math
Not all CPUs implemement the mul, div, or mulx instructions. Ensure
that any runtime handling of these works correctly.

Change-Id: I50426bd5704cd913f290c9677d1760d53c9e4b56
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-28 22:48:28 +00:00
Luiz Augusto von Dentz e9083dfcd7 Bluetooth: GATT: Add flags to attribute write callback
This adds flags parameter to write callback which can be used to indicate
that data only need to be prepared with use of BT_GATT_WRITE_FLAG_PREPARE
fixing qualification tests that needs to check authorization or other
errors that cannot be verified with just the permissions.

Change-Id: I3d662b2027718ffb52a280e3bbc9750be14f89ae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-28 17:36:08 +03:00
Mariusz Skamra c474a03c58 Bluetooth: tester: Fix copying attribute to the server_buf
BT_GATT_INCLUDE_SERVICE user_data shall point to the service declaration
of service to be included. So user_data_len shall be set to 0 to avoid
copying the contents of bt_gatt_attr to the server_buf, and just use
pointer to the actual attribute.

Change-Id: Id770daeb6d64644c51f2bc5d3962dd80363ec8c3
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-28 10:57:44 +02:00
Andrei Emeltchenko 437c0e18e3 Bluetooth/shell: Add HRS simulation to btshell
Add HRS simulation to shell allowing to switch on / off HRS simulation
helping testing GATT notifications.

Change-Id: Idf99b74ac73d45d2f0d3279d50431be4027fef8a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-27 18:43:44 +00:00
Mariusz Skamra acc28a9631 Bluetooth: Fix invalid pointer to local variable
attr pointer is local here, so it may be overwritten anytime, because
this attribute user_data will be used out of scobe of this function.

Change-Id: I85b390299980dac213d8ce1939078fe8b242c887
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-27 10:49:09 +00:00
Arkadiusz Lichwa 5192c44e72 Bluetooth: shell: Suplement BR/EDR L2CAP channel handlers
Adds to BR/EDR L2CAP client channel object required handlers and allocate
room for channel data traffic to make it operational when fully
setup and to be interactive with internal stack.

Change-Id: Id1e90d7ea318ed8a875383995e4d175e124939eb
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-23 19:58:57 +00:00
Andrew Boie b6d9c5ca80 bluetooth: init: disble for CONFIG_UART_ALTERA_JTAG
Interrupt-driving UART not implemented yet for this driver.

Change-Id: Ida60d7e09e9eca2d7e6452a84f6d95529d0af9b6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:20 +00:00
Arkadiusz Lichwa 83fd0cf62e Blutooth: shell: Fix printout BR/EDR PSM server registration
Fixes wrong server instance used during printing details on registration
PSM server.

Change-Id: I269d20bf4d12f24ce143a04c1c23ed8711b9cdba
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-17 11:56:56 +02:00
Luiz Augusto von Dentz 372a8905d5 Bluetooth: tester: Fix write callback not returning errors properly
There is no need for any prepare write variables as this is now handled
transparently by the stack and so any errors that happens during write
shall be reported in the return.

Change-Id: I3e629016cb7f5f6cd9106ff07c3cbb464e81734f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-16 14:57:16 +03:00
Johan Hedberg 8ea57bd5d3 Bluetooth: Shorten limited discovery parameter name
The parameter is already inside a struct that's specific to BR/EDR
discovery, so there's no need to repeat "discovery" in its name.

Change-Id: Idb95788bfc9d62ecd52adecc35104e212724cb78
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-16 11:28:59 +03:00
Johan Hedberg 1a756d6f8d Bluetooth: Fix validity check for Inquiry parameters
Since we only have a single user we can enforce length > 0x01. We
should also ensure that the results count is 1-255.

Change-Id: Id5d91acae06c6c6fc66dd59c0e367682a98dc08c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-16 10:58:50 +03:00
Inaky Perez-Gonzalez aba4b555f4 testcases: sample static testcase to run checkpatch on the source
This is a sample static testcase (so it needs no target machine) to
run checkpatch as a testcase and produce output only if it fails.

Change-Id: I055c0125ac785058e101faa68eb5aaff9f7caf16
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 23:49:57 +00:00
Inaky Perez-Gonzalez 9e66787a33 test_timer: give it more time, in real HW it seems 60s is not enough
Change-Id: Ifea72f4b0e40aa9351f4d377a032c6133b167055
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 23:49:57 +00:00
Inaky Perez-Gonzalez fcec9e37c0 testcases: sanity check TCs get more language for real HW
Add more specifications or qualify some to the sanity check test cases
for them to be ran in real hardware:

 - kernel types (micro vs nano)
 - platforms / arches to exclude / include
 - one that is removed (for the PCI sample) as it cannot be ran
   without extra information

Change-Id: Id14dc15eb89358c3656d2814ea41bb6fec051278
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 23:49:56 +00:00
Inaky Perez-Gonzalez c9cd9ef3f0 testcases: sample testcase to generate project's documentation
This is a sample static testcase (that needs no hardware target) that
will build the documentation and ensure it builds without issues.

Change-Id: I7174205522be9aead350e67b1672b8e976cb9191
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 22:01:39 +00:00
Inaky Perez-Gonzalez 960a498182 benchmark/sys_kernel: use TC_PRINT_RUNID
For automation to detect this is the right test case being executed,
print the RUNID if defined

This TC doesn't use TC_*() macros, so we need to invoke it manually.

Change-Id: I6f7417621d649a59412bb92d8b665130757d926a
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 22:01:27 +00:00
Inaky Perez-Gonzalez 6aa7bd0c65 tc_utils: introduce TC_PRINT_RUNID / TC_RUNID
This is a helper to print a token passed form the compilation
environment.

Further documentation and rationale in the code.

Change-Id: I8d5e6b2246ba5c4f09b78532b3c600891f94bb63
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 21:48:47 +00:00
Benjamin Walsh 53c3106520 tests: test nano_fifo_put_list and nano_fifo_put_slist.
Change-Id: I35ab267070126dcf7c8649ed79a7a4a5479b1f55
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-06-13 20:24:42 +00:00
Arkadiusz Lichwa b2647d84b3 Bluetooth: L2CAP: Refactor l2cap core types
Refactors L2CAP core data structures and modifies functions that uses them.
Now we can have separate L2CAP feature channel objects for LE and BR/EDR
transport. This's also a ground for make L2CAP CoC API to be common
for both transports.

Change-Id: Ic1197b0e3c4f505764b23fb9c7eb27123a44a675
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-13 11:49:07 +00:00
Johan Hedberg ebd5011adf Bluetooth: Update Intel copyright for files modified in 2016
Change-Id: I10a7cab9a7f911b9f64e17bf24ddce82c2f08c40
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-10 12:10:53 +03:00
Johan Hedberg c78a5a9aae net: tests: Clean up logging of net_buf tests
Change-Id: I8f82c586c730691c72f8996a25843ba786c73fe6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-09 10:26:38 +03:00
Johan Hedberg bab34ea49c net: tests: Add task-fiber test for net_buf_get/put
Change-Id: I48c050254fca913c59bfbfd9a160c7d6ca79d53b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-09 10:26:38 +03:00
Szymon Janc 6248407c00 Bluetooth: shell: Fix data_pool declaration
Buffers pass to BT stack need to have minimum BT_BUF_USER_DATA_MIN
of reserved user space data.

Change-Id: Iaeb85faa20b1c5281bfd0331336295ad7cfdd68e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 19:09:59 +02:00
Luiz Augusto von Dentz f54c5b744d Bluetooth: GATT: Remove obsolete flush callback
It is no longer necessary to implement flush callback for long
descriptors since the stack can queue prepare writes this callback
will never be called which makes BT_GATT_LONG_DESCRIPTOR obsolete
as well.

Change-Id: Idca31ba8e4404d2acba760c420394d5adee0a508
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:29:02 +00:00
Luiz Augusto von Dentz 56419a135b drivers/nble: Add buffer pool for prepare writes
This is similar to previous patch which makes the API much more simple
when handling long writes.

Change-Id: Ibd3856863a43927195e23936872a160d5ff94648
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:35 +00:00
Luiz Augusto von Dentz d7e0294227 Bluetooth: ATT: Add incoming buffer pool
This adds a buffer for incoming prepare writes which can be
tunned using BLUETOOTH_ATT_PREPARE_COUNT, these buffers are then used in
execute write to commit the data thus making flush callback obsolete:

[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 50
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 34
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x18 len 2
[bt] [DBG] att_exec_write_req: (0x001159c0)flags 0x01
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 45

Change-Id: Iae071d7b4b5b042285952da57e3f7a853cf58afb
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:11 +00:00
Johan Hedberg 6d93cbb627 net: tests: Refactor net_buf tests for easier extensibility
Change-Id: I23380b1c78b5a9c8814c037a2d48b3505c99f6ea
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 11:22:23 +03:00
Johan Hedberg 7029d6ed62 net: tests: Remove unnecessary microkernel ifdef for mainloop
Change-Id: Ifbf41aeece7f889eb8f4e836c59df5e830882942
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 11:22:23 +03:00
Johan Hedberg 8919bdc573 net: tests: Update net_buf test
Add testing for fragmented buffers to the net_buf test.

Change-Id: Id6c541b86c30ac94931a7086ebb6f1312fbc34f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 08:17:24 +03:00
Szymon Janc 61c2353fc0 Bluetooth: shell: Fix missing new lines
This makes shell logs cleaner.

Change-Id: I5ecc751e3062b9cb581471c5399dd01decc9fa57
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 04:45:30 +00:00
Johan Hedberg 118a36fc26 net: tests: Fix returning net_buf to free pool
When using a custom destroy callback it's the responsibility of the
callback of placing the buffer back in the free pool.

Change-Id: I5ff99c32bcb31ccc5eb0fad544d86b0c830e7051
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-05 19:28:54 +03:00
Anas Nashif b67baefefd tests: fix build test configuration
Change-Id: I14f2c0a1c80f0c128db6a5d24830cc31c46308d1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-03 18:42:33 +00:00
Johan Hedberg e8620aaada Bluetooth: Take advantage of net_buf_get_timeout()
Use the more explicit net_buf_get_timeout() call where it makes sense
(e.g. where we always want to wait or never want to wait).

Change-Id: Id1eabe0ad2f9fa79f7be39e51fefa5161f9cc550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-02 10:32:29 +00:00
Anas Nashif 7d76e9619b ext: move tinycrypt to ext/lib
Tinycrypt is maintained at github and thus should be treated as an
external library and hosted under ext/.

Change-Id: I4c4a3bcdacf01d4922919e5ea1f9dec21a19cd37
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-01 14:27:41 -04:00
Luiz Augusto von Dentz f6dd1e4144 Bluetooth: Add support for using SYS_LOG
This add CONFIG_BLUETOOTH_DEBUG_LOG which depends on SYS_LOG since the
later can actually use either CONFIG_PRINTK or CONFIG_STDOUT_CONSOLE.

Change-Id: Ib2974d1331f6c91d119a218ec95e8bf01069377b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-01 05:04:10 +00:00
Luiz Augusto von Dentz 8b1afeaaa3 tests: Add tests for delayed workqueue
Change-Id: If62f44a989012047008c0d782aef2aa7b6016190
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-31 22:52:52 +00:00
Andrei Emeltchenko 4f696dd779 Bluetooth/shell: Correct confirm shell commands spelling
Change-Id: I832d8898a0e49b2d7b07a9f81193f52f31d45c7d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 11:03:25 +00:00
Szymon Janc 7cd474b3d7 Bluetooth: shell: Fix help message for LE address
LE address can be either public or random.

Change-Id: I5578732bd9929da22ef83f78fbe7ad608847a0d7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-30 13:11:25 +00:00
Szymon Janc 743437bc7b Bluetooth: shell: Add support for setting local ID address
This allows to set custom ID address from shell app.

Change-Id: I293800f116a7e56e183720a9b908ccb0e9622c12
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-30 13:11:14 +00:00
Chuck Jordan bc5cc98966 test: timestamp_serialize() empty macro for ARCv2
If the CPU is ARC, define timestamp_serialize() to be an
empty macro so that this test builds properly.

Change-Id: I36f00dd429972b610c327cbe59bedb24b33553ed
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-27 21:11:27 +00:00
Chuck Jordan 472817285e test: fix wording here to "measure time from ISR back to interrupted task"
Used to say "ISR to back to". Now says "ISR back to".

Change-Id: I568306f6653096799ec22ea21cdb9ebee42ac359
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-27 21:11:25 +00:00
Sergio Rodriguez 3ac7823ba9 benchmark: Changing dummy IRQ due conflict with APIC timer IRQ
The Quark D2000 uses the IRQ 10 for the APIC timer interrupt, this
cause a conflict with the "random" IRQ for the footprint benchmark

Change-Id: Iead18821af307832d54b0c9f3db5e52413ba670b
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-27 11:26:17 +00:00
Javier B Perez fe5aa9f6ae test: bluetooth: disable test for STM32F103RB not enough RAM
Disabled bluetooth test for STM32F103RB SOC because there is not
enough RAM space for the test.

Change-Id: I9f097d9201ed659c4970b67f42c570331b92bad8
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-05-26 11:14:38 -05:00
Anas Nashif de8bc78a5e arc: support microkernel on ARC
Microkernel on ARC works fine, was missing some declarations in the
linker file.
Also enable testing of microkernel with ARC and disable tests where
ARC is not supported yet.

Jira: ZEP-396
Change-Id: I2ac7b8dc0bea22f5d2e24832d9e3afad8df9f580
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-25 22:14:18 -04:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Mariusz Skamra edc4f30beb Bluetooth: tester: Add support for indications in tester application
This adds support for indications in tester application.

1/3   GATT   TC_GAN_SR_BV_01_C   PASS
2/3   GATT   TC_GAI_SR_BV_01_C   PASS
3/3   GATT   TC_GAT_SR_BV_01_C   PASS

Closes ZEP-403.

Change-Id: I3da8746641429388d38c2593344105f33fb43ee8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-25 15:19:30 +00:00
Andrei Emeltchenko 61367b415d Bluetooth/shell: Correct attribute write error
Return correct errors for long write.

Change-Id: Idfd54d961db9b2023d05a0dcfa7082d63e9c0261
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-25 16:44:51 +03:00
Mariusz Skamra 13d0832142 Bluetooth: tester: Fix invalid type cast
This fixes invalid cast from struct bt_gatt_attr to bt_gatt_chrc.

Change-Id: Idc2c016e26b5d38d2d4772a7bd79af8357a4da58
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-25 13:23:19 +00:00
Szymon Janc 44a306293c Bluetooth: shell: Enable TinyCrypt ECC for nimble
This allows to use LE SC with nimble firmware running on Arduino 101
board.

Change-Id: I3a9a485dc87c367160da98010d0189dfef09d5de
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-25 09:52:08 +02:00
Andrei Emeltchenko 1216cf0ac4 Bluetooth/shell: Add test vendor service support
Adding test service makes possible to test Bluetooth PTS test cases
with the shell. Currently long and auth characteristic.

Change-Id: I153efd3f7fa266f93873ef978025faf72c664076
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-24 13:19:25 +00:00
Anas Nashif 60b18711f3 tests: remove duplicate kernel configs and usage of ARCH
Many test configs are the same, remove complexity and duplication by
using just one kernel config where applicable.

This removes the usage of ARCH which is a remnant from the days where
we had to specify the architecture of the board, the architecture is now
part of Kconfig and determined basded on the board configuration.

This will also make it easy adding new architectures to test cases without
having to add an architecture specific config file when it is actually not
needed, for example now that we will enable micro-kernel support on ARC.

Jira: ZEP-238
Change-Id: I143fa3c4629c58329cfeb0c761c7a896fc1ef63a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 16:46:08 +00:00
Mariusz Skamra 92884a7540 Bluetooth: nble: Extend BTP with Identity Resolved event
This event indicates resolved Identity Address.

Change-Id: If3a323c4661697a53b015aab805d990703d6f884
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-23 13:33:55 +02:00
Grzegorz Kolodziejczyk 58339a6c15 Bluetooth: tester: Correct flushed data length
Returned by flush_value function value should be length of data which
are previously prepared by prepare write requests.

Change-Id: Iacfc63527c68cf20a76a4587acc749bd2d00cffd
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-23 09:57:44 +00:00
Luiz Augusto von Dentz 7941630e17 console: shell: Add return to command callback
This enable checking for errors and automatically print help string:

btshell> connect
connect <address: XX:XX:XX:XX:XX:XX> <address type: (public)>

Change-Id: Ie097ecddb72ab15bf6192e310d0bd839bfd251d5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-23 11:00:21 +03:00
Luiz Augusto von Dentz 21fabb3d39 nano_work: Add nano_work_init
Change-Id: I2e54e3e6ad048ff0d85cbef83e415ad436ecf720
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-21 12:02:57 +00:00
Grzegorz Kolodziejczyk f1c5282833 Bluetooth: tester: Fix handling execute write error responses
This patch fixes returning invalid offset, invalid attribute length
error. Error should be set during prepare write and returned in
response to execute write request as error response.

Change-Id: I78c57abc5f6f2fbd4a2c0fbb1ee6532212679a36
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-20 11:31:33 +00:00
Peter Mitsis 1434d49539 test_fp_sharing: Add testcase.ini files
Adds testcase.ini files for the floating point sharing tests to
ensure that there are run on a daily basis.

Change-Id: I206b1734700f6e998c19d7ad1b36a84400284899
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-05-20 00:09:24 +00:00
Luiz Augusto von Dentz 592acc09fd Bluetooth: shell: Add help to commands
This adds help strings to commands describing what parameters they take:

btshell> help init
init [none]
btshell> help connect
connect <address: XX:XX:XX:XX:XX:XX> <address type: (public)>

Change-Id: I0b79cb4f2d424f74b0ddb1de7a6d7120e81e2ae3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-19 08:46:01 +00:00
Mariusz Skamra dc62813b83 Bluetooth: tester: Return Insufficient Authorization error from app
This is related to recent changes in GATT permissions.
Authorization permissions were deleted, so that application
may return BT_ATT_ERR_AUTHORIZATION if configured.

Fixes following Test Cases:
1/9   GATT   TC_GAR_SR_BI_03_C   PASS
2/9   GATT   TC_GAR_SR_BI_09_C   PASS
3/9   GATT   TC_GAR_SR_BI_15_C   PASS
4/9   GATT   TC_GAR_SR_BI_25_C   PASS
5/9   GATT   TC_GAW_SR_BI_04_C   PASS
6/9   GATT   TC_GAW_SR_BI_11_C   PASS
7/9   GATT   TC_GAW_SR_BI_17_C   PASS
8/9   GATT   TC_GAW_SR_BI_22_C   PASS
9/9   GATT   TC_GAW_SR_BI_29_C   PASS

Change-Id: I4c37f6d597192acf34ba50910f92d5f06078201f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-18 10:23:03 +00:00
Johan Hedberg 485d023428 Bluetooth: Remove unnecessary #ifdef for micro/nano main function
By calling the microkernel entry point 'main' there's no need to have
extra hacks to share the same c-file with both nano and micro
configurations.

Change-Id: I6623855a87ef8624b2bddb75b95079521e0eab8b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-17 12:30:41 +03:00
Andrei Emeltchenko 3382e44cf2 Bluetooth/shell: Fix variable scope
Change-Id: I546583a22c6c149553bc1f7bf74618d3cc94d9f1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 15:54:22 +03:00
Andrei Emeltchenko 2bca790c2a Bluetooth/shell: Add support for GATT long write
Support long write maximum 100 bytes.

Change-Id: I071fdf68e29a3d4493c1c60215853cfd8f2ae3c3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 14:28:36 +03:00
Vlad Dogaru efa3b6fa99 tests: Add nano_work test
Change-Id: I78359bdd75aa2aa5e2f4b34347d838747d60015f
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-12 15:27:24 +00:00
Anas Nashif f62d86c42b samples: get rid of obsolete usage of ARCH variable
Using ARCH variable to select different configurations for the different
architectures is misleading and conflicts with the variable ARCH being used by
the build system.  The variable is not needed, it is application specific and
an application can be built without the need to specify ARCH on the command
line.

This is yet another item specific to samples and test cases that
wrongfully being used and documented for every application.  We need to use
another variable and just make it clear it is specific to samples and how they
are written.  One possible solution is to have a script that gets the
architecture based on the board being used.  Attachments

Jira: ZEP-238
Change-Id: Ieccbc087a41858fb96fb361c0aaa04705e968a4e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:28 +00:00
Mariusz Skamra 4108321181 Bluetooth: tester: Add Kconfig for nimble stack
Add config file for Arduino 101 board with the MyNewt nimble stack.

Change-Id: I061b1831457d6780af2ea757da918fb17fdcdaf0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 10:50:57 +00:00
Grzegorz Kolodziejczyk 486de7aa84 Bluetooth: tester: Fix setting nonconn advertising type
BTP API allows to set only advertising and scan response data without
declaring advertising type. Advertising type is deduced from current
flags status. Scan response data is static in tester - to set non
connectable mode in current BTP API scan response length must be
considered.

Change-Id: I742cd8ec774c24f317d639835844a4743bb25445
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-11 11:34:28 +02:00
Luiz Augusto von Dentz 777033f710 Bluetooth: GATT: Make bt_gatt_write take a struct
This makes bt_gatt_write similar to bt_gatt_read where the parameters are
stored in a struct which can be used to store intermediate values while
the operation is in progress.

Change-Id: I3c62af137b99985690cf88dcc37a977a0be891f5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-10 17:55:06 +00:00
Arkadiusz Lichwa c8c078442f Bluetooth: shell: Add BR/EDR PSM server registration
Sets new command in BT shell app to allow register one BREDR PSM server.
Syntax:
>br-l2cap-register <PSM>

Change-Id: Iec6b1f5639d987b0f41b933ab894069fda5dfdc8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-07 07:07:10 +00:00
Chuck Jordan 68c4555b59 test: fix a comment
Some comments were edited.

Change-Id: I76c2763a98d1141c03ce684dd31683701b74f2d8
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-06 11:19:05 +00:00
Benjamin Walsh f1e90a295c benchmark: fix sema give/take test
This test has been broken since we've moved from object IDs being
small integers to pointers. The problem was two-fold:

 - The semaphores are not put in a an array anymore, and are thus not
   necessarily referenced. The linker drops them in that case.
 - The semaphores are not necessarily allocated in memory in the order
   they are defined in the mdef file. On x86 actually, they are
   allocated in the reverse order.

There was no need anyway of having all those semaphores: the microkernel
semaphore is a counting semaphore. It can thus simply be given a number
of times anre taken the same number of times to operate on it a
reasonable amount of time to take a measurement.

Change-Id: I67c82cb7eb03d28906f8c63717db8f951818be5e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-05-05 22:54:49 +00:00
Mariusz Skamra 22fa025157 Bluetooth: Minor fix missing format specifier
Sample output:
Include 3f54 found: handle 00000021, start 00000040, end 00000045
Include 477a found: handle 00000041, start 000000a0, end 000000a2

Change-Id: I44ef1c5c956d0ff81c08b9f447df676cac8185b8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-05 17:23:49 +00:00
Anas Nashif aaa508a2f8 tests: build using newlib also on ARC
A recent issue due to a change to ARC was not caught because we
do not build on ARC. Now that we have libc with ARC toolchain,
built for all arches.

Change-Id: I8c9b7d37802cb582dcb50e6c61d040078d8ecd26
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-05 14:08:50 +00:00
Andrew Boie 0c4590d252 test_tickless: improve testcase.ini filter
The filter specification now matches the code. We can run on any x86,
or those ARM boards where the test's timestamp.c has _Timestamp*
implementations.

Change-Id: Ib81e5379f892beb3783dd3c345cd536c883a74de
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-04 22:57:39 +00:00
Andrew Boie 3ea7892410 sanitycheck: allow for more expressive filtering in testcase.ini
The old 'config_whitelist' directive in testcase.ini has been removed.
We use the new expr_parser module to parse a 'filter' directive which
is a boolean expression. This gives a great deal more flexibility
in how tests can be filtered.

To keep the tree bisectable, use of config_whitelist in testcase.ini
converted to the new expression language.

Change-Id: I0617319818c5559c0f0569d2fa73d09b681cac51
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-04 22:57:39 +00:00
Peter Mitsis 2cac7eea6a tests: Pend microkernel tasks on nanokernel objects
Adds a test for pending microkernel tasks on nanokernel objects.
This explicitly covers the nanokernel FIFOs, LIFOs and timers
while implicitly covering nanokernel sempahores.

Change-Id: Ic044b731da13dea337e199499c23ea425056fae4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-05-04 22:51:34 +00:00
Grzegorz Kolodziejczyk b4ea3209fa Bluetooth: tester: Add possibility to set scan response data
Patch extends le advertising repot with configurable scan response
data.

Change-Id: Ibcbe71d6158ece3e7f63daf33d188a9b0d525384
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-04 13:07:02 +00:00
Szymon Janc 6d5ed390b1 Bluetooth: Simplify advertising API
Instead of requiring application to provide both advertising type
and address type used just require app to provide info if advertising
is connectable or not. Advertising type is set based on provided
SCAN_RSP and local privacy support.

When local privacy is enabled it is no longer possible to advertise
using identity address. If such feature is to be required later on
advertising options can be extended.

This gives BT stack full control over what type of address is used
for advertising and is a preparation for random address rotation
and OOB support.

Change-Id: I90e9a683ef3794f155707343c874f75585439325
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-04 11:11:34 +00:00
Luiz Augusto von Dentz 6a4d39d5cd Bluetooth: GATT: Fix error type
Callback errors should contain ATT error code not posix errors.

Change-Id: I698fac086ab8b2dca3487ab99ee974b4318d16f7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-02 14:31:02 +03:00
Luiz Augusto von Dentz b76abc0460 Bluetooth: Fix not being able to set CONF_FILE for init test
Change-Id: I750cb062b88fd265c14ae3304ae33cd345683a0f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-04-29 11:51:18 +00:00
Grzegorz Kolodziejczyk e0922851a1 Bluetooth: tester: Return pre defined db offset on start server
Some IUTs may have predefined attributes in db which aren't take into
consideration while building via tester database. BTP clients should
know about such attribute handle offset change. After start server
we're sure that none of attributes will be added since zephyr db is
constant.

Change-Id: Ia2c6edaa7a2f3ca4a9c88fe00122c808a529dadb
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-29 07:52:11 +00:00
Luiz Augusto von Dentz e2c1b2b7be tests: test_slist: Add test for sys_slist_insert
Change-Id: I7b478c78050027013f386146bae6198a554f2005
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-04-28 11:41:15 +00:00
Roger Lendenmann 3278f542eb Bluetooth: gatt: include service api definition proposal
* service include macro definition takes reference to
   first service attribute of the included service

Change-Id: Ib2b1defe2c99aea738da791af74a534d56025eae
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2016-04-28 10:35:38 +00:00
Andrew Boie edc81265b4 test_timer: nanokernel: use empty config for all arches
Extra config for x86 was unnecessary.

Change-Id: Ic86979e80db2c63e07b328375027acec97e751c7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-27 21:41:09 +00:00
Andrew Boie 3e156748d0 test_xip: nanokernel: use common proj.conf
They were all the same anyway...

Change-Id: I4cf54d7a837d585885990bfcd168e96059349c4a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-27 21:41:04 +00:00
Andrew Boie 7571cdfd59 test_obj_tracing: nanokernel: use common config
The extra config in x86 isn't necessary.

Change-Id: I967a58ae5c04d55c144e9f711a708f43dc023ebb
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-27 21:40:59 +00:00
Andrew Boie 1bf37fb6d3 test_errno: remove unnecessary use of nanokernel API
Change-Id: I7bc26e11f82f697b980f9eb9105941bc9caeb6c6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-27 21:40:49 +00:00
Szymon Janc 51b91e1a33 Bluetooth: shell: Update advertising command help
Add missing rpa parameter to help message.

Change-Id: I902e0f1308a8f8a8b603873a8ffcb9b03527f6e1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-25 10:15:16 +02:00
Johan Hedberg e3e91d3280 Bluetooth: Add name member to HCI driver struct
This is more of a convenience to let the driver identify itself in
debug logs and the monitor protocol.

Change-Id: I73351477e98d45d6344c180b8088bde29df6f7d9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg 4488fc6cab Bluetooth: Move HCI device bus information to the driver
The bus that we notify over the monitor protocol is really driver
specific, so let each driver specify their bus type.

Change-Id: Ic3a086fcc06352dbf051e52cef5bf6b8696349ae
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg 8c3add2b6a Bluetooth: tests: Add automated tests for new monitor code
Add two new test cases to exercise the code in monitor.c.

Change-Id: I66ae70e0d3b61d3b852916333019e1ed2c5c6cf4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Szymon Janc 85d44978a5 Bluetooth: shell: Add support for advertising with RPA
This allows to test local privacy feature.

Change-Id: Ib231f9187e353f79fee9237acef0d1ffe9cb2b7d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 11:07:19 +00:00
Grzegorz Kolodziejczyk 0d98a3633e Bluetooth: tester: Add support for seqence gatt database
This patch reorganize tester gatt commands to handle also sequence
builded gatt data base

Change-Id: I5fc89c1c498dd2ecf3999bc93e3caffd14f67cb7
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-21 13:32:42 +00:00
Johan Hedberg 3fbe227cdd Bluetooth: tests: Add DEBUG_DRIVER to automated tests
Change-Id: I9fa76816ceb1f6a49861a1145ae85394b6a64c80
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-21 10:41:48 +03:00
Yannis Damigos 2b8d3626c6 sanitycheck: Add olimexino_stm32 board to sanitycheck
Adds olimexino_stm32 board to sanitycheck.

Change-Id: Icd0e5025bc7a348c7a1a4d18d10d2d1e3a9817bd
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-04-20 22:29:02 +00:00
Johan Hedberg 560956c54d Bluetooth: Kconfig: Split debug selection into a choice
This prepares for adding other debug types besides the printf-style
logging to the console.

Change-Id: Ic2ed305192491734da991c4f61fdaace03fd60f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-20 17:46:09 +03:00
Johan Hedberg 483fc4705f Bluetooth: samples: Add sample Kconfig for nimble based controllers
Add config files to be used on Arduino 101 (or any Curie-based) board
with the MyNewt nimble stack running on the nRF51 and exposing HCI
over UART. These configs contain a stripped-down set of features so
that the resulting image fits e.g. on the Arduino 101.

Change-Id: I7300e9ca4205de6f52aa6ca1bfe4e0b011b6dcbe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-19 13:19:02 +03:00
Mariusz Skamra 3bea520c6c Bluetooth: tester: Update tester application README
This adds the guidelines for the tester application building usage.

Change-Id: Ibcd31b7bed827f8eee99fdf21d3bb1e8edd24d2e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-19 06:58:55 +00:00
Anas Nashif 65c06afa58 kinetis: reorganise soc directory using soc family
Add Kinetis SoC family and rename fsl_frdm_k64f to mk64f12.
This will allow adding new SoCs of the same family and the reuse of code
among SoCs of the family and series.

Change-Id: Iea1a663aef7ce0487f147bdd36f668bebe80deb5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Anas Nashif 9bf2da7ef4 stm32: rename CONFIG_SOC_STM32 -> CONFIG_SOC_FAMILY_STM32
Use CONFIG_SOC_FAMILY for the top level SoC family. A family
will have different SoCs or different SoC series with multiple
SoCs.
Adding the Family string to the config variable to avoid confusion
between actual SoCs and families and to prevent name collisions.

Change-Id: Ic99a2c1df7850dee3a45641027af82464dd6fadb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Johan Hedberg 01e29cf395 Bluetooth: samples/shell: Make more features optional
For memory-constrained platforms (like the Arduino 101) it's desirable
to be able to build a slimmed-down shell app that doesn't contain any
unnecessary features. This patch makes more of them optional.

Change-Id: Ia7f2cc0930dda6dfed5ce020b56913c6e0bc3d6f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-18 13:46:21 +00:00
Mariusz Skamra 1cfccfda84 Bluetooth: tester: Start using net_buf to store GATT database
With this patch net_buf based heap will be used to store attribute
user_data and UUID. This is the first step to remove gatt_buf.

Change-Id: I578f26b781e01f5f3464c05f7210dc27cdea8edf
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-15 16:51:40 +00:00
Andrew Boie 15800ce78a nanokernel: deprecate dynamic IRQs
We have not found any use-cases for dynamic IRQs where a static
IRQ did not also suffice. Deprecate so that we can eventually
remove from Zephyr and nontrivially decrease the complexity of
the kernel.

Change-Id: I509655371773aeaca7d01134dd850eb4cd95f387
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-15 16:02:12 +00:00
Andrew Boie a83f895dd5 microkernel: deprecate task IRQs
This mechanism does not add enough value to the kernel to be worth
maintaining it. Drivers that need deferred processing of interrupts
can simply define their own task and have the interrupt handler
release an event that the task waits on.

The API is marked as deprecated and it is removed from unit test
coverage as well as the documentation.

Change-Id: Ib87b91cb41e9b6d7fdf0dc62b240a531b6a8889f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-15 16:02:12 +00:00
Grzegorz Kolodziejczyk 38b202e810 Bluetooth: tester: Update server commands with sequence params
Most iuts data base are intended to have its attribute database builded
in sequence and its constant (except attribute values, parameters,
permissions). Patch allows btp specification to cover also devices
which cannot assign an ID right after issuing add attribute command or
set attribute component (which points to defined attribute ID).

Change-Id: Ie8e5ed223609cca2b6e3fb8444065f33b1408142
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-15 15:14:23 +00:00
Szymon Janc cdd5851715 Bluetooth: shell: Add confirming incoming JustWorks pairing
This allows to accept or decline incoming pairing that would
otherwise result in JustWorks pairing.

Change-Id: I759ea067ef298b437e0112b8b7ef3bedf106dc52
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-15 04:57:41 +00:00
Szymon Janc 01f80c48ff Bluetooth: shell: Use same config for arm and x86 build
There is no need to have separate configs as init sample is now
used for different build configuration tests.

Change-Id: I917692f8a8e96345afc561dd04bdcf08cdfa5de7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-11 11:54:07 +00:00
Johan Hedberg 30601c09bb Bluetooth: Refactor buffer handling for non-host managed buffers
So far the assumption has been that the host stack manages all
incoming and outgoing buffers. For the incoming buffers (from the
controller) this has required hci_core.c to manage its own pools and
do the host flow control. This setup makes perfect sense for an
architecture where the controller resides remotely on a different CPU
& address space (i.e. the "traditional" HCI transport case).

When the stack runs on a system where the controller resides in the
same address space this setup doesn't work that well. In such a
scenario the incoming buffers are ideally created as low down in the
stack as possible (i.e. below HCI), which means that the current
hci_core.c cannot be responsible for managing their pools.

To allow for both types of architectures this patch introduces a new
BLUETOOTH_HOST_BUFFERS Kconfig option that can be selected to say that
host-side management is desired, or deselected to say that the
controller (residing in the same address space) takes care of managing
the incoming buffers.

So far the incoming buffer types were identified by hci_core.c by
looking at their "free pool" pointers, however as soon as the pools
are allowed to be somewhere else this doesn't work. To solve this we
now require a minimum user data size for all Bluetooth buffers and use
that to store the buffer type.

Change-Id: I14bc32007e3e3f17c654f71f79b520650028d7ce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-11 11:52:29 +00:00
Khem Raj a8aa603242 benchmark: Remove trailing whitespaces.
Change-Id: I852fbf40899e3d4f0715377c955870e5b3990af1
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2016-04-09 10:32:09 +00:00
Tomasz Bursztyka 1c827b9721 tests: test_early_sleep: Let's test at all initialization level
Not only SECONDARY, but also the following ones:
- NANOKERNEL
- MICROKERNEL
- APPLICATION

Change-Id: Id41fa572c830727166101fa3c6254398857b31c7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-08 15:08:33 +00:00
Grzegorz Kolodziejczyk bae91cf980 Bluetooth: tester: Use bt enable cb to indicate cmd rsp success
This is needed especially for nble. If bluetooth is not enabled we
cannot send another commands to tester.

Change-Id: I17e639301bba6efd127f2c743b8942c1b493f9da
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-06 17:25:11 +00:00
Johan Hedberg 5ccb20c591 Bluetooth: Use bt_addr_t inside bt_addr_le_t
In many cases when we want to access the 'val' member of bt_addr_le_t
it's in situations where the type needed is actually bt_addr_t. To
avoid unnecessary typecasts in these places simply embed bt_addr_t
inside bt_addr_le_t.

Change-Id: I7eecf129bee1dcf085abc83ec2f32e1a10b0b5aa
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Johan Hedberg 13be3947ab Bluetooth: Add Privacy Feature support
Add initial support for the Privacy Feature, including the ability to
manage a local IRK and to use Resolvable Random Addresses.

Change-Id: I1c70aea67078dd2a5d07f3b797c37746ebe9ab61
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Daniel Leung 16d0b8b0a3 tests: enable pinmux build tests
Enable building pinmux drivers to catch build breakage.

Origin: Original
Change-Id: I86ec02423bf23ee6aca41b9413e240e984313fcf
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-02 23:11:06 +00:00
Maciek Borzecki 9e8e0e8e82 tests: bluetooth/shell: exclude STM32F103RB from microkernel test
For STM32F103RB targets, the SRAM is overflown by 2-3kB in microkernel
test. Platforms with this SoC can still be built for in the nanokernel test.

Change-Id: I012b93cf8dfec74292f7ab228f4b2fca1a4f3444
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Maciek Borzecki 109b10b26e test_sha256: disable test for STM32F103RB SoC
Exclude STM32F103RB platform from the test. The SRAM is overflown by
>20kB, while the CPU itself has 20kB of SRAM.

Change-Id: Ic9aad6b88d517b62f4a18901cd698ba9a9defb40
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Maciek Borzecki 54a055426d test_tickless: disable test for STM32 SoCs
Disable the test for STM32 based platforms until an implementation of
timestamp counter becomes available.

Change-Id: I2e50dac36dbfdc61081610c0e0cf1ace8892f602
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Maciek Borzecki 3b0a701ac1 bluetooth: shell: declare commands as const
Take advantage of shell_init() accepting const commands array. This
moves ~280 bytes from SRAM to the text section.

Change-Id: Id64ee766e3c6cf7ce4cc623a1e21d3dacf33f050
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Peter Mitsis 28e5d0287e test_fifo: Reorganize directories
Splits the test into two clear sub-categories: microkernel and nanokernel.
This is done to maintain consistency with other tests that do the same
(e.g. test_obj_tracing, test_sema, test_stackprot, test_timer).

Change-Id: Iddb1ec8d569a9d953fb8af5ce08e87b51995f821
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-04-01 00:07:28 +00:00
Tomasz Bursztyka 71e26d0d03 tests: Add a test suite for the single linked list generic
It will extensively test all provided functions within a normal usage of
the API.

Change-Id: I723203a29c3f3416b464030a7fe34eac5fff6095
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-01 00:01:58 +00:00
Peter Mitsis 30aa2602ad test_fifo: Fix issues flagged by checkpatch
Fixes line length and whitespace issues flagged by the checkpatch tool.

Change-Id: Id49cd5341571ac7893929a2836fe5e06166abe06
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-04-01 00:00:34 +00:00
Yannis Damigos ee587d08a8 tests: kernel: test_context: reduce ram requirements
Reduces the amount of memory allocated for fiber's stack.
This permits the test_context to compile on boards like
nucleo-f103rb. Sanitycheck script passes all test for
test-context.

This patch was verified on the emulated platforms and not
against real hardware boards.

Change-Id: I219f63063ee2dca5b0326e25141d8b37f4cd1d74
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-31 23:17:52 +00:00
Yannis Damigos 32e450024e tests: kernel: test_pool: reduce ram requirements
Reduces the amount of memory allocated for task's stack.
This permits the test_pool to compile on boards like
nucleo-f103rb. Sanitycheck script passes all test for test-nano.

This patch was verified on the emulated platforms and not
against real hardware boards.

Change-Id: Ib8041f6d91e8ffc5fcb16dc73de1f7662d9596da
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-31 23:17:51 +00:00
Yannis Damigos 60695b18a0 tests: kernel: reduce ram requirements
Reduces the amount of memory allocated for stack (both fiber
and task). This permits test_sema and test_mutex to compile
on boards like nucleo-f103rb. Sanitycheck script passes all
tests for test_sema and test_mutex.

This patch was verified on the emulated platforms and not
against real hardware boards.

Change-Id: Ie25288bbbbfa64bfc5f7463639bfb09639cc184f
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-31 23:17:51 +00:00
Johan Hedberg cfe54794f2 Bluetooth: tests/shell: Add some help text
Change-Id: I09cdec8c710120219412eccf69ba25e95679ecfb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-31 08:02:22 +03:00
Yannis Damigos 560e6a3cf4 tests: kernel: test-fifo: reduce ram requirements
Reduces the amount of memory allocated for fiber's stack.
This permits the test_nano to compile on boards like
nucleo-f103rb and arduino 101 sss. Sanitycheck script passes
all test for test-fifo.

This patch was verified on the emulated platforms and not against
real hardware boards.

Change-Id: Icf30c4056d9f9ebdc82c100305bf761e49b64491
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-30 22:21:25 +00:00
Yannis Damigos f004330589 tests: kernel: test-lifo: reduce ram requirements
Reduces the amount of memory allocated for fiber's stack.
This permits the test to compile on boards like
nucleo-f103rb and arduino 101 sss.
Sanitycheck script passes all test for test-lifo.

This patch was verified on the emulated platforms and not
against real hardware boards.

Change-Id: I1dd514c9d273bcf490e0eb4f1fadee1a8a94bcc5
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-30 20:02:54 +00:00
Andrei Emeltchenko 808b4c6230 Bluetooth/shell: Fix wrong memory access
The extended inquiry response data format include at least two octets:
length and type, so adding NULL termination name shall be 240-2+1
octets.

Fixes accessing wrong memory in the statement below:
...
memcpy(name, &eir[2], sizeof(name) - 1);
...

Change-Id: I71be96aed6af63d0649f4d64271208eeb11e2c6c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-30 11:07:33 +00:00
Anas Nashif e444363cb9 sanity: add quark_se_devboard to tested boards
Change-Id: I82cefb1baaa0c7174cebcd35c527fec3d133241e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-30 11:04:36 +00:00
Yannis Damigos 9d6e0cebed Bluetooth: tester: Fix typo
Fix typo in tests/bluetooth/tester/testcase.ini

Change-Id: I4a2d93cdf709028bc491aa933d1a5819d62afcff
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-29 17:32:17 +00:00
Andrew Boie 15dc9f326e object-footprint: gitignore generated output
Change-Id: I438b8f4d28119817088fa006b8d6f3504089bcb4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-29 11:07:55 +00:00
Andrew Boie baa6ef0798 benchmarks: use portable static interrupt APIs
These tests were using non-portable NANO_CPU_INT_REGISTER. They
now use IRQ_CONNECT, which lets us run these tests on all arches
and not just x86.

Change-Id: Idd4264c2650c851aa78356f01586edbadd014501
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-29 11:07:33 +00:00
Ramesh Thomas bb19e6f82f power_mgmt: Make names consistent with new RFC
Changed names of Kconfig flags, variables, functions, files and
return codes consistent with names used in the RFC. Updated
relevant comments to match the changes.

Origin: Original
Change-Id: Ie7941032d7ad7af61fc02928f74538745e7966e8
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-26 14:35:11 -04:00
Dmitriy Korovkin 0986684e62 tests: Add test for microkernel early sleep functionality
Test verifies that a task_sleep() function can be used during the system
initialization, then it tests that when the k_server() starts, task_sleep()
call makes another task run.

For fibers, test that fiber_sleep() called during the system
initialization puts a fiber to sleep for the provided amount of ticks,
then check that fiber_sleep() called from a fiber running on the
fully functioning microkernel puts that fiber to sleep for the proiveded
amount of ticks.

Change-Id: Iec20b61d7e802a19b1ec074d2511345eed9f2407
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-03-26 10:17:22 +00:00
Szymon Janc e7daa90d6b Bluetooth: shell: Add support for BR/EDR discovery
This add shell commands to start and stop BR/EDR discovery.

Change-Id: Id7ea2c75a06842afd02708424930b27cfb65a1e9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-25 19:28:33 +00:00
Szymon Janc a4836f4da4 Bluetooth: shell: Make cmd_gatt_mread static
This function is not used outside of main.c.

Change-Id: Ia8cc6c2b2193906dd77d031b73d289c6acd128b2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-24 18:39:04 +00:00
Andrei Emeltchenko f4696286b4 Bluetooth: Fix using uninitialized value
Assign value before using.

Change-Id: I67f0e7195c979bf7547c0f718eeaef5e366b447d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-24 15:10:31 +02:00
Andre Guedes 54337aa736 test: Convert returning code to errno.h
Change-Id: Ib4e3fb2e3c1cecf7e1646c7dc03b16e9ce4b6da2
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-23 15:49:40 +00:00
Maciek Borzecki 25799f045c benchmark/latency: reduce RAM requirements
Reduce RAM requirements of latency benchmarks by reducing the amount of
memory statically allocated for stacks (both fiber and task). This helps
reduce the memory usage required by microkernel test to below 20kB,
enabling the benchmark to be run on Nucleo-F103RB board. The change was
verified for nucleo_f103rb and qemu_x86 boards.

Change-Id: If5990d107f0fcfabd12ade82f97e7a1a13f8421c
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-23 11:47:36 -04:00
Maciek Borzecki b7ca3fac3d benchmark/latency: support for Cortex-M targets
Remove x86 specific includes. Add Cortex-M specific instruction pipeline
flush helper.  Microkernel benchmark has been verified to work on STM32
MINI A15 (STM32F103VET) board. Due to memory constraints, Nucleo-F103RB
can only run a nanokernel version of the benchmark.

Change-Id: I2e49c240d6985ceb5643551397d6e0a8cc65b3c6
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-03-23 11:47:36 -04:00
Szymon Janc 6f9ce0b417 Bluetooth: Provide more config options to init sample
This allows to excersize different kconfig configurations in
single app. Thanks to this other samples don't have to get
extra extra options enabled just to improve test build coverage.

Change-Id: Ie5d261f3d38c60e227cf963d938b6fac6d0fb3b9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-23 12:50:30 +00:00
Grzegorz Kolodziejczyk 5a3d40beec Bluetooth: tester: Add LE scan type flags and support
Now start discovery GAP function interprets scan type flags (active,
passive) and starts discovery with specific LE scan parameters.

Change-Id: Iecb942e24d68790966afe893d3543433c33192dc
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-21 11:17:50 +00:00
Mariusz Skamra 9c23e24da5 Bluetooth: tester: Refactor Set Value command handler
Since user_data can be added with gatt_db_add, Set Value
command handler can be simplified.

Change-Id: I86d3ed411cc897488e9073492ff85e0754b2ab93
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-21 11:17:15 +00:00
Daniel Leung fa868a7846 drivers: bluetooth: nble: restructures Bluetooth Kconfig options
This moves both the Bluetooth HCI and NBLE drivers under
"Bluetooth Drivers" category. This also adds a selection for
choosing Bluetooth stacks as the bulk of both HCI and NBLE stacks
cannot be compiled together.

Note that this does not move the source files. That should be
done in a separate change.

Change-Id: I32fa7097ada0fdc52bcc745adb78c7273f4023c6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-19 00:23:11 +00:00
Mariusz Skamra f84bf33aca Bluetooth: tester: Return BTP error if requested unknown attr ID
With this patch BTP error will be returned if attribute with
requested ID don't exist in GATT attribute database.

Change-Id: Ic6125c6359e75a80fb9a51b6a527ee0a98628e6d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-18 15:19:18 +00:00
Andrew Boie 5729a67cd6 app_kernel: fix test case scaling
Test didn't work unless the specific board was noted in the Makefile.
This scales horribly. Assume no floating point / sse unless specifically
mentioned.

Change-Id: Id1eaa88cdf971a8843e2418661e6a8dba6a1b91d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-17 19:18:44 +00:00
Szymon Janc bf497e959a Bluetooth: shell: Add support for outgoing BR/EDR connections
This allows to initiate BR/EDR connection with specified address.

Change-Id: I99f0d7dff29384926d3bf739831c7460a7fb5f68
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-14 16:03:20 +00:00
Andrew Boie ca094b1691 sanitycheck: enable qemu_x86_iamcu and prefer it over qemu_x86
Rationale for defaulting to IAMCU variant is that our most
interesting x86 boards use this calling convention. --all
will test both.

Change-Id: Idaddfec51a74ae85691d348adeeb88a8528060ea
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-12 02:24:51 +00:00
Juan Manuel Cruz 6d040a89ff debug: add task tracing to sanity test
Change-Id: I2d9691d094a764b9e884ef5f7a2700bedcf71745
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-03-11 22:13:43 +00:00
Juan Manuel Cruz 5f566034e5 debug: object tracing sanity test includes thread monitor.
Change-Id: Ic57ed69374b2075bcdf5cd5d72b83b03b59fbac5
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-03-11 22:10:23 +00:00
Anas Nashif 63ec21c451 Revert "tests: Add test for microkernel early sleep functionality"
This reverts commit b1a0041de6.

This breaks sanitychecks in CI. The early_sleep kernel test case is failing
randomly.

Change-Id: I129b649f7010da90f52616f6fd63eec8b63f8247
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-11 22:09:42 +00:00
Anas Nashif 3d9759c9c5 Revert "sanitychecks: skip early_sleep test"
This reverts commit f9d1d56153.

This breaks sanitychecks in CI. The early_sleep kernel test case is failing
randomly.

Change-Id: I4b21f926198af9f0703f042fc170226ed6ab4331
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-11 22:09:31 +00:00
Juan Manuel Cruz 83cbf63431 debug: sanity test for kernel object tracing
Adds the sanity test to integrate the kernel object tracing
API. The test implements the philosophers demo and adds
an additional test thread that uses the kernel object tracing
API and test for the correct output.

Change-Id: I2f01f7b3386afd4783ae58b5311eb7d6ee5a3cea
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
Origin: Original
2016-03-11 22:07:15 +00:00
Anas Nashif f9d1d56153 sanitychecks: skip early_sleep test
Test fails in CI, disabling until we have a resolution.

Change-Id: Ie8e1ca00b08238c2c2a4feefbe08140c762e6d2f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-11 11:40:49 -05:00
Luiz Augusto von Dentz f206d86c10 Bluetooth: GAP: Add service sample
This adds a GAP service sample and make use of it in shell test which had
a copy of this code.

Change-Id: I5f03fb7db5349236e41bc30eb884c134136439e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-11 11:32:13 +02:00
Dmitriy Korovkin b1a0041de6 tests: Add test for microkernel early sleep functionality
Test verifies that a task_sleep() function can be used during the system
initialization, then it tests that when the k_server() starts, task_sleep()
call makes another task run.

For fibers, test that fiber_sleep() called during the system
initialization puts a fiber to sleep for the provided amount of ticks,
then check that fiber_sleep() called from a fiber running on the
fully functioning microkernel puts that fiber to sleep for the proiveded
amount of ticks.

Change-Id: Ibe20ca1ca966575aaaad0b6ffd66ca43512801f0
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-03-10 18:39:33 +00:00
Andrei Emeltchenko 489b0ff793 Bluetooth/shell: Clear subscription on gatt_unsubscribe()
Clear subscription allowing to test subscribe / unsubscribe in
sequence.

Change-Id: Ife8b994410107f05c23687e3fb23b4a81cad8ce7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 15:40:36 +00:00
Andrei Emeltchenko 1ec4ec237b Bluetooth/shell: Print handle in hex instead of decimal
Change-Id: Id8654b5c58c3d4f3f157725e550091dd112de4a0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 15:40:21 +00:00
Grzegorz Kolodziejczyk 2c121675f5 Bluetooth: tester: Add support for get supported l2cap commands
This adds support for get supported commands of l2cap service.

Change-Id: Ic3e2b6502c05a5784d1fd01af0e47cce11e6d2c9
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-09 10:21:46 +00:00
Grzegorz Kolodziejczyk 5d74aecf52 Bluetooth: tester: Add initial support for l2cap service
This patch adds initial declaration of l2cap service in tester
application.

Change-Id: I9bd729bc351b2fe135e7b5b80262b45eaf70b10b
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-09 10:21:17 +00:00
Szymon Janc 6116d58b02 Bluetooth: Use bt_auth_cancel for pairing cancel
bt_auth_cancel can be used to cancel any type of pairing.

Change-Id: Ia1a6ba834186ab6d5082d3eb473319c2d70cf4a7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-08 15:38:59 +00:00
Mariusz Skamra 9e5854c16c Bluetooth: tester: Refactor adding attributes to the GATT database
This patch makes adding attributes more clean.
Attribute UUID and user data are now added along with the attribute
in gatt_db_add function. Thanks to that, some static variables have
been deleted, and the code is more readable.

Change-Id: I510bd7a1a9ae0210dd90520212a340ee1a3b2b53
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-07 18:21:52 +00:00
Anas Nashif e81053ee03 samples/tests: remove old message about standard security
Change-Id: I52bb6731a8c7b2c3ba38b867ac57ff82332ae7f2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-07 16:07:35 +00:00
Andrew Boie 7393a00a5f test_bitfield: exercise sys_*_bit and sys_bitfield_*_bit
Origin: original code
Change-Id: I16c324e1124a58d77386236f4c0cc597041c220e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-04 15:12:07 +00:00
Andrew Boie b54355050d REVERTME: bluetooth: tests: disable some tests
bluetooth/shell and bluetooth/tester need to be disabled on
galileo and minnowboard respectively. On these platforms,
the IRQ for the UART console and the H4 are the same IRQ line.
IRQ_CONNECT() is being called on the same IRQ line twice, and
it's only through linker luck that these tests work at all
since one driver will "win" when the mapping is set up at build
time by gen_idt.

gen_idt was supposed to break the build in this situation but
was bugged. The next patch in the series fixes gen_idt.

Change-Id: Ib4a42b57181731121dfad50606c8362a9fd0277d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-03 10:24:25 +00:00
Mariusz Skamra 8a186d4eab Bluetooth: tester: Fix missing le to host order conversion
This fix missing conversion of CEP properties.

Change-Id: Ibdf9fecdb3e21e8fd5e2b7ccacb88ae2abd81776
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-03 08:18:39 +00:00
Mariusz Skamra 9055bfe58f Bluetooth: tester: Fix missing bit in GAP supported commands
GAP_CONNECT bit was missing in supported commands.

Change-Id: I9d009c55327ae67bed38c45b7c11fb67665e1cd0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Mariusz Skamra c76bd33d61 Bluetooth: tester: Fix supported commands to use uint8_t array
Fixes endianess issues.

Change-Id: I9c308187d34a832cc875c9037235cedc8bee033c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Mariusz Skamra 0abe6e85ba Bluetooth: btp: Fix BTP GATT command opcodes
This patch makes opcodes to be in the sequence.
Supported commmands is form now uint8_t array, so this resolves
the problem with endianess as well.

Change-Id: I602a58081948dbbf5e0d83cbb12a118a5990b9f8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Peter Mitsis e0f8162a8b test: Add nanokernel test_sleep project
The 'test_sleep' nanokernel project tests the following functionality:
   1. Normal expiration of fiber_sleep()
   2. Waking a sleeping fiber via fiber_fiber_wakeup()
   3. Waking a sleeping fiber via isr_fiber_wakeup()
   4. Waking a sleeping fiber via task_fiber_wakeup()
   5. Normal expiration of task_sleep()

Change-Id: Ie51997ace9a4413f62d77daacd6dff97b6b3a4dd
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-23 10:48:54 -05:00
Peter Mitsis 06e2b4e129 nanokernel: Change fiber_delayed_start() return type
Instead of returning a 'void *', the nanokernel fiber_delayed_start()
family of routines now return a handle of type nano_thread_id_t.

Consequently, the nanokernel fiber_delayed_start_cancel() family of
routines now accept a parameter of type nano_thread_id_t instead of
'void *'.

The complete list of affected nanokernel routines is:
    fiber_delayed_start()        fiber_delayed_start_cancel()
    fiber_fiber_delayed_start()  fiber_fiber_delayed_start_cancel()
    task_fiber_delayed_start()   task_fiber_delayed_start_cancel()

Change-Id: Ibd4658df3ef07e79a81b7643a8be9ea5ffe08ba0
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-23 10:48:54 -05:00
Mariusz Skamra 084405c2c4 Bluetooth: tester: Remove set_ccc_value helper
CCC user data is already available on the initialization
(struct bt_gatt_ccc_cfg and ccc_cfg_changed callback).

Change-Id: Id06c69b6da33f651bc049983179cd6fe3bc197d6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:50 +00:00
Mariusz Skamra e561f7c021 Bluetooth: tester: Refactor gatt_buf_add and gatt_buf_reserve functions
This removes a bit of redundant code.
gatt_buf_reserve can call gatt_buf_add with data set to NULL, to
reserve space on gatt_buf.

Change-Id: I533a515bbd022a07ba8e2bfb3cd07e1a9ff8878b
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:34 +00:00
Mariusz Skamra 9d862b2a61 Bluetooth: tester: Fix initialization of static variables
Static variables are already initialized to zero.

Change-Id: I8da4b6d93192f5534fbe55622c4ee890c0297de1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:16 +00:00
Mariusz Skamra cd272cadfb Bluetooth: tester: Use BT_UUID defines for UUID comparisons
Defined BT_UUID for the header can be used instead of struct member.

Change-Id: I55ca069d04622450e4fbb1e3f7abf6fdef2f8f30
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:05 +00:00
Johan Hedberg bab3b49fdb Bluetooth: Change GATT callback return values to ssize_t
Since the return value of these callbacks is a number of bytes ssize_t
is more appropriate than int.

Change-Id: I3406fb382975d62f51e7a195666d0ae88364fd2c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-20 15:39:33 +00:00
Johan Hedberg dfaafb204f Bluetooth: Use BIT() macro wherever possible
Instead of manually creating bit shifts for individual bits use the
BIT() macro that exists for this purpose.

Change-Id: I599ecc16b3a2cffe8a355e19816c405e51937e91
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-19 10:47:29 +02:00
Mariusz Skamra fc7bc7cffb Bluetooth: tester: Use common write without response command handler
There is no point having separate handlers for signed writes and
write without response commands because both call the same,
bt_gatt_write_without_response function.

Change-Id: Ib033ffb77e2123dd565e8f1119ef668253f810f9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-18 11:41:11 +01:00
Anas Nashif 1e57226ae6 boards: remove obsolete CTB board
This board is not supported and not available for general public.
Use the Quark SE CRB/Devboard instead.

Change-Id: Id0f8c08bbacb812ef00fe9502b4acecf4f31ffd7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-17 17:07:08 +00:00
Johan Hedberg a72d967d33 Bluetooth: GATT: Expose ATT error codes to application callbacks
Introduce BT_GATT_ERR macro to make it possible for application
callbacks to return exact ATT error codes.

Change-Id: I971536508e75036fbddc40b3f33e5201e11940bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-17 15:05:34 +00:00
Mariusz Skamra 89fbdeef9a Bluetooth: btp: Fix permission bits
This splits Authorization permission to Read with Authorization
and Write with Authorization.

Some attribites may be readable with no authorizarion, but writable
with authorization defined by a higher layer specification or be
implementation specific (eg. Server Characteristic Configuration
Descriptor).

Change-Id: I341a7095c1e8db1dea92cdeebf76c5a2307a49a1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-17 14:09:25 +00:00
Andrei Emeltchenko 92cd5c9529 drivers/nble: Decrease shell debug
Makes shell output readable by disabling extensive debug from UART
driver.

Change-Id: Ic8df252c8ca4abd6b021db11d266f4db80df4b09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 15:44:32 +00:00
Szymon Janc ea085c4b47 tests: Fix Bluetooth tests and samples platform blacklisting
To exclude platform platform_exclude=foo should be used and not
platform_whitelist=!foo.

Change-Id: I4cddcd3b73e0bd8c42a0726776f8237ebd79a6ae
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 15:06:53 +00:00
Szymon Janc 3e00c7ad0e tests: Simplify test_bluetooth configuration
Use common config for tests and use testcase.ini for defining micro
and nano kernel variants.

Change-Id: I47453cd49696dd496cc728cc1eb2eba9cf7f1c6c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 12:57:57 +01:00
Szymon Janc c5d2e76048 Bluetooth: Merge init_h5 into init test
There is no need to have spearate app for H5 testing as init test can
use multiple configuration targets.

Change-Id: I467b5939ae914e7c1ac22fdac24d8b0b6ed3f1cf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 09:40:30 +01:00
Anas Nashif 8afd0c993f samples: move bluetooth shell/init to tests
Combine both nano and micro tests and cleanup whitelisting
for the testcases to include all buildable boards.

Change-Id: I28d41b82fb60d75d4b172d9dd3ac7e71480053b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-14 19:25:31 +00:00
Johan Hedberg 1589a22650 Bluetooth: samples: Move init and shell to tests
The init, init_h5 and shell are not really samples but fit better in
the test category.

Change-Id: Id1a7ff31ad8767f858705bd952311cf64ff1f3f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 10:46:32 +02:00
Anas Nashif 790d2457c6 move benchmark applications to tests/benchmark/
Change-Id: I637331f89442816442c1cc4fbad72177bbe7e94b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 2250c4d397 tests: test_fifo: unify nano and micro tests into one directory
Manage this test using one testcase.ini for both nano and micro
kernel cases.

Change-Id: I9757299cdced17e7fcbfa1fbbbcf87693b48bf41
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif d746f2726f test_rand32: only microkernel version exist
eliminate one directory level since we only have one kernel variant.
Remove one level in the hierarchy.

Change-Id: I0924b5a40357b1a892f7ed3ecf512f617edc99a3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 7e44279399 test_ring_buf: only nanokernel version exist
eliminate one directory level since we only have one kernel variant.

Change-Id: I53dc387c15c6a6efc74f88c477015b2e422c5d6c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif bc19b72974 test_task_priv: only microkernel version exist
eliminate one directory level since we only have one kernel variant.

Change-Id: I72597e8253d027cd134dd58cc3051f21dce376d0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 1642796202 test_task_irq: only microkernel version exist
eliminate one directory level since we only have one kernel variant.

Change-Id: Ia9f457db372729f403be24c7a502a896623db5b9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 8bbf02d3f3 test_task: only microkernel version exist
eliminate one directory level since we only have one kernel variant.

Change-Id: I7d7c31e7dc5b98ad8ea0ad9e17a05694ac89770a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 65f538238b move driver samples to samples/drivers
All SoC specific driver tests go to samples/drivers.

Change-Id: Ia9aa2140465320a548504ddb7a44569e2d2af6bd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 74df249dd8 move net/buf test under tests/
This test should be under tests and is not a sample.

Change-Id: Ibb42207f72554516a650625a2cf4cc9cb7a0b021
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 18cc4a8ea3 move sample apps to top level directory under samples/
All 'real' sample application now reside under samples/ directly.
the nano and micro variants will be under the specific sample directory
and not split across the file system.

Change-Id: I0ddf929cff7a29749aa4944b4385af058d9cc74c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 13:08:44 -05:00
Anas Nashif 8290b4c795 move include directory for tests cases to tests/
Make the test case routines reside under tests.

Change-Id: Iea59a68e8b537954250d63923a88df267639e716
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:08:08 +00:00
Anas Nashif 0d63b2eada tests: move aio and i2c driver build tests
Move aio and i2c driver test cases to tests/ and change Makefiles
accordingly where applicable.

Change-Id: I28f24997f147dcd188973555df6024c44f3fb6e8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:07:30 +00:00
Anas Nashif 13b3727e6e tests: move kernel tests to tests/
Move all kernel testcases to tests/ and change Makefiles
accordingly where applicable.

Change-Id: I130cc3919174e93b7130d55fb101bed1d5d7552d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:06:33 +00:00
Anas Nashif 2e4de760be tests: move bluetooth tests to tests/
Move all bluetooth testcases to tests/ and change Makefiles
accordingly where applicable.

Also fix Makefile to make some variables overridable and reduce
level of whitelisting in testcase.ini.

Change-Id: Ia71ee1fbbb238c45280b1e3c4747ca2f748f5263
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:00:35 +00:00
Anas Nashif 7c35c6b524 tests: move crypto tests to tests/crypto
Put all tests under tests/crypto

Change-Id: Id64f0f39f7a7c6dba40161db3d8335febf545905
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:00:35 +00:00