Domanda

La mia fonte e albero di compilazione si presenta così (vedi Makefile per mettere i file oggetto dal file di origine directory diverse in un unico directory separata ) dopo un make (che costruisce e gestisce FooAndBarTests):?

src
- Foo.cpp
- Bar.cpp
inc
- Foo.h
- Bar.h
test
- FooTest.cpp
- BarTest.cpp
- Main.cpp
- Makefile
- obj
  - Foo.gcda
  - Foo.gcno
  - Bar.gcda
  - Bar.gcno
- FooAndBarTests
UnitTest++
- libUnitTest++.a
- src
  - ...

I può quindi produrre .gcov file nella directory di prova eseguendo gcov -o obj/ ../src/Foo.cpp e gcov -o obj/ ../src/Bar.cpp.

Ma se corro lcov -d obj/ -c -o FooAndBarTests.lcov ottengo:

Capturing coverage data from obj/
Found gcov version: 4.2.1
Scanning obj/ for .gcda files ...
Found 4 data files in obj/
Processing Foo.gcda
../src/Foo.cpp:cannot open source file
Processing FooTest.gcda
FooTest.cpp:cannot open source file
../inc/Foo.h:cannot open source file
../UnitTest++/src/Checks.h:cannot open source file
...

E poi quando corro genhtml FooAndBarTests.lcov ottengo:

Reading data file FooAndBarTests.lcov
Found 45 entries.
Found common filename prefix "/Users/dspitzer/FooAndBar/test"
Writing .css and .png files.
Generating output.
Processing file UnitTest++/src/Checks.h
genhtml: ERROR: cannot open /Users/dspitzer/FooAndBar/test/UnitTest++/src/Checks.h for reading!

Come faccio a dire lcov e GENHTML dove il file .h cpp e sono?

È stato utile?

Soluzione

Utilizzare l'opzione -b a lcov. L'opzione -b specifica base di codice.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top