Commit graph

2321 commits

Author SHA1 Message Date
Carlo Caione edd3437826 riscv: Rename Kconfig symbol to *_PRIVILEGED
Rename SOC_FAMILY_RISCV_PRIVILEGE to SOC_FAMILY_RISCV_PRIVILEGED because
the spec is "privileged".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-09 11:46:29 -04:00
Peter Mitsis d26d3f9fd4 test: Change loop calibration count initialization
The kernel/context test_timer_interrupts() test has a loop calibration
phase to estimate the number of loops needed for 1 system tick.
By initializing this calibration to 1 instead of 0, we can avoid an
edge condition where the calibration phase indicates 0 loops are
required (a case that could happen when running on a slow simulator).

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-06-02 17:43:59 -04:00
Anas Nashif fa98745a10 tests: remove linker_generator sub tests from kernel
Kernel is being built the same way for all those tests and there is not
much related to the linker generator in any of those tests. Just keep a
small set of tests to have needed coverage in the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Declan Snyder 670e2a28fb tests: userspace: Support mimxrtXXX_evk_cm33
RT685 and RT494 ran out of mpu regions to do this test,
so add board overlays to disable the USB SRAM MPU
region definition because it is not needed for this test.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-01 19:02:58 -04:00
Keith Packard 091948a5a9 tests: Increase a couple of test stack sizes
mem_protect and sprintf stacks both need to be slightly larger than
currently defined in order to avoid stack overflow when using picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-06-01 13:43:25 -04:00
Jaxson Han 7d174eed41 test: kernel: fpu_sharing: Fix text exception by increasing the stack size
The test case will show an unexpected exception in the idle thread after
all test cases pass. The issue is caused by the main thread
stackoverflow.

Increase the main stack configured in this test case to fix the issue.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-05-30 10:14:55 +02:00
Lukasz Mrugala 2d1ab025b0 tests: shared_multi_heap: Docstring typo fix
Word 'platform' misspelled as 'plaform'.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-05-29 14:34:33 -04:00
Krzysztof Chruscinski 5a7f80feb3 tests: kernel: usage: Relax timing requirements for RISCV
Test was previously relaxed for RISCV machine timer. I have a
platform where it fails on RISCV requiring further relaxation.
Relaxing precision for RISCV architecture.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-05-27 06:26:13 -04:00
Keith Packard b0585be1c4 tests/kernel/common: Add an explicit test using the minimal C library
When the default C library is switched to picolibc, we need some tests to
make sure things still build with the minimal C library.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-27 06:23:31 -04:00
Evgeniy Paltsev 658ed409c1 SMP: reproduce finalized test case
Test case for threads abort issue.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-05-27 06:17:22 -04:00
Carlo Caione fecb03ecf8 bitarray: Fix mismatch checking when matching regions
We are currently reporting the wrong mismatching bits in in-between
bundles. Fix this and extend the test to cover the wrong case.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-25 16:31:23 -04:00
Daniel Leung c9b5326270 tests: kernel/userspace: add a test for kernel only thread
This adds a test to make sure kernel only threads cannot go
into user mode: doing so would result in kernel panic.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-05-25 16:30:26 -04:00
Anas Nashif 8dae3cd4d2 tests: kernel: common: fix where suites are defined
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Anas Nashif 5d8c8f3838 tests: sys_sem: cleanup test metadata
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Anas Nashif ea103f7a0b tests: sys_mutex: cleanup test metadata
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Carlo Caione 6f3a13d974 barriers: Move __ISB() to the new API
Remove the arch-specific ARM-centric __ISB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione cb11b2e84b barriers: Move __DSB() to the new API
Remove the arch-specific ARM-centric __DSB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Anas Nashif c5d798173c tests: improve filtering and use integration_platforms
Use integration platforms to limit scope in CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-24 07:50:50 -04:00
Anas Nashif 689ea54b78 tests: do not filter on SMP, use board yaml file
Avoid expensive runtime filtering and use platform features instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-24 07:50:50 -04:00
Mahesh Mahadevan df26e99637 pm: rt5xx: Enable OS Timer as wakeup source
1. Enable os_timer as a wakeup-source in the board
   dts file.
2. Enable PM_DEVICE when PM is enabled.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-16 18:19:35 +02:00
TOKITA Hiroshi 8d28cb094b tests: kernel: add qemu_riscv to no-multithreading tests
Add qemu_riscv32, qemu_riscv32e, and qemu_riscv64 targets
to the tests that list below. These set CONFIG_MULTITHREADING=n.

- tests/kernel/fatal/no-multithreading
- tests/kernel/mem_heap/mheap_api_concept
- tests/kernel/mem_slab/mslab_api
- tests/kernel/threads/no-multithreading

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-12 09:56:40 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Keith Packard bfa6a44746 tests,samples: Fix picolibc malloc arena settings
With picolibc moving to using the common malloc implementation, samples and
tests with picolibc-specific settings need to switch to using the common
malloc settings instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-09 01:29:16 +09:00
Alberto Escolar Piedras b10817ba25 tests: timer cycle64: Fix filtering for POSIX arch
This test was excluding and including only
the native_posix board, while it should have instead
excluded/allowed anything in the architecture.
=> Change the filtering accordingly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-04 16:48:01 -04:00
Mahesh Mahadevan b26eb63e88 tests: tickless_concept: Fix failures seen on NXP RT595
Add the os_timer as a wakeup source so we can exit
deep-sleep modes.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-02 16:56:48 +02:00
Carlo Caione 826d35b188 tests: cache: Add missing cases
Some test cases are missing. Add those back.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-04-20 14:56:09 -04:00
Gerard Marull-Paretas 4d06166623 device: allow NULL init function
Some devices do not need to perform any initialization, so allow the
init function to be NULL. In this case, the initialization code will
just mark the device as initialized, i.e. ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Nicolas Pitre a1d21ca69b tests: timer_behavior: don't fail the test with timer wrap-arounds
If the timer driver only implements sys_clock_cycle_get_32() (meaning
CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER=n) and the hardware clock is high
enough then the reported cycle count may wrap an uint32_t during the
test. This makes validating the total test duration pointless as it
cannot be measured. Just print a warning instead of failing the test
in that case.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-04-18 16:46:13 -04:00
Nicolas Pitre e982bf71c5 tests: timer_behavior: jitter test using timer start delay and period
Exercize both the timer start delay as wellas the timer period and
gather stats for each.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-04-18 16:46:13 -04:00
Keith Packard e17191b146 tests/fpu_sharing: Increase main stack size on riscv64
Looks like switching the main return value to int means that stack
frame persists and increases stack usage by a few bytes. Increase the
main stack size to avoid overflows.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Franciszek Zdobylak ffe94b512f drivers: update overlays for HiFive Unmatched
HiFive Unmatched is using size and address cells of length 2. It has to
use different overlays (with reg properties of correct length).

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-04-12 13:05:55 +02:00
Kumar Gala 99fee43f07 tests: interrupt: Fix armclang compiler warning
When building this test with the armclang compiler we get the following
warning:

tests/kernel/interrupt/src/dynamic_isr.c
tests/kernel/interrupt/src/dynamic_isr.c:23:32: error: 'used' attribute
ignored on a non-definition declaration [-Werror,-Wignored-attributes]

extern struct _isr_table_entry __sw_isr_table _sw_isr_table[];
                               ^
There is no need to add the __sw_isr_table on the extern, so remove it
to address the warning.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-11 09:35:42 +02:00
Lucas Tamborrino 9e4d1a817c tests: kernel: fpu_sharing: generic: add xtensa testing
Add xtensa arch to FPU test.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-04-08 12:34:25 +02:00
Anas Nashif fcefc27823 tests: remove intel adsp cavs platforms from filters
Remove all filters related to dropped platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Rick Tsao 1a51f6d45d tests: mem_protect: Add support for configurable granularity of PMP
Redefine MEM_REGION_ALLOC to make memory domain align with granularity
of PMP.

Signed-off-by: Rick Tsao <rick592@andestech.com>
2023-04-06 11:50:43 +02:00
Keith Packard 95a5c60abf tests/kernel: Cast time difference to int32_t before abs call
Clang complains when an unsigned value is passed to abs, even though there
is an implicit cast to a signed type. Insert an explicit cast to make clang
happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-05 10:38:34 +02:00
Anas Nashif 9a183fa912 tests: sys_mutex: do not use TC_START for debugging
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif 9d31177112 tests: kernel: timer: remove extra TC_START
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif 3f11cf497a tests: kernel: fatal: report testcase results
Report results, do not rely on the test success report at the end.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif a4e8cc25b2 tests: gen_isr_table: remove exta TC_START call
TC_START is used to evaluate output of tests and is used internally by
ztest when a test starts, no need to call this manually here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Tomasz Moń c55266a925 tests: kernel: timer_behavior: Decrease tick rate for nRF
Nordic targets use 24-bit RTC peripheral for system clock. Nordic system
clock timeout implementation relies on RTC CC (capture compare) when
the timeout is in future. Nordic system clock driver allows setting
alarm only to 3 or more counts from current counter value due to silicon
limitation (to ensure that CC event triggers before counter overflow).

RTC CC limitation does not have much impact on normal applications where
there is no need to schedule such short timeouts, but is problematic in
a timer test that expects being able to repeatedly schedule timeouts on
subsequent ticks.

Reduce system tick rate to 8192 on nRF targets to allow setting CC to
the very next tick. With system tick rate being 4 times less than the
hardware tick rate, it is always possible to schedule timeout to happen
in the next tick because ticks are 4 counts apart, i.e. current timer
value + 3 never runs past the next tick.

Fixes: #54211

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-04-05 08:30:15 +02:00
Filip Kokosinski 491f27455e tests: mark testcases with pm where CONFIG_PM=y is forced
This commit marks testcases that require working Power Managament with
the appropriate `pm` tag to allow proper testcase filtering in the board
YAML file.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-04-04 13:34:45 +02:00
Shawn Nematbakhsh bf46f73510 tests: Remove references to deleted board "beaglev_starlight_jh7100".
beaglev_starlight_jh7100 board was deleted so remove references to it in
tests/.

fixes: #56398

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-03-31 07:13:24 -04:00
Ederson de Souza 52db964840 tests/kernel/smp: Limit 'stress' tests based on factor
SMP tests `inc_concurrency` and `smp_switch_torture` use a 'stressing'
approach to verify their results: run something for some time (or some
number of repetitions). However, in some environments, current 'stress'
levels can be quite high, making tests take a long time - environments
like emulators/simulators.
This patch adds a Kconfig that allows one to define a percentage factor
to the 'stress' (time or repetitions) used by these tests.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2023-03-30 09:44:00 -04:00
Daniel Leung e35733d2ff tests: mem_protect/syscalls: print FAILED when faulting
If there are any CPU exceptions, printing a failed message
would allow twister to stop early instead of waiting for
timeout.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-03-27 20:13:22 -04:00
Daniel Leung 4a39c0c49f tests: mem_protect/sys_sem: print FAILED when faulting
If there are any CPU exceptions, printing a failed message
would allow twister to stop early instead of waiting for
timeout.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-03-27 20:13:22 -04:00
Daniel Leung 97fe4833d8 tests: mem_protect: remove code to recover spinlock
The variable need_recover_spinlock is always set to false so
the spinlock recovery code is effectively no-op. So remove
everything related to the variable.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-03-24 09:04:13 +01:00
Alberto Escolar Piedras a2541d6c82 util: Replace all POSIX arch busy_waits with Z_SPIN_DELAY
A new Z_SPIN_DELAY() macro has been added which
can be used to reduce a bit the amount of noise
due to the POSIX arch need to break busy loops with
k_busy_wait().
Use it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-04 22:14:04 +01:00