File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,10 @@ config COVERAGE_GCOV
7272
7373endchoice
7474
75+ if COVERAGE_GCOV
76+
7577config COVERAGE_GCOV_HEAP_SIZE
7678 int "Size of heap allocated for gcov coverage data dump"
77- depends on COVERAGE_GCOV
7879 default 32768 if X86 || SOC_SERIES_MPS2
7980 default 16384
8081 help
@@ -84,10 +85,20 @@ config COVERAGE_GCOV_HEAP_SIZE
8485
8586config COVERAGE_DUMP
8687 bool "Dump coverage data on exit"
87- depends on COVERAGE_GCOV
8888 help
8989 Dump collected coverage information to console on exit.
9090
91+ config COVERAGE_DUMP_PATH_EXCLUSIVE
92+ string "Only files matching this pattern are dumped in coverage data"
93+ default ""
94+ help
95+ Filenames are matched against the pattern using the posix fnmatch
96+ function. Filenames are based on their path in the build folder, not the
97+ original source tree. To only include files in a given west module, use
98+ the module name from `module.yml`.
99+
100+ endif # COVERAGE_GCOV
101+
91102config FORCE_COVERAGE
92103 bool "Force coverage"
93104 select HAS_COVERAGE_SUPPORT
Original file line number Diff line number Diff line change 99#include <stdint.h>
1010#include <errno.h>
1111#include <string.h>
12+ #include <fnmatch.h>
1213#include "coverage.h"
1314
1415K_HEAP_DEFINE (gcov_heap , CONFIG_COVERAGE_GCOV_HEAP_SIZE );
@@ -315,6 +316,11 @@ void gcov_coverage_dump(void)
315316 }
316317 printk ("\nGCOV_COVERAGE_DUMP_START" );
317318 while (gcov_list ) {
319+ if ((strlen (CONFIG_COVERAGE_DUMP_PATH_EXCLUSIVE ) > 0 ) &&
320+ (fnmatch (CONFIG_COVERAGE_DUMP_PATH_EXCLUSIVE , gcov_list -> filename , 0 ) != 0 )) {
321+ /* Don't print a note here, it would be interpreted as dump data */
322+ goto file_dump_end ;
323+ }
318324
319325 dump_on_console_start (gcov_list -> filename );
320326 size = gcov_calculate_buff_size (gcov_list );
@@ -334,6 +340,7 @@ void gcov_coverage_dump(void)
334340 dump_on_console_data (buffer , size );
335341
336342 k_heap_free (& gcov_heap , buffer );
343+ file_dump_end :
337344 gcov_list = gcov_list -> next ;
338345 if (gcov_list_first == gcov_list ) {
339346 goto coverage_dump_end ;
You can’t perform that action at this time.
0 commit comments