Commit Graph

9 Commits

Author SHA1 Message Date
Roman Studenikin edf09ca7f9 testsuite: coverage: Correct value of GCOV_COUNTERS for gcc 14
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>
2024-08-06 17:15:22 -04:00
Roman Studenikin fdd81f87c2 testsuite: coverage: Add CONFIG_ZTEST_COVERAGE_RESET_BEFORE_TESTS
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>
2024-06-12 14:32:04 +03:00
Roman Studenikin 179585e54b testsuite: coveerage: support counters reset
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>
2024-06-12 14:32:04 +03:00
Joshua Lilly b3cba84dcd testsuite: coverage: allow access to gcov internals
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>
2023-11-29 04:59:47 -08:00
Enjia Mai 77986382df tests: framework: fix code coverage report on zephyr-sdk-0.15
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>
2022-09-22 14:14:39 +00:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Kumar Gala cc0c58c3af tests: coverage: GCOV counter value changed in GCC10.
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>
2020-11-18 22:17:58 -05:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Wentong Wu 0ef2408e26 tests: move tests/coverage to subsys/testsuite
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>
2019-03-04 08:24:42 -05:00