Lines Matching +full:platform +full:- +full:schema

4 # Copyright (c) 2018-2024 Intel Corporation
8 # SPDX-License-Identifier: Apache-2.0
45 def _get_installed_packages() -> Generator[str, None, None]:
63 PYTEST_PLUGIN_INSTALLED = 'pytest-twister-harness' in installed_packages
71 def add_parse_arguments(parser = None) -> argparse.ArgumentParser:
82 $ ./scripts/twister -v \\
83 --testsuite-root tests/ztest/base \\
84 --testsuite-root tests/kernel \\
85 --test tests/ztest/base/testing.ztest.verbose_0 \\
86 --test tests/kernel/fifo/fifo_api/kernel.fifo
94 description="Report the composed test plan details and exit (dry-run)."
118 "-E",
119 "--save-tests",
127 "-F",
128 "--load-tests",
132 "from a JSON file ('testplan.json' schema)."
136 "-T", "--testsuite-root", action="append", default=[], type = norm_path,
143 "-f",
144 "--only-failed",
149 test_plan_report_xor.add_argument("--list-tests", action="store_true",
150 help="""List of all sub-test functions recursively found in
151 all --testsuite-root arguments. The output is flattened and reports detailed
152 sub-test names without their directories.
153 Note: sub-test names can share the same test scenario identifier prefix
157 test_plan_report_xor.add_argument("--test-tree", action="store_true",
161 "-G",
162 "--integration",
167 "--emulation-only", action="store_true",
171 "--device-testing", action="store_true",
173 "use with the --device-serial option.")
175 run_group_option.add_argument("--generate-hardware-map",
176 help="""Probe serial devices connected to this platform
178 --device-testing
182 "--simulation", dest="sim_name", choices=SUPPORTED_SIMS,
188 device.add_argument("--device-serial",
193 device.add_argument("--device-serial-pty",
198 E.g "twister --device-testing
199 --device-serial-pty <script>
202 device.add_argument("--hardware-map",
207 parser.add_argument("--device-flash-timeout", type=int, default=60,
211 parser.add_argument("--device-flash-with-test", action="store_true",
213 when flash operation also executes test case on the platform.
216 parser.add_argument("--flash-before", action="store_true", default=False,
219 and serial console, or use soft-USB, where flash must come first.
223 "-b",
224 "--build-only",
226 default="--prep-artifacts-for-testing" in sys.argv,
231 "--prep-artifacts-for-testing", action="store_true",
236 "--package-artifacts",
237 help="Package artifacts needed for flashing in a file to be used with --test-only"
241 "--test-only", action="store_true",
245 parser.add_argument("--timeout-multiplier", type=float, default=1,
247 timeout would be multiplication of test timeout value, board-level timeout multiplier
251 "-s", "--test", "--scenario", action="append", type = norm_path,
254 or just 'section.subsection' identifier. With '--testsuite-root' option
259 "--sub-test", action="append",
260 help="""Recursively find sub-test functions (test cases) and run the entire
262 functions. Sub-tests are named by:
268 the source files which are not generated by macro-substitutions.
269 Note: With --no-detailed-test-id use only Ztest names without scenario name.
273 "--pytest-args", action="append",
279 "--enable-valgrind", action="store_true",
283 configuration and is mutual exclusive with --enable-asan.
287 "--enable-asan", action="store_true",
291 configuration and is mutual exclusive with --enable-valgrind.
294 # Start of individual args place them in alpha-beta order
305 "-A", "--board-root", action="append", default=board_root_list,
311 "--allow-installed-plugin", action="store_true", default=None,
316 "-a", "--arch", action="append",
317 help="Arch filter for testing. Takes precedence over --platform. "
322 "-B", "--subset",
329 "--shuffle-tests", action="store_true", default=None,
331 Used only when --subset is provided.""")
334 "--shuffle-tests-seed", action="store", default=None,
337 Used only when --shuffle-tests is provided.""")
339 parser.add_argument("-C", "--coverage", action="store_true",
341 "--enable-coverage.")
344 "-c", "--clobber-output", action="store_true",
349 "--cmake-only", action="store_true",
352 parser.add_argument("--coverage-basedir", default=ZEPHYR_BASE,
355 parser.add_argument("--coverage-platform", action="append", default=[],
358 "Default to what was selected with --platform.")
360 parser.add_argument("--coverage-tool", choices=['lcov', 'gcovr'], default='gcovr',
364 "--coverage-formats",
367 help="Output formats to use for generated coverage reports, as a comma-separated list. " +
369 ','.join(supported_coverage_formats['gcovr']) + " (html - default)." +
371 ','.join(supported_coverage_formats['lcov']) + " (html,lcov - default)."
375 "--test-config",
381 parser.add_argument("--level", action="store",
386 "--device-serial-baud", action="store", default=None,
390 "--disable-suite-name-check", action="store_true", default=False,
395 parser.add_argument("-e", "--exclude-tag", action="append",
399 parser.add_argument("--enable-coverage", action="store_true",
403 "--enable-lsan", action="store_true",
407 configuration and when --enable-asan is given.
411 "--enable-ubsan", action="store_true",
419 "--filter", choices=['buildable', 'runnable'],
420 default='runnable' if "--device-testing" in sys.argv else 'buildable',
426 parser.add_argument("--force-color", action="store_true",
430 parser.add_argument("--force-toolchain", action="store_true",
434 parser.add_argument("--gcov-tool", type=Path, default=None,
439 "--create-rom-ram-report",
442 "using additional build option `--target footprint`.")
445 "--footprint-report",
453 "Implies '--create-rom-ram-report' to generate the footprint data files. "
457 "--enable-size-report",
462 "--disable-unrecognized-section-test",
468 "--footprint-from-buildlog",
472 "Requires --enable-size-report or one of the baseline comparison modes."
478 "-m", "--last-metrics",
482 "Implies --enable-size-report option.")
485 "--compare-report",
487 "The file should be of 'twister.json' schema. "
488 "Implies --enable-size-report option.")
491 "--show-footprint",
496 "-H", "--footprint-threshold",
506 "-D", "--all-deltas",
510 "Implies --footprint-threshold=0")
513 "-z", "--size",
520 "-i", "--inline-logs", action="store_true",
524 parser.add_argument("--ignore-platform-key", action="store_true",
525 help="Do not filter based on platform key")
528 "-j", "--jobs", type=int,
530 "overcommitted by factor 2 when --build-only.")
533 "-K", "--force-platform", action="store_true",
539 "-l", "--all", action="store_true",
540 help="Build/test on all platforms. Any --platform arguments "
543 test_plan_report_xor.add_argument("--list-tags", action="store_true",
546 parser.add_argument("--log-file", metavar="FILENAME", action="store",
550 "-M", "--runtime-artifact-cleanup", choices=['pass', 'all'],
557 "-N", "--ninja", action="store_true",
558 default=not any(a in sys.argv for a in ("-k", "--make")),
562 "-k", "--make", action="store_true",
566 "-n", "--no-clean", action="store_true",
567 help="Re-use the outdir before building. Will result in "
571 "--aggressive-no-clean", action="store_true",
572 help="Re-use the outdir before building and do not re-run cmake. Will result in "
580 '--detailed-test-id', action='store_true',
582 "the appropriate Scenario name using PATH_TO_TEST_CONFIG/SCENARIO_NAME schema. "
589 "--no-detailed-test-id", dest='detailed_test_id', action="store_false",
601 "--detailed-skipped-report", action="store_true",
607 "-O", "--outdir",
608 default=os.path.join(os.getcwd(), "twister-out"),
610 "Default is 'twister-out' in the current directory. "
611 "This directory will be cleaned unless '--no-clean' is set. "
612 "The '--clobber-output' option controls what cleaning does.")
615 "-o", "--report-dir",
622 parser.add_argument("--overflow-as-errors", action="store_true",
625 parser.add_argument("--report-filtered", action="store_true",
628 parser.add_argument("-P", "--exclude-platform", action="append", default=[],
634 parser.add_argument("--persistent-hardware-map", action='store_true',
635 help="""With --generate-hardware-map, tries to use
641 "--vendor", action="append", default=[],
645 "-p", "--platform", action="append", default=[],
646 help="Platform filter for testing. This option may be used multiple "
649 "as default in the platform metadata file will be chosen "
653 "--platform-reports", action="store_true",
654 help="""Create individual reports for each platform.
657 parser.add_argument("--pre-script",
663 "--quarantine-list",
672 "--quarantine-verify",
678 "--quit-on-failure",
684 "--report-name",
689 "--report-summary", action="store", nargs='?', type=int, const=0,
691 "However, you can specify the number of items (e.g. --report-summary 15). "
692 "It also works well with the --outdir switch.")
695 "--report-suffix",
701 "--report-all-options", action="store_true",
703 environment.options object in twister.json. Default: show only non-default settings.
707 "--retry-failed", type=int, default=0,
711 "--retry-interval", type=int, default=60,
715 "--retry-build-errors", action="store_true",
719 "-S", "--enable-slow", action="store_true",
720 default="--enable-slow-only" in sys.argv,
721 help="Execute time-consuming test cases that have been marked "
725 "--enable-slow-only", action="store_true",
726 help="Execute time-consuming test cases that have been marked "
727 "as 'slow' in testcase.yaml only. This also set the option --enable-slow")
730 "--seed", type=int,
731 help="Seed for native_sim pseudo-random number generator")
734 "--short-build-path",
741 "'--ninja' argument (to use Ninja build generator).")
744 "-t", "--tag", action="append",
749 parser.add_argument("--timestamps",
754 "-u",
755 "--no-update",
759 "twister, for example when re-running failed tests with --only-failed "
760 "or --no-clean. This option is for debugging purposes only.")
763 "-v",
764 "--verbose",
770 "-ll",
771 "--log-level",
778 parser.add_argument("-W", "--disable-warnings-as-errors", action="store_true",
782 "--west-flash", nargs='?', const=[],
784 --device-testing. Supports comma-separated argument list.
786 E.g "twister --device-testing --device-serial /dev/ttyACM0
787 --west-flash="--board-id=foobar,--erase"
788 will translate to "west flash -- --board-id=foobar --erase"
790 NOTE: device-testing must be enabled to use this option.
794 "--west-runner",
796 with --west-flash.
798 E.g "twister --device-testing --device-serial /dev/ttyACM0
799 --west-flash --west-runner=pyocd"
800 will translate to "west flash --runner pyocd"
802 NOTE: west-flash must be enabled to use this option.
807 "-X", "--fixture", action="append", default=[],
811 "-x", "--extra-args", action="append", default=[],
813 May be called multiple times. The key-value entries will be
814 prefixed with -D before being passed to CMake.
816 "twister -x=USE_CCACHE=0"
818 "cmake -DUSE_CCACHE=0"
824 "-y", "--dry-run", action="store_true",
832 help="Additional args following a '--' are passed to the test binary")
834 parser.add_argument("--alt-config-root", action="append", default=[],
849 ) -> argparse.Namespace:
855 logger.error("--short-build-path requires Ninja to be enabled")
859 logger.error("--device-serial-pty is not supported on Windows OS")
863 logger.error("west-runner requires west-flash to be enabled")
867 logger.error("west-flash requires device-testing to be enabled")
897 options.coverage_platform = options.platform
915 "Use --device-testing with --device-serial, or --device-serial-pty, or --hardware-map."
921 and (options.device_serial or options.device_serial_pty) and len(options.platform) != 1
923 logger.error("When --device-testing is used with --device-serial "
924 "or --device-serial-pty, exactly one platform must "
929 logger.error("--device-flash-with-test requires --device_testing")
933 logger.error("--device-flash-with-test does not apply when --flash-before is used")
937 logger.error("--device-serial-pty cannot be used when --flash-before is set (for now)")
941 logger.error("--shuffle-tests requires --subset")
945 logger.error("--shuffle-tests-seed requires --shuffle-tests")
956 logger.warning("WARNING: Using --footprint-from-buildlog will give inconsistent results "
960 logger.error("--footprint-from-buildlog requires --enable-size-report")
966 # list should begin with a "--". If not, there is some extra
969 if options.extra_test_args[0] != "--":
971 double_dash = options.extra_test_args.index("--")
978 " Use -- to delineate extra arguments for test binary or pass -h for help."
983 # Strip off the initial "--" following validation.
987 logger.error("By default Twister should work without pytest-twister-harness "
989 "`pip uninstall pytest-twister-harness` and `git clean "
990 "-dxf scripts/pylib/pytest-twister-harness`.")
994 "pytest-twister-harness plugin.")
998 def strip_ansi_sequences(s: str) -> str:
1000 return re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', "", s)
1004 def __init__(self, options : argparse.Namespace, default_options=None) -> None:
1057 def non_default_options(self) -> dict:
1058 """Returns current command line options which are set to non-default values."""
1076 subproc = subprocess.run(["git", "describe", "--abbrev=12", "--always"],
1092 subproc = subprocess.run(["git", "show", "-s", "--format=%cI", "HEAD"],
1109 cmake_args = ["-D{}".format(a.replace('"', '')) for a in args[1:]]
1110 cmake_args.extend(['-P', script])
1146 toolchain_script = Path(ZEPHYR_BASE) / Path('cmake/verify-toolchain.cmake')