A patch against libssh2 that makes 'make coverage' generate a code
coverage report in docs/coverage/ is as below.  You'll need to install
gcov+lcov.  I'll wait with committing this until we have more self-tests
in place, for now I just wanted to illustrate how easy it is to generate
the reports.

/Simon

Index: Makefile.am
===================================================================
RCS file: /cvsroot/libssh2/libssh2/Makefile.am,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.am
--- Makefile.am 8 Nov 2007 15:14:13 -0000       1.17
+++ Makefile.am 21 Nov 2008 08:54:50 -0000
@@ -34,3 +34,26 @@ dist-hook:
          strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
          cp $$file $(distdir)$$strip; \
        done)
+
+# Code Coverage
+
+init-coverage:
+       make clean
+       lcov --directory . --zerocounters
+
+COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_OUT ?= docs/coverage
+
+build-coverage:
+       make CFLAGS=$(COVERAGE_CCOPTS) check
+       mkdir -p $(COVERAGE_OUT)
+       lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
+               --capture
+
+gen-coverage:
+       genhtml --output-directory $(COVERAGE_OUT) \
+               $(COVERAGE_OUT)/$(PACKAGE).info \
+               --highlight --frames --legend \
+               --title "$(PACKAGE_NAME)"
+
+coverage: init-coverage build-coverage gen-coverage

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to