'How to config GCOV for coverage Testing for a Driver(Ethernet Driver)?
I am trying to use GCOV to test a Device Driver eg: Ethernet Driver wrote in C language. This driver is in Userspace and has a lot of Kernelspace calls. Using a Linux Ubuntu machine Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-96-generic x86_64)
On compiling Driver code - Object file ( .o file is generated for each c file) and combined (.ko file). main() starts from startup code in my understanding. After loading the (*.ko ) file ethernet device needs to be tested functionally and a later coverage report shall be used.
I have a limited knowledge of Linux. Articles that I have come across are executing programs in Userspace only.
Question1:
I am not sure what are the steps to do so. Please suggest.
Appreciate your help in Advance.
Solution 1:[1]
I think the right manual lives here: https://www.kernel.org/doc/html/latest/dev-tools/gcov.html?highlight=gcov
Solution 2:[2]
I have been through this manual. And this doesn't give complete details. However, I have practically tried and achieved gcov coverage and gcovr also helped me to generate proper results.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | marxin |
| Solution 2 | Vinay Kumar |
