Просмотр исходного кода

compile with absolute paths to allow lcov use

Instructing gcc (or clang) to prepare for capturing coverage data is
easy: Just build with: CXXFLAGS=--coverage

The hard part is that our buildsystem uses relative paths and so
confuses the hell out of lcov as it assumes this way that all our *.cc
files are in the same directory… by changing to absolute paths in the
compile rules we solve this problem.

Still not perfect as it refers to build/include files for most headers
and our forking/threading code isn't properly captured, but good enough
to see red reports for now:

CXXFLAGS=--coverage make
make test
./test/integration/run-tests -q
lcov --no-external --directory . --capture --output-file apt.info
genhtml --output-directory ./coverage/ apt.info

Git-Dch: Ignore
David Kalnischkies лет назад: 12
Родитель
Сommit
cbc9ec23b0
4 измененных файлов с 4 добавлено и 4 удалено
  1. 1 1
      buildlib/library.mak
  2. 1 1
      buildlib/program.mak
  3. 1 1
      buildlib/python.mak
  4. 1 1
      buildlib/staticlibrary.mak

+ 1 - 1
buildlib/library.mak

@@ -63,7 +63,7 @@ $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
 vpath %.cc $(SUBDIRS)
 $(OBJ)/%.opic: %.cc $(LIBRARYDEPENDS)
 	echo Compiling $< to $@
-	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $<
+	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $(abspath $<)
 	$(DoDep)
 
 # Include the dependencies that are available

+ 1 - 1
buildlib/program.mak

@@ -50,7 +50,7 @@ $($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS)
 vpath %.cc $(SUBDIRS)
 $(OBJ)/%.o: %.cc
 	echo Compiling $< to $@
-	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(abspath $<)
 	$(DoDep)
 
 # Include the dependencies that are available

+ 1 - 1
buildlib/python.mak

@@ -58,7 +58,7 @@ endif  # ifdef PYTHONLIB
 vpath %.cc $(SUBDIRS)
 $(OBJ)/%.opic: %.cc
 	echo Compiling $< to $@
-	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $<
+	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $(abspath $<)
 	$(DoDep)
 
 # Include the dependencies that are available

+ 1 - 1
buildlib/staticlibrary.mak

@@ -50,7 +50,7 @@ endif
 vpath %.cc $(SUBDIRS)
 $(OBJ)/%.o: %.cc
 	echo Compiling $< to $@
-	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(abspath $<)
 	$(DoDep)
 
 # Include the dependencies that are available