Commit graph

5361 commits

Author SHA1 Message Date
Hake Huang f02454f68a tests: update edma test pattern
align test pattern with testcase.yml

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-01-14 16:14:51 -06:00
Andrzej Puzdrowski d9c308cce9 tests/subsys/dfu/mcuboot: support mcuboot max alignment
MCUboot support flash write-bock-size up to BOOT_MAX_ALIGN.
This patch takes this into account.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-01-14 18:03:38 +01:00
Andrzej Puzdrowski 049dac2a8a modules: introduce MCUBOOT_BOOTUTIL module
Some parts of subsys/dfu/boot code are re-implementations of
what is implemented in the MCUBoot repository.

Mcuboot's repository already provide implementation of function
required for application for interact with the MCUboot.

This patch introduces new MCUBOOT_BOOTUTIL module which covers
common code which is used in the bootloader and the chainnloaded
application.

dfu/boot: use MCUBoot's source code

Module was reworked so it start using MCUBoot's
bootutil_public API instead of copied code.

Reworked boot_is_img_confirmed() used MCUBoot's API
for determine image_ok flag.

mcuboot_shell switchd to use MCUboot's boot_read_swap_state_by_id()
This is MCUBoot function, use it for avoid linking conflict.

test/subsys/mcuboot: fix `test_write_confirm`

dfu/boot library was reworked so it uses MCUboot's bootutil_public
library whenever it can.
The library required that image was marked as copy-done before it
can be pending.
This patch adds such mark which fixes the test.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-01-14 18:03:38 +01:00
Fabio Baltieri 4a4c63519d net: if: check for multicast address already registered
Add a check to stop a multicast address to be registered multiple times.
This can happen if the application is using net_if_ipv6_maddr_add()
directly.

Tested on the existing bluetooth/ipsp sample:

<wrn> net_if: Multicast address ff02::1 is is already registered.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-01-14 16:57:07 +02:00
Pavel Vasilyev 561a8e4f0e Bluetooth: Mesh: Break up mesh settings
The mesh settings.c module is a giant piece of code responsible for
storing the mesh stack configuration. Such approach makes it difficult
to control the data to be stored, breaks the stack modules'
encapsulation by forcing them to reveal the internal kitchen, which
leads to unpleasant issues such as #19799.

This commit moves the responsibility of storing the configuration
to corresponding modules while keeping control of the moment of storing
the configuration and of starting the stack after the settingss loading
is completed.

This doesn't introduce any abstraction between the mesh settings.c and
other modules as it will add more complexity and overhead than necessary
for the actual task.

Fixes #19850

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-01-14 16:38:50 +02:00
Kumar Gala 3befd7d45f cleanup: rename sanitycheck references to twister
Cleanup references to sanitycheck that should now be twister.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-14 07:50:52 -06:00
Hake Huang 129ddfe5c6 tests: fpu_sharing fix print size issue
As FPU enalbed the printf code size is changed,
so increase main stack size to make test pass on NXP RT platforms

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-01-14 07:30:30 -05:00
Jakub Rzeszutko 91b01ce703 shell: internal api update: history module
Add prefix z_ to internal functions handling history feature.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-01-14 12:07:25 +01:00
Peter Bigot e017441ca0 boards: remove has-be32k from SPI NOR mtd nodes
Use of this property has no effect since it was by SFDP erase data in
Zephyr 2.4.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-13 11:58:37 -06:00
Enjia Mai 489223146f tests: ztest: add test cases and example for fatal handler hook
Add testing for fatal and assert handler hook feature, and examples
of how to use it.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-01-13 09:05:31 -05:00
Hake Huang 2263462aee test: resude sys_kernel loops in small ram
need ram up to 36M for twr_ke18f so reduce the loops

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-01-13 07:38:07 -05:00
Lukasz Maciejonczyk ad360c42af net: openthread: Make radio workqueue stack size configurable
Add Kconfig option for configuring OpenThread radio transmit workqueue
stack size.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-01-13 11:29:30 +02:00
Ying ming ab68d88c53 test: mslab: improve coverage for mslab
Improve branch coverage for k_mem_slab_init api.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-12 22:16:33 -05:00
Henrik Brix Andersen 90825a8812 tests: drivers: pwm: add PWM loopback test
Add test cases for the PWM capture API using PWM signal loopback.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-12 19:43:06 +01:00
Jukka Rissanen 408a6ceff3 tests: net: tcp2: Add tests for TCP recv data queueing
Make sure that received and out-of-order TCP segments are queued
until we receive proper segments.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-01-12 13:40:05 +02:00
Aastha Grover b644432720 boards: x86: acrn : Add configurations for acrn_ehl_crb
Adding acrn configurations specific to the platform
on which acrn boots zephyr, Only the EHL specifc
configurations for now. Keeping the HW clock frequency to
1900Mhz for EHL and using the new APIc timer driver.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2021-01-11 16:11:59 -05:00
Krzysztof Chruscinski 96c027a02b tests: drivers: uart: Add gpio_loopback harness to test config
Added gpio_loopback to indicate that test requires pins to be
shorten. This allows to filter out tests on setup which does
not have pin setup.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-01-10 15:38:21 -05:00
Xinrong Han 8eaa624bee tests: subsys: canbus: isotp: conformance: add error checks of isotp_send()
Validate that isotp_send() succeeds.

Fixes #29943

Signed-off-by: Xinrong Han <hanxr19@mails.tsinghua.edu.cn>
2021-01-10 12:43:36 -05:00
Flavio Ceolin 72a7e97208 tests: dts: Test DT_PROP_LEN_OR macro
Test if the macro fallback properly for a default value if the
property does not exists.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-10 12:43:08 -05:00
Dominik Ermel 738bddf765 tests: fs: Add tests for fs_tell/fs_seek ENOTSUP error
The fs_seek and fs_tell are expected to return -ENOTUSP if file system
driver lacks implementation of said funcions.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-09 08:33:24 -05:00
Thomas Stranger 13a5d05757 boards: nucleo_g071rb: enable adc support
Enable ADC on Nucleo G071RB board(ADC1 channel 0 and 1)

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-01-07 15:50:22 -06:00
Flavio Ceolin 2b49266861 power: Add notifier API
Get rid of weak functions adding a new API to register an object to
receive notifications when the system changes power state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-07 12:40:19 -05:00
Jefferson Lee 35c5fbe554 boards: Add the Arduino Nano BLE 33
This commit adds the board definition files
needed to support the Arduino Nano BLE 33.
Tested: the following have been verified with
my logic analyzer.
* Serial peripherals (UART, I2C, SPI)
* USB
* RTC

Untested:
* PWM. In theory it should work but I don't
have a good enough logic analyzer to test this

* RTC's. The board doesn't have a backup battery.
The peripherals are enabled for modding another
battery in the device tree.

Signed-off-by: Jefferson Lee <jeffersonlee2000@gmail.com>
2021-01-07 09:46:22 -06:00
Peter Bigot d12a99588b lib: cbprintf: remove cbprintf_arglen
This function was designed to support the logging infrastructure's
need to copy values from va_list structures.  It did not meet that
need, since some values need to be changed based on additional data
that is only available when the complete format specification is
examined.  Remove the function as unnecessary.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 9e5b50afc8 tests: cbprintf: avoid checkpatch diagnostic
checkpatch wants parameters to IS_ENABLED() to be Kconfig constants,
i.e. ones that start with CONFIG_.  Avoid the whinage.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 5f493c669d tests: cbprintf: make skip messages consistent
TC_PRINTF doesn't append a newline, so the skip messages sometimes ran
into the test result message.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot 928183b8ca tests: cbprintf: sanitize language
Replace SANITYCHECK flag with TWISTER.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 14:02:06 +01:00
Peter Bigot acd43cbaac net: timeout: refactor to fix multiple problems
The net_timeout structure is documented to exist because of behavior
that is no longer true, i.e. that `k_delayed_work_submit()` supports
only delays up to INT32_MAX milliseconds.  Nonetheless, use of 32-bit
timestamps within the work handlers mean the restriction is still
present.

This infrastructure is currently used for two timers with long
durations:
* address for IPv6 addresses
* prefix for IPv6 prefixes

The handling of rollover was subtly different between these: address
wraps reset the start time while prefix wraps did not.

The calculation of remaining time in ipv6_nbr was incorrect when the
original requested time in seconds was a multiple of
NET_TIMEOUT_MAX_VALUE: the remainder value would be zero while the
wrap counter was positive, causing the calculation to indicate no time
remained.

The maximum value was set to allow a 100 ms latency between elapse of
the deadline and assessment of a given timer, but detection of
rollover assumed that the captured time in the work handler was
precisely the expected deadline, which is unlikely to be true.  Use of
the shared system work queue also risks observed latency exceeding 100
ms.  These calculations could produce delays to next event that
exceeded the maximum delay, which introduced special cases.

Refactor so all operations that use this structure are encapsulated
into API that is documented and has a full-coverage unit test.  Switch
to the standard mechanism of detecting completed deadlines by
calculating the signed difference between the deadline and the current
time, which eliminates some special cases.

Uniformly rely on the scanning the set of timers to determine the next
deadline, rather than assuming that the most recent update is always
next.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 11:14:38 +02:00
Christian Taedcke c6c5a371a7 tests: adc: Add support for lpcxpresso55s28 in the ADC test
Add lpcxpresso55s28 board to the ADC test to prevent compilation issues.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-01-05 15:38:04 -06:00
Enjia Mai 478ddde6cc tests: skip memory mapping execution testing of qemu_x86_64 coverage
Skip the memory mapping execution test case when code coverage enabled
for qemu_x86_64 platform. See issue #30434.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-01-05 10:32:38 -08:00
Wolfgang Puffitsch dc6ef26ffd tests: Check return value of settings_runtime_set in ll_settings test
Make sure errors returned by settings_runtime_set are caught.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2021-01-05 16:51:19 +02:00
Jordan Yates bd2c974c0c tests: net: buf: validate push & remove impl
Add test cases for checking the previously untested `net_buf_push_*`
functions in terms of the new `net_buf_remove_*` functions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-05 14:31:13 +02:00
Andy Ross eb3734168a tests/kernel/fatal/exception: Remove ticked kernel from stack sentinel test
The "sentinel" variant of this test runs the same code, but enables
the stack sentinel feature.  Inexplicably, it's also disabling
TICKLESS_KERNEL, forcing a timer interrupt at every tick boundary.

That doesn't seem to be required for any test functionality I can see.

And worse, by changing that setting without adjusting the tick rate,
it runs afoul of more modern platforms which were designed with
tickless operation in mind.  Specifically, the intel_adsp platforms
have a default tick rate of 50 kHz, which is just too fast for
reasonable operation.  It leaves almost no time available for
application code and something falls behind and fails.

Just remove it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-01-04 20:40:55 -05:00
Thomas Stranger 5aefefef20 boards: nucleog071rb enable spi
Enable SPI on Nucleo G071RB and
add this board in spi_loopback test case.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-01-04 17:52:05 -05:00
Henrik Brix Andersen 35def71d13 test: drivers: pwm: api: allow test to run with NXP FlexTimer PWM
Allow the PWM API tests to run with the NXP MCUX FlexTimer PWM shim
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-04 12:15:20 -05:00
Nicolas Pitre aeda6ccdd8 lib/os/heap: fix realloc issues
If the new size amounts to the same number of chunks then:

- If right-chunk is used then we needlessly allocate new memory and
  copy data over.

- If right-chunk is free then we attempt to split it with a zero size
  which corrupts the prev/next list.

Make sure this case is properly handled and add a test for it.

While at it, let's simplify the code somewhat as well.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-01-04 11:12:05 -05:00
Ying ming 49e992ac8c test: workqueue: imporve coverage for workqueue
Add module testcase of function k_work_submit_to_user_queue().

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-04 16:25:40 +01:00
Flavio Ceolin 8fe3866e19 power: rename _pm_power_state_ -> pm_power_state
Leftover from old renaming commits. This function is not private and
should not start with underscore.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-04 09:02:23 -05:00
Daniel Leung c6253fbe1a tests: latency_measure: fix mis-matched timing start/stop calls
Inside the semaphore tests, there are mis-matched pair of timing
start/stop calls. One called start without calling stop, another
one calling stop twice. So fix them.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-01-04 12:15:30 +01:00
Enjia Mai 3026df2a24 tests: spinlock: add some error test cases
Add some error test cases for spinlock, include:
1.Validate indentical spinlock cannot be used recursively.
2.Validate unlocking incorrect spinlock will trigger assertion.
3.Validate releasing incorrect spinlock will trigger assertion.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-12-27 18:19:42 +01:00
Andy Ross c2c6bee036 drivers/timer: Remove legacy APIC driver
For a while now, we've had two APIC drivers.  The older was preserved
initially as the new (much smaller, "new style") code didn't have
support for Quark interrupt handling.  But that's long dead now.  Just
remove it.

Note that this migrates the one board using this driver (acrn) to
CONFIG_APIC_TIMER instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-27 18:19:17 +01:00
Ningx Zhao 187697c2d7 tests: stack: add some testcases
Add some testcases for stack source code coverage,
and add a fatal handler function to hand the error
by null parameter.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-12-27 18:17:22 +01:00
Christopher Friedt 05a08a3b66 tests: kernel/k_malloc: tests for k_aligned_alloc
This change adds tests for k_aligned_alloc.

Fixes #29519

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:17:07 +01:00
Martin Åberg 6788d867f2 tests: can.frame: use enums for rtr and id_type
Make use of the the enums for rtr and id_type as described in
drivers/can.h.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-12-27 18:16:58 +01:00
Martin Åberg 265d848cbb tests: can.frame: enable can test on qemu_leon3
Enable CAN frame test which does not require a driver implementation
or a network.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-12-27 18:16:58 +01:00
Francois Ramu 64da50f45b tests: drivers: dma: adapt test applications on stm32l476 nucleo board
The dma test applications for MEM-to-MEM transfers are modified
to run on the stm32l476 with a DMA.
The CONFIG_DMA_LOOP_TRANSFER_DRV_NAME is either DMA_1 or DMA_2
CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 1 to 7 for DMA_1
CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 1 to 5 for DMA_2

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-12-27 18:16:47 +01:00
Francois Ramu 0a3437d4ca tests: drivers: dma: adapt test applications on stm32wb55 nucleo board
The dma test applications for MEM-to-MEM transfers are modified
to run on the stm32wb55 with a DMAMUX
loop_transfer on any CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR from 0 to 13
chan_blen_trasnfer on CONFIG_DMA_TRANSFER_CHANNEL_NR_0 from 0 to 13
and on CONFIG_DMA_TRANSFER_CHANNEL_NR_1 from 0 to 13

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-12-27 18:16:47 +01:00
Francois Ramu 445c8936e7 tests: drivers: dma adapt the dma tests applications for stm32 devices
It adds flexibility to test different dma channels
The chan_blen_transfer is modified
like the loop_transfer application to support stm32xx devices
with dma and/or dmamux.
On the stm32 devices, the first dma channel is 1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-12-27 18:16:47 +01:00
Christopher Friedt c313828eaf tests: gpio_api_1pin: support for emulated GPIO
This adds support for emulated GPIO (CONFIG_GPIO_EMUL=y) and
additionally allows BOARD=native_posix and
BOARD=native_posix_64 to run the gpio_api_1pin test suite.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00
Christopher Friedt cc537b5a3a tests: gpio_basic_api: support for emulated GPIO
This adds support for emmulated GPIO (CONFIG_GPIO_EMUL=y) and
additionally allows BOARD=native_posix and
BOARD=native_posix_64 to run the gpio_basic_api test suite.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00