Add unit test code coverage (gcov) make target
[ric-plt/sdl.git] / Makefile.am
index 1e75af9..499b862 100644 (file)
@@ -387,8 +387,25 @@ TESTS = \
 test: testrunner
        ./run-tests.sh
 
+if ENABLE_GCOV
+AM_CXXFLAGS= -O0 --coverage
+AM_LDFLAGS= --coverage
+
+test_gcov: test
+       @for p in src/.libs/*.o src/redis/.libs/*.o; do \
+               gcov -abcfru $$p 1>/dev/null; \
+       done
+       mkdir -p @GCOV_REPORT_DIR@
+       mv *.gcov @GCOV_REPORT_DIR@
+       ls -la @GCOV_REPORT_DIR@
+endif
+
 clean-local:
        rm -f libsdl.pc
+if ENABLE_GCOV
+       rm -rf @GCOV_REPORT_DIR@
+       @find . -name '*.gcno' -o -name '*.gcda'| xargs -r rm
+endif
 
 @DX_RULES@