number of counters have changed in gcc 14 by commit
https://github.com/gcc-mirror/gcc/commit/08a52331803
Specifically, a new counter was added in gcc/gcov-counter.def:
```
/* Conditions. The counter is interpreted as a bit-set. */
DEF_GCOV_COUNTER(GCOV_COUNTER_CONDS, "conditions", _ior)
```
which in turn updates the value of GCOV_COUNTERS that is defined in
gcov-io.h like this:
```
enum {
GCOV_COUNTERS
};
```
Signed-off-by: Roman Studenikin <srv@meta.com>
Add an option to reset gcov counters before running tests.
This ensures that only code lines triggered by test itself are counted in
the coverage report and all the board initialization code and pre-test
bootstrap is not counted. This is useful when, for example, you are
testing code that is also executed during bootup
Test Plan:
west build -p always -b qemu_x86_64 tests/ztest/base/ -- \
-DCONFIG_COVERAGE=y -DCONFIG_COVERAGE_GCOV=y -DCONFIG_COVERAGE_DUMP=y \
-DCONFIG_ZTEST_COVERAGE_RESET_BEFORE_TESTS=y
ninja -Cbuild run | tee log.log
Signed-off-by: Roman Studenikin <srv@meta.com>
Ability to reset gcov counters allows better isolation of tests
coverage. Specifically it allows to:
1. Not include counters for any code that was executed prior running the
test, which includes all the code executed during the board boot.
2. Run multiple tests without firmware reload by resetting counters
between each.
Signed-off-by: Roman Studenikin <srv@meta.com>
This allows external applications wishing to report coverage data over
different interfaces the ability to do so by exposing the gcov list.
Signed-off-by: Joshua Lilly <jgl@meta.com>
The GCC/GCOV version over 12 has slight format change of the gcno
and gcda. Make some adaption in the gcov dump function to fix the
code coverage report.
Mainly two places change:
1. Added the checksum in the struct gcov_info. This fix the crash
in qemu_x86, and mps2_an385 when run with --coverage.
2. Adjust the GCOV_TAG_FUNCTION_LENGTH accroding to gcov-io.h. It's
length unit is caculated by bytes now.
Fixes#50255.
Fixes#50257.
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
Updated the GCOV_COUNTERS value, without which the coverage data
was corrupted when gcc 10.2 was used.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This part of tests was forgotten when we move to subsys/
Fixes#13729
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>