Commit graph

1790 commits

Author SHA1 Message Date
Alberto Escolar Piedras
40eae69e58 tests: debug/thread_analyzer: Fix platform filter
Today the thread analyzer depends on !ARCH_POSIX,
so this filter needs to filter any board for this architecture
not just native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-11 10:30:49 +02:00
Daniel Leung
2ef8c4e74f tests: debug/thread_analyzer: add some build tests
Add some build tests for thread_analyzer to catch build issues
at CI.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-08-09 17:58:03 +01:00
Krzysztof Chruściński
70260720e9 tests: ipc: pbuf: Disable data cache management
Packet buffer is designed to run writer and reader code on two CPUs.
The write function cannot be preempted by the read function in a CPU,
or the cache management could result in data corruption. In the tests,
the reader and the writer are executed on a single CPU. Disable data
cache management to prevent potential data corruption.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-09 09:54:29 +02:00
Katarzyna Giądła
8753534077 tests: subsys: storage: flash_map: Extend timeout storage.flash_map.mpu
The test `storage.flash_map.mpu` for `nrf52840dk/nrf52840` fails
althought the output is correct. Time to test execution is not enough.
This change extend test execution timeout.

Signed-off-by: Katarzyna Giądła <katarzyna.giadla@nordicsemi.no>
2024-08-06 09:17:20 +01:00
Mark Holden
c35f6d1cac coredump: Add test for threads core dump config
Add z_test which uses new configs to capture multiple
threads in a core dump and with all of the context
necessary to debug the threads.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Fabio Baltieri
61129d8fd2 input: longpress, keymap: use an explicit callback name
Use an explicit callback name so that multiple instances of this do not
result in a:

redefinition of '_input_callback__longpress_cb'

error. This used to work when it was using unique generated wrappers,
but now it needs an index in the callback name.

Use it in one of the API tests as well, just in case.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-31 12:55:11 +02:00
Fabio Baltieri
716fa268f4 input: add a user_data pointer to the callback
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-31 12:55:11 +02:00
Pieter De Gendt
92019b1dac emul: Support UART device emulation
Add support to the existing UART emulated bus, to have a client device
emulator.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-30 18:28:17 +01:00
Tomi Fontanilles
48d69b4e7e tests: modem: cmux: add missing timeout param
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
https://github.com/zephyrproject-rtos/zephyr/pull/74325.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-07-30 11:44:04 +02:00
Dominik Ermel
1b5f986404 tests/stream_flash: Replace one-line config overlays with extra_configs
The commit removes one-line overlay files, when copyrights excluded,
with direct Kconfig options selection inside testcase.yaml.
The overlays have been removed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-07-29 14:23:11 +02:00
Bjarki Arge Andreasen
372c7183ef modem: pipe: Add explicit timeout to sync APIs
The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.

This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-07-29 14:14:42 +02:00
Ren Chen
aa3470ba7e tests: usb: desc_sections: raise the description span to 201
Raise the descriptor table span to 201 due to the inclusion of the USB
configuration descriptor.

Tested with:
$ west build -p -b it82xx2_evb tests/subsys/usb/desc_sections
  -T usb.desc_sections

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2024-07-28 07:30:30 +03:00
Jordan Yates
c9b1daa7ae tests: fs: fat_fs_api: disable flash disk in RAM test
Disable the flash disk driver in the RAM driver test to prevent the
test using the wrong disk in the tests.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-27 15:19:14 +03:00
Johann Fischer
28b2051bda usb: device_next: add support for configuration string descriptor
Change USBD_CONFIGURATION_DEFINE macro to take the address of a string
descriptor node as an argument. This is a breaking change for macro
users, but quite convenient and easy to implement.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-27 15:06:09 +03:00
Yong Cong Sin
58f66623aa tests: gdbstub: add build-only test
Add build-only test for existing boards.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-07-27 10:42:59 +03:00
Yong Cong Sin
b97d97ff17 tests: gdbstub: minor refactor to the testcase.yaml
Change the `platform_allow` to multi-line format so that newly
supported archs/boards can be added as a new line.

Refactor the tags out to `common`, and add
`CONFIG_ARCH_HAS_GDBSTUB` filter

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-07-27 10:42:59 +03:00
Anas Nashif
84221f5219 tests: display: fix test identifier
Fixed test identifiers and places in correct area.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-18 06:47:57 -04:00
Anas Nashif
366ddac79e tests: sensing: fix identifier
Fix identifier of test and add to MAINTAINERS file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-18 06:47:57 -04:00
Daniel Leung
0b76fd92fc tests: logging/dictionary: pytest only looks at last output
There are instances where on hardware tests would result in
multiple dictionary logging blocks. This is usually due to
flashing and running via twister in separate steps. Once
flashing is done, the device starts running and sending
logging string to output, but twister is not ready to read
them, thus leaving the strings in the host's UART buffer.
Then twister starts its testing run by resetting the device
which results in another dictionary logging block to show
up. So the pytest script has to be updated to only look at
the last dictionay logging block.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-09 17:25:22 -04:00
Daniel Leung
ea109ce39b tests: logging/dictionary: filter for backend
Since only the UART backend supports output in hexidecimal form
with dictionary logging, so filter for that or else the pytest
would fail due to none, or wrong captured output.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-09 17:24:02 -04:00
Luis Ubieda
5686ac48cc tests: rtio: workq: Add testsuite to exercise RTIO work-queues
Basic tests demonstrating ability to decouple, batch-submit, preempt
and keep track of used items.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Krzysztof Chruściński
4a53c69fa5 tests: logging: log_api: Fix logging.frontend.only.rt_filtering
When NO_BACKENDS was not defined then log backends were
initialized (even though not used). During the initialization
filters for that backends were configured and because of that
messages were not filtered out as expected.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-07-09 14:01:56 +02:00
Pieter De Gendt
5e4e51de78 tests: zbus: unittests: Add CMAKE_LINKER_GENERATOR case
Add a test case where the CMAKE_LINKER_GENERATOR is used.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-09 12:02:51 +02:00
Evgeniy Paltsev
4b9828c2a8 tests: logging: fix build error
Currently we get the build error when building
'tests/subsys/logging/log_backend_uart':

error: static_assert expression is not an integral constant expression
BUILD_ASSERT(strlen(TEST_DATA) < SAMPLE_DATA_SIZE);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It can be easily workarounded by using sizeof instead of strlen
to calculate string size.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-07-09 08:49:05 +02:00
Evgeniy Paltsev
edfb690587 test: logging: dictionary: fix build error
In `tests/subsys/logging/dictionary` we don't include stdio.h
header but use standard stream definitions (i.e. `stdout`)
which cause build issues (if the minimal libc is used).

Fix that.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-07-09 08:48:24 +02:00
Alberto Escolar Piedras
a912bb6f14 tests/subsys/ipc/pbuf: Filter out partial native/posix arch builds
Some AMP native simulator targets (like the nrf5340bsim net core)
will not produce a final executable if only one of the core images
is built, when IPC is enabled, as those images require the other
core image to be able to link.
So this test cannot be run when targetting that core alone
(without using sysbuild to build the other).

Let's filter out these targets to avoid twister building
but finding itself with no executable and error out badly
as it cannot run the test.

The filter condition is effectively:
If building for a native target, there must be an .exe being
produced.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-07-06 17:03:26 +02:00
Daniel Leung
4ffb813110 tests: logging/dictionary: wait longer for first output
Some hardware takes longer to boot before any output is visible
from the app. So lengthen the initial timeout on waiting for
any output.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-04 18:00:47 -04:00
Daniel Leung
ddfc39bd63 tests: logging/dictionary: fix pytest log parsing regex
When doing device testing, there may be some other characters
being printed before the dictionary logging header string.
Also the delay boot banner may also be there. So change
the regex to ignore those them.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-04 18:00:47 -04:00
Daniel Leung
04c9637db7 tests: logging/dictionary: fix pytest when built with sysbuild
With sysbuild, the test app is actually built under another
layer of directory where the dictionary JSON file will reside.
Instead of simply using dut.device_config.build_dir, use
dut.devive_config.app_build_dir instead, which takes into
account of that.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-04 18:00:47 -04:00
Daniel Leung
9a08fdc1df tests: logging/dictionary: enable pytest to test output
Add pytest to test the output of dictionary logging to make sure
the encoded logs can be decoded back into strings, and to also
make sure the decoded logs have the expected strings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-28 21:14:14 +02:00
Daniel Leung
d1c222a7c7 tests: logging: copy dictionary logging sample into tests
This is in preparation for introducing pytest to test the output
of dictionary logging. Code is the same, but the testcase.yaml
is trimmed to only those that can be tested.

Note that a copy is made instead of moving the whole sample over
is simply due to various documentation having references to
the sample. Since RST files under tests/ are not parsed for
zephyr:code-sample:<name>, the linking would have been vanished.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-28 21:14:14 +02:00
TOKITA Hiroshi
1bcebbafac tests: subsys: display: cfb: Add CFB tests
Add test cases for testing basic CFB functions.

These tests cannot run in CI because the CI environment has no display.
Mark these tests as `build_only`.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-06-28 07:21:47 -04:00
Jordan Yates
91f8c1aea9 everywhere: replace #if IS_ENABLED() as per docs
Replace `#if IS_ENABLED()` with `#if defined()` as recommended by the
documentation of `IS_ENABLED`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-28 07:20:32 -04:00
Jordan Yates
243eb36b18 everywhere: reindent .overlay files with tabs
`checkpatch.pl` requires that dts sources are indented with tabs,
fix all the spaces that slipped in while checkpatch wasn't watching.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-26 15:59:44 +02:00
Bjarki Arge Andreasen
9d76f9ad37 tests: modem: cmux: extend test suite to cover release case
When the CMUX is released from its pipe, it must stop transmitting
data to it, and prevent starting any work which requires
transmitting data like connecting CMUX or opening a DLCI pipe.

This commit extends the CMUX test suite to validate this behavior.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-26 09:27:20 -04:00
Luca Burelli
e42549c632 llext: add a test for llext_find_section
Add a new test case that verifies that llext_find_section() returns the
correct offset for a symbol in a loadable extension. This exploits the
fact that in the STORAGE_WRITABLE cases, the symbol addresses will be
inside the ELF file buffer, so they can be easily compared.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli
cec4be3a84 llext: rework test and sample coverage
This patch reworks the testcase.yaml and sample.yaml files for the llext
subsystem to further reduce the number of tests performed by CI while
improving overall coverage.

The following changes are introduced by this commit:

- Remove the arch_allow field from the common section to allow any arch
  to be tested in the build_only test. All other tests explicitly narrow
  down the arches they are applicable to.
- In addition to platforms with active issues, also exclude a number of
  platforms that are always skipped by the runtime filter due to
  RAM/Flash limitations.
- Add integration_platforms to limit the test count to a few selected
  platforms which are representative of the different arches.
- Remove a number of duplicate SLID tests and group them into a single
  test that covers both ARM and Xtensa architectures.
- Test the relocatable case on ARM as well.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli
2ba545c5c6 llext: test: align ELF file buffers to 4k
The ELF files should be aligned to at least sizeof(elf_word) to avoid
issues. Use a larger value to ease debugging, since it reduces the
differences in addresses between similar runs.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Andrej Butok
fe2e560577 tests: flash_map: Increase the test coverage of supported platforms
- Increase the test coverage of supported platforms.
- Fix test_flash_area_check_int_sha256 for platforms with
  flash program size >32. Increase the supported flash program size
  to 512 (maximum supported by Zephyr platforms now).
- Fix test_flash_area_get_sectors test for platforms
  with maximum number of sectors per image slot >256.
  Increase the support value to 1024.
- Fix possible stack size overflow.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2024-06-25 10:25:22 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Jordan Yates
17d466918f tests: fs: nvs: add mps2/an385 support
Add support for running the test with the simulated `mps2/an385` board.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-19 13:43:45 -04:00
Francois Ramu
5716429c01 tests: subsys: lorawan testing on the nucleo_wl55jc with timeout
Running the tests/subsys/lorawan/clock_sync/ requires a long timeout
to pass. Set a timeout: 500 to cover most of the usecase

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-06-19 13:22:49 -04:00
Yong Cong Sin
67578faefe lib: cpp: remove deprecated Kconfigs
These Kconfigs should have been deprecated for more than 2
releases, remove them:

- `CONFIG_CPP_MAIN`
- `CONFIG_CPLUSPLUS`
- `CONFIG_LIB_CPLUSPLUS`
- `CONFIG_EXCEPTIONS`
- `CONFIG_RTTI`

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin
e6295b5279 log: remove CONFIG_LOG_DOMAIN_ID
`CONFIG_LOG_DOMAIN_ID` has been deprecated for years and
shouldn't be used according to its documentation, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Daniel DeGrasse
65b10a14e0 tests: settings: functional: file: add native_sim/native/64 overlay
In 0be0d2175b (cmake: modules: extensions: Revert using common
board files), the overlay for `native_sim/native/64` in the settings
functional file test was not recreated. Duplicate the overlay used for
the `native_sim` target to support this test correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-06-14 18:51:01 -04:00
Tomi Fontanilles
f2c643ba02 storage: flash_map: replace TinyCrypt by PSA
As part of ongoing work to move away from TinyCrypt and towards PSA
(#43712), introduce a PSA option and remove the TinyCrypt one for the
SHA-256 implementation.

The Mbed TLS implementation is modified to use `mbedtls_sha256`
directly for smaller code size.

As of now the implementation defaults to PSA only if TF-M is enabled
because a dependency loop happens if using `PSA_CRYPTO_CLIENT` as a
condition in `FLASH_AREA_CHECK_INTEGRITY_BACKEND`.

A test case is added for the PSA implementation, and an NS platform is
added to the base test case to verify the compilation on a TF-M-enabled
platform.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-06-14 14:02:08 -04:00
Rubin Gerritsen
8799ab1ec2 test: Apply semantic patch file ztest_strcmp.cocci
This patch file updates the use of assertion macros
comparing strings.

Command line used:
```
./scripts/coccicheck --mode=patch \
--cocci=scripts/coccinelle/ztest_strcmp.cocci tests/
```

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-14 19:25:42 +02:00
Luca Burelli
6db484455d llext: remove the "modules_enabled" tests
These tests are simple copies of the existing tests with the addition of
the CONFIG_MODULES=y option. This different Kconfig setting has no
practical effect on the code, and the tests are therefore redundant.

Remove them to halve the number of tests.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-14 19:24:51 +02:00
Johann Fischer
4191602f11 usb: device_next: add helper to register all available class instances
Add helper to register/unregister all available class instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-14 19:17:13 +02:00
Dominik Ermel
a593f344b5 tests/storage/flash_map: Fix erase and flatten test
Fix offset read for verification and comparison of read to
erased value, where type mismatch has been causing fails in
comparisons.

Fixes #74066

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-14 15:37:10 +02:00