Commit graph

822 commits

Author SHA1 Message Date
Lukasz Mrugala
8353a6c95f scripts: Fix twisterlib for ruff - F811
This fixes ruff linting error F811,
where a module is reimported or otherwise
redefined without being used.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
22a875e490 scripts: Fix twisterlib for ruff - SIM115
This fixes ruff linting error SIM115,
where files were opened without the use of
a context handler.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
0c6fd60407 scripts: Fix twisterlib for ruff - UP015
This fixes ruff linting error UP015,
where open() has specified unnecessary modes.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
9b128a24e2 scripts: Fix twisterlib for ruff - B028
This fixes ruff linting error B028,
where warnings.warn() lacked explicit
stacklevel parameter.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
0df8240b49 scripts: Fix twisterlib for ruff - SIM105
This fixes ruff linting error SIM105,
where try-except-pass construct was used
instead of contextlib.suppress().

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
96beec0add scripts: Fix twisterlib for ruff - B006
This fixes ruff linting error B006,
where mutables were used as
default parameters.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
12a374cc8b scripts: Fix twisterlib for ruff - B023
This fixes ruff linting error B023,
where function definitions use
loop variables incorrectly.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
9584eaee2d scripts: Fix twisterlib for ruff - B904
This fixes ruff linting error B904,
where an error raised inside an except
clause does not specify from where it
should start.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
29cdac06a0 scripts: Fix twisterlib for ruff - B905
This fixes ruff linter error B905,
where zip lacks explicit use of the
strict parameter.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
1eed6dfaa9 scripts: Fix twisterlib for ruff - B009
This fixes ruff linting error B009,
where getattr() was used with a
constant field name.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
dad7a8e17e scripts: Fix twisterlib for ruff - SIM102
This fixes ruff linting error SIM102,
where multiple ifs were used instead
of combining them with and or similar
operators.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
c0553343c4 scripts: Fix twisterlib for ruff - UP008
This fixes ruff linting error UP008,
where super() call has unnecessary
parameters.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
fbde9f1b1a scripts: Fix twisterlib for ruff - UP021, UP022
This fixes ruff linting errors UP021 and UP022,
where obsolete subprocess parameters were
still used.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
52cd7d673f scripts: Fix twisterlib for ruff - UP004
This fixes ruff linting error UP004,
where a redundant `object` inheritance
is present.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
c273419864 scripts: Fix twisterlib for ruff - UP006
this fixes ruff linting error UP006,
where old typing types are still used
instead of newer, PEP585-compliant ones.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
39599cafc9 scripts: Fix twisterlib for ruff - E713
This fixes ruff linting error E713,
where `not x in y` is used instead
of `x not in y`.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
b541f0415a scripts: Fix twisterlib for ruff - E741
This fixes ruff linting error E741,
where a variable name is ambiguous
or hard to read (e.g. l).

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
c8ac6c3add scripts: Fix twisterlib for ruff - SIM110
This fixes ruff linting error SIM1101,
where a builtin, like any() or all()
has been reimplemented.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
f80f3771a7 scripts: Fix twisterlib for ruff - SIM114
This fixes ruff linting error SIM114,
where there are multiple arms in an
if-elif-else construct with the same result.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
e8c54657e4 scripts: Fix twisterlib for ruff - SIM202, SIM201
This fixes ruff linting error SIM201,
where not is used instead of a more
appropriate comparison operator.
SIM202 exclusion was removed, as it
didn't apply to anything.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
f9c62afd26 scripts: Fix twisterlib for ruff - SIM300
This fixes ruff linting error SIM300,
where constant values are on the left
side of an expression.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
a20e395174 scripts: Fix twisterlib for ruff - SIM401
This fixes the ruff linting error SIM401,
where if-else construction is used instead
of dict.get().

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
f07edf3302 scripts: Fix twisterlib for ruff - SIM118
This fixes the ruff linting error SIM118 - unnecessary
use of keys().

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
240cb62bdf scripts: Fix twisterlib for ruff - I001
This fixes the error I001 - unsorted imports.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
a29236d808 scripts: Fix twisterlib for ruff - UP035
This fixes errors of type UP035 - deprecated import.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Lukasz Mrugala
4175bbb4ce scripts: Fix twisterlib for ruff - E402
This fixes errors E402 - module import
not at top of file.
One error in testplan.py left in,
as it is a part of a obscure 2020 fix
that would need to be re-tested.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-11-29 15:29:31 +01:00
Wilfried Chauveau
468ce19e9c twister: testplan: fix robot filter when there is no simulator
#79174 incorectly interpreted the condition. If no simulator is found
if cannot be "renode" and therefore robot should be considered unsupported.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-11-28 15:43:48 +00:00
Anas Nashif
48ddfe7c4a twister: filters: add ability to filter by vendor
add vendor_allow and vendor_exclude to the list of filters. The vendor
data is maintained in the board.yml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-27 06:58:23 -05:00
Dmitrii Golovanov
113875d53c twister: testplan: Detect duplicates on --no-detailed-test-id
Detect duplicate TestSuites on load, and raise error when it happens
with `--no-detailed-test-id` option which shortens TestSuite name
excluding the test project path prefix, thus increasing chances
for duplicates. Without this check, only the last duplicated
test configuration was selected while others silently ignored.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-11-27 08:19:39 +01:00
Dmitrii Golovanov
89466f9d7e twister: testplan: Fix duplicate scenarios error reporting
Fix duplicate test scenario error reporting to show paths to all
twister.yaml configuration files where these duplicates were found.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-11-27 08:19:39 +01:00
Pieter De Gendt
bf2db7afc0 python: Format and sort imports
ruff check --select I001 --fix applied to all python files that had
this as only issue.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-25 10:07:13 +01:00
Wilfried Chauveau
7cc70f01f1 scripts: twisterlib: Enable multiple simulator support in twister
This change introduces the ability in twister to select which
emulation/simulation tool to use on the command line.

If none is specified, it will select the first in the list.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-11-25 08:31:28 +01:00
Dmitrii Golovanov
e11aecaed5 twister: fix Ztest C++ test names extraction from ELF
Fix Ztest test function name extraction from ELF symbols
for C++ compiled binaries where symbol names need additional
'demangling' to match with corresponding test names.

The `c++filt` utility (part of binutils) is called for
demangling when it is needed.

Twister test suite extension and adjustment.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-11-22 08:26:59 -05:00
Dmitrii Golovanov
a72244f2d0 twister: ztest: harness: Fix missed TestCase statuses
Fix a problem of Ztest suite names not taken into account by Twister
to identify a TestCase, so in some situations a Ztest test's status
was not assigned to the proper TestCase and it remains 'None'
whereas the actual status value lost, eventually the resulting total
execution counters not correct.

The issue was observed in these situations:
 * Ztest application with multiple test suites having same test names.
 * Ztest suite is 'skipped' entirely on execution with all its tests.

The proposed solution extends Twister test case name for Ztest to
include Ztest suite name, so the resulting identifier looks like:
   `<test_scenario_name>.<ztest_suite_name>.<ztest_name>`

The above naming scheme now requires ztest_suite_name part to be
provided for `--sub-test` command line option.

Testcase identifiers in twister.json and testplan.json will also
include ztest_suite_name component.

The Twister Ztest(Test) Harness is improved to track all state changes
known from the test application's log for Ztest suites and test cases,
so now it parses log output from a Ztest application more scurpulously.
Regular expressions to match log records are extended and optimized
to compile them only once and, in some cases, fixed (suite summary).

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-11-22 08:26:59 -05:00
Pieter De Gendt
f05deb1aa4 python: Format trivial files where only newlines were missing
Apply formatting on files that only needed adding newlines.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-21 20:10:51 +01:00
Grzegorz Chwierut
e0bd7e7c87 twister: Allow sharing hardware platform between variants
Extended hardware map to share a single board between variants.
To run tests for different variants on the same board
without re-configuring the hardware map file for each variant,
one can use a `platform` atribute as a list of names.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-11-21 14:48:03 +01:00
Anas Nashif
cfc232fa32 twister: stats: fix platform stats
Fix wrong reporting about where testcases were executed.

We have:

INFO    - 1130 of 1130 executed test cases passed (100.00%) on 0 out of
total 860 platforms (0.00%).

which is obviously wrong.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-16 13:29:23 -05:00
Anas Nashif
049b243b51 twister: stats: use anytree to create summary
Do not create the tree structure manually, use anytree instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
a43a67e3a3 twister: stats: fix suite statistics
suite stats were not correct, a mixup between skipped and filtered
suites was leading to inconsistent numbers. This is now fixed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
b578fa5b2a twister: stats: more renames skipped -> filtered
Additional variable renames leading to confusion between skipped and
filtered.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
d69d14aac6 twister: stats: skipped_configs -> filtered_configs
Rename variables leading to confusion between skipped and filtered
suites.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
61aefee3ad twister: stats: skipped testcases are part of selected group
Count skipped cases as part of selected group in stats.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
1647b46a07 twister: stats: remove double counting of statuses
We have been double counting some statuses, remove to get the stats
right.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
7e23b35c33 twister: stats: 'Executed test cases' -> 'Completed test cases'
Built tests are not executed, change column title.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
950dccc5bb twister: status inconsistencies are now warnings
Do not report status issues as errors, very confusing and developer end
up looking at the wrong thing, instead, treat those as warnings and
count them and report them at the end.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
5ad5b95fde twister: remove verbose debug message about adding platforms
This is very verbose and very long sometimes getting the way when trying
to debug a problem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
11447e4463 twister: stats: not run tests are also part not executed summary
Add notrun tests to the count of non-executed tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
64f950420a twister: do not report filtered cases in summary
It is confusing to report filtered testcases as  testcases that were
selected but not exexuted. If they are filtered, then there should not
be considered as selected.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
81af36202b twister: use consistent language for test configurations
In the summary, use "configurations" instead of instances.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00
Anas Nashif
c394a27d77 twister: count filtered testcases as such, not as skipped
When a suite is filtered, its testcases are also filtered and not
skipped.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-12 18:05:16 -06:00