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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>