Commit Graph

3466 Commits

Author SHA1 Message Date
Jordan Yates 06aae61019 scripts: zspdx: fix writing custom license IDs
The builtin list function `.sort()` sorts the list in-place and returns
None. As this is an invalid type for iteration, use the builtin `sorted`
function, which returns a sorted copy of the list, which we can iterate
over.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-23 10:18:06 +02:00
Fabio Baltieri bd61ced760 twister: fix wrong flag name in the helpdoc
The flag --testcase-root has been renamed to --testsuite-root in

15bc98eb50 twister: rename TestCase -> TestSuite

Fix the --help text to reflect the change.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-20 19:22:20 -07:00
Henrik Brix Andersen c6b3094d5e scripts: kconfig: kconfigfunctions: use relative ZEPHYR_BASE path
Use a path relative to the script itself to determine the ZEPHYR_BASE path
instead of relying on the environment variable.

This allows for modules to use the Zephyr kconfiglib without having
ZEPHYR_BASE set in the environment.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-18 11:02:26 -07:00
Stephanos Ioannidis f2b0991147 scripts: check_compliance: Fix broken links to Contribution Guidelines
This commit fixes the broken links to the Contribution Guidelines in
the Compliance Check script.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-17 13:40:27 -04:00
Anas Nashif 734c345457 twister: sort hardware map based on id
Serial is not required, in some cases it might be set to null or we
might be using serial_pty, so sort existing map file based on ID
instead.

Fixes #45713

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-17 08:29:42 -04:00
Chen Peng1 ca08d2e4a6 twister: ignore serial device SerialException.
For some boards, like up_squared and ehl_crb, they need do a
power off/on operation and use bios to load and execute zephyr
test binary, during the power off, it may meet this SerialException,
but the serial object still works well after power on, we can continue
to get all results from serial, so we don't need to close it,
it's ok to ignore this exception.
BTW, even if we ignore this exception here, it doesn't influence twister
function, because if it was really caused by disconnection, the test would
still be judged as failed due to timeout and serial would be closed later
in main thread, it doesn't impact results.
On the contrary, close serial directly in the monitor serial thread, it
will cause later tests failed due to mismatch errors.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-05-16 16:55:42 +02:00
Anas Nashif a6f924db7f twister: add support for platform_type filter
Instead of relying on runtime filter to limit scope to emulation
platforms, use the type attribute for each platform and do the filtering
very early on. This will speed things up for tests where we only run on
emulation platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-14 14:49:59 -04:00
Daniel DeGrasse fbefc50a9c scripts: kconfig: add dt_chosen_has_compat
Add dt_chosen_has_compat kconfig helper function. This function checks
if a given `chosen` node has a provided compatible string in its
compatible list. Returns "y" if compatible string is present, and "n"
otherwise.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-13 10:57:08 -07:00
Jordan Yates 8e4107f9be scripts: ensure intended path for edtlib imports
When updating `sys.path` to allow importing the pickled edtlib instance,
add the path to the front of `sys.path`, not the end. This ensures that
the `devicetree.edtlib` module that is imported is the one relative
to the files being run, not some other version which may exist on the
path.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 10:09:45 -07:00
Anas Nashif f089f964fd twister: update ci options for twister
Now that we have partially oerhauled twister in the tree, modify actions
with new options:
- not reporting filtered tests is now default
- output is json, not csv

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:57:37 -04:00
Anas Nashif 3ae685ef8d twister: for ci and in twister.yml, treat built tests as passed
For CI and for the condensed version of the report, consider built tests
as passed and do not mark them as skipped. Tests that are built only
will be reported as skipped in the full and suite reports.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif bd1b364c2e twister: do not report filtered tests by default
Filtered tests are now not being reported by default to allow generation
of reports that are easier to parse and work with in different tools.

The complete filtered set of tests is still available in the json output
for review and verification.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 0313c5ce6f twister: hwm: rename forgotten connected_hardware -> duts
This was forgotten from an early overhaul, fix this as
connected_hardware attribute does not exist anymore.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 7a83d4fe02 twister: reports: add timestamp to junit report
Add a timestamp to junit reports as per specification.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif fd75aa6286 twister: generate junit report with testsuites rather than platforms.
We have been generating reports with the platform being used as the
testsuite, ie. all testcases would land under one single big testsuite,
which is very difficult to use or read.

This change uses testsuites as intended and does that for each defined
testsuite (or scenario). Platforms are added as properties among other
things.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 6404988e3b twister: fix setting of reason value on tests to be run
When loading tests from json file we want to reset the reason for those
tests that are to be run and remove whatever we had when the test was
only built.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif c8adf8808c twister: set type of built only tests correctly
we mark built only tests as skipped, however, the type was still the
same as other skipped tests, set this to 'built' to indicate the tests
was only built.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif bad8a0f9ef twister: xunit: we do not use the results of xunit
Remove return that is not being used anywhere.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif c5ea3af001 twister: fix hardware map generation an serial detection on mac
Do not fail on serial not being available.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif d5a5cc131f twister: cleanup status and reason setting
Remove some legacy code and set status and failure/skip reason directly
without set_state and get_state.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 03dca681d3 twister: fix status handling on build errors and overflows
Handle build errors due to overflows correctly and do not report those
as failures if not requested.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif c88d8c07c7 twister: fix --build-only followed by --test-only usecases
Set status correctly when building and executing tests in 2 different
steps.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif bf48c12b14 twister: set status for subcases when blocked
When we have a build failure or anything that would prevent execution of
the test, set the status for all subcases accordignly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 7f3a62f2ce ci: keep old name of testplan file for now
Until we are ready to change workflow file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 41cb42d4db ci: testplan converted to use json
twister now exports json instead of csv, so we make the testplan read
the json data and generate the consolidated plan for the workflow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 7d23e509a3 twister: finetune reporting for misconfigured testsuites
Report misconfigued testsuites and subcase parsing issues instead of
erroring out. This should help us fix those tests and then enforce
accurate result capturing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 9328285b1d twister: status: fix status evaluation
Fix some inconsistencies with status and execution time setting in
multiple areas.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 79693590d4 twister: reporting: set default status to 'Unknown'
Set status to unknown when we do not have any status set or status is
None.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif c820ffe18c twister: remove unused arguments in reporting functions
Remove unused arguments that became obsolete through the refactoring.
- filter_status
- only_failed
- json_report

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif b156f2dbea twsiter: also count errors for the plan
Count the errors found during setup and update counter.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif dbd460fd04 twister: apply_filter: discards is not part of TestPlan
Use class member instead of local variable of discards.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 26e3c30234 twister: report: capture failures per testcase
Capture failures per testcase so that we can include the output in
reports for only failed testcases and not include the whole log which
can be overwhelming.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif b86895adbb twister: reports: attach logs to xunit reports
This was missed in the report generation step, we now add them to the
xml file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 58f1926c93 twister: xunit: Fix conversion to text alignment
Do not create testsuite entries if all tests are being filtered.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif ab15d1ad8b twister: tests: remove tests of dropped features
Removed tests for dropped functionality.

Renamed classes and files to reflect new structure.

As we refactor the reporting infrastructure, tests will follow once we
have everything in place.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 61f11536f9 twister: fix initial stats about discards
Fix discard stats in the summary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 8e805596d5 twister: support defining testcases in yaml file
Some complex testsuite use macros and other mean to define testcases
which makes them unparseable. This ends up in a descripency between the
testplan and the test results.

Allow adding the testcases into the yaml and use those instead of
parsing the C files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif e08760e507 twister: support per case duration
We are now able to capture individual case duration and can display this
as part of the reports instead of using the overall test instance
execution time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 4a1695acf5 twister: add testcase class
Now we can add the TestCase class which will hold all information about
individual testcases, their status and why they are not passing, etc.

Test cases are parsed initially and testsuite is populated with the list
of testcases it contsins. This list is duplicate for each instance
(scenario) and used to capture test case data.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 111097098e twister: rename more testCase -> testsuite usages
More renaming and change to variable names to make it less confusing.
Especially, renames of tc to become ts where applicable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 15bc98eb50 twister: rename TestCase -> TestSuite
TestCase in the old terminology is the test application, but we have
just freed up TestSuite, so use TestSuite here to signify the test
application which consists of many test scenarios and testcases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 7424c65779 twister: rename TestSuite -> TestPlan
Change terminology and fix usage based on the current hierarchy. A
testsuite is each test application we have in the tree. The top class is
where we detect all the test suites and create the testplan to be run
later.
Content of testplan will have to split out, so it only deals with the
plan and not the overall execution of tests. This step will be done at a
later point.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif d70b267e3e twister: set correct status when loading json
When loading json, make sure we set the status correctly depending on
the type of the testscase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif ba8b557433 twister: fix some pylint issues
Fix a few pylint issues after the refactoring.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 2de0366784 twister: re-enable report filtering
Re-enable option to filter out skipped test cases as a result of
configuration or runtime filters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif c9daae592a twister: fix reporting of status and duration
Various fixes to reporting and filtering of results.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif eba9792a1b twister: generate unit from json
We now have all the logic for generating data suitable for reports in
one single place (json). The junit reports and in the future other
reports will be using this as input and generate reports using the json
data.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 1de0a3dc93 twister: remove release data handling
An obsolete feature that is no longer being used due to the amount of
data that is needed per release and the fact it becomes stale very fast.
Instead, point to files directly for comparison.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 106521074e twister: remove --export-tests option
We now have a better format for exports (json), use that instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Anas Nashif 3dcc038274 twister: use json instead of csv for everything
Drop CSV generation which was the standard for sharing information since
the early days and instead use json with more content to share
information across sessions and for report generation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00