Change in vdsm[master]: coverage: Add vdsm-coverage sub package

nsoffer at redhat.com nsoffer at redhat.com
Fri Dec 4 22:26:54 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: coverage: Add vdsm-coverage sub package
......................................................................

coverage: Add vdsm-coverage sub package

Add vdsm-coverage package installing support files for creating code
coverage reports.

See coverage/README.md for more info.

Change-Id: I95454731ca1c19e6f01417d2c26023e7c748365a
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M .gitignore
M Makefile.am
M build-aux/Makefile.subs
M configure.ac
A coverage/Makefile.am
A coverage/README.md
A coverage/coverage.conf.in
A coverage/vdsm.in
M lib/vdsm/config.py.in
M vdsm.spec.in
10 files changed, 103 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/49807/1

diff --git a/.gitignore b/.gitignore
index 720cd6e..bf3de78 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,8 @@
 config.log
 config.status
 configure
+coverage/coverage.conf
+coverage/vdsm
 doc/build
 init/systemd/supervdsmd.service
 init/systemd/systemd-vdsmd
diff --git a/Makefile.am b/Makefile.am
index bce25f4..bd9d685 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,6 +21,7 @@
 SUBDIRS = \
 	client \
 	contrib \
+	coverage \
 	debian \
 	init \
 	lib \
diff --git a/build-aux/Makefile.subs b/build-aux/Makefile.subs
index 34cafc7..6e14be6 100644
--- a/build-aux/Makefile.subs
+++ b/build-aux/Makefile.subs
@@ -34,6 +34,7 @@
 	-e "s,[@]VDSMLOGDIR[@],$(vdsmlogdir),g" \
 	-e "s,[@]VDSMREPO[@],$(vdsmrepo),g" \
 	-e "s,[@]VDSMRUNDIR[@],$(vdsmrundir),g" \
+	-e "s,[@]VDSMCONFDIR[@],$(vdsmconfdir),g" \
 	-e "s,[@]VDSMUPGRADEDIR[@],$(vdsmupgradedir),g"
 
 CONFIGSUBST = $(top_builddir)/config.status --file=-
diff --git a/configure.ac b/configure.ac
index d10577b..95bc897 100644
--- a/configure.ac
+++ b/configure.ac
@@ -334,6 +334,7 @@
 	Makefile
 	client/Makefile
 	contrib/Makefile
+	coverage/Makefile
 	debian/Makefile
 	init/Makefile
 	init/systemd/Makefile
diff --git a/coverage/Makefile.am b/coverage/Makefile.am
new file mode 100644
index 0000000..2fc3710
--- /dev/null
+++ b/coverage/Makefile.am
@@ -0,0 +1,46 @@
+#
+# Copyright 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+include $(top_srcdir)/build-aux/Makefile.subs
+
+nodist_noinst_DATA = \
+	coverage.conf \
+	vdsm \
+	$(NULL)
+
+EXTRA_DIST = \
+	coverage.conf.in \
+	vdsm.in \
+	README.md \
+	$(NULL)
+
+all-local: \
+	$(nodist_noinst_DATA) \
+	$(NULL)
+
+install-data-local:
+	$(MKDIR_P) $(DESTDIR)$(vdsmconfdir)
+	$(INSTALL_DATA) coverage.conf $(DESTDIR)$(vdsmconfdir)/coverage.conf
+	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
+	$(INSTALL_DATA) vdsm $(DESTDIR)$(sysconfdir)/sysconfig/vdsm
+
+uninstall-local:
+	$(RM) $(DESTDIR)$(vdsmconfdir)/coverage.conf
+	$(RM) $(DESTDIR)$(sysconfdir)/sysconfig/vdsm
diff --git a/coverage/README.md b/coverage/README.md
new file mode 100644
index 0000000..efd86d5
--- /dev/null
+++ b/coverage/README.md
@@ -0,0 +1,31 @@
+# Vdsm coverage
+
+This package contains support files for creating code coverage report.
+
+## Files
+
+- /etc/vdsm/coverage.conf - coverage configuration file
+- /etc/sysconfig/vdsm - environment file for enabling coverage
+
+## Recording code coverage
+
+2. Enable coverage in vdsm.conf
+
+   [devel]
+   coverage_enable = true
+
+3. Start vdsm
+4. Run functional tests, or perform some flows manually
+5. Stop vdsm
+
+Coverage data file is stored in /var/run/vdsm/vdsm.coverage.
+
+## Creating html report
+
+Run this to create html report in htmlcov directory:
+
+    COVERAGE_FILE=/var/run/vdsm/vdsm.coverage coverage html
+
+To open the report in the your preferred browser:
+
+    xdg-open htmlcov/index.html
diff --git a/coverage/coverage.conf.in b/coverage/coverage.conf.in
new file mode 100644
index 0000000..362f773
--- /dev/null
+++ b/coverage/coverage.conf.in
@@ -0,0 +1,5 @@
+[run]
+data_file = @VDSMRUNDIR@/vdsm.coverage
+source =
+    @VDSMDIR@
+    vdsm
diff --git a/coverage/vdsm.in b/coverage/vdsm.in
new file mode 100644
index 0000000..6ff3695
--- /dev/null
+++ b/coverage/vdsm.in
@@ -0,0 +1 @@
+COVERAGE_PROCESS_START=@VDSMCONFDIR@/coverage.conf
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 73bcb2b..6b5afa4 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -415,9 +415,9 @@
             'Enable manhole debugging service (requires manhole package).'),
 
         ('coverage_enable', 'false',
-            'Enable code coverage (requires python-coverage package). '
-            'false by default. Use environment file /etc/sysconfig/vdsm to '
-            'set COVERAGE_PROCESS_START and COVERAGE_FILE variables.'),
+            'Enable code coverage (false by default). To configure '
+            'coverage, edit @VDSMCONFDIR@/coverage.conf (requires '
+            'vdsm-coverage package).'),
 
     ]),
 
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 183b221..ecbe4fc 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -628,6 +628,13 @@
 Gluster plugin enables VDSM to serve Gluster functionalities.
 %endif
 
+%package coverage
+Summary: Support files for generating coverage report
+Requires: python-coverage
+
+%description coverage
+Configuration files for generating coverage report
+
 %prep
 %setup -q
 
@@ -1491,6 +1498,11 @@
 %{_datadir}/%{vdsm_name}/gluster/tasks.py*
 %endif
 
+%files coverage
+%defattr(-, root, root, -)
+%config(noreplace) %{_sysconfdir}/%{vdsm_name}/coverage.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/vdsm
+
 %changelog
 * Sun Oct 13 2013 Yaniv Bronhaim <ybronhei at redhat.com> - 4.13.0
 - Removing vdsm-python-cpopen from the spec


-- 
To view, visit https://gerrit.ovirt.org/49807
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95454731ca1c19e6f01417d2c26023e7c748365a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list