Commit 471ffbe7 authored by Anas Nashif's avatar Anas Nashif
Browse files

coverage: do not dump coverage data by default

Only dump data when we are interested in the analysing coverage. By
default just collect the data.

CONFIG_COVERAGE_DUMP is used to control this behaviour.

This will help speed up sanitycheck and will avoid lots of noise in the
log when some tests with coverage enabled failed. Dumping data to
console is also suspected to be one of the reason why qemu hangs in CI.

Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent ca09a7bf
Loading
Loading
Loading
Loading
+2 −0
Changes for kernel/init.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -285,8 +285,10 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
	/* Mark nonessenrial since main() has no more work to do */
	z_main_thread.base.user_options &= ~K_ESSENTIAL;

#ifdef CONFIG_COVERAGE_DUMP
	/* Dump coverage data once the main() has exited. */
	gcov_coverage_dump();
#endif
} /* LCOV_EXCL_LINE ... because we just dumped final coverage data */

/* LCOV_EXCL_START */
+1 −0
Changes for scripts/sanitycheck: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -1744,6 +1744,7 @@ class TestInstance:
            if enable_coverage:
                if platform.name in coverage_platform:
                    content = content + "\nCONFIG_COVERAGE=y"
                    content = content + "\nCONFIG_COVERAGE_DUMP=y"

            if enable_asan:
                if platform.type == "native":
+6 −0
Changes for subsys/testsuite/Kconfig: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -57,6 +57,12 @@ config COVERAGE_GCOV
	  can be read by gcov utility. For more details see gcovr.com .
endif

config COVERAGE_DUMP
	bool "Dump coverage data on exit"
	depends on COVERAGE_GCOV
	help
	  Dump collected coverage information to console on exit.

config TEST_USERSPACE
	bool "Indicate that this test exercises user mode"
	help