  License: LGPLv2+
  Group: Development/Libraries
  BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-@@ -444,6 +444,9 @@ Requires: numad
+@@ -712,6 +712,9 @@ Requires: numad
  Requires: dbus
  # For uid creation during pre
  Requires(pre): shadow-utils

+Requires: numactl-devel
+
 
 # All build-time requirements
 %if 0%{?enable_autotools}
@@ -952,6 +955,7 @@ autoreconf -if
            %{?_with_firewalld} \
            %{with_packager} \
            %{with_packager_version} \
+           --enable-test-coverage \
            --with-qemu-user=%{qemu_user} \
            --with-qemu-group=%{qemu_group} \
            %{init_scripts}
@@ -1035,6 +1039,11 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc
 rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml
 %endif
 
+mkdir docs/gcno
+rsync -avm --include='*.gcno' --include='*.c' --include='*.h' \
+    --include='*.generated.*' -f 'hide,! */' . docs/gcno
+chmod a+rw -R docs/gcno
+
 %clean
 rm -fr %{buildroot}
 
@@ -1067,6 +1076,9 @@ if ! getent passwd qemu >/dev/null; then
 fi
 exit 0
 %endif
+if [ -d "/usr/coverage/BUILD/libvirt-%{version}" ]; then
+    mv -f /usr/coverage/BUILD/libvirt-%{version} /usr/coverage/BUILD/libvirt-%{version}-bk
+fi
 
 %post
 
@@ -1384,6 +1396,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 %{_mandir}/man1/virt-host-validate.1*
 %{_bindir}/virsh
 %{_bindir}/virt-xml-validate
+%{_bindir}/virtcov
 %{_bindir}/virt-pki-validate
 %{_bindir}/virt-host-validate
 %{_libdir}/lib*.so.*
@@ -1438,6 +1451,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 
 %doc docs/*.html docs/html docs/*.gif
 %doc docs/libvirt-api.xml
+%doc docs/gcno/*
 %doc examples/hellolibvirt
 %doc examples/domain-events/events-c
 %doc examples/dominfo
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 9391696..2e37236 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -92,6 +92,12 @@ virt_host_validate_SOURCES = \
 		virt-host-validate-lxc.c virt-host-validate-lxc.h \
 		$(NULL)
 
+EXTRA_DIST += virtcov.in
+bin_SCRIPTS += virtcov
+virtcov: virtcov.in Makefile
+	$(AM_V_GEN)sed -e 's|[@]VERSION@|$(VERSION)|g' \
+		< $< > $@ || (rm $@ && exit 1) && chmod +x $@
+
 virt_host_validate_LDFLAGS = \
 		$(AM_LDFLAGS) \
 		$(PIE_LDFLAGS) \
diff --git a/tools/virtcov.in b/tools/virtcov.in
new file mode 100644
index 0000000..099a58f
--- /dev/null
+++ b/tools/virtcov.in
@@ -0,0 +1,208 @@

 check-local: all tests
 
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 4dc801b..6998aea 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -363,7 +363,7 @@
 Summary: Library providing a simple virtualization API
 Name: libvirt
 Version: @VERSION@
