@@ -443,7 +443,7 @@ def target_supports_toolchain(target, toolchain_name):
443443def prepare_toolchain (src_paths , build_dir , target , toolchain_name ,
444444 macros = None , clean = False , jobs = 1 ,
445445 notify = None , config = None , app_config = None ,
446- build_profile = None , ignore = None ):
446+ build_profile = None , ignore = None , coverage_patterns = None ):
447447 """ Prepares resource related objects - toolchain, target, config
448448
449449 Positional arguments:
@@ -460,6 +460,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
460460 app_config - location of a chosen mbed_app.json file
461461 build_profile - a list of mergeable build profiles
462462 ignore - list of paths to add to mbedignore
463+ coverage_patterns - list of patterns for code coverage
463464 """
464465
465466 # We need to remove all paths which are repeated to avoid
@@ -483,6 +484,9 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
483484 target .default_toolchain = "uARM"
484485 toolchain_name = selected_toolchain_name
485486
487+ if coverage_patterns :
488+ target .extra_labels .append (u'COVERAGE' )
489+
486490 try :
487491 cur_tc = TOOLCHAIN_CLASSES [toolchain_name ]
488492 except KeyError :
@@ -494,7 +498,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
494498 profile [key ].extend (contents [toolchain_name ].get (key , []))
495499
496500 toolchain = cur_tc (
497- target , notify , macros , build_dir = build_dir , build_profile = profile )
501+ target , notify , macros , build_dir = build_dir , build_profile = profile , coverage_patterns = coverage_patterns )
498502
499503 toolchain .config = config
500504 toolchain .jobs = jobs
@@ -517,7 +521,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
517521 report = None , properties = None , project_id = None ,
518522 project_description = None , config = None ,
519523 app_config = None , build_profile = None , stats_depth = None ,
520- ignore = None , resource_filter = None ):
524+ ignore = None , resource_filter = None , coverage_patterns = None ):
521525 """ Build a project. A project may be a test or a user program.
522526
523527 Positional arguments:
@@ -562,7 +566,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
562566 toolchain = prepare_toolchain (
563567 src_paths , build_path , target , toolchain_name , macros = macros ,
564568 clean = clean , jobs = jobs , notify = notify , config = config ,
565- app_config = app_config , build_profile = build_profile , ignore = ignore )
569+ app_config = app_config , build_profile = build_profile , ignore = ignore , coverage_patterns = coverage_patterns )
566570 toolchain .version_check ()
567571
568572 # The first path will give the name to the library
@@ -668,7 +672,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
668672 archive = True , notify = None , macros = None , inc_dirs = None , jobs = 1 ,
669673 report = None , properties = None , project_id = None ,
670674 remove_config_header_file = False , app_config = None ,
671- build_profile = None , ignore = None , resource_filter = None ):
675+ build_profile = None , ignore = None , resource_filter = None , coverage_patterns = None ):
672676 """ Build a library
673677
674678 Positional arguments:
@@ -719,7 +723,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
719723 toolchain = prepare_toolchain (
720724 src_paths , build_path , target , toolchain_name , macros = macros ,
721725 clean = clean , jobs = jobs , notify = notify , app_config = app_config ,
722- build_profile = build_profile , ignore = ignore )
726+ build_profile = build_profile , ignore = ignore , coverage_patterns = coverage_patterns )
723727 toolchain .version_check ()
724728
725729 # The first path will give the name to the library
0 commit comments