Commit graph

4869 commits

Author SHA1 Message Date
Alberto Escolar Piedras
545d68a5a3 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
f02906708cf1668fe54ef2c2f1e159ed947573aa

Which includes:
* f029067 CPU ctrl: Fix two malformed error/warning messages
* 114f78b Host trampolines: Fix typos in comment

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-02-17 17:30:33 +01:00
Anas Nashif
fc5211fc03 twister: always add integration platforms to platform scope
Add integration_platforms to the list of the default platforms per test
for improved coverage when not running in integration mode.

Some tests when run without any option do not exercise any tests and
skip the integration platforms completely.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-16 13:00:44 +01:00
Anas Nashif
cb1ee13e9d twister: only parse specified tests when using --test
Enhance the -s option of twister, used to point to a single scenario in
a testsuite.
- Now accept --scenario on the command line, --test still supported.
- If no testsuite is provided, extract testsuite from scenario
  identifier and avoid parsing the whole tree if we only want to address
  one scenario in a testsuite.
- If just the identifier of the scenario is provided to
  --test/--scenario option, try to find this as well, do not need the
  full path for that.

Something like this is now possible:

twister  --scenario kernel.threads.init --list-tests
twister -T <path> --scenario kernel.threads.init --list-tests
twister -T <path>/kernel.threads.init --list-tests

All should print the same output.

Fixes #67307

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-16 13:00:32 +01:00
Laurentiu Mihalcea
89a2a147a9 build: gen_isr_tables.py: fix bad IRQ index computation for L3 interrupts
According to the Zephyr documentation, the multi-level interrupts
are encoded as follows:

`L1_ID | ((L2_ID + 1) << L2_BITS) | ((L3_ID + 1) << (L3_BITS + L2_BITS))`

This means that when L3 interrupts are enabled, the gen_isr_table.py
script will receive the value of L2_ID + 1. Currently, the script
takes this value and directly compares it with the offsets set via
`CONFIG_3RD_LVL_INTR_xx_OFFSET`. This is wrong because the values from
said configurations are the same as L2_ID and because of that the
script will generate an error. To fix this, use the value of L2_ID
instead of L2_ID + 1.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-14 22:57:29 +01:00
Yuval Peress
c2a207bd85 twister: Add support for GTEST_SKIP()
Calling GTEST_SKIP will print the test as DISABLED, add support and unit
tests for this.

Signed-off-by: Yuval Peress <peress@google.com>
2024-02-14 21:45:24 +01:00
Mike Szczys
e01a66f10c twister: support domains when cleaning up binaries
Binaries are located in multiple build directory subfolders when built for
multiple domains (sysbuild is one example). Parse domains.yaml and preserve
files across all domains for testing when --prep-artifacts-for-testing
option is used.

Signed-off-by: Mike Szczys <szczys@hotmail.com>
2024-02-14 19:03:39 +01:00
Abram Early
5dec4fcab8 scripts/requirements: bump imgtool to 2.0.0
Resolves incorrectly located `image_ok` tag in generated hex files when
CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE is used.

Fixes #64098

Signed-off-by: Abram Early <abram.early@gmail.com>
2024-02-12 23:26:04 +01:00
Grzegorz Chwierut
7fc0bcaa7c twister: pytest: update device id when testing with pytest harness
Updated the instance with the device id to have it in the summary
report also when using pytest harness.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-02-09 13:46:19 +01:00
Anas Nashif
b320899663 ci: expand ignore list on PRs
Add more CI files to be ignored when determining change.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-06 15:39:23 -05:00
Radoslaw Koppel
0ae48ecb58 scripts: build: gen_isr_tables: Implement local ISR generation
This commit moves all the functionality related to the current
interrupt parser into gen_isr_tables_parser_carrays.py file.
The new parser file gen_isr_tables_parser_local.py file is
implemented with the new parser that.
Additional information added to the generated interrupt header
that contains data required by the new parser.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Radoslaw Koppel
568cced14f scripts: gen_isr_tables: Break code into classes
This commit breaks the code into functional classes.
This way the functionality is visibly splitted into
functional parts and it is easier to replace the
specific parser part to implement new code generators.

There is also common functionality to handle multi level interrupts
moved to configuration class.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Radoslaw Koppel
4360acb27e scripts: gen_isr_tables: Code cleanup
This commit cleans up the gen_isr_tables code for better clarity
and easier modification.
Changes include:
- Separate functions to load intList section.
- Replace spurious handlers in internal data with None.
  Now it is the output generator work to choose right function.
- All the work to generate vt and swt separated into its own functions.
- Remove the need for internal shared array - all the information
  is here in swt array.
- The update_masks function - more functionality moved here.
- Simplify bit_mask function.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Grzegorz Chwierut
8f18094c62 twister: pytest: Fix shell fixture
On the hardware, after booting up the device, on the
console might appear additional logs after receiving first
prompt. Wait and clear the buffer to avoid unexpected
messages when verifying output.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-02-02 10:52:46 -06:00
Gerard Marull-Paretas
018cf08d8d scripts: kconfig: functions: add dt_chosen_partition_addr_int|hex
dt_chosen_partition_addr_int|hex allow obtaining the absolute address of
a partition, which is the result of the grandparent node address plus
the partition node address.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-02 16:40:11 +01:00
Gerard Marull-Paretas
6b987d3192 scripts: west: runners: nrfjprog: add basic support for nRF54H series
Add basic support to flash application and/or radio core for nRF54H
series. Note that features like merged hexes present in nRF53 series is
not supported.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-02 16:40:11 +01:00
Gerard Marull-Paretas
a99b5ca01b scripts: west: runners: nrfjprog: add erasepage op
Add a new operation that allows erasing pages.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-02 16:40:11 +01:00
Gerard Marull-Paretas
b2c8f7680d scripts: west: runners: nrfjprog: add option to not erase
On some new SoCs, the erase option is not required, so introduce a new
option that doesn't set any erase mode.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-02 16:40:11 +01:00
Anas Nashif
5529241bc9 ci: pr stats: deal with trivial+hotfix PRs
deal wit the case of Trivial+Hotifx and mark it correctly in PR
dashboard.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-02 05:54:04 -05:00
Anas Nashif
b64af4008f twister: deal with predicates and skipped tests
Using ztest predicate feature, testcases are skipped, however, the skip
is only reported as part of the summary and not through normal
execution. Until now such tests were reported as blocked or had a null
status in the twister json output.

This changes will look into summary results and use them to confirm
parsed results and add any missing results that either were not reported
or not captured through the serial console.

The issue can be observed with the drivers.can.api test for example on
the frdm_k64f board.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-01 14:31:05 -06:00
Gerard Marull-Paretas
ec9dc5d739 scripts: west: runners: nrf: fix UICR check
uicr_ranges dictionary entries did not contain the `_FAMILY` suffix, now
used by self.family variable, resulting in an always false check.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-31 15:38:06 +01:00
Lukasz Mrugala
cdcb853a98 scripts: pylib: twister: Fix --save-tests help
As saving tests writes to file, rather than appending to it,
we should indicate that in the --save-tests help.
--load-tests help changed so its grammar is the same as --save-tests's.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-31 09:05:41 +01:00
Witold Lukasik
13abdcccb3 scripts: west_commands: runners: nrf_common: add support for nRF54L
Add support for new Nordic family in west commands.

Signed-off-by: Witold Lukasik <witold.lukasik@nordicsemi.no>
2024-01-30 21:00:44 +00:00
Michal Smola
1f25531d7c twister: pytest: fix missing messages from hardware target
When pytest harness test is run on harware, messages sent from target
right after application start-up are lost, because connection to COM
port is not established yet. It can cause unexpected
behavior of a test. Fix it by flashing and running application after
connecting to COM port when testing on hardware.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-01-30 14:13:46 +00:00
Michal Smola
5c78b3d842 twister: pytest: fix pty import on Windows
Import of pty module causes exception when pytest harness is used
for device testing on Windows. Fix it by importing pty module
on non-windows hosts only. Add logger message for case pty
is used by mistake on Windows.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-01-30 14:13:46 +00:00
Paszkiet Kamil
1799a2bf0c scripts: tests: twister_blackbox: Add test test_runner.py
- change name test_qemu.py to test_runner.py
- add test to test_runner.py:
  - build_only
  - runtest_only
  - ninja (dummy test)
  - dry_run (dummy test)
  - any_platform (dummy test)
  - cmake_only
  - pre_script (dummy test)
  - exclude_platform
  - device_flash_timeout (dummy test)
  - retry_failed
  - retry_interval
  - timeout_multiplier
  - quarantine_list
  - tag
  - only_failed
  - retry_build_errors

Made required changes to test_testplan.py tests

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2024-01-29 17:43:59 -05:00
Pieter De Gendt
433de7d2e2 scripts: native_simulator: common: Fix typo in comment
Fix a typo in comment describing the naming convention for nsi_host.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-01-29 13:20:28 +01:00
Yasin Ustuner
6cb98162b7 scripts: ci: check_compliance.py: Add out-of-tree dts/bindings
This commit includes out-of-tree dts/bindings to
temporary Kconfig.dts for compliance checks.

Signed-off-by: Yasin Ustuner <yasin.ustuner@analog.com>
2024-01-28 22:04:16 -06:00
Christopher Friedt
a37254140b scripts: checkpatch.pl: fix constant comparison false positives
Comparisons that have constants on both side of the operator
were getting flagged incorrectly. Adjust the check so that
pure constant comparisons are not flagged, reducing false
positives.

WARNING:CONSTANT_COMPARISON: \
  Comparisons should place the constant on the right side of \
  the test
+BUILD_ASSERT(CONFIG_MAX_PTHREAD_COUNT == \
  CONFIG_MAX_PTHREAD_MUTEX_COUNT - 1);

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-28 13:01:36 -05:00
John Whittington
3f282da22d west: runners: blackmagicprobe: elf_file fallback
Building the HEX file is optional (CONFIG_BUILD_OUTPUT_HEX), so
`bmp_flash` will fallback to elf_file if missing. Additionally, to
maintain section names the HEX is only used if it is signed.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2024-01-26 14:24:05 -05:00
John Whittington
10183797a1 west: runners: blackmagicprobe: flash hex_file
The cfg.elf_file is not signed, so `west flash` with a sysbuild will
not run the application if MCUboot image signature checking is on. Using
the cfg.hex_file for `bmp_flash` resolves since as the signed hex is
used when using sysbuild. Symbols are not required for flashing so the
switching from elf to hex is not an issue.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2024-01-26 14:24:05 -05:00
Grzegorz Chwierut
cca78041f8 twister: pytest: Fix failing tests of mcumgr fixture.
Updated tests of mcumgr fixture in pytest-twister-harness
plugin.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-01-26 19:36:01 +01:00
Lukasz Mrugala
03bd8d0dd2 scripts: tests: Blackbox - make clear_log fixture autouse
clear_log is used to prevent a common pytest log error,
which makes logs unusable in testing.
Such a fix is useful for all tests,
 so it should be autouse by default.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-26 15:54:25 +00:00
Paszkiet Kamil
0e2f19a564 scripts: tests: twister_blackbox: Add more tests to test_report.py
add tests to test_report.py:
 - log-file
 - coverage
 - enable-coverage

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2024-01-26 15:53:15 +00:00
Patryk Kuniecki
032451994a scripts: tests: Harness
Adding more tests for twister harness.

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-01-26 14:30:31 +01:00
Keith Packard
3cc4c5eb7a posix: Use _POSIX_C_SOURCE=200809L instead of 200809
This constant is supposed to be defined as a long instead of an int,
presumably to support systems where int isn't large enough.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Øyvind Rønningstad
5d95776514 scripts: requirements-extra.txt: Update zcbor from 0.6.0 to 0.8.0
If people are using the zcbor script for code generation, it needs to be
at the latest version

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-01-25 15:09:16 +00:00
Paszkiet Kamil
114548ef60 scripts: twister_blackbox: Added the ability to clear log from the code
clear_log is used as a fixture by pytest. We need to be able to call
it from the code level. Example of use in the file
test_harwaremap.py line 157.

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2024-01-23 23:03:56 -05:00
Grzegorz Chwierut
3e234966dc twister: pytest: Update MCUmgr helper method
Update helper method used by pytest fixtures. Extended upload
method with 'slot' parameter. Added searching of uploaded images
that can be tested or confirmed.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-01-23 09:45:27 -05:00
Yong Cong Sin
450a66fa36 gen_defines: output the interrupt level of a node
Currently it is tedious to know the level of an interrupt for
a node in C. One would have to go through a very complex and
error prone macros to check if there's a parent interrupt
controller & if the controller has an interrupt number and thus
not a pseudo interrupt controller like the one found in
`rv32m1`. The level of a node is required to encode the
Zephyr's multi-level interrupt number

Since it is easier to do it in the `gen_defines` script, let's
do the heavy lifting there so that we can introduce new DT
macros to get the interrupt level very easily later.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-23 06:48:16 -05:00
Yong Cong Sin
89fb8f8b98 gen_isr_tables: print index number at the end of each entry as comment
Make it easier to debug by printing the index number at the
end, this is especially helpful when there's a lot of
interrupts.

Before:

```c
/* build/zephyr/isr_tables.c */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
```

After:

```c
/* build/zephyr/isr_tables.c */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 0 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 1 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 2 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 3 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 4 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 5 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 6 */
```

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-23 06:40:32 -05:00
Greter Raffael
7bcd0699e6 gen_isr_tables: Add meaningful error message
When using direct isrs, a vector table is needed. However, if none is
present , i.e. `CONFIG_GEN_IRQ_VECTOR_TABLE=n`, this script failed. The
given error message was not helpful (`'NoneType' has no len()`).
This change makes it clearer, where to look for the problem.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2024-01-22 15:28:39 +01:00
Michal Smola
c772234e43 twister: fix build dir path for mklink
When twister is run on Windows with --short-build-path option, mklink
fails to create link, because path to build dir contains forward
slashes, which are not handled correctly by mklink.
Fix it by using os.path.normpath in mklink call.
Added os.path.join mock in twister unit test to handle path join
consistently.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-01-19 06:54:17 -05:00
Alberto Escolar Piedras
5a2641b1d7 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
3eae4374db5984a5defcefdeda254b37e72e2ca8

Which includes:
* 3eae437 cmdline parsing: Allow providing more arguments progammatically
* d148a28 Host trampolines: Add realloc

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-19 10:33:30 +01:00
Lukasz Mrugala
c405d8d68f scripts: tests: Blackbox test expansion
Adds five new tests, covering six more flags:
* -s, --test
*     --sub-test
* -G, --integration
*     --test-config
*     --level
*     --filter

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-19 09:53:36 +01:00
Lukasz Mrugala
8bcec18e25 scripts: tests: blackbox noclearout mark warning removal
Currently, the noclearout pytest mark generates warnings because
it is not registered.
This commit adds its registration in the relevant conftest.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-18 09:23:20 -05:00
Jordan Yates
8f7e3b8123 scripts: twister: snippet roots from modules
Automatically populate the snippet roots from Zephyr modules, instead of
only looking in `ZEPHYR_BASE`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-17 13:02:22 -05:00
Anas Nashif
abef8bde4e twister: reuse test schema in common section
Rather than duplicating the same schema, define it only once and reuse
for both common section and tests section.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-17 14:42:10 +01:00
Bjarki Arge Andreasen
08d6ff059e scripts: dts: gen_defines: Generate interrupt-controller macro
Extend the gen_defines.py write_interrupts(node) function to
generate macros to get the interrupt controller for an
interrupt specifier by idx and by name.

The information is already generated by edtlib.py and stored in
node.interrupts[].controller. This addition uses the node pointed
to by the controller member to generate the following example output

define DT_N_S_device1_IRQ_IDX_0_CONTROLLER \
       DT_N_S_gpio_800

define DT_N_S_device1_IRQ_NAME_test4_CONTROLLER \
       N_S_device1_IRQ_IDX_0_CONTROLLER

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-17 13:18:00 +01:00
Fabio Baltieri
49e8e11a77 scripts: set_maintainer: fix author == maintainer fallback logic
The "Submitter is same as Assignee" is comparing strings to <Area> and
always failing the condition, fix it by dropping the ".name".

Tested with ./scripts/set_assignees.py -v -y -P 67526 (now falls back to
the other maintainer as it should).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-01-16 14:24:05 -05:00
Alberto Escolar Piedras
1fc6550a25 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
880eea00abf0191f3d986559876359a5422c9618

Which includes:
* 880eea0 HW scheduler: Minor optimization
* 37c0d86 Minor: Comment fix: Remove out of date reference

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-16 11:29:54 +00:00
Erwan Gouriou
a59e01d297 scripts: kconfigfunctions: Add dt_node_ph_array_prop_int/hex
Add dt_node_ph_array_prop_int/hex function to query value of cells
from a phandle-array property of a node at a given index of the array.

Based on dt_node_array_prop_int/hex.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-01-16 10:07:02 +00:00
Anas Nashif
c2b16d7403 ci: pr stats: count hours open since moving out of draft
if a PR was made ready for review from draft, calculate based on when it
was moved out of draft.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-16 10:28:44 +09:00
Grzegorz Swiderski
460b6ef122 code_relocation: Add NOKEEP option
When using the code and data relocation feature, every relocated symbol
would be marked with `KEEP()` in the generated linker script. Therefore,
if any input files contained unused code, then it wouldn't be discarded
by the linker, even when invoked with `--gc-sections`.

This can cause unexpected bloat, or other link-time issues stemming from
some symbols being discarded and others not.

On the other hand, this behavior has been present since the feature's
introduction, so it should remain default for the users who rely on it.

This patch introduces support for `zephyr_code_relocate(... NOKEEP)`.
This will suppress the generation of `KEEP()` statements for all symbols
in a particular library or set of files.

Much like `NOCOPY`, the `NOKEEP` flag is passed to `gen_relocate_app.py`
in string form. The script is now equipped to handle multiple such flags
when passed from CMake as a semicolon-separated list, like so:

   "SRAM2:NOCOPY;NOKEEP:/path/to/file1.c;/path/to/file2.c"

Documentation and tests are updated here as well.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-01-15 13:20:17 +01:00
Anas Nashif
7fedc81666 ci: merged_pr stats: fix a bug an minor tweaks
We are not setting the review rule value correctly and default to 'no'
for all prs, even if they were correctly reviewed by assignees.

Minor other cleanups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-12 21:35:04 -05:00
Anas Nashif
0a50cb9179 ci: pr stats: define elasticsearch index as a repo variable
Add flexibility to change and modify index using a variable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-12 21:35:04 -05:00
Anas Nashif
0d7d39d441 scripts: set_maintainer: do not re-add self-removed reviewers
If a collaborator removes themselves from the reviewer list, do not
attempt to re-add them on changes to the PR.

Fixes #67214

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-11 15:46:20 -06:00
Jordan Yates
7557756b86 scripts: twister: testplan: search for requested snippets
Search for the snippets requested by the test, not for snippets found
in the snippet roots.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-11 11:40:32 -05:00
Keith Packard
97f8b8b6ee scripts/footprint: Avoid fpdiff failure when data changes lots
Bounds check the array access in case the input data changes so that the
number of entries in the 'children' array is not the same. The tool output
with this change isn't terribly useful, but at least it doesn't crash.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-10 20:50:51 -05:00
Anas Nashif
29a4e04143 ci: update elasticsearch index with merged PR data
A simple workflow that runs when a PR is merged and updates the
elasticsearch index with merged PR info.
The dashboard for displaying the information can be found here:

https://kibana.zephyrproject.io/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-10 16:39:04 -05:00
Anas Nashif
4e7269669b twister: hotfix for unimplemented harnesses
Harness is freeform right now in the yaml file and if the harness is not
implemented in class, things fail. While we cleanup and enforce
implementations, this should serve as a quick fix dealing with such
unimplemented harnesses.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-10 11:44:04 -05:00
Lukasz Mrugala
23b3e5741e scripts: tests: Removal of straggling folders
Current blacbox tests leave two folders,
OUT_DIR and TEST_DIR after they are finished.
Unit tests create two further folders,
mock_testsuite and demo_board_2.
This change deletes them appropriately.

Additionally, the created twister-out* folders in blackbox tests are
moved to a temp directory and removed after every test.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-10 09:23:06 -05:00
Piotr Golyzniak
8831aa60eb scripts: twister: add copying of bsim exe
To make possible to build bsim tests by Twister, it is necessary to
copy executables to BabbleSim bin directory.

Signed-off-by: Piotr Golyzniak <metody159@gmail.com>
2024-01-10 12:10:58 +01:00
Paszkiet Kamil
a9ea0fe420 scripts: tests: twister_blackbox: Add more tests test_printouts.py
add tests to test_printouts.py:
  -timestamps
  -broken_parameter
  -help (dummy check)
  -force_color (dummy check)

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2024-01-09 18:26:41 +01:00
Michael Arnold
240bd8e16a runners: jlink: Add support for J-Link over IP
Add support for J-Link over IP and J-Link remote server.
If the "--dev-id" is a valid ip, the transport over ip is selected.
Otherwise usb is selected.

Signed-off-by: Michael Arnold <marnold@baumer.com>
2024-01-09 14:49:03 +01:00
Thomas Gagneret
7bde51bccf scripts: zspdx: Include modules as packages in zephyr.spdx
The current zephyr.spdx does not contain the modules included in the build.
This commit split the zephyr-sources package into multiple packages, one
for each modules found by zephyr_module.py.

Signed-off-by: Thomas Gagneret <tgagneret@witekio.com>
2024-01-09 09:59:57 +01:00
Marc Herbert
4aa0e7af68 west: sign.py: add "REM" support to pass comments through cpp
Generated outputs can be difficult to read, preserving comments helps a
lot and they often provide good `git grep` search keywords.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-01-08 13:20:41 -05:00
Marc Herbert
a27e8f9a19 west: sign.py: explain why -P is passed to cpp
Zero-functional change.

Also move it to a separate line so it's more convenient to temporarily
comment it out.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-01-08 13:20:41 -05:00
Marc Herbert
2ee6c26d15 west: sign.py: rename new generated/platf.toml to rimage_config.toml
CMake-based build systems like Zephyr's use separate build directories;
one for each build configuration. Even Zephyr's multi-build system
"sysbuild" (which is not relevant here) uses separate subdirectories.

So there is only one pre-processed, .toml file generated by build
directory and no need to vary its filename based on the platform name or
any other configuration parameter. It can and should keep the same
filename across build directories as zephyr.elf and all other build
artefacts do.

Moreover, when building a collection of configurations (as for instance
`sof/scripts/xtensa-build-zephyr.py` does), keeping all build
directories consistent with each other simplifies installation,
checksumming and any other post-processing.

"Fixes" recent commit 15336045af ("west: sign.py: generate platf.toml
from platf.toml.h with cc -E")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-01-08 13:20:41 -05:00
Dmitrii Golovanov
3bbd34d1b6 twister: coverage: Fix device handler coverage collection mode
Twister DeviceHandler now checks `--enable-coverage` command line argument
instead of `--coverage` when it deals with device output.
This resolves potential problem when only `--enable-coverage` argument
is given and the coverage report is not needed. In this case the test image
which is built for code coverage works slower also producing additional
console output, so the additional DeviceHandler timeout still have to be
applied and the output with coverage data correctly processed by Harness.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-01-08 09:02:47 -05:00
Lukasz Mrugala
97757e48d6 scripts: tests: twister: Platform module test expansion
Added a unit test for the platform.py module.
It covers 99% of the code. The 1% is unreachable.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-05 14:41:13 -05:00
Lukasz Mrugala
56625fc887 scripts: tests: twister: Testplan unit test expansion
All functions/methods except apply_filters() covered explicitely.
86% coverage achieved.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-05 14:40:33 -05:00
Lukasz Mrugala
8ce15abb60 scripts: tests: twister: TestPlan unit test refactoring
TestPlan test file renamed and shortened before expansion.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-05 14:40:33 -05:00
Lukasz Mrugala
3b8a326dc0 scripts: tests: twister: TestInstance test expansion
TestInstance unit tests were added.
The module is now 100% covered by them.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-05 14:39:58 -05:00
Lukasz Mrugala
6140948ffb scripts: tests: twister: TestInstance tests refactor
Prepares the test_testinstance.py for expansion of its tests

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-01-05 14:39:58 -05:00
Peter Marheine
0a9728f87e twister: support parallel coverage with lcov >=2.0
lcov 2.0 added support for processing coverage data in parallel, which
provides a large speedup when processing many files, at the cost of some
additional overhead. When running the Chrome EC tests with coverage,
parallel reporting on a 36C72T machine reduces the time spent generating
coverage reports by 40 minutes (from approximately 1 hour to 20 minutes
total runtime), at the cost of about 3x greater CPU time overall
(assumed to be overhead for parallel processing, likely from spawning
much larger numbers of subprocesses).

The level of lcov parallelism is taken from the --jobs option passed to
twister, allowing lcov to choose if unspecified.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2024-01-05 16:23:01 +01:00
Peter Marheine
2b20f01d86 twister: move lcov version handling to helpers
This moves handling of changed lcov arguments in lcov 2.0 into helper
functions, significantly simplifying Lcov._generate() to reduce the
visual noise of extra arguments that are required but unimportant to the
task at hand.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2024-01-05 16:23:01 +01:00
Krzysztof Chruściński
e90d69f979 scripts: checkpatch.pl: Add exceptions for FOR_EACH_NONEMPTY_TERM macro
Add exception for macro which is not terminated with semicolon.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-02 16:01:11 +00:00
Anas Nashif
aa4416624d twister: coverage: cleanup how we set gcov tool
Make sure we set the gcov tool in a consistent way and avoid issues
where path is set as Path instead of a string.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-29 10:50:14 +00:00
Dmitrii Golovanov
7525cc7943 twister: coverage: Remove dead code at BinaryHandler
BinaryHandler.hanlde() method was trying to call GCOV and fails
silently because of incorrect call parameters. Moreover, even
being fixed, this call is not needed here as it attempts to
find and process .gcno and .gcna files (using wrong paths)
to create .gcov coverage text reports.
Currently the CoverageTool class does all data processing
and report generation using GCOVR or LCOV tools instead of
direct calls to GCOV.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-27 16:10:46 +00:00
Keith Short
f6a7895496 twister: Fix exception when running coverage
Fix an exception when running coverage using gcov or llvm-cov.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/66897

Signed-off-by: Keith Short <keithshort@google.com>
2023-12-22 16:36:40 -05:00
Anas Nashif
8ad22f7df4 twister: coverage: verify existence of tools before trying to use them
Verify we have the coverage tool we want to use, otherwise we will end
up with many warnings and errors during coverage data collection.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 14:30:18 -05:00
Dmitrii Golovanov
f688532412 twister: coverage: Add command line options check for reporting
Additional checks for Twister command line options `--coverage-tool`
and `--coverage-formats`.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-22 09:54:19 +01:00
Dmitrii Golovanov
8e3a3b4845 twister: coverage: GCOVR as defautlt coverage reporting tool
Twister now uses GCOVR by default as the more reliable code
coverage reporting tool instead of LCOV.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-22 09:54:19 +01:00
Anas Nashif
cf640fef61 MAINTAINERS: add 2 new keys: tags, tests
Add two new keys: tags, tests.

tags for aligning with what we use in tests and samples and tests to
associate areas and components with tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 09:54:12 +01:00
Benjamin Cabé
109c53dae8 doc: kconfig: redirect: Add redirects for some old URLs
Documentation pages around Kconfig have moved around on a couple of
occasions in the past [1] [2] and current redirects were dysfonctional
(leading /) and incomplete, while an entire set of redirects was also
missing. This notably fixes the "browse latest development version of
this page" link on
https://docs.zephyrproject.org/2.7.5/guides/build/kconfig/tips.html or a
link to the "Kconfig tips" page as found in Kconfiglib's current README
(https://pypi.org/project/kconfiglib/)

[1] commit 5342bc64dd [2] commit
5c88418428

Fixes #66701

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-12-21 10:02:58 +00:00
Grzegorz Chwierut
e9aa3e36a9 twister: second fix for hardware map detection
When scanning ports the manufacture field is not always
filled. It must be checked before using.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-12-20 10:19:19 -05:00
Anas Nashif
a4356da484 ci: version_mgr: minor cleanups
- store downloaded version file in a temporary file.
- list weekly builds

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-20 11:57:36 +00:00
Johan Hedberg
35854391c8 scripts: compliance: Add HEAP_MEM_POOL_ADD_SIZE_ to undef whitelist
The HEAP_MEM_POOL_ADD_SIZE_ is used as a prefix for matching specific
Kconfig option names, i.e. it's not a real option in itself.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-12-20 11:01:42 +01:00
Dmitrii Golovanov
947c9dc1b4 twister: coverage: Fix LCOV full path prefixes
In some cases genhtml incorrectly built reports from LCOV
coverage data using full path for some of the source files
and relative paths for other files.
This fix adds `--prefix` parameter to shorten paths explicitly
relative to the ZEPHYR_BASE directory.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-19 08:52:20 -06:00
Yong Cong Sin
9d314ff86d twister: implement simulation_exclude filter
This gives us the flexibility to exclude certain platforms'
simulator that's known to fail from running in Twister, but
allows real hardware to be tested.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-19 07:33:39 -05:00
Yong Cong Sin
1b16d3d3ec twister: fix a minor typo
Should be 'related' instead of 'realted'.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-19 07:33:39 -05:00
Yong Cong Sin
2bd0c8c552 twister: change schema of platform_type to follow type
The `platform_type` was created to filter `type` so they
should have the same schema.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-19 07:33:39 -05:00
Piotr Kosycarz
a3acc425a9 scripts: twister: coverage: deal with multiple function definitions
Keep definitions instead of abort report creation.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-12-19 07:17:01 -05:00
Michal Smola
096e95898b twister: fix hardware map hardware detection
NXP boards with CMSID-DAP are not detected by twister
--generate-hardware-map, because serial device name 'mbed' is compared
with upper case 'MBED' in a list of supported manufacturers.
Fix it by making the comparison case-insensitive.
Tested using mimxrt1020_evk.

Fixes #63765

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2023-12-19 08:51:14 +01:00
Yong Cong Sin
0884a33ee3 scripts: build: gen_isr_tables: add some debug prints
Add some debug prints for the interrupts bits and bitmasks
in each level.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Yong Cong Sin
b4db285c1f scripts: build: gen_isr_tables: change naming of bitmask variables
Rename the bitmask variables from `*_LVL_INTERRUPTS` to
`INTERRUPT_LVL_BITMASK[]` array to be consistent with
`INTERRUPT_BITS`, making it easier to loop over the bitmasks.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Yong Cong Sin
56570cc8c1 scripts: build: gen_isr_tables: fix calculation of THIRD_LVL_INTERRUPTS
The calculation of `THIRD_LVL_INTERRUPTS` bitmask in the
`update_masks()` function is wrong, the number of bits to shift
should be the sum of the first two levels.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Marc Herbert
15336045af west: sign.py: generate platf.toml from platf.toml.h with cc -E
Allow using the C pre-processor to generate a
`rimage/config/platform.toml` file from a "source"
`rimage/config/platform.toml.h` file.

This is optional and fully backwards compatible.

To use, do not use `-c` and point west sign at a configuration directory
instead or let it use the default `rimage/config/` directory and change
the files there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert
a65b8d40fb west: sign.py: always log the rimage command
rimage is very verbose by default and has no -q(uiet) option, so saving
one line out of more than 100 lines is pointless.

RimageSigner.sign() was already very complex and suffering from
combinatorial explosion of parameters. With .toml
pre-processing (#65411) it's getting worse, so we really need all build
logs to show the complete rimage command.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert
c13cf99f2a west: sign.py: recommend separator -- tool_args always
In the following command, the first argument `for_rimage` is passed to
`rimage` whereas `--for west` goes to west.

```
west sign  for_rimage --for west
```

This is somehow valid but we really don't want anyone to do that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert
dbc4b2ed4e west: sign.py: extract new method RimageSigner.rimage_config_dir()
Zero functional change, preparation for the .toml modularization.

RimageSigner.sign() is also way too long and too complex and this helps.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert
039e5ef1b8 intel_adsp: remove rimage sign() from west flash
`west sign` has been invoked by `west build` (through CMake) since
commit fad2da39aa, almost one year ago. During that time, this new
workflow has been refined and successfully used by at least two vendors,
multiple CIs across both SOF and Zephyr and many developers.

At the time, the ability to sign from `west flash` was preserved for
backwards compatibility. This means rimage parameters can come from many
different places at once and that rimage can be invoked twice during a
single `west flash` invocation!

Now that Zephyr 3.5 has been released, we need to reduce the number of
rimage use cases and the corresponding validation complexity and
maintenance workload to simplify and accelerate new features like
splitting rimage configuration files (#65411)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Jordan Yates
ac78b97820 scripts: ci: guideline_check: support other repos
Support running this check against other repositories.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-12-15 14:38:02 +01:00
Fang Huang
15640611cf scripts: logging/dictionary/sys-t: remove escape between CDATA
This removes escape from generate XML_CATALOG_EACH string, because
the string between CDATA tag need to be treated as normal text.

Signed-off-by: Fang Huang <fang.huang@intel.com>
2023-12-15 14:34:15 +01:00
Lukasz Mrugala
f473bd9be1 twister: testplan: Platform key checking rationalisation in apply_filters
Fixes #65477
Platform key checking seemed to be erroneous;
now the variable names, comments and code seem in line with each other.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-12-15 11:32:15 +00:00
Anas Nashif
7d2b3302eb twister: support lcov > 2.0
Support lcov > 2.0 tool which has strict error checking and some new
configuration options deprecating syntax used in 1.4 versions.

Fixes #62202

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-15 04:27:28 -05:00
Piotr Golyzniak
5a3b9799aa doc: test: improve pytest documentation
Improve documentation about pytest integration with Twister. Add
examples of usage, improve description of available options and
introduce automatic doc generation of two plugin classes (DeviceAdapter
and Shell) basing on their docstrings from source code.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-12-14 10:12:21 +01:00
Daniel Leung
a819bfb2d5 xtensa: rename z_xtensa to simply xtensa
Rename the remaining z_xtensa stuff as these are (mostly)
under arch/xtensa.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Maciej Perkowski
2f7364fa0a twister: Refactor "skip to error" method
Use filter statuses instead of string matching in case of quarantine.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-12 19:09:01 +01:00
Maciej Perkowski
61dc683b71 twister: fix typo in filters.QUARANTINE
Fix typo filters.QUARENTINE to filters.QUARANTINE

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-12 19:09:01 +01:00
Joakim Andersson
25787e2df6 tfm: Harded build against TF-M built with unsecure keys
Introduce Kconfig option in zephyr build system that reflects the TF-M
cmake config variable with the same default value for dummy provisioning
and have it satisfy the IAK present requirement.
This configuration is not suitable for production, and by having this
in zephyr configuration we can have this as part of the hardened
configuration check.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-12 19:08:46 +01:00
Hake Huang
1dc43605df tests: testinstance: enforce utf-8 write
as in windows platfrom the format by default is not utf-8,
and we will see below error

Traceback (most recent call last):
  File "...zephyr\scripts\twister", line 211, in <module>
    ret = main(options)
          ^^^^^^^^^^^^^
  File "...scripts/pylib/twister\twisterlib\twister_main.py",
    tplan.load()
  File "...scripts/pylib/twister\twisterlib\testplan.py",
    self.load_from_file(last_run, filter_platform=connected_list)
  File "...scripts/pylib/twister\twisterlib\testplan.py",
    instance.create_overlay(platform, self.options.enable_asan,
        self.options.enable_ubsan, self.options.enable_coverage,
        self.options.coverage_platform)
  File "...scripts/pylib/twister\twisterlib\testinstance.py"
    f.write(content)
 UnicodeEncodeError: 'gbk' codec can't encode character '\xf8'
 in position 64: illegal multibyte sequence

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-12-12 15:03:11 +01:00
Anas Nashif
bd227e19cf twister: ignore testplan filters for integration mode
Testplan filters should be ignored when evaluating correctness of
integration configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-11 22:10:56 -05:00
Marc Herbert
352980be98 scripts/build: make struct_tags.json deterministic
It's not good to see struct_tags.json change from one build to the next
when nothing changes.

Python's sets are not deterministic, see long story for older commit
f896fc2306 ("scripts: gen_handles: Sort the device handles")

Simply convert multiple_directories to a sorted list before using it.

Fixes commit 80e78208e6 ("kernel: syscalls: no need to include all
syscalls in binary")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-11 09:51:22 +01:00
Piotr Kosycarz
a3d0c63797 scripts: twister: testinstance: store run id between builds
Cache value of run id between builds.
Save it in file and later load during next build.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-12-06 10:27:08 -05:00
Dmitrii Golovanov
47da4e2e76 twister: Improve recording at Harness
The Console Harness is able to parse its log with patterns to compose
extracted fields into records in 'recording.csv' file in the test's build
directory. This feature allows to extract custom test results like
performance counters.
With this change the extracted records are also written into 'twister.json'
as a part of each test suite object. This makes easier to store
all the data collected by the test for its further processing.

Other improvements:
 - compile parsing pattern only once instead of at each input line;
 - quote fields in '.csv' to avoid unexpected field separators;
 - make 'regex' a required schema field of 'harness_config';
 - Twister documentation update.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-06 10:26:35 -05:00
Daniel Leung
f779385b59 scripts: get_maintainer: __init__ to use filename if passed
This changes the logic in __init__() so that if a path to
MAINTAINERS.yml is passed in, it uses the passed-in value
instead of blindly running git to find the top level of
Zephyr tree.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-06 12:11:57 +00:00
Fabio Baltieri
ac5366c27d ci: compliance: keep-sorted: handle indented blocks
Change the keep-sorted check to handle blocks of code uniformly
indented.

Suggested-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-06 09:30:55 +00:00
Dmitrii Golovanov
4318140ff5 twister: qemu: Fix race condition at QEMUHandler
A race condition was possible at QEMUHandler which didn't wait for
its harness to complete causing false negatives and test suite
retries, for example when the console harness has got rather
long output from a test application to check for patterns.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-05 10:20:30 +00:00
Zhang Peng
a47aa23129 west: sign: add support for NXP i.MX8ULP board
Add support for signing i.MX8ULP SOF with Zephyr images with rimage.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2023-12-04 16:41:00 +00:00
Marc Herbert
fb8d41b123 scripts/build/elf_parser.py: make dependency graph output deterministic
Python's sets are not deterministic.

`devices` were already sorted but `dev_supports` is still a
non-deterministic set. Sort dev_supports to make the graph output
deterministic.

Fixes commit 29942475c5 ("scripts: gen_handles: output dependency graph")

It is quite ironic that this initial and non-deterministic graph commit
was concurrent with and slightly delayed other commit
f896fc2306 ("scripts: gen_handles: Sort the device handles") which
fixed another, similar non-determinism issue in the same area. A true
"whack-a-mole"!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-04 14:24:32 +01:00
Marc Herbert
eea56d2080 scripts/build/elf_parser.py: add __lt__() method to base class
This allows sorting objects consistently without having to specific a
key.

No functional change yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-04 14:24:32 +01:00
Maciej Perkowski
690011498c twister: Add target reports in json format
Using --platform-reports will also generate json reports
with results from a single platform. Needed for on-target
results publishing process.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-02 07:50:50 -05:00
Alberto Escolar Piedras
188cdd95c5 twister tests: Replace native_posix with native_sim
As native_sim is replacing native_posix overall and
becoming the default test platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Ederson de Souza
10ec2b129c scripts/pylib/twister/twisterlib: Support multiple --pytest-args
One can not even replace sucessfully pytest basic sample `pytest-args`
with command line "--pytest-args", as all it does is to append a single
string to current list of commands, making it impossible to send several
arguments.

This patch fixes that by allowing several instances of `--pytest-args`
to compose the whole list of arguments to be passed to pytest.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2023-11-30 10:03:01 +01:00
Anas Nashif
ffcf9c5987 twister: do not add a platform to keyed tests if previously filtered
If a platform is fitlered, do not add it to keyed test map, otherwise we
will end up skipping all platforms from the same class without any
coverage.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-30 10:02:52 +01:00
Jeppe Odgaard
f74f309ec7 valgrind: Update POSIX soc no cpu cleanup suppression
Add `possible` to match-leak-kinds to prevent false positives caused by
POSIX soc no cpu cleanup.

The leak can be reproduced by adding CONFIG_NETWORKING=y to
tests/lib/cpp/libcxx/prj.conf and run twister:
twister -p native_sim -s tests/lib/cpp/libcxx/cpp.libcxx.host
--enable-valgrind

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-11-29 15:33:49 +01:00
Paszkiet Kamil
4c035af05c scripts: tests: twister_blackbox: Add test test_report.py
add test to test_report.py:
  -platform_reports
  -report_suffix
  -report_name
  -report_dir
  -outdir

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2023-11-29 09:52:44 +00:00
Anas Nashif
0d535010cd twister: tests: adapt test for new option
mock build_dir of instance.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-28 14:48:03 +01:00
Anas Nashif
d3af185acd twister: add --aggressive-no-clean option
Useful option during development and when applying smaller change to the
code and verifying changes using tests. This works fine as long as no
dependencies or major changes are done, i.e. when editing few files and
in a subsystem. Use with caution and use on your own risk :-)

When building multiple tests, this provide significant boost, up to 300%
faster than when rebuilding everything from scratch or when re-running
cmake every single time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-28 14:48:03 +01:00
Seppo Takalo
a8d56c4f1f net: scripts: Use native_sim instead of native_posix
Sample tests should also be using native_sim board.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-27 19:55:30 +01:00
Alberto Escolar Piedras
3d406a7a56 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
ae241af736d06874ec02deb9aacb79918d745aba

Which includes:
* ae241af native timer_model: Allow calling into get_host_us_time

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Anas Nashif
c696344f0d twister: tests: adapt tests for new behaviour in runner class
We have removed some return data and added build time to instance class.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-25 08:49:27 -05:00
Anas Nashif
2ba6bcf906 twister: measure build time and report it in json output
Measure both cmake and make/ninja build times and log them in debug mode
and additionally put the result in the json report for tracking build
times.

Cleanup what build/cmake function return and remove unused keys in the
result map.

Remove some excessive logging of launched jobs or default platforms that
gets in the way when in debug mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-25 08:49:27 -05:00
Yong Cong Sin
ecb2df0444 scripts/checkpatch: add __unused to the $Attribute list
Add `__unused` to the `$Attribute` family along with its
`__maybe_unused`, `__always_unused` & `__used` brothers, so
that:

```c
__unused int ret;
```

is recognized as variable declaration, and doesn't raise
`LINE_SPACING` warning in CI.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-24 09:27:39 +00:00
Grzegorz Chwierut
a1698b691d twister: pytest: Add --pytest-args to Twister command line
Extend Twister command line with --pytest-args. This parameter
is passed to pytest subprocess. It allows to select a specific
testcase from a test suite.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-11-23 10:03:11 +01:00
Alberto Escolar Piedras
71db6550cd native simulator: Get latest from upstream
Align with native_simulator's upstream main
7d652dbfb313260cf07d595ccf26638f2b3c2959

Which includes:
* 7d652db Provide macros for noreturn and unreachable & annotate

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:52:52 +01:00
Alberto Escolar Piedras
0ce4de8eec pytest sample & docs: Replace native_posix with native_sim
In the docs replace references to native_posix with native_sim
Switch the default test platform to native_sim from native_posix

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 12:02:48 +01:00
Benjamin Cabé
05e6e1ce15 scripts: sync spelling.txt with version from Linux kernel v6.7-rc1
Sync the spelling.txt file with a recent version of the one found in
Linux kernel.
List sorting was preserved (however inconsistent it might be) to
simplify future syncs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-15 17:33:17 -05:00
Benjamin Cabé
78afda36f1 scripts: Add "the the" as a common typo in spellchecker
Somehow this is seems to be a very common typo. Adding it to spelling.txt
 to catch it as part of compliance check.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-15 17:33:17 -05:00
Paszkiet Kamil
7029c79ef2 scripts: tests: twister_blackbox: Add test test_hardwaremap.py
add tests to hardwaremap tests:
  - generate_hardware_map (different ways)

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2023-11-15 10:01:33 +01:00
Wilfried Chauveau
2deea4eeee twister: Fix failure on MacOS
On MacOS, ps utils raises a `NoSuchProcess` error rather than a
`ProcessLookupError` when a pid no longer exists.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2023-11-15 10:00:08 +01:00
Anas Nashif
56f73bde0f ci: testplan: fix mcumgr path
fix path for mcumgr in tags.yaml, we were skipping tests due to wrong
path.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-14 17:49:40 -05:00
Fabio Baltieri
2171f8b7a1 ci: compliance: only run sorted check on text files
The sorted check code crashes on binary files. Add a check on file type
and only process text ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-14 15:05:56 +00:00
Dmitrii Golovanov
7d0d3f83cb twister: harness: Fix TestCase id at Console for Ztest
Implement a workaround for Console harness to compose TestCase
identifier correctly when a Ztest suite with a single testcase
uses this harness type. Normally, a Ztest suite should use the
Ztest Twister harness.
Without this workaround each Ztest TestCase result on Console is
duplicated (and written into twister.json) with its 'identifier'
attribute set to TestSuite id only, no TestCase suffix added;
the resulting entry with the full TestCase id is also stored,
but its values are empty with defaults.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Dmitrii Golovanov
00d260af96 twister: harness: Check Console harness configuration
If Console Harness 'harness_config' properties have no 'regex'
patterns or no correct 'type' set, then ConfigurationError exception
is raised, handled, and the test instance error is accounted
in the summary results.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Dmitrii Golovanov
8b6f447ef8 twister: harness: Fix Console unordered pattern matching for ztest
Fix the Twister Console harness unordered pattern matching
to treat the ztest as failed when not all of the
expected patterns were found in the console output, but the ztest
application itself reports 'PROJECT EXECUTION SUCCESSFUL'.

Unify debug logging on pattern match for ordered and unordered patterns.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Alberto Escolar Piedras
d1e91686f3 twister: Replace native_posix with native_sim
* Replace native_posix references with native_sim
  in arguments help messages
* For the seed parameter, correct platform check to accept
  native_sim
* Use native_sim in twister tests

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-14 06:51:38 -05:00
Fabio Baltieri
aa25fe06a5 ci: compliance: undef list few configs used in optional modules
The Kconfig check fails when running the script locally for undefined
symbols if the checkout does not include optional modules (the default
behavior). Add these symbol to the Kconfig undef list.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-14 09:24:03 +01:00
Jordan Yates
31200fb33d scripts: twister: config_parser: copy common values
Create copys of the common configuration values when constructing test
scenarios, to avoid mutating the common value with test specific
appends.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-13 09:53:16 +01:00
Yves Vandervennet
28c5b1d76d west: linkserver: update to reflect logging changes in 1.3.15
NXP released the linkserver update 1.3.15, which corrects an issue
with logging that by default went out to stderr when flashing.

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-11-13 09:47:27 +01:00
Hake Huang
dbed251249 test: twister: testplan.py use normpath
when load test plan it is possible the plan is built in another os
so the case key would be
'samples/hello_world/samples.baseic.hello_world'
but the testsuite is scaned in current os may in window
and the key is like
'samples\\hello_world\\samples.baseic.hello_world'

so update the uniq path with only backslash in path

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-11-13 09:42:50 +01:00
Fabio Baltieri
98d9a7f86f scripts: compliance: add a compliance check to keep blocks of code sorted
This allows defining a list within two marker (zephyr-keep-sorted-start
and zephyr-keep-sorted-stop), and have the CI validate that the block is
kept sorted every time stuff gets added to it.

This is mainly for Kconfig and CMake include lists so that there's no
ambiguity on where to add new stuff.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-13 09:41:05 +01:00
Yuval Peress
6bd0b54526 twister: Fix gtest harness
Some platforms prefix extra logging information before the standard
[] blocks so I've added `.\*` to the regex. Also, removed the static
values so they're only referenced using 'self.' and stopped parsing
lines after the FINISHED_PATTERN is matched since some versions of
gTest also print out a test summary after and it's not useful for
the processing.

Signed-off-by: Yuval Peress <peress@google.com>
2023-11-10 16:23:07 -05:00
Hake Huang
cf053d07e3 test: twister: test_runner remove line number check in log
1. remove the line number check in test vector
2. log_info is not a static method anymore, change test

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-11-08 07:49:49 -05:00
Anas Nashif
debe7fefe6 ci: assignees: do not set trivial on manifest changes
manifest changes are often a oneliner change, but they are not
necessarily trivial.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-06 12:11:58 -05:00
Lukasz Mrugala
670b917b4b scripts: tests: twister: Hardware map unit testing
This change creates unit tests for the hardwaremap.py module.
It achieves 98% coverage.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-11-06 10:08:44 +01:00
Grzegorz Chwierut
e466b7ac26 twister: pytest: Improve reporting failed pytest scenarios
When pytest scenario fails, then 'handler.log' is printed.
Changed to print 'twister_harness.log' that is a log from
pytest execution. That file tells much more when test fails.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-11-04 07:39:31 -04:00
Dmitrii Golovanov
97fab83716 scripts: coverage: gcovr to ignore negative counters
Apply a workaround for an issue introduced with bc8b7dd
for code coverage collection at qemu_x86 when gcov data
was broken because of optimized out memcpy() in write_u64()
static inline function, so gcovr parser fails with
"gcovr.gcov_parser.NegativeHits: Got negative hit value
in gcov line 'branch  1 taken -1'".

Add gcovr command line option to ignore such errors (since v.6.0):
"--gcov-ignore-parse-errors=negative_hits.warn_once_per_file"

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-03 07:57:10 -04:00
Anas Nashif
a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
9c4d881183 syscall: rename Z_SYSCALL_ to K_SYSCALL_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
c25d0804f0 syscall: rename z_object_find -> k_object_find
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
27d74e95c9 syscall: rename z_object_wordlist_foreach -> k_object_wordlist_foreach
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
a6b490073e kernel: object: rename z_object -> k_object
Do not use z_ for internal structures and rename to k_object instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Fabio Baltieri
dd178ce311 scripts: check_init_priorities: rework the error messages
The current error messages are a bit cryptic, rework them to make them
more meaningful:

- add an extra message on the first error to explain what the errors
  refer to.
- rework the error message to be more explicit.
- rework the priority string print to use a LEVEL+offset format to
  somehow highlight that the number is the offset from the level, not
  the actual priority.
- print the init function name in addition to the devicetree path.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-03 11:45:23 +01:00
Fabio Baltieri
2a70c31945 scripts: check_init_priorities: drop the same priority check
Since bb590b5b6e introduced ordinals in the priority sequence, the "same
priority" case cannot happen anymore, furthermore the priority value in
the script is now the position of the function in the init sequence, so
if two devices have the same priority there's something real bad going
on.

Drop all the "same priority" handling code and tests, convert the case
into ane exception instead. Drop the init stubs as well from the test,
they are not required anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-03 11:45:23 +01:00
Anas Nashif
85dd423468 twister: report: remove defunct and old option
--report-excluded has not been working for years, nobody has noticed.

Fixes #64644

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Anas Nashif
32f7570bb4 twister: report: remove dead code
Remove dead code for listing tests. This is covered already for the case
of --list-tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Anas Nashif
9571f1c502 twister: use correct variable for testcases
We use testcases now, not cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Mateusz Junkier
8bccb645aa boards: intel_adsp: fix board flashing
add missing declarations to work with ace15 board

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-11-03 09:56:08 +01:00
Carles Cufi
9cf07bbdb5 bluetooth: Rename rpmsg HCI driver and sample to ipc
The existing driver and sample:

- drivers/bluetooth/hci/rpmsg
- samples/bluetooth/hci_rpmsg

are no longer correctly named, since they now use the IPC subsystem to
send and receive data. The IPC subsystem can use RPMsg as a transport,
but that is one of several selectable backends.

I initially wanted to deprecated both the BT_RPMSG Kconfig option as
well as the zephyr,bt-hci-rpmsg-ipc chosen node in Devicetree. However,
this proved to be undoable in the case of the Kconfig option. This is
because it's a choice option, and those have special behavior. In
particular, the only practical way to deprecate would've been to keep
the old Kconfig option outside the choice (much like it's done in this
commit) but then also add a 'depends on !BT_RPMSG' on each of the
remaining choice symbols *except* on the new BT_HCI_IPC one. This, however,
only works correctly for .conf files. If a board instead sets the
default BT_HCI_BUS_TYPE in the Kconfig.defconfig file then the Kconfig
tree parsing would fail, because it'd try to set it to a value
(BT_RPMSG) that is no longer part of the choice.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-11-02 08:32:20 +02:00
Grzegorz Chwierut
0958abd2ef twister: unittests: Fix unittest test_projectbuilder_gather_metrics
Fix #64606 by initializing mock object.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-31 09:53:33 -04:00
Maciej Perkowski
aa3e79a88a scripts: Add test_plan.py to twister_ignore.txt
There is no point in running full twister scope when
test_plan.py script is modified.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-31 09:02:16 +01:00
Simon Hein
169de2c0ee scripts: utils: add guidelines converter script
Add a guidelines rst converter script
to convert the rst document written coding guidelines
into another format.
First supported format is the format for cppcheck

Signed-off-by: Simon Hein <Shein@baumer.com>
2023-10-30 13:46:23 -04:00
Grzegorz Chwierut
bbab631021 twister: unittests: Use mock for os.name in unittests
Use mock.patch instead of monkeypatch for os.name in unittests
to fix error when executing tests under VSCode

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-30 11:50:48 -04:00
Yong Cong Sin
df2c0681d3 devicetree: encode multi-level interrupt number in C devicetree magic
The multi-level encoding of the interrupt number currently
happens in the `gen_defines.py`, which is called in the
`dts.cmake` module after `kconfig.cmake`. However, the number
of bits used by each level is defined in Kconfig and this means
that `gen_defines.py` will not be able to get that information
during build.

To fix this, do the multi-level encoding in C devicetree macro
magic instead of the python script. This ticks one of a
long-standing TODO item from the `gen_defines.py`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Maciej Perkowski
3314b8e0c3 twister: bugfix: Fix infinite loop in test_plan.py script
Commit 72f416f382 added a horizontal
scan for .yaml files when a modification was made in "common" folder.
If yamls were found in such way, the loop ended. However, the
implementation didn't address what happens if such yamls are not found.
This made the script going into an infinite loop. If yamls are not
found next to "common", the script should proceed as before, i.e. go
to the directory above an start looking there.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-30 10:54:57 -04:00
Lukasz Mrugala
471cff50e8 scripts: tests: twister: Jobserver tests
Jobserver module was not covered by unit tests.
This change brings its coverage to 100%.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-30 08:28:02 -04:00
Lukasz Mrugala
3c7968172e scripts: tests: twister: Add error testing
Errors did not have their dedicated test file.
This change adds it to the repo and
checks the only non-def statement there.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-30 08:27:43 -04:00
Lukasz Mrugala
2235a8253b scripts: tests: twister: runner test expansion
Creates a few dozen new tests that cover every runner.py method.
99% coverage (All statements save for one) is achieved.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-27 13:36:17 -05:00
Grzegorz Chwierut
fffe0b9fad twister: pytest: Parametrize scope of the dut fixture
Added pytest_dut_scope keyword under harness_config section.
New keyword is used to determine the scope of dut and shell
fixtures in pytest-twister-harness plugin.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-27 13:35:14 -05:00
Maciej Perkowski
72f416f382 scripts: Add workflow for "common" directories in find_tests()
Some tests use a "common" directory to store pieces of code which
are reused by different scenarios. In those cases, no test yaml is
found within such director nor within its parents.
If no test yaml is found in a directory, and the directory is called
common, also look in collocated directories if they have test yamls.
If so, add all those locations to the scope.
E.g. tests/bluetooth/controller/common

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-27 09:13:16 -04:00
Maciej Perkowski
9f85001061 scripts: Make workflow of test_plan.py script more robust
The script was not resolving all detected changes uniformly:
find_excludes() could skip or not certain patterns based on
required testing scope. The idea was to not include files
that were already handled by find_test() and find_boards() workflows.
However, only boards and tests folders could be removed but
not samples. This also led to blind spots: changes in some files
were not triggering any tests. E.g. change in a test/common, where
no corresponding yaml can be found by find_tests() which is also
ignored by find_excludes(). In the new workflow a list of resolved
files (for which find_arch(), find_tests() or find_boards()
found scope) is created. Instead of using skip in find_excludes,
files are excluded only if they were resolved.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-27 09:13:16 -04:00
Krzysztof Chruściński
f172a1a5ee scripts: logging: dictionary: Handle string stripping
Add support for getting strings from section which is not part
of the binary.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 11:42:21 +02:00
Krishna T
85e3a4ca6a scripts: ci: Fix for compliance with multi-user machine
If in a server multiple users are running compliance then it throws
errors as the filename "Kconfig.modules" and "Kconfig.dts" is owned by
someone else.

Fix this by creating a randomized Kconfig file and delete after use.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-10-26 16:47:30 +02:00
Jordan Yates
79e467c92a scripts: kconfig: kconfiglib: introduce configdefault
Introduce the `configdefault` keyword as a Kconfig extension. This new
keyword allows `default` values to be applied to externally defined
symbols without needing to respecify dependencies, or weakening the
existing dependencies.

This is primarily useful in downstream repositories that wish to define
default configurations such as:
```
config MY_COMPANY_APPS
    bool "Apply defaults for internal applications"

configdefault BT
    default y if MY_COMPANY_APPS
configdefault MCUMGR
    default y if MY_COMPANY_APPS && BT
```

Obtaining the same functionality with `config` (without weakening the
symbol dependencies) requires finding the original definition and
duplicating any `depends on` and surrounding `if` statements. This is a
non-trivial exercise that needs to be manually rechecked on each Zephyr
update.

`configdefault` simplifies this process by acting as if the `default`
statement was present at any one of the original definitions of the
symbol.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-26 09:47:06 +02:00
Jordan Yates
c8df08d681 scripts: kconfig: kconfiglib: cleanup pylint errors
Cleanup pylint errors that otherwise cause future commits to fail.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-26 09:47:06 +02:00
Henrik Brix Andersen
bf598848b1 scripts: west: commands: tests: dfu_util: fix test under Python 3.12
Use "call_args_list" from unittest.mock instead of "called_with" for
verifying the arguments supplied to the dfu-util west runner.

This aligns the assert with the rest of the test case and fixes the
dfu-util west runner test when running under Python 3.12.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-26 07:17:10 +02:00
Daniel Leung
4201978f34 manifest: sof: update to commit e7cb489d4
This updates SOF modules to commit
e7cb489d430dc2181e4a5f7f953ed1eaeec6668d. This includes
a change where rimage is pulled into the tree and is no
longer a submodule. So update the rimage config path so
signing still works.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-25 21:44:14 -04:00
Daniel Leung
3be5732a68 west: sign/rimage: skip extended manifest when !SOF
Non-SOF build does not have extended manifest data for
rimage to process, which might result in rimage error.
So do not do extended manifest during signing when not
doing SOF builds.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-25 21:44:14 -04:00
Fabio Baltieri
73d5ecc0c5 scripts: check_init_priorities: drop recursive child parsing
Now that child nodes are handled by edtlib there's no need to parse
child nodes in check_init_priorities anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-25 18:39:31 -07:00
Fabio Baltieri
403640b75e edtlib: link child nodes to parent for nodes with child-bindings
The current EDT graph logic only use properties directly under a
specific node to add dependencies. For nodes properties in
child-bindings, this means that the child phandles are only linked by
the child node itself, which does have an ordinal but no corresponding
"sturct device" in the code, causing those dependencies to be silently
ignored by gen_handles.py.

Fix that by adding the recursive logic to visit child bindings when
present, which causes all child node property handles to be linked to
the parent node.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-25 18:39:31 -07:00
Manuel Argüelles
52e9671fa8 west: add tests for NXP S32 Debug Probe
Add minimal set of tests to verify behavior of supported commands.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles
e938a5a31a west: add NXP S32 Debug Probe runner
The NXP S32 Debug Probe is a JTAG-based probe that enables debugging on
NXP S32 devices. This probe is designed to work in conjunction with NXP
S32 Design Studio and this runner offers a wrapper to launch a debug
session from cli.

`flash` command is not implemented at the moment because presently there
are no zephyr boards that can make use of it and test it.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles
1bc53ff84d west: core: allow to pass keywords args to server and client
Allow the runners to pass extra keywords arguments to both the server
and client subprocesses calls, as can be useful for instance to set
a specific execution environment.
ZephyrBinaryRunner.check_call() already supports passing kwargs to
the inner subprocess call but this is currently not possible when
starting server/client processes. So pass through the kwargs to each of
the client/server subprocess calls.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles
c35d024b8d west: core: add search path argument to require()
Allow the runners to override the default search path, e.g. when
provided through command line. The default is to search for the program
binary on the system PATH.

This is useful when the runner allows to optionally override the search
path of the tool, in the case there are multiple versions or
installations, and not necessarily the tools path are present in the
system PATH environment variable. For example:
`tool = self.require(tool_name, path=args.tool_path_override)`

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Piotr Kosycarz
8c5a15aac4 scripts: twister: get status of coverage data processing
Do not break processing when incorrect coverage data are received.
Instead, report failures but still process valid data.

Include coverage processing status within twister retrun code.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-10-25 09:57:15 +02:00
Piotr Kosycarz
861cab4a2a scripts: twister: extend test timeout to get gcov data
When coverage is enabled, gather console logs longer
to receive gcov data which are send after test output.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-10-25 09:57:15 +02:00
Flavio Ceolin
2e5c37142c scripts: kconfig: Always generate ZEPHYR_*_MODULE
Define the ZEPHYR_{MODULE_NAM}_MODULE option for all available modules.
Right now only modules defined as 'kconfig-ext' has this symbol defined
which may cause problem if the build wants to check if a module not
using this options is available.

This allow us to do something like:

comment "mbedTLS module not available."
	depends on !ZEPHYR_MBEDTLS_MODULE

or make a feature depends on the module be present.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-24 10:53:24 +02:00
Maciej Perkowski
0752d60443 scripts: Add arg to test_plan.py for alternative test locations
The arg --testsuite-root was copied from twister. When it is used
for test_plan.py it will be propagated to twister calls. This allows
to make alternative test locations (e.g. from another repo) to work
with test_plan.py

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski
7692610004 scripts: Add arg to set_plan.py for alternative tag relation list
Add --alt-tag arg for test_plan.py script. User can use it and point
to an alternative file with tag-directories relations. If so, such
file will be used instead of the default one.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski
47405a114a scripts: Allow using alternative ignore-patters in test_plan.py
Expand test_plan.py args with --ignore-path. This allows to provide an
alternative lists of patterns for the script.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski
f7c4d5f9d4 scripts: Allow test_plan.py to work with other than zephyr repos
The test_plan.py script has a path to repository to be scanned for
changes hard coded to zephyr. This patch separates zephyr path from
such repository's path and adds an arg to pass repo to scan

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski
f9178926a9 scripts: Add --no-detailed-test-id arg to test_plan.py script
An option --no-detailed-test-id was added to twister to help align
names for test outside of zephyr tree. This commit add this arg
to test_plan.py script which is then propagated to twister.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Anas Nashif
b643692fa5 ci: test_plan: use integration mode for architectures
Reduce the scope to integration only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-23 11:20:57 -04:00
Anas Nashif
99bb4b9581 ci: testplan: fix include path
Add zephyr to the include path detection.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-23 11:20:57 -04:00
Alberto Escolar Piedras
bc5da1a158 native simulator: Get latest from upstream
Align with native_simulator's upstream main
d32b2504ad2b6d6d541bc71a0f9b16ab7b6a3831

Which includes:
* d32b250 Minor format fix
* 7b4f35b native HW counter: Provide new API to reset and control
* 4f815cb INT CNTLR: Bugfix for more than 32 interrupts
* 1d36254 Provide new 64 version of nsi_find_lsb_set

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-20 15:20:43 +02:00
Anas Nashif
2ab8c1b779 ci: do not run twister on set_assignees.py changes
No need to run twister when changing this script.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:10:11 +02:00
Anas Nashif
d9a300e4ae ci: various set_assignee fixes
Cleanup of script and change how we assign PR in general:

Make sure that when multiple areas are changed, including platform or
driver changes, we set assignee of the general areas and not the
platform maintainers. For example, if I change 100 SoC files and touch
the kernel file, the assignee is set to the kernel maintainer.

First, we should as much possible try and split such changes and not
have common area changes with platform changes at the same time. Second,
it is important that such changes which affect everyone are reviewed and
approved by the maintainer of the general areas rather than leave them
to the platform maintainer.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:10:11 +02:00
Anas Nashif
719fee2bbc doc: ztest: adapt ztest docs
Remove remaining usage and documenation of dropped kconfig that is now
the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif
996c8457d7 ztest: remove old ztest api
Remove old Ztest API entirely. New API is the now the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Radoslaw Koppel
48b93ee0aa scripts: build: gen_isr_tables: Cleanup access to ".intList"
This commit removes the needs or generating isrList.bin temporary file.
Now gen_isr_tables.py script access the required section directly in
elf file, that was accessed by the script anyway.
It simplifies the building removing one step.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2023-10-20 14:58:55 +02:00
Øyvind Rønningstad
bb1cfbad19 twister: Add option for generating rom.json and ram.json
Generate the files via the 'footprint' target for each project.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2023-10-20 14:54:54 +02:00
Alberto Escolar Piedras
ec273d1357 twister: Fix description of relationship between filter and allow/exclude
The current description of the relationship between the tests filter
and the arch/platform allow/exclude was actually incorrect.

Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-17 18:55:35 +03:00
Anas Nashif
38e86c8e86 twister: runner: change log message from info to debug
Very verbose log message without too much context that should be a debug
message rather than a info().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-12 20:40:56 +03:00
Maciej Perkowski
4cd7df2eec twister: Fix error for --device-testing with not runnable integration
An urforseen error was introduce with #62713. When "--device-testing"
or "--filter runnable" is used in CLI, twister will skip tests which
cannot be executed (not just built) on a given platform. If a given
platform is among integration platforms it will cause an error.
However, it shouldn't be the case. Such skip is intentional and
shouldn't be an error. Fixed by assigning an existing Filter.CMD_LINE,
which is exempted from being turned to error.

fixes: #63844

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-12 18:22:23 +03:00
Dmitrii Golovanov
496509cd65 twister: Reset TestInstance status before run
Reset TestInstance status when ProjectBuilder.run() is called
to run the test after its successful build, so the build status
will not propagate as the run status if the run fails.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-10-12 14:43:38 +03:00
Dmitrii Golovanov
9cdb0aaa14 twister: harness: Fix Console pattern matching for ztest
Fix the Twister Console harness ordered 'multi_line' and 'one_line'
pattern matching to treat the ztest as failed when not all of the
expected patterns were found in the console output, but the ztest
application itself reports 'PROJECT EXECUTION SUCCESSFUL'.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-10-12 14:43:38 +03:00
Gerard Marull-Paretas
7772cec6bd edtlib: always insert root node to the graph
When we have an empty Devicetree, ie,

```
/dts-v1/;

/ {

};
```

The node's dep_ordinal is never initialized because the node graph is
empty. This ends up with invalid ordinal tokens (-1) in
devicetree_generated.h which in turn produce some cryptic compiler
errors, see e.g.

```
error: pasting "dts_ord_" and "-" does not give a valid preprocessing
token
   95 | #define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_,
      DT_DEP_ORD(node_id))

...

include/zephyr/devicetree.h:2498:41:
note: in expansion of macro 'DT_FOREACH_OKAY_HELPER'
 2498 | #define DT_FOREACH_STATUS_OKAY_NODE(fn)
      DT_FOREACH_OKAY_HELPER(fn)
            |
	    ^~~~~~~~~~~~~~~~~~~~~~
include/zephyr/device.h:1022:1:
note: in expansion of macro 'DT_FOREACH_STATUS_OKAY_NODE'
     1022 |
	  DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL)

```

(devicetree_generated.h)

```
...
 #define DT_N_ORD -1
 #define DT_N_ORD_STR_SORTABLE 000-1
...
```

This patch makes sure root node is always inserted (without any target)
so that it gets initialized later.

Discovered as part of
https://github.com/zephyrproject-rtos/zephyr/pull/63696

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-10-11 18:28:01 +03:00
Grzegorz Swiderski
ce1b8d6d16 scripts: kconfig: Make DEPRECATED/EXPERIMENTAL symbols optional
Make `kconfig.py` not crash when any one of these settings is undefined:

  * DEPRECATED
  * EXPERIMENTAL
  * WARN_DEPRECATED
  * WARN_EXPERIMENTAL

While these will continue to exist in Zephyr, they shouldn't be strictly
required for the script to work. One situation in which they could go
missing is when a user creates an application-specific Kconfig root, but
forgets to source "Kconfig.zephyr" inside it - not that this is expected
to work anyway, but it could at least raise a more intelligible error.

Note that when WARN_DEPRECATED is undefined, selecting DEPRECATED will
always produce warnings. Same with WARN_EXPERIMENTAL and EXPERIMENTAL.
This matches the fact that the WARN_* symbols normally have `default y`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-11 18:25:57 +03:00
Benjamin Cabé
4773f42c27 west: bossac: handle stty from coreutils on macOS
There might be situations where people are running the coreutils version
of stty on macOS, hence the need for being smarter at detecting when
that might be the case

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-11 11:05:48 +01:00
Alberto Escolar Piedras
07e88a9fba west native_gdb runner: Fix to use exe instead of elf
The runnable output from the build system is the
exe file. In native_posix the elf happend to also be
runnable, but this is not the case in general,
and not for native_sim or the nrf5*bsim boards.

So lets use the exe instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-10 15:26:09 +02:00
Alberto Escolar Piedras
f8455b410e west runner: Add exe file to configuration
Add the exe fle to the runnerconfiguration class,
so we can use it from runners which will need it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-10 15:26:09 +02:00
Anas Nashif
22042e7b4e ci: tags: include wifi/net drivers in the net group
Changes to networking and wifi drivers should trigger networking tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-10 16:22:54 +03:00
Lukasz Mrugala
eeb142d409 .github: workflows: Workflow for build_helpers
PR #63195 has managed to change code under test without
triggering those tests.

This change should remedy that by creating a new workflow,
based on twister_tests.yaml, that runs tests in
scripts/tests/build_helpers if build_helpers are modified.

Such a workflow should be easily extendable if we ever have more
non-Twister things to test in scripts/pylib.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Lukasz Mrugala
76f9a024c3 scripts: tests: twister: Domains tests fix
PR #63195 has changed how Domains work without
triggering necessary tests, thus breaking them.
This commit fixes the domains tests.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Lukasz Mrugala
2fcf4e3499 scripts: pylib: build_helpers: flash_order fix
If flash_order were to be missing from the YAML, the Domains init
would crash instead of substituting an empty list.
This commit fixes that.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Seppo Takalo
1ecd4fda1a net: script: Fix the net-tools path
Fix the correct path to net-tools directory.
Also default to Bash instead of /bin/sh as we use
Bash syntax.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-10-06 16:14:39 +03:00
Yong Cong Sin
0722c621c8 util: increase several macros limit from 255 to 4095
Currently, the following macros will only work for 0 - 255:
- `IS_EQ`
- `UTIL_X2`
- `UTIL_INC`
- `UTIL_DEC`
- `LISTIFY`

This patch increases their limit to 4095.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-05 06:10:06 -04:00
Grzegorz Swiderski
9bbf7e5a48 scripts: domains: Convert Domain to a dataclass
For conciseness.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Swiderski
652b0a8a98 scripts: domains: Support initialization only from YAML
By requiring a full-on YAML fragment, the Domains class can rely on
pykwalify to do the heavy lifting with validating types and structure.
Remove support for loading domains from a dictionary, so that we don't
ever have to replicate the same checks on the input, and we can instead
have a single entry point.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Swiderski
f82e2ef043 scripts: domains: Tighten up initialization
Do extra checks to reject inconsistent `domains.yaml` contents early:

   default: app
   build_dir: /path/to/build
   domains:
     - name: image_1
       build_dir: /path/to/build/image_1
     - name: image_2
       build_dir: /path/to/build/image_2
   flash_order:
     - image_1
     - image_2
     - unknown

This example lists "image_1" and "image_2" as known domains, but an
entry for the default "app" is missing, which should never be allowed.
A valid `domains.yaml` file shall also not contain extra domains under
`flash_order`, such as "unknown", which doesn't appear under `domains`.
Either of these cases can now be caught while initializing an instance
of the Domains class.

It follows that a valid `domains.yaml` file must always contain a list
of domains with at least one entry - the default image. Since `default`
is a required key in the YAML schema, `domains` should be required too.
Thus, empty lists will be rejected by pykwalify, so the questionable
warning for "no domains defined; this probably won't work" can be axed.

Fixes #63166

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Chwierut
fd6f3c5a2a twister: Fix quarantine performance issue
When using a quarantine file with more than 512 unique
entries, than time of matching quarantine increases
significantly. This is because regexp cache size is
512. Add precompiled regexp entries to the quarantine
as a fix.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-04 14:49:38 +01:00
Øyvind Rønningstad
fea8caccea twister: Make string stripping consistent across handlers
All handlers except QEMU were right-stripping console lines before
checking them. In certain cases where the regex is expecting the
whitespace, this could make the test fail on qemu when it is passing
on something else. Change QEMUHandler to us .rstrip instead of .strip()

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2023-10-03 16:38:02 +01:00
Lukasz Mrugala
b892a4bc49 scripts: tests: twister: Add log_helper tests
Log helper is a small module that this commit
covers with an explicit test.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-03 15:22:08 +01:00
Carles Cufi
2332a1db39 west: runners: nrf: Document why the network core is recovered first
The network core needs to be recovered first due to the fact that
recovering it erases both the network and application cores' flash
memory. This means that the little flash image that is programmed during
the recover operation would be lost for the app core if we inverted the
order.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-03 15:11:55 +01:00
Grzegorz Chwierut
0badef8091 twister: Fix missing timeout in handler class
In PR #62947 a timeout variable was replaced with a method,
but this timeout was used in another place to start
pytest subprogram. This commit provides a fix.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-02 16:40:11 +01:00
Anas Nashif
9d9f3b5c67 twister: do not error on module filters
If a module is not available, then it is optional, so do not error in
--integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-01 09:21:50 +03:00
Martí Bolívar
23ed21c0a0 scripts: runners: rework RunnerCaps implementation
This provides miscellaneous quality of life improvements:

- We couldn't use dataclasses when this class was originally written.
  We can now, so move to dataclass to avoid having to write
  __repr__().

- Add missing validation for the advertised commands

- Add missing documentation for the 'file' capability

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2023-09-29 16:30:07 +02:00
Maciej Perkowski
066cc2c9d2 twister: Add options deciding if paths be included in tests' names
Test suites names are not being handled uniformly for tests not
in zephyr tree. Their names depend on -T arg used in twister's CLI.
The newly added options allow to select if twister should add paths
to suite names. This is needed if test plans are to be used for tests
outside of zephyr tree.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-29 16:29:16 +02:00
Maciej Perkowski
4e4b743fe1 twister: Add "path" entry to json test report
"Path" is a path (relative to zephyr) to a directory with test suite's
definition. Such entry helps to locate a given test.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-29 16:29:16 +02:00
Lukasz Mrugala
66730c961e scripts: tests: twister: Domain module testing
Domain module was not yet covered by explicit unit tests.
This commit adds a new test file to cover that gap.
It achieves 100% coverage at the time of creation.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-29 16:26:35 +02:00
Manoel Brunnen
ae924b2afc twister: Fix test-only tests with hardware map fixtures
In test-only mode with a hardware map, all tests with fixtures were
skipped, even when the hardware map has appropriate fixtures defined.

TestPlan.load_from_file had the check for fixtures missing, but actually
best is that the TestInstance checks the fixtures in the hardware map.

Signed-off-by: Manoel Brunnen <manoel.brunnen@ithinx.io>
2023-09-29 16:25:47 +02:00
Evgeniy Paltsev
80d2872a41 twister: introduce twister-level timeout multiplier
Twister allows us to control maximum execution time for each test
with timeout value in test's .yaml configuration and
platform level timeout multiplier which allows us to tweak
timeout value for specific platform.

However, sometimes we want to additionally adjust tests timeouts
when running twister. This is especially useful in case of
simulation platform as simulation time may depend on the host
speed & load, we may select different (i.e. cycle accurate but
slower one) simulation method, etc...

Let's introduce global (twister-level) timeout multiplier option.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-29 12:59:31 +02:00
Evgeniy Paltsev
c2de739f1f twister: tests: handler: fix incorrect timeout mock
There is clearly an issue with current timeout value
timeout into mocked_instance as this value is used only
once before this mock happen, so this mock is actually useless
and we always use default value. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-29 12:59:31 +02:00
Jukka Rissanen
6661f05daf net: ppp: Mark the PPP L2 as non-experimental
The experimental status of the PPP L2 is long overdue so
it can be removed as the component is working fine.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-09-29 10:33:50 +02:00
Yonatan Schachter
66c4cef240 west_commands: bindesc: Fixed crash when no sub-command is given
The west bindesc command currently crashes when no subcommand is
given. This is because the subcommand was not marked as required.
This commit fixes the issue.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-09-28 23:04:47 +03:00
Carles Cufi
2d38c095a6 west: runners: Add support for a common --reset argument
Some of the runners in the tree have been adding their own,
class-specific versions of a switch to instruct the runner to reset or
not the device after flashing.

In order to better support multi-image builds that require more than one
flash operation, introduce a new --reset,--no-reset command-line
parameter that is part of the RunnerCaps so taht this functionality can
be accessed in a standardized manner.

Implementations for the new parameter are provided for the runner
classes that were already configurable in this regard.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-28 11:08:25 -07:00
Yonatan Schachter
726e14e475 doc: bindesc: Add documentation for binary descriptors
Add documentation for binary descriptors under "OS Services"

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-09-28 07:39:09 -04:00
Yonatan Schachter
c42a7dff4d west: commands: Add bindesc command
Added the bindesc command to west, for working with binary
descriptors. Currently it supports dump, list and search
subcommands, for bin, hex, elf and uf2 file types.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-09-28 07:39:09 -04:00
Daniel Leung
b4da11f929 gdbstub: xtensa: add support for dc233c core
This adds support for using coredump with Xtensa DC233C core,
which are being used by qemu_xtensa and qemu_xtensa_mmu.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-27 19:30:15 -05:00
Jamie McCrae
ce65806cd4 tests: boot: Add MCUboot data sharing test
Adds a test for the data sharing retention feature of MCUboot
configuration to an application.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-27 20:18:31 -04:00
Jamie McCrae
db4febc584 retention: Add bootloader configuration interface
Adds a bootloader configuration interface which allows for a
bootloader (e.g. MCUboot) to set configuration in a shared data
area which is then read by the application.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-27 20:18:31 -04:00
Grzegorz Swiderski
05d7769073 sysbuild: Do not exclude images from domains.yaml
The recent support for BUILD_ONLY images was implemented by excluding
them from `domains.yaml`, in order to crudely prevent them from being
picked up by `west flash`. Arguably, this is incorrect or unexpected,
because the sysbuild documentation defines a "domain" as:

   Every Zephyr CMake build system managed by sysbuild.

Another consequence is that, given a build-only `<image>`, this makes it
impossible to pass `--domain <image>` to `west flash`, `west debug`, and
ironically `west build`.

To fix that, `domains.yaml` should again represent all domains, and the
build-only ones should be indicated in another way. Enter `flash_order`:
a new top-level key in the domains YAML schema. It contains the default
sequence of images used by `west flash`, where the build-only images are
excluded, and the order is influenced by `sysbuild_add_dependencies()`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-09-27 17:49:12 +02:00
Grzegorz Chwierut
ae336f69c3 tests: mcuboot: pytest: Add image swap test with mcumgr
Added application based on SMP Server Sample. Application is built together
with MCUboot using sysbuild and is flashed onto device in one step.
Tests are automated with pytest - new harness of Twister.
The image for upgrade is prepared using west sign command
then is uploaded by mcumgr into device and tested.
Automated scenarios to test upgrade (image upload, test, revert, confirm),
to test downgrade prevention mechanism and to test upgrade with image,
that is signed with an invalid key.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-27 15:43:56 +02:00
Fabio Baltieri
cf6bb282e2 scripts: set_assignee: set reviewers for modules
Add support for setting reviewers as well for module PRs, in addition to
the assignees.

Note that this still only works on repositories with an assignee on
record since it does not seem to be possible to query for PRs that have
no reviewers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-27 15:27:19 +02:00
Gerard Marull-Paretas
73b803ab4b edtlib: pinctrl properties are required in the binding
Consumers need to include `pinctrl-device.yaml` where this is defined.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-27 13:58:28 +02:00
Anas Nashif
9e87bd7ad6 gitlint: exclude long line with co-authored-by
Treat co-authored-by like signed-off-by.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-27 06:20:16 -04:00
Franciszek Pindel
a50343cf62 tests: twister: robot: Fix setting testcases status
Currently, when a Robot test is run, the test case status value is
reported as `None`, which causes the XML to contain information about
the test being skipped due to misconfiguration.

This commit fixes the value reported in Twister XML test result by
assigning the test result to the `status` variable of a testcase
instance after the test has finished running.

Signed-off-by: Franciszek Pindel <fpindel@internships.antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2023-09-26 15:10:07 -04:00
Lukasz Mrugala
4b934551ff scripts: pylib: twister: twisterlib: Fix size_calc error checking
Fixes #63042

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-26 15:05:56 -04:00
Keith Packard
389f061c8d scripts/log_parser: Handle signed and unsigned char length modifier
The C standard specifies 'hh' as a length modifier indicating an integer
conversion specifier applies to a signed char or unsigned char
argument. Python doesn't do that, so replace relevant %hh with %h.

Also fix the handling of %ll so that it applies to all integer specifiers
as well.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-09-25 19:41:50 +02:00
Jamie McCrae
97123c4f4a scripts: ci: check_compliance: Add sysbuild Kconfig exceptions
Adds exceptions for Kconfigs which sysbuild uses when configuring
MCUboot.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-25 12:45:44 +02:00
Evgeniy Paltsev
06b28fc4ea ARC: west: mdb runner: support 12 cores targets
Bump number of cores limit in mdb west runner.
As we are here - adjust core number in runner test closer to
the limit.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-25 09:49:50 +02:00
Anas Nashif
c3827ec48e boards: add vendor to board yaml
This is coming from devicetree and corrosponds to what we have in the
dts/bindings/vendor-prefixes.txt file.

This will allow for static filtering, especially with twister, i.e. no
need to build anything to know the vendor of a board

All of the vendor data was extracted automatically from the devicetree,
so some platforms might not have the right vendor or no vendor at all
right now, we need to fix some of the DTS information or do this
manually to get this 100% correct. But we are close.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-22 09:29:36 +02:00
Anas Nashif
3966d30a4f twister: support filtering by vendor
Add a new option --vendor which allows filtering by vendors tracked in
the board/platform yaml file. The vendor string is compatible with DTS
and is what we have in dts/bindings/vendor-prefixes.txt.

Providing multiple vendors is also supported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-22 09:29:36 +02:00
Marc Herbert
8e7c7c62b1 .gitlint: de-duplicate defaults with zephyr_commit_rules.py
We don't need to have two different sets of Zephyr-specific default
values overriding one another, it's confusing.

Note this commit makes NO functional change, the effective defaults stay
the same. It does however make it easier to change defaults in the
future.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-09-21 09:29:24 +02:00
Fabio Baltieri
5212a4c619 scripts: check_init_priorities: use the Zephyr executable file
Rework check_init_priorities to use the main executable file instead of
the individual object files for discovering the devices.

This should make the script more robust in case of stale files in the
build directory, and also makes it work with LTO object files.

Additionally, keep track of the detected init calls, and add a handy
"-i" option to produce a human readable print of the initcalls in the
call sequence, which can be useful for debugging initialization problems
due to odd SYS_INIT and DEVICE interactions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-20 20:24:46 +01:00
Grzegorz Chwierut
6c86af0331 twister: pytest: Fix problems with no prompt in tests with shell
Only impacts on twister-pytest scenarios. Exec command is waiting for
the prompt message, but in some cases, e.g. after reseting the DUT, prompt
can be followed by another strings. Solution is to clear internal serial
buffer and to not request the prompt string before executing a command.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-20 20:23:28 +01:00
Seppo Takalo
d1f058e65e scripts: pytest: Add option to filter the captured shell output
Sometimes you might need exec_command() to return an value from
running device. If the output contains shell prompts or logger
output, it is harder to capture the value.
Filter away the lines we thing belongs to the shell prompt or
normal logging output.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-09-20 20:22:06 +01:00
Maciej Perkowski
813e40f818 twister: Ignore skips due to toolchain incompatibility.
Skips are turned to errors on integration platforms. However, if
a user (or a CI) selects toolchain other than zephyr, unexpected
errors due to skips can appear. With this commit skips due to
toolchain incompatibilities are not treated as errors.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-20 08:34:08 -04:00
Anas Nashif
4a8d620127 twister: platform key filtering should not be flagged as error
If coverage is provided by a different platform not in the integration
list, it should not be reported as error.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-19 18:44:23 -04:00
Paweł Anikiel
4b33f4fe19 scripts: Update ntc-thermistor table generator
Update the script to work with the current version of the
ntc-thermistor driver.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Pavlo Havrylyuk
fa5636632e twister: fix utf-8 encoding for device handler
Fixed bug for when yaml contains utf-8 special character
Changed handler.log to be utf-8

Signed-off-by: Pavlo Havrylyuk <pavlo.havrylyuk@infineon.com>
2023-09-19 15:23:52 +01:00
Manoel Brunnen
dee8bb5ed0 twister: fix test plan to skip unconnected platforms
Remove dead and erroneous (DUT is not a dict) if branch. Simply use the
self.options.platform list. Which is filled by either the hardware map
or the '--platform' option.

This change addresses issue #62723 and #62560.

Signed-off-by: Manoel Brunnen <manoel.brunnen@ithinx.io>
2023-09-19 09:54:02 -04:00
Maciej Perkowski
42aa8fd72c twister: Always change skip to error on integration platforms
Before only with --integration such skips were changed to errors.
This hinders issues when twister is call with --all flag in CI
and new skips on integration platforms are not caught. Then those
skips cause errors in other PRs when --integration was used.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-19 09:53:31 -04:00
Maciej Perkowski
6d64fe67ee twister: Change category of skip due to emulation_platforms
The value of emulation_platforms is a bool corresponding to
--emulation-only CLI option. Therefore, it should be registered
as Filters.CMD_LINE. Without it, twister raises errors when an
integration platform is descoped due to this option.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-19 09:53:31 -04:00
Grzegorz Chwierut
f53a0e9ce5 twister: Allow an empty quarantine file
Added an exception to scl.py module, to not process an empty
yaml file, because of error from pykwalify. New exception
is handled when processing quarantine files, to allow
an empty file.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-18 15:40:03 +02:00
Lukasz Mrugala
a0642b8538 scripts: tests: twister: Handlers test update post refactor
After the handler.py module has been split up more,
we can update the relevant tests.
100% coverage achieved.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-18 08:17:57 -04:00
Lukasz Mrugala
2d3d22d666 scripts: pylib: twister: twisterlib: Handlers refactor
Simple refactoring aiming to reduce the average method length.
Minor corrections of the handlers module, removing wholly unused
variables, etc.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-18 08:17:57 -04:00
Lukasz Mrugala
b961be53a0 scripts: tests: Handler
Expansion of the tests related to handlers.py
Achieves over 85% coverage.
Implemented most of golowanow's suggestions.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-18 08:17:57 -04:00
Pavlo Havrylyuk
8f37003401 twister: platform filtering when test-only
Add the functionality to use -p and -P to filter out platforms
when using test-only

Signed-off-by: Pavlo Havrylyuk <pavlo.havrylyuk@infineon.com>
2023-09-18 06:33:47 -04:00
Grzegorz Chwierut
5bb3067942 twister: pytest: Allow list of pytest testpaths
Allow to specify a list of pytest directories, files or subtests
with pytest_root keyword in test yaml.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-18 05:59:35 -04:00
Alberto Escolar Piedras
e3aa649ee0 native simulator: Get latest from upstream
Align with native_simulator's upstream main
64b8be6311a61df2c63987813e8058560c8dc49c

Which includes:
 * 64b8be6 Make: Give option to add extra localization parameters
 * 05bc3ce Generalize code for N CPUs/MCUs
 * 489069b Makefile: Generalize for N embedded images
 * a4c817e runner->embedded trampolines: Improve definitions
 * 8d8dd29 nsi_utils: Provide debracket macro
 * 6b4956e Add optional embedded test hook definition

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-18 10:42:38 +01:00
Pieter De Gendt
ae8c72444e scripts: build: file2hex: Add optional offset and length parameters
Add optional offset and length parameters to generate partial hex files.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-09-15 13:23:30 +02:00
Théo Battrel
e5de0b6824 west: fix wrong zsh completion
The subcommand 'spdx' was suggesting '-d' for SPDX output directory
instead of '-s'.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2023-09-15 09:27:20 +02:00
Théo Battrel
4dc648642f west: Fix a typo in the fish completion script
In the `help` command, 'status' was written 'statue'.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2023-09-15 09:27:20 +02:00
Fabio Baltieri
183b84d0e2 scripts: compliance: add a check for missing west area maintainer enties
Add a check to ensure that every module has a corresponding maintainers
file entry, ensure modules are not added with no recorded point of
contact.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-14 08:13:57 -07:00
Grzegorz Chwierut
f618522144 twister: pytest: Move fixtures to one file
Fixtures in pytest-twister-harness plugin are moved to one
file to simplify adding new fixtures in the future - no
need to add pytest_plugins entry and register asserts.
Moved also shell fixture from sample dir, because that
fixture can be reused in new tests.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-14 05:58:25 -04:00
Laurentiu Mihalcea
017cf89a83 arch: Add support for static shared interrupts
This commit introduces all the necessary changes for
enabling the usage of shared interrupts.

This works by using a second interrupt table: _shared_sw_isr_table
which keeps track of all of the ISR/arg pairs sharing the same
interrupt line. Whenever a second ISR/arg pair is registered
on the same interrupt line using IRQ_CONNECT(), the entry in
_sw_isr_table will be overwriten by a
(shared_isr, _shared_sw_isr_table[irq]) pair. In turn, shared_isr()
will invoke all of the ISR/arg pairs registered on the same
interrupt line.

This feature only works statically, meaning you can only make use
of shared interrupts using IRQ_CONNECT(). Attempting to dynamically
register a ISR/arg pair will overwrite the hijacked _sw_isr_table
entry.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-09-14 08:35:12 +02:00
Jonathan Rico
db52d27eb5 scripts: Update CFB font generator
Update CFB font generator so it works with Pillow version 10. They
deprecated some methods, with no direct replacements, so the generated
fonts might be slightly different.

Signed-off-by: Jonathan Rico <jonathan@rico.live>
2023-09-13 14:40:00 -07:00
Théo Battrel
45e66de58f west: Add fish shell completion
Add west completion for fish shell.

Update others files to include the support for fish shell.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2023-09-13 12:51:22 -07:00
Ederson de Souza
1f51a0e0e1 scripts/pylib/pytest-twister-harness: Do not fail on Unicode garbage
If pylib twister harness reads bytes that can't be decoded to Unicode,
it would raise an exception at a separate "serial reader" process, that
would fail without any warning.

This patch uses "errors='replace'" parameter for Python str.decode()
method, so that this doesn't happen.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2023-09-13 11:34:27 +02:00
Lukasz Mrugala
da3c9d2671 scripts: tests: twister: Testsuite tests update after 20b81a8
A commit breaking tests slipped past CI checks.
This commit fixes broken tests in test_testsuite.py.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-12 10:42:08 -04:00
Lukasz Mrugala
9fc414a97f scripts: tests: twister_blackbox: Add -i flag to qemu tests
An -i flag allows easier debugging for blackbox qemu tests.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-11 12:29:22 -04:00
Lukasz Mrugala
ffecd8d0fc scripts: tests: twister: Sanity Check Loader tests
Adds explicit testing to the Sanity Check Loader utility.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-09 05:19:45 -04:00
Christopher Friedt
20b81a865d twister: support scanning for ztests in subdirectories
Previously, only the main src/ directories was scanned for
ZTest testsuite names and tests. This allows us to place
test sources in subdirectories as well.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-09-08 06:08:58 -04:00
Chaitanya Tata
6b05af6e43 twister: handle quotes for configuration options
Add support handling quotes for configuration options in extra args by
escaping them properly instead of removing the quotes altogether. For
other options in extra_args quotes are removes as usual.

Add similar support in west build command also.

Add a unit test to check this functionality.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-09-08 06:04:48 -04:00
Fabio Baltieri
fb003d1aa8 scripts: check_init_priorities: add priority to the file debug print
Log the device priority on the file debug output print, this is
convenient to list out all the defined devices and their priority, even
if they don't depend on each other.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-07 09:49:55 +02:00
Jamie McCrae
1b2abf3c83 tests: twister: Add tests for required_snippets functionality
Adds 2 tests which check required_snippet functionality works.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-06 16:40:53 +02:00
Jamie McCrae
bc97d8fb1e twister: Add support for required snippets
Adds support for twister to require using snippets on tests

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-06 16:40:53 +02:00
Lukasz Mrugala
0af7770132 scripts: tests: twister: Mixin test
Simple test checking whether our method for skipping unwanted
test classes works.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-06 09:40:38 -04:00
Yuchao Guo
9fb6c9ddd7 west: runners: uf2: Add more fstype check for is_uf2_partition
During testing it was found that if the partition type was displayed as
msdos it could not be detected correctly, so this partition type
determination was added.

Signed-off-by: Yuchao Guo <yuchao.guo@hoorii.io>
2023-09-06 14:16:58 +02:00
Yves Vandervennet
ab9da956b0 nxp: mimxrt1170: add support for NXP's LinkServer
LinkServer is NXP's tool to flash and debug on MCU's.
This patch expands support for LinkServer to MIMXRT1170.

There is one limitation with flashing and debugging the SoC's seciond
core (COrtex M4) that will be addressed with a future submission.

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-09-06 09:35:24 +02:00
Lukasz Mrugala
2c95b6944f scripts: tests: twister: Testsuite test fix
Previous tests didn't take b48c3cd into account.
This fix restores previously passing tests.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-05 10:30:44 -04:00
Lukasz Mrugala
8977567a2d scripts: tests: twister: Testsuite test expansion
This should increase the coverage of the testsuite.py module
up to 100%.
Some tests have been commented out, as the code tested there is
incorrect. Thus the real increase is 99%.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-05 11:41:08 +02:00
Alberto Escolar Piedras
65c9288901 native simulator: Align with latest upstream version
Align with native_simulator's upstream main
5fc61e22e7a5b35a1c721c2503da5ff8eaadbfd5

Including:
* 5fc61e2 Typo fixes
* 4888ec2 Add default empty embedded images
* a318045 Add hooks for up to 16 embedded CPUs
* 0546c59 Makefile: Fix typo

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-04 13:18:01 +02:00
Gerard Marull-Paretas
a4858c40ec scripts: build: elf_parser: _DEVICE_STRUCT_HANDLES_OFFSET is optional
It is only available if CONFIG_DEVICE_DEPS=y, so the ZephyrElf class
would fail to load if it does not treat _DEVICE_STRUCT_HANDLES_OFFSET as
optional.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-01 15:50:32 +02:00
Maciej Perkowski
fb9a6af700 scripts: west_commands: Allow passing source dir when looking for test
Before, only following way of getting test-item build was supported:
`west build -b <BOARD> -T <PATH_TO_SOURCE/TEST_NAME>`
This commit allows to also call it by:
`west build -b <BOARD> <PATH_TO_SOURCE> -T <TEST_NAME>`

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-08-31 12:06:18 -07:00
Piotr Golyzniak
e326015cda scripts: pytest: add Shell helper unit tests
Add unit tests dedicated for Shell helper sample class.
Add shell_simulator_script.py script to simulate shell application
behavior.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
577d421ba7 scripts: pytest: add pytester tests
Add tests which use pytester to call pytest with pytest-twister-harness
plugin on previously defined test. This gives a possibility to test
plugin in end-to-end variant.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
36e2b8e2b2 scripts: pytest: add tests to new adapters API
According to new adapters API add new tests which verify their
correctness. Introduce some minor naming changes to describe better
their role.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
eb672ddd0a scripts: pytest: improve plugin options
Add better description of available options and add actions which
should help to prevent from passing invalid options to plugin.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
a31b24372c scripts: pytest: remove logging configuration
Remove log.py and by this logging configuration from
pytest-harness-plugin. Instead use pytest options for setting verbosity
and format of printed logs. Thanks to this management of verbosity
level can be easier for users.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
ffbe257663 scripts: pytest: create helper class Shell
Create helper class Shell which can be used in tests which require
interaction with shell application.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
ceb61f38ea scripts: pytest: move helper.py to utils.py
Move helper.py file content to utils.py file in device directory,
where those helper functions are used.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
32c2be0234 scripts: pytest: divide dut fixture
Divide dut fixture into three smaller fixtures to make it easier
to user to change dut fixture scope or to write her/his own dut
fixture. Add initialize_log_files method to make it possible to
initialize log files per each test.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
967dfd97c3 scripts: pytest: pass test name to handler.log
Pass pytest test name to handler.log header to make it easier to
analyze handler.log content.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
a4a550888e scripts: pytest: add readlines_until
Add readlines_until method to DeviceAdapter class to simplify using
adapters in tests by give user possibility to read output from device
until following conditions:
- provided regex was found
- provided number of lines was already read
- timeout was occurred

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
2e333000b5 scripts: pytest: refactor FifoHandler class
Introduce changes into FifoHandler class to make it more safe
(especially to avoid blocking all program when FIFO queue is not opened
by other application).

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
9b7e64ab1a scripts: pytest: remove constants.py file
Constants variables are no longer used, so this file can be removed.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
6ddc1431ee scripts: pytest: remove log_file.py
LogFile class is not used anymore, so there is no sense to keep it
and its unit tests.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
f22c2d6388 scripts: pytest: align adapters API
Select and place common code of three adapters (HardwareAdapter,
BinaryAdapterBase and QemuAdapter) into basic DeviceAdapter class.

Introduce new way of reading device output by run separate thread which
try to read device output and place it into internal python queue.
Thanks to this, now it is possible to create readline method for all
adapters, which can be unblock when timeout occur.

Collect all common steps which have to be done before setup device in
launch method. The same was done for teardown operations which were
placed into close method.

Additionally some protection mechanisms were introduced to prevent for
undesirable side-effects when user could try to launch to already
launched device or try to send some data to disconnected device.

iter_stdout method was replaced by two new methods: readline and
readlines. To make it possible to remove all read output from internal
buffer (queue), clear_buffer method was introduced.

Also unit tests were rewritten to work properly with current version
of adapters.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
b5d496019f scripts: pytest: rename SimulatorAdapterBase
Change name of SimulatorAdapterBase class to more meaningful like
BinaryAdapterBase. This changes is also made to be more align with
Twister terminology.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
c54d55c2d8 scripts: pytest: rename DeviceAbstract
Change name of DeviceAbstract class to more meaningful like
DeviceAdapter.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Piotr Golyzniak
b486b2acab scripts: pytest: unify timeouts
Add possibility of passing timeouts from Twister to pytest and unify
various timeouts used in adapters to point to one main timeout.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Grzegorz Chwierut
2990586b45 tests: pytest: Fix for pytest warning
PytestAssertRewriteWarning is raised when pytest-twister-harness
plugin is called from twister. Call register method to get rid
of that warning

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-08-30 06:39:55 -04:00
Jeremy Bettis
1e471eb2a7 twister: Switch to a non-greedy regex
When parsing test names from symbol names, use a non-greedy match to
avoid parsing test names with __ in them.

The symbol looks like z_ztest_unit_test__SUITE__TEST. It is more likely
that a test name will contain __ than a suite name, so now something
z_ztest_unit_test__a_b__c_d__e_f will be parsed as suite:a_b
test:c_d__e_f, whereas it used to be parsed as suite:a_b__c_d test:e_f

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-08-29 10:27:17 +02:00
Jeremy Bettis
1d9ce862a7 twister: Don't require test_ prefix to set status
If a test doesn't start with test_, twister currently emits an error:
suite_name.test_name: Unknown status 'started'

Following the suggestion by Maksim Masalski on PR#21191, change the
regex to exclude spaces in the test name, and remove the check that the
test_ prefix exists.

See also #21162

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-08-29 10:27:17 +02:00
Jeremy Bettis
cd265fd603 twister: Use raw string and remove pylint disable
Avoid the pylint anomalous-backslash-in-string warning by using a raw
string.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-08-29 10:27:17 +02:00
Anas Nashif
d4b0c48892 west: build: fail early if path to test item is not valid
Fail early in case the path to the test item (--test-item) is not valid
or does not exist.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-28 09:17:42 -07:00
Iuliana Prodan
4cf9d67432 west: sign: do not make rimage configuration and platform name mandatory
Now, if the rimage target (meaning rimage configuration and platform name)
is not defined in board.cmake the sign script returns fatal error.
Change this to a warning since there are configurations that are
not using 'west sign' or is used just to glue the headers of the
final image.

Also, update the documentation accordingly.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-08-28 09:17:02 -07:00
Lukasz Mrugala
4d467af7f4 scripts: tests: twister: Black box testing
In addition to the white-box testing and unit tests,
we would like to have some black-box testing for the
console commands of twister.

This serves as a Proof of Concept for future expansion.

Special dummy tests are made for blackbox testing.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-08-28 15:57:06 +02:00
Benjamin Cabé
d8d5bdfdfa footprint: ci: ehl_crb board has been renamed.
Following PR #61471, ehl_crb board is now intel_ehl_crb.
Update the footprint test plan accordingly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-28 10:28:18 +02:00
Fabio Baltieri
5e78660715 ci: assigner: fix the main operation selector check
Fix an "if" that should have been an "elif". This is currently causing
the script to fallback into the "do all unassigned PRs of the day" path
when a PR is specified.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-25 15:31:53 +01:00
Fabio Baltieri
b6cbcbaa5b ci: assigner: add a function to assign issues
Add a -I option to process an issue and, if it's not assigned already,
add assignees based on the labels, matching the ones set in the
MAINTAINERS file areas.

Suggested-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-25 10:33:06 +02:00
Fabio Baltieri
9a1f4abd59 scripts: set_assignee: add an option to assign module PRs
Add a -m option to set_assignees to have the script find all unassigned
module PRs for areas that have an assignee and set the assignee on those
PRs.

This should help avoiding forgotten PRs on modules. It's implemented as
a search and meant to run periodically, so we don't have to add a
workflow for this on every individual module.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-25 10:33:06 +02:00
Carles Cufi
05467ad6c6 scripts: kconfig: Add copyright and license to kconfig.py
The file kconfig.py was originally introduced by myself in:
https://github.com/zephyrproject-rtos/zephyr/pull/5569

The file was a modified version of a Kconfiglib one, so it makes sense
to keep the original license (ISC).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-08-24 22:06:07 +01:00
Benjamin Cabé
ef0fd13090 scripts: size_report: fix encoding issue
Force default stdout encoding to utf-8 as otherwise ram_report/rom_report
may fail to render (ex. in CLion IDE built-in terminal).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-24 11:53:17 +01:00
Anas Nashif
948ab60eb3 ci: test_plan: also filter on platforms when manifest changes
Add platform filtering when generating tests for manifest modules.
In the clang workflow, we do select to run only on one platform, so this
needs to be applied as well or we end up building unwanted tests using
the wrong toolchain.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-24 06:36:00 -04:00
Sachin D Kulkarni
0399213cd5 scripts: coccinelle: Remove strtok_r symbol from checklist
strtok_r is part of GNU99, but default Zephyr is built with C99, so,
the GNU headers are not pulled in, even if we add "--std=gnu99" it
won't override the C99 standard.

As a workaround for build we redefine the prototype, but this causes a
coding guideline warning, so, for now disable this warning
for strtok_r.

Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
2023-08-23 16:05:08 +01:00
Daniel Leung
d90cbc79d9 scripts: gen_syscalls: rename shadow variables
The generated stubs use retval for function return value.
However, this is too generic and is going to collide with
other code. So rename those to be more specific. Note
that the double underscore is intentional to minimize
chance of being shadow variables.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 17:30:56 -04:00
Anas Nashif
d4169c93fd ci: test_plan: add tags based on manifest change
When manifest changes, add tags based on the changed project names.t

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-22 18:08:30 +02:00
Diego Elio Pettenò
d9fe63b188 twister: increase resilience when running outside of git.
While the code already includes some provisions to allow running outside
of a git checkout, attempting that right now causes a failure to generate
the XML report, as the JSON report creates a null `zephyr_version` field.

The reason for that is that the original code doesn't set `self.version`
when the subprocess returns a non-zero status (and also doesn't log.)

Instead of having to set `self.version` for all failure cases, initialize
it to the failure state, and log if it hasn't changed from that.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
2023-08-22 14:42:51 +02:00
Christopher Friedt
09e4f8fada syscalls: include stdarg.h for va_list type
Include the standard `<stdarg.h>` header to get the
correct definition for `va_list`, etc.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-08-22 09:59:44 +02:00
Anas Nashif
b28b6a0687 twister: print dut name when testing on hardware
When using the hardware map and testing on device, print out the name of
the dut (from the hardware map) on the script and report it in the json
output as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 10:14:34 +02:00
Anas Nashif
b48c3cd3e3 twister: do not attempt to parse empty file
Do not attemp to parse empty file, just skip them.

Fixes #60835

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 10:14:34 +02:00
Grant Ramsay
5443703dc9 edtlib: Exclude PCI devices from some inapplicable checks
PCI devices are have some differences to regular nodes:
* node name specifies device/function e.g. "pcie@1,0"
* register address has a different meaning
* zero-sized register is allowed

This improves alignment with Linux DT for PCI devices

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-18 10:13:12 +02:00
Christian Marx
6a20f4b013 scripts: size_report: Fix ram_report and rom_report with anytree 2.9.0
The anytree package has introduced a breaking change in version 2.9.0 by
adding a 'size' property to the NodeMixin class. Since the TreeNode class
in size_report derives from NodeMixin and defines an attribute with the
same name, an AttributeError is raised when generating reports.
With this change, the attributes of the TreeNode class are prefixed with
an underscore to resolve the name collision and to prevent future name
collisions.

Fixes #60213.

Signed-off-by: Christian Marx <c.marx@vega.com>
2023-08-16 18:36:13 -04:00