Commit graph

4571 commits

Author SHA1 Message Date
Dmitrii Golovanov 94e4addd07 ci: scripts: Add run_id and run_attempt context on upload to ES
Optionally record run-id and run-attempt github context variables
as additional test suite environment properties on upload into
ElasticSearch to track re-runs of CI workflows.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-02-26 11:32:17 +00:00
Marcin Niestroj f9dddc387e native_simulator: constify 'buffer' argument in nsi_host_write()
'buffer' argument is read only, so it can be 'const'. This makes it
compatible with POSIX specification of write(3) syscall.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-02-26 11:36:21 +01:00
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