Commit graph

7035 commits

Author SHA1 Message Date
Daniel DeGrasse
90b7fb0dd1 tests: drivers: disk: Add disk driver test
Adds a disk driver test, intended for the NXP USDHC driver but valid for
any disk device. The test performs multiple reads and writes to the
disk, and verifies that the driver does not write out of bounds to the
provided buffer.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:30:06 -05:00
Daniel DeGrasse
1067c2fdb7 tests: arch: arm: irq_vector_table Add correct ISR table for iMX.RT SOCs
RT1xxx SOCs using the GPT timer require a custom ISR table for the arm
irq_vector_table test, since they use a custom system timer implemented
using the GPT peripheral. Implement the required vector tables within
the irq_vector_table test to enable it to run.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Daniel DeGrasse
369a54514f tests: kernel: threads: Correct test assertion in thread_apis test
Thread APIs test for k_busy_wait incorrectly asserted that a delay of
100 us should produce a delay in cycles less than or equal to to 100 cycles
of the hardware clock. Since most hardware clocks are fast, this assertion
was valid, but it does not test for the actual delay.

Fix the assertion to verify that a delay of 100 us produces a delay in
cycles less than or equal to 100 us worth of hardware clock cycles.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Daniel Leung
c1ac125068 tests: coredump: skip acrn_ehl_crb
The coredump tests output quite a large amount of data into
the console. However, the ACRN console only has very limited
history (comparatively), such that twister is unable to
match the necessary strings to consider the tests passed.
So skip those tests on acrn_ehl_crb.

Fixes #40887

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-12-13 19:27:24 -05:00
Aymeric Aillet
50540ed594 driver: i2c: TCA9546A: Rename to TCA954x
Prepare the driver to upcoming support of more mux references.
Rename all TCA9546A related files to TCA954x.
Keep ti,tca9546a and ti,tca9546a-channel compatible
for backward compatibility reasons.
New tca954x-base binding embedding common properties,
tca9546a binding inherits from it and define its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Kent Hall
ce95e033fb tests: drivers: counter: Update tests for STM32F4 timer counter driver
Updates counter driver test suite to support STM32F4 timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Johann Fischer
5296339fde usb: rework to use macro STRUCT_SECTION_FOREACH
Replace deprecated macro USBD_CFG_DATA_DEFINE by
USBD_DEFINE_CFG_DATA which places usb_cfg_data structures
in specific iterable section.

Replace __usb_data_start, __usb_data_end usage patterns
  size_t size = (__usb_data_end - __usb_data_start);
  for (size_t i = 0; i < size; i++) {...}
by
  STRUCT_SECTION_FOREACH(usb_cfg_data, ...) {...}

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Carles Cufi
0b96dd419d tests: lib: mpsc_pbuf: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c: In function
'item_put_data_overwrite':
/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c:497:3: error:
converting a packed 'struct test_data_ext' pointer (alignment 1) to a
'uint32_t' {aka 'const unsigned int'} pointer (alignment 4) may result
in an unaligned pointer value [-Werror=address-of-packed-member]
  497 |   mpsc_pbuf_put_data(&buffer, (uint32_t *)&item, len);

To avoid the warning, as well as several others related to the same
problem, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi
cfbaac6733 tests: kernel: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c: In
function 'test_main':
/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c:1024:17:
error: converting a packed 'k_thread_stack_t' {aka 'struct
z_thread_stack_element'} pointer (alignment 1) to a 'struct
z_x86_thread_stack_header' pointer (alignment 4096) may result in an
unaligned pointer value [-Werror=address-of-packed-member]
 1024 |  hdr = ((struct z_x86_thread_stack_header *)ztest_thread_stack);

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Flavio Ceolin
f3718ed701 tests: pm: s/power/pm tag
Use tag "pm" in power management tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Flavio Ceolin
a0f58aa7c9 tests: pm: power_mgmt: Fix testcase name
Fix test case name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Flavio Ceolin
c4918050f6 tests: pm: Add multicore test
A simple test respects per cpu power states.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Johann Fischer
1339a404d2 tests: build_all: remove display controller nodes from sensor test
Remove unused display controller nodes from sensor test.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
307c13b218 drivers: display: remove unused Kconfig options
remove unused options SDL_DISPLAY_* and DUMMY_DISPLAY_*.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
2d175d14f3 drivers: display_dummy: rework to obtain configuration from devicetree
Add bindings for dummy display controller.
Rework dummy display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Lixin Guo
51cd1fcde6 tests: syscall: fix low value of CONFIG_MAX_THREAD_BYTES
Failed to build tests/kernel/mem_protect/syscalls on fvp_baser_aemv8r_smp
because the default value of CONFIG_MAX_THREAD_BYTES is too low.
So manually set the value to 5 in test case's prj.conf file.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-09 19:46:25 -05:00
Erwan Gouriou
f7f67ded53 tests/drivers/clock_control: stm32u5: Add tests on clock configs
Add a test suite to check various clocks configurations.
Test is based on HAL functions that read clock configuration
from registers.
One test is build only, as there is no available hw to test it today.
Others can be tested on target.

More configurations and test points could be added in future.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:45:41 -05:00
Henrik Brix Andersen
f499559434 drivers: can: deprecate the use of CAN-specific error return values
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Lukasz Majewski
f3a246c8cb test: pwm: Remove range check when PWM signal has inverted polarity
There shall be no special case for inverted PWM pulse when checking
if the captured value is correct.

The output signal inversion is done in HW (at least for stm32h7xx)
SoC. The measured value of the pulse shall be the same - no matter
if we invert the signal or not (as measuring also takes into account
the inversion of the output/input signal).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-09 11:07:45 -06:00
Lukasz Majewski
a3ead3c565 test: pwm: Pass information regarding polarity to PWM setup functions
Without this change the information about PWM polarity is lost when
flags are passed, as the out.flags is set according to PWM description
in the DTS.

For example in: pwms = <&pwm2 2 0 PWM_POLARITY_NORMAL>  the out.flags
is always set to PWM_POLARITY_NORMAL.

However, some tests - like 'test_pulse_capture_inverted' require testing
if PWM driver is able to invert the generated signal.

After this change, the generated waveform (from the TIMx pin) is
inverted.

Tested on: Nucleo 'nucleo_h743zi' board (TIM2 ch2 -> out, TIM5 ch1 <- in)

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-09 11:07:45 -06:00
Lukasz Majewski
22ad6af5e6 test: pwm: Add nucleo_h743zi (stm32h7xx) board to loopback test
This commit allows testing the PWM (timers) on the
nucleo_h743zi development board.

The HW setup for testing:
Timer2 (channel 2) as PWM signal generator -> CN11 connector
(PIN 30)

Timer5 (channel1) in Capture mode to measure the pulse
duration -> CN11 connector (PIN28)

Such setup allows easy HW loopback connection (just short cut two
consecutive pins/soldering vias on the devel board's PCB).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-09 11:07:45 -06:00
Jordan Yates
749b112fa8 tests: devicetree: test LINKER_DT_NODE_REGION_NAME
Add a new application for testing non-core devicetree functionality.
Add tests for the default and fallback case of
`LINKER_DT_NODE_REGION_NAME`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-12-09 16:23:03 +01:00
Peter Johanson
a5ad94f20f driver: gpio: mcp23xxx: Refactor to generic.
Refactor the mcp230xx driver to generically also support
SPI IO expanders, renaming it to mcp23xxx in the process.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2021-12-08 08:55:28 -05:00
Mark Holden
1a697ccf59 coredump: add support for RISC-V
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for RISC-V

Signed-off-by: Mark Holden <mholden@fb.com>
2021-12-08 08:54:32 -05:00
Daniel DeGrasse
ba462bbb74 boards: mimxrt1070_evk_cm7: Enable DMA controller on RT1170 EVK
DMA controller is enabled and tested for cortex M7 core. The M7 core was
tested on the loop and channel link transfer tests.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
4d4939c4e1 boards: mimxrt1060_evk_cm7: Enable DMA controller on RT1160 EVK
DMA controller is enabled and tested for cortex M7 core. The M7 core was
tested on the loop and channel link transfer tests.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
81682a7c09 tests: regulator_pmic: Added PMIC regulator test
Test verifies that i2c pmic regulator can be disabled or enabled using
the regulator API. Verifies PMIC output voltage using ADC.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Pieter De Gendt
18647f58e9 tests: drivers: counter: Generic seconds counter test
This commit reworks the CMOS test to a generic seconds
counter test.

And it adds a test case for the iMX RT1064 SNVS RTC.

Tested with mimxrt1064_evk

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-12-07 09:45:43 -06:00
Emil Gydesen
912c5f29ed Bluetooth: Shell: Update audio.conf to use BT_FILTER_ACCEPT_LIST
Update the configuration file to use BT_FILTER_ACCEPT_LIST
instead of the deprecated BT_WHITELIST.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-07 09:39:59 -06:00
Dominik Ermel
5036043268 fs: fat_fs: Set FS_MOUNT_FLAG_USE_DISK_ACCESS on mount
Mounting FAT FS will set FS_MOUNT_FLAG_USE_DISK_ACCESS to the flags
of an object serving the mount point.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-12-06 08:08:26 -05:00
Lixin Guo
c02d39ea57 tests: userspace: add support for K_OBJ_CONDVAR
add support for K_OBJ_CONDVAR in test_alloc_kobjects()
This improves the code coverage.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-06 08:06:45 -05:00
Lixin Guo
350a13566e tests: userspace: add support for validating invalid objects
test userspace API with invalid kernel objects.
This improves code coverage.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-06 08:06:45 -05:00
Gerard Marull-Paretas
7bfd0976aa pm: state: PM_STATE_DT_ITEMS_LEN->DT_NUM_CPU_POWER_STATES
Rename PM_STATE_DT_ITEMS_LEN to DT_NUM_CPU_POWER_STATES to make its
purpose more clear. This macro could be made part of a Devicetree API
for PM in the future.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
5ab7d35e7c pm: state: PM_STATE_DT_ITEMS_LIST->PM_STATE_LIST_FROM_DT_CPU
Rename the PM_STATE_DT_ITEMS_LIST macro to PM_STATE_LIST_FROM_DT_CPU to
make its purpose more clear. Similar naming scheme is found e.g. in the
GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
fa96955305 pm: state: PM_STATE_INFO_DT_ITEMS_LIST->PM_STATE_INFO_LIST_FROM_DT_CPU
Rename the PM_STATE_INFO_DT_ITEMS_LIST macro to
PM_STATE_INFO_LIST_FROM_DT_CPU to make its purpose more clear. Similar
naming scheme is found e.g. in the GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Johann Fischer
35691d21d8 tests: thread_apis: fix cast to smaller integer type
Clang 12.0.0 complains about
"cast to smaller integer type 'enum control_method' from 'void *'
[-Werror,-Wvoid-pointer-to-enum-cast]".
Cast it to intptr_t type first.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-04 12:09:54 +01:00
Gerard Marull-Paretas
76aa706461 tests: subsys: logging: log_msg2: disable some tests on qemu_cortex_a9
logging.log_msg2_64b_timestamp and logging.log_msg2_fp_64b_timestamp are
currently failing on qemu_cortex_a9 due to #39978. Disable them on that
platform until the issue is fixed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-02 23:55:23 -05:00
Carles Cufi
e3c6538344 tests: logging: Disable log2 deferred tests on qemu_cortex_a9
As described in #39978, an issue is currently preventing those tests
from executing correctly. Disable them until a fix is found.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-02 06:27:20 -06:00
Gerard Marull-Paretas
befac2a352 tests: subsys: pm: add device busy API test
Add a test case for the device PM busy API (previously part of kernel
device tests).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-02 10:53:39 +01:00
Gerard Marull-Paretas
618609dc2c tests: kernel: device: remove PM related tests
The PM subsystem is tested in tests/subsys/pm, the removed tests were
not relevant for devices. The test_build_suspend_device_list test has
been renamed to test_device_list since the API is not strictly related
to PM (and does not depend on it).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-02 10:53:39 +01:00
Lingao Meng
7464c8a923 Bluetooth: Mesh: Add build multi extened advertising test
Add new testcase to tests/bluetooth/mesh that builds mesh with
multi advertising sets.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Ramiro Merello
7dce757233 tests: lib: json: Added tests array decoding, encoding and int limits
Added tests for:
- json_arr_parse
- json_arr_encode_buf
- integer limit testings

Signed-off-by: Ramiro Merello <rmerello@itba.edu.ar>
2021-12-01 12:21:19 -05:00
Krzysztof Chruscinski
f2e75a7140 testsuite: busy_sim: Add callback to the interrupt
Add optional callback which is called from the busy
interrupt context.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-01 10:00:50 +01:00
Stephanos Ioannidis
e996db8138 tests: cpp: libcxx: Set minimum RAM requirement for full newlib test
This commit sets the minimum RAM requirement for the full newlib test
(`cpp.libcxx.newlib`) to 24 KiB so that only the target platforms that
can provide sufficient RAM area for the newlib heap are selected.

In case of the newlib full variant, the minimum required newlib heap
size, specified by CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE, is 8192.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-11-30 14:36:44 -05:00
Kim Bøndergaard
ee6c552805 boards: frdm_k64f: Solve conflict between UART3 and enet
Arduino compatible boards should have a working UART on pin 0 & 1.
On frdm_k64f this is handled by uart3

Unfortunately pinmuxing of uart3 was destroyed when enabling NETWORKING,
because the uart3 RX/TX pins was reconfigured for 1588 timers.

1588 timers are enabled by the enet child node, ptp which by some reason
is enabled by default.
1588 timers aren't needed in most cases when ethernet is being used,
so this fix ensures ptp is by default disabled. Likewise pinmuxing of
the 1588 timer functionality is now dependant of ptp being active

Signed-off-by: Kim Bøndergaard <kim.boendergaard@escoglobal.com>
2021-11-30 11:08:15 -06:00
Daniel DeGrasse
0aeb69ee8c boards: mimxrt10xx: Added support for LPSPI DMA on RT10xx series
Add support for LPSPI DMA mode on RT1064, RT1060, RT1050, RT1024,
RT1020, RT1015, and RT1010 evaluation boards. Update tests to match.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-11-30 10:57:17 -06:00
Carlo Caione
26856ca878 test: device: Specify address and size cells.
The test is wrongly assuming that all the archs have #address-cells =
<1> and #size-cells = <1> at the DT root. This is not always true, and
it makes the test failing for AArch64. Fix the wrong assumption.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-29 19:41:27 -05:00
Anas Nashif
d4962db828 tests: m2gl025_miv: exclude slow platform from some tests
This platform is slow on some tests and times out on non-hardware
related tests, so exclude it or increase timeout for some of the tests
to avoid false negatives in the test results due to timeouts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-29 19:39:38 -05:00
Robert Lubos
2eb67b2fe4 tests: net: Add custom 802154 L2 tests
Add some basic custom 802154 L2 tests, verifying that a custom L2 can be
integrated with Zephyr properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-29 18:55:13 -05:00
NingX Zhao
cb4a629bc8 tests: removing incorrect testcases of poll
These two test cases both are fault injection test cases,
and there are designed for testing some negative branches
to improve code coverage. But I find that this branch
shouldn't be tested, because the spinlock will be locked
before a procedure performs here, and then it will trigger
an assert error and the process will be rescheduled to the
handler function, and terminated the current test case,
so spinlock will never be unlocked. And it will impact
the next test case in the same test suite(the next testcase
will be never get spinlock).

Signed-off-by: NingX Zhao <ningx.zhao@intel.com>
2021-11-29 18:26:02 -05:00