Linux Host Unit test Coverage - ESP-IDF
Posted: Sun Jun 09, 2024 11:36 pm
Hello,
I'm having trouble setting code coverage generation for my unit testing. I'm able to run my tests perfectly fine and I'm able to generate .gcno files by adding --coverage to the build process for both the test source file and the sources for the custom component I'm testing. The problem is the resulting .gcda when I run the test binary are only created for the test source .gcno files, but not for the component sources, even though the test includes the files and calls the functions.
This is my current directory structure:
I'm having trouble setting code coverage generation for my unit testing. I'm able to run my tests perfectly fine and I'm able to generate .gcno files by adding --coverage to the build process for both the test source file and the sources for the custom component I'm testing. The problem is the resulting .gcda when I run the test binary are only created for the test source .gcno files, but not for the component sources, even though the test includes the files and calls the functions.
This is my current directory structure:
Code: Select all
├── CMakeLists.txt (1)
├── component_file.c
├── component_file.h
├── host_test
│ ├── component_unit_tests
│ │ ├── CMakeLists.txt (2)
│ │ ├── main
│ │ │ ├── CMakeLists.txt (3)
│ │ │ └── component_unit_tests.c
│ │ └── sdkconfig.defaults
/code]
I've attached the contents of all three cmakelist files. Any insight on this is greatly appreciated. Thanks