Commit graph

4302 commits

Author SHA1 Message Date
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