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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Additional checks for Twister command line options `--coverage-tool`
and `--coverage-formats`.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
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>
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>
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
5c88418428Fixes#66701
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This allows sorting objects consistently without having to specific a
key.
No functional change yet.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>