Commit graph

4528 commits

Author SHA1 Message Date
Michal Smola c772234e43 twister: fix build dir path for mklink
When twister is run on Windows with --short-build-path option, mklink
fails to create link, because path to build dir contains forward
slashes, which are not handled correctly by mklink.
Fix it by using os.path.normpath in mklink call.
Added os.path.join mock in twister unit test to handle path join
consistently.

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

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

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

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

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

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

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

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

define DT_N_S_device1_IRQ_IDX_0_CONTROLLER \
       DT_N_S_gpio_800

define DT_N_S_device1_IRQ_NAME_test4_CONTROLLER \
       N_S_device1_IRQ_IDX_0_CONTROLLER

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

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

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

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

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

Based on dt_node_array_prop_int/hex.

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

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

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

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

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

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

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

Documentation and tests are updated here as well.

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

Minor other cleanups.

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

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

Fixes #67214

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

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

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

https://kibana.zephyrproject.io/

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #66701

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

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

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

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

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

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

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-19 07:33:39 -05:00