twister: add --aggressive-no-clean option

Useful option during development and when applying smaller change to the
code and verifying changes using tests. This works fine as long as no
dependencies or major changes are done, i.e. when editing few files and
in a subsystem. Use with caution and use on your own risk :-)

When building multiple tests, this provide significant boost, up to 300%
faster than when rebuilding everything from scratch or when re-running
cmake every single time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-11-23 14:22:59 -05:00 committed by Carles Cufí
parent c2ddfa2bd2
commit d3af185acd
2 changed files with 18 additions and 1 deletions

View file

@ -452,6 +452,15 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
help="Re-use the outdir before building. Will result in "
"faster compilation since builds will be incremental.")
parser.add_argument(
"--aggressive-no-clean", action="store_true",
help="Re-use the outdir before building and do not re-run cmake. Will result in "
"much faster compilation since builds will be incremental. This option might "
" result in build failures and inconsistencies if dependencies change or when "
" applied on a significantly changed code base. Use on your own "
" risk. It is recommended to only use this option for local "
" development and when testing localized change in a subsystem.")
parser.add_argument(
'--detailed-test-id', action='store_true',
help="Include paths to tests' locations in tests' names. Names will follow "
@ -740,6 +749,9 @@ def parse_arguments(parser, args, options = None):
if options.show_footprint or options.compare_report:
options.enable_size_report = True
if options.aggressive_no_clean:
options.no_clean = True
if options.coverage:
options.enable_coverage = True

View file

@ -1250,12 +1250,17 @@ class TwisterRunner:
instance.filter_stages = []
if instance.testsuite.filter:
instance.filter_stages = self.get_cmake_filter_stages(instance.testsuite.filter, expr_parser.reserved.keys())
if test_only and instance.run:
pipeline.put({"op": "run", "test": instance})
elif instance.filter_stages and "full" not in instance.filter_stages:
pipeline.put({"op": "filter", "test": instance})
else:
pipeline.put({"op": "cmake", "test": instance})
cache_file = os.path.join(instance.build_dir, "CMakeCache.txt")
if os.path.exists(cache_file) and self.env.options.aggressive_no_clean:
pipeline.put({"op": "build", "test": instance})
else:
pipeline.put({"op": "cmake", "test": instance})
def pipeline_mgr(self, pipeline, done_queue, lock, results):