ref: c74f44101e06d77245d06d8f1414a9f8d0a59970
parent: 8962b7c98baa809867d23d301665b9c0e99db10b
author: Licai Guo <guolicai@gmail.com>
date: Wed Mar 12 21:38:33 EDT 2014
add code coverage test. use lcov & gcov to generate coverage report use genhtml to generate html pages on ubuntu: sudo apt-get install lcov will install these two cmd lines.
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,10 @@
CFLAGS += -DNO_DYNAMIC_VP
LDFLAGS +=
+ifeq (Yes, $(GCOV))
+CFLAGS += -fprofile-arcs -ftest-coverage
+LDFLAGS += -lgcov
+endif
#### No user-serviceable parts below this line
ifneq ($(V),Yes)
--- /dev/null
+++ b/code-coverage.sh
@@ -1,0 +1,6 @@
+#!/bin/sh
+lcov -b . -d . -c -o tmp.info
+lcov -e tmp.info \*/codec/\* -o gcov.info
+mkdir -p code-coverage
+genhtml gcov.info -o ./code-coverage
+rm -f tmp.info gcov.info