Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22201

gcov and gcovr: no .gcno files are generated after compiling

$
0
0

I am trying to get code coverage in my unit test project in windows system.

Description

After compiling with -fprofile-arcs -ftest-coverage, I found out the execution file is generated and works fine. However there's no any .gcno files in the folder. So I cannot output the coverage report properly by gcovr.

Software version

gcc 8.1.0/gcov 8.1.0/gcovr 5.1/python 3.10.2

Steps

Here's what I've done during the whole process. Please help me if there's something wrong.

  1. There are only .c and .h files in one folder

  2. Compile my project using gcc

gcc -Wall -Wno-unknown-pragmas -fcompare-debug-second -fprofile-arcs -ftest-coverage -DUTEST AllTests.c CuTest.c BZR2.c BZR2_test.c -o beta.exe

  1. Then I got beta.exe in the folder.

  2. After runing beta.exe, there's my test result(All tests are passed.) showing in the command line window. Besides there're .gcda files with the same filename as my .c files.

  3. Then I run gcovr -r ., the result is showing below. I think the reson why gcovr can't show the coverage information is there's no any .gcno files generated after compiling my project. But I don't understand why and how to solve this.

------------------------------------------------------------------------------                           GCC Code Coverage ReportDirectory: .------------------------------------------------------------------------------File                                       Lines    Exec  Cover   Missing------------------------------------------------------------------------------------------------------------------------------------------------------------TOTAL                                          0       0    --%------------------------------------------------------------------------------

Thanks for your time!


Viewing all articles
Browse latest Browse all 22201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>