Commit graph

185 commits

Author SHA1 Message Date
Lukasz Mrugala f71a4184f3 scripts: twister: Fix Unit Tests on Windows systems
Unit tests currently are not runnable on Windows systems, failing
on two testfiles: test_jobserver.py and test_testsuite.py.

This commit removes code dependency on Windows-unavailable
elements on Windows systems via skipping the offending tests.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-05-15 17:08:06 +02:00
Grzegorz Chwierut 59212c198c twister: Allow to run sysbuild with native_sim
Fix issue 72083. Update path to zephyr.exe binary using
default domain from domains.yaml file.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-05-15 13:16:39 +02:00
Kamil Paszkiet 85c6ce69ca scripts: tests: Blackbox test expansion - report summary
add test for report summary switch

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-05-15 09:29:05 +02:00
Dmitrii Golovanov 1230640076 twister: Refactor 'recording' feature
Refactor Twister 'recording' feature moving it from Handler class
to TestInstance class and enable it also for other Harness child
classes other than Console.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-05-14 18:20:12 -04:00
Dmitrii Golovanov 4d85967e09 twister: Set default coverage platform only when needed
Set options.coverage_platform only when running coverage.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-05-13 11:39:16 +02:00
Maciej Perkowski be682e22e1 twister: allow using west-flash with 'erase'
Using `erase` with west-flash was blocked as it was
messing with sysbuild. With #69748 the issue is fixed, hence
'erase' is no longer blocked.
Remove obsolete twister test

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2024-05-10 20:26:02 -04:00
Lukasz Mrugala b2f43210de scripts: Loader change
CSafeLoader used instead of yaml.safe_load and SafeLoader.
C implementation is faster.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-05-07 09:38:00 +02:00
Lukasz Mrugala a294a9a9ab scripts: twister: Name prefix loading
Sped up Twister via name prefix loading.
If the only thing influencing the platform selection
is the platform filter (-p), then we only load *.yaml
files that start the same way as those selected platforms.
We split the platform name to the first '/' or '@'.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-05-07 09:38:00 +02:00
Lukasz Mrugala 83db378dc5 scripts: twister: Remove Handler atavisms
Removed following fields from relevant Handlers,
as they were unused in code:

* Handler's state
* Handler's generator
* BinaryHandler's call_west_flash
* QEMUHandler's results
* QEMUWinHandler's results

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-29 17:40:06 +01:00
Declan Snyder 5edc356d96 twister: Make --list-tests respect tag filter
Make the --list-tests and --tests-tree options outputs
respect the --tag and --exclude-tag options,
so that only the tests for the specified tags are listed.

Also update the TestPlan report testcases for this change.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-26 16:10:25 +02:00
Dmitrii Golovanov 50db868b58 twister: footprint: Improve error handling at gather_metrics
Add error handling for 'gather_metrics' stage and separate
build issues from 'scripts/footprint/size_report' issues.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-24 09:52:57 +02:00
Dmitrii Golovanov 978c0e4273 twister: testplan: Handle unknown test level
Fail a test run gracefully when an unknown test level
is requested to execute with the current test plan.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-23 15:31:50 +02:00
Marcin Niestroj 8654daeebd twister: pytest: use runner_params from hardware map YAML file
Use 'runner_params' specified in hardware map YAML file. This allows to
configure custom params (like openocd's adapter configuration for
FT232-based probe) when used with pytest harness.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-20 13:45:44 -04:00
Lukasz Mrugala a0d1b778a4 scripts: twister: Fix overbroad Mock in environment unit tests
os.path.abspath was mocked too broadly, leading to errors for some users,
while being undetected in the CI.
This change narrows down the mock effect, fixing the problem.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-15 16:25:51 +02:00
Dmitrii Golovanov 300507d43b twister: blackbox: pylint no-name-in-module warnings
Ignore no-name-in-module pylint warnings.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Dmitrii Golovanov a8eaa401a6 twister: blackbox: Fix test_output time-sensitive asserts
Exclude time-sensitive log entries at `test_output` to avoid
false negatives comparing build logs.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Dmitrii Golovanov 2ef6b98b98 twister: footprint: Improve command-line arguments
Improve Twister command line arguments for memory footprint:

 * group and order footprint arguments meaningfully,
 * clearer help descriptions,
 * resolve logical inconsistences for combinations of arguments,
   in particular:
   `--last-metrics` now forces `--enable-size-report`,
   `--show-footprint` now controls only detailed log output of
       footprint deltas in comparison modes.
 * align twister tests accordingly.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Patryk Kuniecki d8b368a160 scripts: tests: twister_blackbox: Add test_ignore_platform_key
Add new tests to test_filter.py in blackbox twister testing

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-04-03 10:34:35 +02:00
Lukasz Mrugala 2302e5f766 scripts: tests: Move bbox platform tests to a single file
Blackbox tests related to platform choice
now moved to test_platform.py:
* test_emulation_only
* test_exclude_platform

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-31 17:37:09 -04:00
Lukasz Mrugala 2f97795360 scripts: tests: Blackbox test expansion - platform
Adds tests related to the Twister's platform selection:
* -A, --board-root
* -K, --force-platform
* -p, --platform

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-31 17:37:09 -04:00
Kamil Paszkiet 717fccaa09 scripts: tests: Blackbox test expansion - device
Adds tests related to device flags:
--seed

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-29 15:07:38 +00:00
Artur Wilczak 6d8132c445 scripts: tests: Blackbox test expension - disable
Add test related to disable-suite-name-check flag

This flag disabling extended test suite name verification at
the beginning of Ztest test. This option could be useful for tests
or platforms, which from some reasons cannot print early logs.

Add test related disable-warnings-as-errors

Do not treat warning conditions as errors.

Signed-off-by: Artur Wilczak <arturx.wilczak@intel.com>
2024-03-29 15:07:19 +00:00
Maciej Dubiel d076962f73 twister: ut for config_parser.py
initial commit

Signed-off-by: Maciej Dubiel <maciejx.dubiel@intel.com>
2024-03-29 15:06:44 +00:00
Kamil Paszkiet fff833eda4 scripts: tests: Blackbox test expansion - filter
Adds tests related to filter flags:
--arch
--vendor

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-27 14:31:43 +00:00
Lukasz Mrugala 3fb11e260a scripts: tests: Blackbox test expansion - addon
Adds tests related to the addon flags:
*     --enable-ubsan
*     --enable-lsan
*     --enable-asan
*     --enable-valgrind
*     --allow-installed-plugin
*     --pytest-args
* -x, --extra-args
* extra test args for the binary

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 18:08:31 -05:00
Kamil Paszkiet ff5780fcc7 scripts: tests: Blackbox test expansion - coverage
Adds tests related to coverage flags:
--gcov-tool
--coverage-platform

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-26 18:08:02 -05:00
Lukasz Mrugala fd063d6ae5 scripts: tests: Move --ninja test to test_tooling
Brings the previously-created --ninja test to its test section file.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 11:15:41 -05:00
Lukasz Mrugala 8a54236d0b scripts: tests: Blackbox test expansion - tooling
Adds tests related to the Twister tooling:
* -j, --jobs
*     --force-toolchain

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 11:15:41 -05:00
Kamil Paszkiet 2a4332ba5f scripts: tests: Blackbox test expansion - error
Adds tests related to filter flags:
--overflow-as-errors

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-26 11:10:02 -05:00
Luca Burelli 5800c53b3e twister: tests: add "no platform" test case for --device-testing
Add a test case for --device-testing without a platform specified.
Also adjust the error message to match current code.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-03-25 16:18:05 +01:00
Lukasz Mrugala ccd3612575 scripts: tests: Remove test_harness straggling dirs
Current test_harness after its expansion leaves straggling
mock_platform directory. This fixes that error.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-25 16:17:32 +01:00
Anas Nashif 313d135cb2 twister: do not use non-existing architectures
Do not use non-existing architectures, we now have an enum in the
schema.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-19 18:28:06 -04:00
Alberto Escolar Piedras a4b0e8a706 twister tests: Let's use native_sim instead of native_posix
native_posix is being replaced with native_sim, let's
use native_sim instead in twister tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-19 13:15:48 -05:00
Maciej Perkowski 5af2140927 twister: Use proper warnings-to-errors command for sysbuild
If sysbuild is used a flag SB_CONFIG_COMPILER_WARNINGS_AS_ERRORS
has to be used in order to turn warings to errors on all images.
Align pytest tests with the change.

Fixes: #67360

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2024-03-18 15:41:53 +01:00
Kamil Paszkiet c63ad6c915 scripts: tests: Blackbox test expansion - coverage
Adds tests related to coverage flags:
--coverage-tool
--coverage-basedir
--coverage-formats

Move to coverage.py:
--coverage
--enable-coverage

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-13 11:09:59 +00:00
Anas Nashif 35176b993d twister: fix exception message
'Handling of handler...' is a bit weird to read.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Anas Nashif dbc3246723 tests: twister: use assert_called_with for multiple calls
Do not use assert_called_once_with, we can some functions more than once
and test should not prevent that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Patryk Kuniecki a10b842991 scripts: tests: twister_blackbox: Add test test_verbose.py
Add new test to twister blackbox tests

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-03-11 21:11:17 -05:00
Lukasz Mrugala 36c12482c6 scripts: tests: --package-artifacts fix, blackbox tests
Requirements added for bz2.
Blackbox test for --package-artifacts added.
package.py no longer includes twister-out no matter the outdir.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-11 16:12:55 -04:00
Lukasz Mrugala 621b621007 script: tests: Blackbox test expansion - report
Adds tests related to report flags:
*     --enable-size-report
*     --detailed-skipped-report

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:58:12 +01:00
Lukasz Mrugala dc68b11432 scripts: tests: Blackbox test expansion - testlist
Adds tests related to the flags creating testlists:
* -E, --save-tests
* -F, --load-tests

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:57:25 +01:00
Lukasz Mrugala 8b1ef285cb scripts: tests: Move --quarantine-list test to test_quarantine.py
Brings the previously-created --quarantine-list test
to its test section file.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:57:09 +01:00
Lukasz Mrugala 6ae873d4c2 scripts: tests: Blackbox test expansion - quarantine
Adds tests related to the quarantine flags:
*     --quarantine-verify

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:57:09 +01:00
Lukasz Mrugala c0d6e9f29b scripts: tests: Blackbox test expansion - printouts
Adds tests related to the flags
creating alternate printouts instead of
running Twister tests:
* -z, --size

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:56:53 +01:00
Lukasz Mrugala 93a377e674 scripts: tests: Blackbox test expansion - outfile
Adds tests related to the changing of the output files:
* -c, --clobber-output
* -n, --no-clean
* -M, --runtime-artifact-cleanup
*     --short-build-path
*     --prep-artifacts-for-testing

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:56:04 +01:00
Lukasz Mrugala 600c4d8a45 scripts: tests: Blackbox test expansion - filter
Adds tests related to the flags
that filter the tests:
* -e, --exclude-tag
* -S, --enable-slow
*     --enable-slow-only

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:55:27 +01:00
Lukasz Mrugala 32f4c17374 scripts: tests: Blackbox test expansion - output
Adds tests related to the flags
that change the console outputs:
*     --detailed-test-ids
*     --no-detailed-test-ids
* -i, --inline-logs

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 15:54:13 +01:00
Michal Smola 3bf61528cc twister: qemu: add QEMU support on Windows in twister
Twister does not support running tests on QEMU on Windows.
Add a new twister handler called QEMUWinHandler which supports running
tests on Windows. Enable running tests in testinstance, only if
QEMU_BIN_PATH environment variable exists on Windows.
Modify pytest test for testinstance to reflect the change in
runnability of QEMU on Windows.
Tested by running several Ztest and console harness tests.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-03-05 08:20:49 -05:00
Lukasz Mrugala 0db5d5194a scripts: tests: Blackbox test expansion - footprint
Adds tests related to report flags:
*     --compare-report
* -m, --last-metrics
* -D, --all-deltas
*     --footprint-threshold
*     --show-footprint
*     --footprint-from-buildlog

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 07:45:39 -05:00
Lukasz Mrugala 9d8600136d scripts: tests: Move blackbox config tests to test_config.py
Moved tests related to the test_config.yaml files to test_config.py.
* test_level

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-05 07:44:51 -05:00