add code coverage support
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -20,6 +20,8 @@ autom4te.cache
|
|||||||
.dirstamp
|
.dirstamp
|
||||||
.deps
|
.deps
|
||||||
.sconsign*
|
.sconsign*
|
||||||
|
src/*.gcda
|
||||||
|
src/*.gcno
|
||||||
src/*.o
|
src/*.o
|
||||||
src/*.lo
|
src/*.lo
|
||||||
examples/*.o
|
examples/*.o
|
||||||
@@ -72,3 +74,6 @@ expat/
|
|||||||
.settings/
|
.settings/
|
||||||
.project
|
.project
|
||||||
.cproject
|
.cproject
|
||||||
|
coverage/
|
||||||
|
coverage.info
|
||||||
|
configure~
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
0.12.0
|
||||||
|
- Add code coverage support
|
||||||
|
|
||||||
0.11.0
|
0.11.0
|
||||||
- SASL EXTERNAL support (XEP-0178)
|
- SASL EXTERNAL support (XEP-0178)
|
||||||
- Client certificate can be provided for TLS negotiation. If the
|
- Client certificate can be provided for TLS negotiation. If the
|
||||||
|
|||||||
19
Makefile.am
19
Makefile.am
@@ -2,6 +2,11 @@ AUTOMAKE_OPTIONS = subdir-objects
|
|||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
COVERAGE_CFLAGS=@COVERAGE_CFLAGS@
|
||||||
|
COVERAGE_LDFLAGS=@COVERAGE_LDFLAGS@
|
||||||
|
COVERAGE_PRE=@COVERAGE_PRE@
|
||||||
|
COVERAGE_POST=@COVERAGE_POST@
|
||||||
|
|
||||||
PARSER_CFLAGS=@PARSER_CFLAGS@
|
PARSER_CFLAGS=@PARSER_CFLAGS@
|
||||||
PARSER_LIBS=@PARSER_LIBS@
|
PARSER_LIBS=@PARSER_LIBS@
|
||||||
|
|
||||||
@@ -18,12 +23,12 @@ RESOLV_LIBS = @RESOLV_LIBS@
|
|||||||
|
|
||||||
WARNING_FLAGS = @WARNING_FLAGS@
|
WARNING_FLAGS = @WARNING_FLAGS@
|
||||||
STROPHE_FLAGS = -I$(top_srcdir) $(WARNING_FLAGS)
|
STROPHE_FLAGS = -I$(top_srcdir) $(WARNING_FLAGS)
|
||||||
STROPHE_LIBS = libstrophe.la
|
STROPHE_LIBS = $(COVERAGE_PRE) libstrophe.la $(COVERAGE_POST) $(COVERAGE_LDFLAGS)
|
||||||
|
|
||||||
## Main build targets
|
## Main build targets
|
||||||
lib_LTLIBRARIES = libstrophe.la
|
lib_LTLIBRARIES = libstrophe.la
|
||||||
|
|
||||||
libstrophe_la_CFLAGS = $(SSL_CFLAGS) $(STROPHE_FLAGS) $(PARSER_CFLAGS) $(RESOLV_CFLAGS)
|
libstrophe_la_CFLAGS = $(SSL_CFLAGS) $(STROPHE_FLAGS) $(PARSER_CFLAGS) $(RESOLV_CFLAGS) $(COVERAGE_CFLAGS)
|
||||||
libstrophe_la_LDFLAGS = $(SSL_LIBS) $(PARSER_LIBS) $(RESOLV_LIBS) -no-undefined
|
libstrophe_la_LDFLAGS = $(SSL_LIBS) $(PARSER_LIBS) $(RESOLV_LIBS) -no-undefined
|
||||||
# Export only public API
|
# Export only public API
|
||||||
libstrophe_la_LDFLAGS += -export-symbols-regex '^xmpp_'
|
libstrophe_la_LDFLAGS += -export-symbols-regex '^xmpp_'
|
||||||
@@ -255,3 +260,13 @@ format:
|
|||||||
@echo " * run clang-format on all sources"
|
@echo " * run clang-format on all sources"
|
||||||
@dos2unix -q src/*.[ch] *.h tests/*.[ch] examples/*.c
|
@dos2unix -q src/*.[ch] *.h tests/*.[ch] examples/*.c
|
||||||
@clang-format -i src/*.[ch] *.h tests/*.[ch] examples/*.c
|
@clang-format -i src/*.[ch] *.h tests/*.[ch] examples/*.c
|
||||||
|
|
||||||
|
if COVERAGE
|
||||||
|
MOSTLYCLEANFILES = src/*.gcno src/*.gcda coverage.info
|
||||||
|
clean-local:
|
||||||
|
-rm -rf coverage/
|
||||||
|
|
||||||
|
coverage: check
|
||||||
|
@lcov --capture --no-external --directory src -q --output-file coverage.info
|
||||||
|
@genhtml coverage.info --output-directory coverage -q
|
||||||
|
endif
|
||||||
|
|||||||
@@ -42,17 +42,30 @@ another path use the `--prefix` option during configure, e.g.:
|
|||||||
Run script `build-android.sh` and follow the instructions. You will
|
Run script `build-android.sh` and follow the instructions. You will
|
||||||
need expat sources and android-ndk.
|
need expat sources and android-ndk.
|
||||||
|
|
||||||
|
### Code Coverage
|
||||||
|
|
||||||
|
If you want to create a code coverage report, run:
|
||||||
|
|
||||||
|
./configure --enable-coverage
|
||||||
|
make coverage
|
||||||
|
|
||||||
|
The coverage report can be found in `./coverage/index.html`.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
libstrophe requires:
|
libstrophe requires:
|
||||||
|
|
||||||
- expat or libxml2 - expat is the default; use --with-libxml2 to
|
- expat or libxml2 - expat is the default; use `--with-libxml2` to
|
||||||
switch
|
switch
|
||||||
- openssl on UNIX systems
|
- openssl or GnuTLS on UNIX systems - openssl is default; use
|
||||||
|
`--with-gnutls` to switch
|
||||||
|
|
||||||
To build libstrophe using autotools you will need autoconf, automake,
|
To build libstrophe using autotools you will need `autoconf`,
|
||||||
libtool and pkg-config.
|
`automake`, `libtool` and `pkg-config`.
|
||||||
|
|
||||||
|
To run code coverage analysis you will need `gcov` and `lcov`.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|||||||
21
configure.ac
21
configure.ac
@@ -44,6 +44,23 @@ if test "x$enable_fuzzing" = "xyes" ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([coverage],
|
||||||
|
[AS_HELP_STRING([--enable-coverage], [turn on coverage for tests])],
|
||||||
|
[case "${enableval}" in yes) coverage=true ;; no) coverage=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;; esac],[coverage=false])
|
||||||
|
AM_CONDITIONAL([COVERAGE], [test x$coverage = xtrue])
|
||||||
|
|
||||||
|
if test "$enable_coverage" = "yes"; then
|
||||||
|
COVERAGE_CFLAGS="--coverage -g"
|
||||||
|
COVERAGE_LDFLAGS="--coverage -lgcov"
|
||||||
|
COVERAGE_PRE="-Wl,--whole-archive"
|
||||||
|
COVERAGE_POST="-Wl,--no-whole-archive"
|
||||||
|
else
|
||||||
|
COVERAGE_CFLAGS=""
|
||||||
|
COVERAGE_LDFLAGS=""
|
||||||
|
COVERAGE_PRE=""
|
||||||
|
COVERAGE_POST=""
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SEARCH_LIBS([socket], [network socket])
|
AC_SEARCH_LIBS([socket], [network socket])
|
||||||
AC_CHECK_FUNCS([snprintf vsnprintf])
|
AC_CHECK_FUNCS([snprintf vsnprintf])
|
||||||
AC_CHECK_DECLS([va_copy], [], [], [#include <stdarg.h>])
|
AC_CHECK_DECLS([va_copy], [], [], [#include <stdarg.h>])
|
||||||
@@ -174,6 +191,10 @@ AC_SUBST([PC_REQUIRES], [${PC_REQUIRES}])
|
|||||||
AC_SUBST([PC_CFLAGS], [${PC_CFLAGS}])
|
AC_SUBST([PC_CFLAGS], [${PC_CFLAGS}])
|
||||||
AC_SUBST([PC_LIBS], [${PC_LIBS}])
|
AC_SUBST([PC_LIBS], [${PC_LIBS}])
|
||||||
|
|
||||||
|
AC_SUBST(COVERAGE_CFLAGS)
|
||||||
|
AC_SUBST(COVERAGE_LDFLAGS)
|
||||||
|
AC_SUBST(COVERAGE_PRE)
|
||||||
|
AC_SUBST(COVERAGE_POST)
|
||||||
AC_SUBST(PARSER_CFLAGS)
|
AC_SUBST(PARSER_CFLAGS)
|
||||||
AC_SUBST(PARSER_LIBS)
|
AC_SUBST(PARSER_LIBS)
|
||||||
AC_SUBST(RESOLV_CFLAGS)
|
AC_SUBST(RESOLV_CFLAGS)
|
||||||
|
|||||||
Reference in New Issue
Block a user