I have successfully generated the .gcda and .gcno files and they are in the same folder.
The flags in the make file looks as below :
CPPFLAGS += -std=c++11 --coverage -isystem $(GTEST_DIR)/include
CXXFLAGS += -std=c++11 --coverage -g -Wall -Wextra -pthread -I$(PULSE_DIR)/inc
CFLAGS += -std=c++11 --coverage -g -Wall -Wextra -pthread -I$(PULSE_DIR)/inc
I am using the googleTest (Gtest) to write the unitTests. The executable files generated for the unitTests are working fine. I just want to generate the code coverage. I am successfully able to generate .gcno and .gcda files and both of them are in the same obj folder.
Then, I used the following lcov command from obj directory :
lcov -t "result" -o testcoverage.info -c -d .
This was supposed to generate testcoverag.info file but it gives me error as follows : Capturing coverage data from .
Found gcov version: 5.4.0
Scanning . for .gcda files ...
Found 4 data files in .
Processing GeneratorObj_unittests.gcda
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-internal.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest-printers.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest.h
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-port.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest-message.h
Processing GeneratorObj.gcda
Processing gtest-all.gcda
Cannot open source file deps/googletest/googletest/src/gtest-typed-test.cc
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-port.h
Cannot open source file deps/googletest/googletest/src/gtest.cc
Cannot open source file deps/googletest/googletest/src/gtest-death-test.cc
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-internal.h
Cannot open source file deps/googletest/googletest/src/gtest-internal-inl.h
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest-printers.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest-message.h
Cannot open source file deps/googletest/googletest/include/gtest/gtest-test-part.h
Cannot open source file deps/googletest/googletest/src/gtest-printers.cc
Cannot open source file deps/googletest/googletest/src/gtest-port.cc
Cannot open source file deps/googletest/googletest/src/gtest-test-part.cc
Cannot open source file deps/googletest/googletest/src/gtest-filepath.cc
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-filepath.h
Cannot open source file deps/googletest/googletest/include/gtest/internal/gtest-param-util.h
Processing gtest_main.gcda
Cannot open source file deps/googletest/googletest/src/gtest_main.cc
Cannot open source file deps/googletest/googletest/include/gtest/gtest.h
Finished .info-file creation
GeneratorObj_unittests is the unittest file that I have written. It some how is not able to open all the files associated with gtest folder.
If I could only generate testcoverage.info file then I would be able to generate the html coverage file using the genhtml.
I tried checking the permission of the gtest files and they are all read and write. I dont know what is going on wrong here.