Commit graph

2670 commits

Author SHA1 Message Date
Anas Nashif
3744dd828f tests: kernel: fix test groups for semaphore/mutex
define groups for semaphores and mutexes

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-17 05:24:09 -04:00
Anas Nashif
6cf12c1aa9 tests: gen_isr_table: remove misnamed platform
This platform does not exist, causing ci failures due to recent
additional checks added.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-16 14:53:58 -04:00
Anas Nashif
0bca19588a tests: remove misnamed platforms from platform_exclude
Few tests with wrongly names platforms. This section is now being
verified for correctness like all others.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-16 10:07:51 +02:00
Nicolas Pitre
7e847eca25 tests: demand_paging: add a test for on-demand sections
Exercises linker placement, the ondemand backing store, demand paging.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-11 20:18:51 -04:00
Nicolas Pitre
78cd836e2f tests: demand_paging: move existing test to a mem_map subdirectory
This test concerns itself mainly with anonymous memory mappings.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-11 20:18:51 -04:00
Nicolas Pitre
c99371e486 arm64: demand paging is supported
Test configs for UP and SMP are also included.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-11 20:18:51 -04:00
Hou Zhiqiang
60abb95a4f test: kernel/common: custom MAX_THREAD_BYTES for imx95 SMP
Increased the value of CONFIG_MAX_THREAD_BYTES to avoid
triggering twister failing.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2024-09-11 09:34:04 +02:00
Hou Zhiqiang
33b773aab9 test: kernel/sem/sem: custom MAX_THREAD_BYTES for imx95 SMP
Increased the value of CONFIG_MAX_THREAD_BYTES to avoid
triggering twister failing.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2024-09-11 09:34:04 +02:00
Hou Zhiqiang
1b2985d77e test: kernel/sem/sys_sem: custom MAX_THREAD_BYTES for imx95 SMP
Increased the value of CONFIG_MAX_THREAD_BYTES to avoid
triggering twister failing.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2024-09-11 09:34:04 +02:00
Yong Cong Sin
4e54cff223 soc: qemu: riscv: update IRQ config
- Update `MAX_IRQ_PER_AGGREGATOR` to 1024 to match with the
  devicetree
- Update `2ND_LEVEL_INTERRUPT_BITS` to 11 bits to
  be able to encode the L2 IRQs.
- Update `NUM_IRQS` to 1036 (L1 has 12, L2 has 1024)

Update the `MAX_IRQ_PER_AGGREGATOR` config in testcase
accordingly, so that it won't overflow the configured bits.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-09-06 14:06:23 -05:00
Karol Lasończyk
18086567dd tests: kernel: Add support for FLPR core in nRF54L15
Add support for production device.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2024-08-29 12:02:35 +02:00
Dmitrii Golovanov
ec7b42a19f tests: timer_behavior: align saleae package requirements
Align python package versions to saleae/grpc/saleae.proto
new requirements.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-27 15:12:59 -04:00
Filip Kokosinski
77cec9d935 tests: kernel.common.stack_sentinel: exclude m2gl025_miv
This commit excludes the `m2gl025_miv` platform from running the
`kernel.common.stack_sentinel` test. It experiences the same issue as
`hifive1`, which was described in issue #66070.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-08-27 10:48:44 -04:00
Nicolas Pitre
c9aa98ebc0 kernel: mmu: support for on-demand mappings
This provides memory mappings with the ability to be initialized in their
paged-out state and be paged in on demand. This is especially nice for
anonymous memory mappings as they no longer have to allocate all memory
at mem_map time. This also allows for file mappings to be implemented by
simply providing backing store location tokens.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-08-26 17:25:41 -04:00
Anas Nashif
376085c9ed tests: kernel: add missing test call argument
Add missing param argument.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-24 07:17:15 -04:00
Alberto Escolar Piedras
3976dce591 tests/kernel thread_apis: Switch native_posix to native_sim in comment
native_posix is being deprecated, let's update a comment

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-16 11:20:34 +01:00
Alberto Escolar Piedras
53a47a2e1a tests/kernel/context: Correct dependency
An ifdef should have been also checking for native_sim,
let's correct it.

Note: By now native_sim builds with "native_posix compatibility mode"
enabled, which sets BOARD_NATIVE_POSIX to avoid breaking all this kind
of dependencies. But that will stop soon.
So let's fix the dependencies.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-16 11:20:34 +01:00
Neil Chen
dad8b212ba tests: userspace: support userspace example for frdm_mcxn236 board
disable sramx, support userspace example for frdm_mcxn236 board

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2024-08-15 10:15:12 +01:00
Dmitrii Golovanov
889950843f tests: timer: behavior_external: fix MAX_STD_DEV
Fix `MAX_STD_DEV` calculation at the timer behavior external test.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-09 08:37:14 -04:00
Dmitrii Golovanov
d2ff869a1d tests: timer: behavior: fix MAX_STD_DEV recording
Fix misaligned name change for `MAX_STD_DEV` value.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-09 08:37:14 -04:00
Peter Mitsis
1bb5f3a52b tests: kernel: Add ISR tests for k_thread_priority_set()
Adds tests demonstrating k_thread_priority_set() being called
from the context of an ISR.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-08-02 03:29:55 -04:00
Anas Nashif
c5e6416a65 tests: device: test CONFIG_DEVICE_DT_METADATA=y
Looks like this option is not tested with userspace enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-27 15:09:10 +03:00
Fabio Baltieri
ef14c9b867 lib: os: add a header for printk hook functions
Add a zephyr/printk.h header for the __printk_hook functions, these are
currently manually declared by all console drivers for no good reason.

Move the documentation into the header and also unify the way that
console drivers call the function.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-27 10:41:01 +03:00
Krzysztof Chruściński
44c2b19d5e tests: kernel: timer: behavior: pytest: Adjust max stddev
Like in C test. If MAX STDDEV is lower than single clock cycle then
set it to a single clock cycle.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-07-09 19:02:51 +02:00
Krzysztof Chruściński
1968cdf556 tests: kernel: timer: timer_behavior: Tweak expected std deviation
If frequency of the system clock is lower then deviation may exceed
default value (10us). Instead of adjusting the default value, test is
rounding up expected standard deviation to a single clock cycle.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-07-09 19:02:51 +02: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
Nicolas Pitre
a53ddff3b6 tests: demand_paging: touch memory with more useful content
When content validation fails it is rather difficult to figure out the
cause if some meaningless byte mismatches another meaningless byte.
Let's store each memory location with its own virtual address so if a
mismatch occurs when reading it back it is obvious where it comes from.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-25 21:19:40 -04:00
Keith Packard
0491000c16 tests/kernel: Add test for constructors in C
Make sure constructors are run even when not using C++.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-25 19:14:37 -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
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Peter Mitsis
4123c531f3 tests: Add test for IPI cascades
Adds a test to show that enabling IPI cascades
(CONFIG_SCHED_IPI_CASCADE=y) can correct an invalid set
of high priority threads on an N CPU system.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-06-21 20:49:11 -04:00
Nicolas Pitre
51a5986b04 tests: demand_paging: extend memory access patterns
Add the ability to touch memory in the opposite direction from one loop
to the next so to exercize the LRU eviction algorithm.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-14 18:58:02 -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
Dmitrii Golovanov
01dcb942c6 tests: kernel: timer_behavior_external: Fix a typo
Rename `do_analysys()` to `do_analysis()`.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-06-14 09:41:52 -04:00
Dmitrii Golovanov
d72dd3562e tests: kernel: timer: Fix log capture on external tool testing
Fix incomplete test log capture when the external tool is used
and Twister Pytest Harness script ends without reading output
from the last test case running on the device.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-06-14 09:41:52 -04:00
Dmitrii Golovanov
014a0983fb tests: kernel: timer_behavior_external: Additional stats recording
Additional logging of kernel.timer.timer_behavior_external test case
statistics for timer drift, variance, etc. as JSON-formatted records
to make easier data collection and its further analysis.
These log records will be processed by the Twister Harness recording
feature which captures and parses timer statistics from the log output,
then composes it into twister.json and recording.csv files.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-06-14 09:41:52 -04:00
Dmitrii Golovanov
dd67791857 tests: kernel: timer_behavior: Additional stats recording
Additional logging of kernel.timer.timer test case statistics for
timer drift, variance, etc. as JSON-formatted records to make easier
data collection and its further analysis.
These log records will be processed by the Twister Harness recording
feature which captures and parses timer statistics from the log output,
then composes it into twister.json and recording.csv files.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-06-14 09:41:52 -04:00
Andrzej Głąbek
f73471eaf9 tests: timer_api: Use 64-bit integers in busy slew threshold calculation
32-bit multiplication overflows for the 130000 ppm value used currently
on Nordic SoCs and the duration that is configured to 100000 us.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-06-13 20:22:08 -04:00
Andrzej Głąbek
1cfd57177e tests: timer_api: Use busy slew threshold when checking remaining ticks
On Nordic SoCs, the clock that drives the system timer and the one that
is used in busy-waiting may be significantly skewed, so the test cases
that compare durations derived from those two clocks need to take into
account a proper threshold. After the `z_timeout_expires` function was
corrected in 3d29c9fe54, it turned out
that the threshold was missing in one check and the related test case
started to fail on nRF platforms. This patch adds that threshold there.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-06-13 20:22:08 -04:00
Yong Cong Sin
726fefd12c arch: riscv: stacktrace: implement arch_stack_walk()
Created the `arch_stack_walk()` function out from the original
`z_riscv_unwind_stack()`, it's been updated to support
unwinding any thread.

Updated the stack_unwind test case accordingly.

Increased the delay in `test_fatal_on_smp`, to wait
for the the fatal thread to be terminated, as stacktrace can
take a bit more time.

Doubled the kernel/smp testcase timeout from 60 (default) to
120s, as some of the tests can take a little bit more than 60s
to finish.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-13 16:46:48 -04:00
Nicolas Pitre
d8a891b563 tests: demand_paging: add a test for k_mem_unmap()
Make sure k_mem_unmap() completes successfully on memory that is half
paged-out and such memory is no longer accessible afterwards.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-13 09:22:39 +02:00
Daniel Leung
7f6d600dd6 kernel: mm: rename z_num_pagefaults_get to k_mem_num_*
This is part of a series of moving memory management related
stuff out of the Z_ namespace and into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
9064652db9 tests: mem_protect/syscalls: exclude board numaker_m2l31ki
The board defconfig forces CONFIG_USERSPACE to be disabled
due to small number of available MPU regions which are not
enough for userspace testing.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
54af5dda84 kernel: mm: rename z_page_frame_* to k_mem_page_frame_*
Also any demand paging and page frame related bits are
renamed.

This is part of a series to move memory management related
stuff out of the Z_ namespace into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
a459cdf51e kernel: mm: rename Z_FREE_VM_START to K_MEM_VM_FREE_START
This is part of a series to move memory management related
stuff from Z_ namespace into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
db9d3134c5 kernel: mm: rename Z_MEM_PHYS/VIRT_ADDR to K_MEM_*
This is part of a series to move memory management functions
away from the z_ namespace and into its own namespace. Also
make documentation available via doxygen.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
552e29790d kernel: mm: rename z_phys_un/map to k_mem_*_phys_bare
This renames z_phys_map() and z_phys_unmap() to
k_mem_map_phys_bare() and k_mem_unmap_phys_bare()
respectively. This is part of the series to move memory
management functions away from the z_ namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Aksel Skauge Mellbye
fee86aecaa boards: silabs: Consistently name radio boards
Rename all Silicon Labs radio boards to always use the official kit name of
the kit containing only the radio board as board target name. Disentangle
boards using Series 1 and Series 2 SoCs that have almost nothing in common
in terms of devicetree content, but still occupied the same directory.

As part of the initial HWMv2 port, all radio boards were merged into a
single target efr32_radio, using the SoC as a board qualifier to target
specific boards. This was unfortunate, as the SoC name is not sufficient
to identify a specific board -- the same SoC may be used on multiple
different boards. This commit reinstates every radio board as an individual
board target.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-06-12 12:52:28 -04:00
Nicolas Pitre
2871c87aae tests: poll: fix misconstructed k_poll_event test
Since commit 0c23cf94a4 ("include/kernel: check type of object passed
to K_POLL_EVENT_INITIALIZER") it is no longer possible to use arbitrary
type literals with the initializer macro. Misconstructing a k_poll_event
type for test purpose must be done explicitly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-12 10:24:21 +02:00
Yassine El Aissaoui
bb770c5965 samples: tests: bluetooth: Add support for frdm_rw612
Adding bt_tester support.

Adding bt_tester app build
with Twister for frdm_rw612 board

Fix failing tests/samples due to unsufficent MPU ressources
by releasing unnecessary MPU regions.

Twister builds added on peripheral/central ht and
enabled Power manager on those examples to cover
the CI builds with PM enabled.

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-06-10 07:02:06 -07:00