-From 4ca9e8ef1c20c99a8f17b863c72b908a6b85d0c7 Mon Sep 17 00:00:00 2001
+From 51320ad3cd08605d590436a1a53aadd0f2f8e4f9 Mon Sep 17 00:00:00 2001
 From: Luyao Huang <lhuang@redhat.com>
-Date: Fri, 4 Nov 2016 10:27:08 +0800
-Subject: [PATCH] Virtcov for v2.2.0~
+Date: Fri, 4 Nov 2016 11:02:40 +0800
+Subject: [PATCH] Virtcov for v0.10.0~
 
 Signed-off-by: Luyao Huang <lhuang@redhat.com>
 ---
  Makefile.am       |   2 +-
- libvirt.spec.in   |  15 +++-
- tools/Makefile.am |   7 +-
+ libvirt.spec.in   |  16 ++++-
+ tools/Makefile.am |   6 ++
  tools/virtcov.in  | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 229 insertions(+), 3 deletions(-)
+ 4 files changed, 230 insertions(+), 2 deletions(-)
  create mode 100644 tools/virtcov.in
 
 diff --git a/Makefile.am b/Makefile.am
-index 50c358c..00d546f 100644
+index 333e300..487523b 100644
 --- a/Makefile.am
 +++ b/Makefile.am
-@@ -66,7 +66,7 @@ $(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl \
- 	   > $@-t && mv $@-t $@ ; fi;
+@@ -50,7 +50,7 @@ $(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl $(top_srcdir)/docs/hackin
+ 	   > $@-t && mv $@-t $@ ; fi );
  
  rpm: clean
--	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
-+	@(unset CDPATH ; $(MAKE) dist && rpmbuild --define "_topdir /usr/coverage" -ta $(distdir).tar.xz)
+-	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
++	@(unset CDPATH ; $(MAKE) dist && rpmbuild --define "_topdir /usr/coverage" -ta $(distdir).tar.gz)
  
  check-local: all tests
  
 diff --git a/libvirt.spec.in b/libvirt.spec.in
-index 545990c..3f0c5ac 100644
+index 174053d..66499d4 100644
 --- a/libvirt.spec.in
 +++ b/libvirt.spec.in
-@@ -221,7 +221,7 @@
+@@ -319,7 +319,7 @@
  Summary: Library providing a simple virtualization API
  Name: libvirt
  Version: @VERSION@

+Requires: numactl-devel
+
 
 %description daemon
 Server side daemon required to manage the virtualization capabilities
@@ -1200,6 +1203,7 @@ rm -f po/stamp-po
            %{?arg_loader_nvram} \
            %{?enable_werror} \
            --enable-expensive-tests \
+           --enable-test-coverage \
            %{arg_init_script}
 make %{?_smp_mflags}
 gzip -9 ChangeLog
@@ -1285,6 +1289,11 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
    $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp
 %endif
 
+mkdir libvirt-docs/gcno
+rsync -avm --include='*.gcno' --include='*.c' --include='*.h' \
+    --include='*.generated.*' -f 'hide,! */' . libvirt-docs/gcno
+chmod a+rw -R libvirt-docs/gcno
+
 %clean
 rm -fr %{buildroot}
 
@@ -1342,6 +1351,9 @@ fi
 /sbin/chkconfig --add virtlogd
 /sbin/chkconfig --add virtlockd
 %endif
+if [ -d "/usr/coverage/BUILD/libvirt-%{version}" ]; then
+    mv -f /usr/coverage/BUILD/libvirt-%{version} /usr/coverage/BUILD/libvirt-%{version}-bk
+fi
 
 %preun daemon
 %if %{with_systemd}
@@ -1785,6 +1797,7 @@ exit 0
 %{_mandir}/man1/virt-host-validate.1*
 %{_bindir}/virsh
 %{_bindir}/virt-xml-validate
+%{_bindir}/virtcov
 %{_bindir}/virt-pki-validate
 %{_bindir}/virt-host-validate
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 319abb2..e52b1ac 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -64,6 +64,7 @@ EXTRA_DIST = \
 	libvirt-guests.sysconf				\
 	virt-login-shell.conf				\
 	virsh-edit.c					\
+	virtcov.in					\
 	$(PODFILES)					\
 	$(MANINFILES)					\
 	$(NULL)
@@ -76,7 +77,7 @@ MAINTAINERCLEANFILES =
 confdir = $(sysconfdir)/libvirt
 conf_DATA =
 
-bin_SCRIPTS = virt-xml-validate virt-pki-validate
+bin_SCRIPTS = virt-xml-validate virt-pki-validate virtcov
 bin_PROGRAMS = virsh virt-admin
 libexec_SCRIPTS = libvirt-guests.sh
 man1_MANS = \
@@ -107,6 +108,10 @@ virt-xml-validate: virt-xml-validate.in Makefile
 		       -e 's|[@]VERSION@|$(VERSION)|g' \
 	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
 
+virtcov: virtcov.in Makefile
+	$(AM_V_GEN)sed -e 's|[@]VERSION@|$(VERSION)|g' \
+		< $< > $@ || (rm $@ && exit 1) && chmod +x $@
+
 virt-pki-validate: virt-pki-validate.in Makefile
 	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
 		       -e 's|[@]VERSION@|$(VERSION)|g' \
diff --git a/tools/virtcov.in b/tools/virtcov.in
new file mode 100644
index 0000000..3b2818e
--- /dev/null
+++ b/tools/virtcov.in
@@ -0,0 +1,208 @@

+# <http://www.gnu.org/licenses/>.
+
+version="@VERSION@"
+COVPATH="/usr/share/doc/libvirt-devel-${version}/gcno/"
+WORKPATH="/usr/coverage/BUILD/libvirt-${version}/"
+COVERAGE_POOL="127.0.0.1:8000"
+
