[gdal-dev] GDAL code coverage
Even Rouault
even.rouault at mines-paris.org
Sun Apr 13 16:26:34 EDT 2008
Hi,
I experimented a bit gcov on GDAL to see the code coverage of the python
autotest suite.
The result on my own GDAL tree (roughly latest trunk with some personnal
changes) is available at : http://home.gdal.org/tmp/coverage.zip.
The output is not as nice as I would have wished as it was tricky to make the
coverage report generator find the source files.
Here's the procedure I followed to generate the report :
1) Rebuild your GDAL tree with the GCC coverage options :
CC="gcc --coverage" CXX="g++ --coverage" ./configure 'your_usual_options'
make clean
make
2) Run the autotest suite. This will generate .gcda files in the object
directories of GDAL tree
3) In $(GDAL_ROOT) : create a 'coverage' subdirectory
4) In $(GDAL_ROOT) :
lcov --directory . --capture --output-file ./coverage/gdal.info
This will fail as lcov doesn't manage to find the source files. I had to add
various symbolic links. The main steps are :
cd $(GDAL_ROOT)/ogr/ogrsf_frmts/o
for i in `find ../../.. -name "*.c*" | grep -v svn`; do ln -s $i; done
for i in `find ../../.. -name "*.h*" | grep -v svn`; do ln -s $i; done
ln -s ../geojson/jsonc .
cd ..
ln -s ili/iom
cd $(GDAL_ROOT)/frmts/o
for i in `find .. -name "*.c*" | grep -v svn`; do ln -s $i; done
for i in `find .. -name "*.h*" | grep -v svn`; do ln -s $i; done
ln -s ../pcraster/libcsf .
ln -s ../gtiff/libtiff .
ln -s ../gtiff/libgeotiff .
ln -s ../grib/degrib18 .
Try 'lcov --directory . --capture --output-file ./coverage/gdal.info' and add
all necessary symbolic links until this finally works
5) In $(GDAL_ROOT) : genhtml -o ./coverage --num-spaces 2 ./coverage/gdal.info
6) Enjoy ./coverage/index.html
If someone knows how to tell lcov how to find the source files where they
really are instead of creating all those symbolic links that would be great !
Even
More information about the gdal-dev
mailing list