libxml2 r3780 - trunk
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml2 r3780 - trunk
- Date: Wed, 27 Aug 2008 15:33:28 +0000 (UTC)
Author: veillard
Date: Wed Aug 27 15:33:28 2008
New Revision: 3780
URL: http://svn.gnome.org/viewvc/libxml2?rev=3780&view=rev
Log:
* configure.in Makefile.am: add an --with-coverage configure option
and a 'make cov' target based on gcc profiling and the lcov
tool. Currently at 68.9% coverage out of 'make check' and
runsuite executions.
* xmlreader.c: remove warnings due to C++ comments
Daniel
Modified:
trunk/ChangeLog
trunk/Makefile.am
trunk/configure.in
trunk/xmlreader.c
Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Wed Aug 27 15:33:28 2008
@@ -1129,6 +1129,7 @@
cleanup:
-@(find . -name .\#\* -exec rm {} \;)
+ -@(find . -name \*.gcda -o *.gcno -exec rm {} \;)
-@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm {} \;)
dist-hook: cleanup libxml2.spec
@@ -1164,7 +1165,7 @@
< $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
&& mv xml2Conf.tmp xml2Conf.sh
-CLEANFILES=xml2Conf.sh
+CLEANFILES=xml2Conf.sh *.gcda *.gcno
confexecdir=$(libdir)
confexec_DATA = xml2Conf.sh
@@ -1216,3 +1217,28 @@
sparse: clean
$(MAKE) CC=cgcc
+
+#
+# Coverage support, largely borrowed from libvirt
+# Both binaries comes from the lcov package in Fedora
+#
+LCOV = /usr/bin/lcov
+GENHTML = /usr/bin/genhtml
+
+cov: clean-cov
+ if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \
+ echo not configured with coverage; exit 1 ; fi
+ if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
+ echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
+ -@($(MAKE) check)
+ -@(./runsuite$(EXEEXT))
+ mkdir $(top_builddir)/coverage
+ $(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir)
+ $(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr*
+ rm $(top_builddir)/coverage/libxml2.info.tmp
+ $(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info
+ echo "Coverage report is in $(top_builddir)/coverage/index.html"
+
+clean-cov:
+ rm -rf $(top_builddir)/coverage
+
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed Aug 27 15:33:28 2008
@@ -163,6 +163,8 @@
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
])
+AC_ARG_WITH(coverage,
+[ --with-coverage build for code coverage with GCC (off)])
dnl
dnl hard dependancies on options
@@ -1371,8 +1373,18 @@
AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
+if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
+then
+ echo Enabling code coverage for GCC
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
+else
+ echo Disabling code coverage for GCC
+fi
+
AC_SUBST(CPPFLAGS)
AC_SUBST(CFLAGS)
+AC_SUBST(LDFLAGS)
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBDIR)
Modified: trunk/xmlreader.c
==============================================================================
--- trunk/xmlreader.c (original)
+++ trunk/xmlreader.c Wed Aug 27 15:33:28 2008
@@ -1847,22 +1847,22 @@
}
if (reader->state != XML_TEXTREADER_BACKTRACK) {
- /* Here removed traversal to child, because we want to skip the subtree,
+ /* Here removed traversal to child, because we want to skip the subtree,
replace with traversal to sibling to skip subtree */
if (reader->node->next != 0) {
- reader->node = reader->node->next;// Move to sibling if present,skipping sub-tree
- //reader->depth++;
+ /* Move to sibling if present,skipping sub-tree */
+ reader->node = reader->node->next;
reader->state = XML_TEXTREADER_START;
return(1);
}
-
- /* if reader->node->next is NULL mean no subtree for current node,
+
+ /* if reader->node->next is NULL mean no subtree for current node,
so need to move to sibling of parent node if present */
if ((reader->node->type == XML_ELEMENT_NODE) ||
(reader->node->type == XML_ATTRIBUTE_NODE)) {
reader->state = XML_TEXTREADER_BACKTRACK;
- xmlTextReaderRead(reader);// This will move to parent if present
- //return(xmlTextReaderReadTree(reader));
+ /* This will move to parent if present */
+ xmlTextReaderRead(reader);
}
}
@@ -1881,8 +1881,8 @@
reader->node = reader->node->parent;
reader->depth--;
reader->state = XML_TEXTREADER_BACKTRACK;
- xmlTextReaderNextTree(reader); //Repeat process to move to sibling of parent node if present
- //return(1);
+ /* Repeat process to move to sibling of parent node if present */
+ xmlTextReaderNextTree(reader);
}
reader->state = XML_TEXTREADER_END;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]