Revision 27e336af

b/.gitignore
41 41
# doc
42 42
/doc/api
43 43
/doc/build
44
/doc/coverage
44 45
/doc/html
45 46
/doc/install-quick.rst
46 47
/doc/news.rst
b/Makefile.am
54 54
	doc/news.rst
55 55

  
56 56
maintainer-clean-local:
57
	rm -rf doc/api doc/html
57
	rm -rf doc/api doc/html doc/coverage
58 58

  
59 59
CLEANFILES = \
60 60
	autotools/replace_vars.sed \
......
245 245
	autotools/check-python-code \
246 246
	autotools/check-man \
247 247
	autotools/docbook-wrapper \
248
	autotools/gen-coverage \
248 249
	$(RUN_IN_TEMPDIR) \
249 250
	daemons/daemon-util.in \
250 251
	daemons/ganeti-cleaner.in \
......
340 341

  
341 342
TESTS = $(dist_TESTS) $(nodist_TESTS)
342 343

  
343
TESTS_ENVIRONMENT = \
344
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
345
	$(RUN_IN_TEMPDIR) $(PYTHON)
344
# Environment for all tests
345
PLAIN_TESTS_ENVIRONMENT = \
346
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
347

  
348
# Environment for tests run by automake
349
TESTS_ENVIRONMENT = $(PLAIN_TESTS_ENVIRONMENT) $(PYTHON)
346 350

  
347 351
all_python_code = \
348 352
	$(dist_sbin_SCRIPTS) \
......
535 539
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
536 540
	  etags -
537 541

  
542
.PHONY: coverage
543
coverage: $(BUILT_SOURCES) $(TESTS)
544
	set -e; \
545
	mkdir -p doc/coverage; \
546
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
547
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
548
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
549
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage $(TESTS)
550

  
538 551
# vim: set noet :
b/autotools/gen-coverage
1
#!/bin/bash
2
#
3

  
4
# Copyright (C) 2010 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

  
21
set -e
22

  
23
: ${COVERAGE:=coverage}
24
: ${PYTHON:=python}
25
: ${COVERAGE_FILE:?}
26
: ${TEXT_COVERAGE:?}
27

  
28
omit=$($PYTHON -c 'import sys;
29
print " ".join(["--omit=%s/" % i for i in
30
                set([sys.prefix, sys.exec_prefix])])')
31

  
32
$COVERAGE erase
33

  
34
for script; do
35
  $COVERAGE run --branch --append $script
36
done
37

  
38
echo "Writing text report to $TEXT_COVERAGE ..." >&2
39
$COVERAGE report $omit | tee "$TEXT_COVERAGE"
40

  
41
if [[ -n "$HTML_COVERAGE" ]]; then
42
  echo "Generating HTML report in $HTML_COVERAGE ..." >&2
43
  $COVERAGE html $omit -d "$HTML_COVERAGE"
44
fi
b/doc/devnotes.rst
15 15
  (tested with version 0.6.1)
16 16
- `graphviz <http://www.graphviz.org/>`_
17 17

  
18
To generate unittest coverage reports (``make coverage``), `coverage
19
<http://pypi.python.org/pypi/coverage>`_ needs to be installed.
20

  
18 21

  
19 22
Configuring for development
20 23
---------------------------

Also available in: Unified diff