How to config GCOV for coverage Testing for a Driver(Ethernet Driver)?

264 Views Asked by At

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.

2

There are 2 best solutions below

1
On

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.

0
On