0

I am trying to get coverage for my source file(main_source.c) tested using unit testing via gtest framework. In my program i am creating a shared object of the source file placed in directory A(--coverage flag was set while creation of .so file, I can see the gcno files in A folder). I have a test file which tests one or two .lo files present in this shared object. My test file is created in folder B which includes shared object created in the previous step for linking purposes. My test is running good, I am able to the get coverage for the test source file. I am getting an error "profiling: A/main_source.c:Error writing gcda files". Can anyone please help. Thank you in advance.

user2873508
  • 1
  • 1
  • 1
  • where is your tested codes? – Sachith Muhandiram Sep 15 '16 at 04:00
  • I have two folders /home/xyz/sourceCode and /home/xyz/testingCode. sourceCode folder has the tested code and testingCode has the testing source code. I am creating the exe of test code by adding the so file source code during linking step. I am having the gcno file for the .lo files in sourceCode folder. My test is running successfully. but getting profilling:/home/xyz/sourceCode/source.gcda:Error wriring. – user2873508 Sep 15 '16 at 10:47
  • when I go to /home/xyz/sourceCode/ , I can see the gcda file for main tested code. when i try lcov over it gives warning that assuming gcda file is not written @Sachith – user2873508 Sep 15 '16 at 10:55
  • Does it make a difference if you use only absolute paths? Just guessing, but I had a similar problem (see http://stackoverflow.com/a/39552483/783510 ) – Philipp Claßen Oct 05 '16 at 23:11
  • I don't think so. I was overloading one function which was used by gcov to write the gcda data. After removing that overloaded function from my source code, volla ! it started working. – user2873508 Oct 07 '16 at 01:56

0 Answers0