Revision b91e9518

b/.gitignore
53 53
# doc
54 54
/doc/api
55 55
/doc/build
56
/doc/coverage
56
/doc/py-coverage/
57
/doc/hs-coverage/
57 58
/doc/html
58 59
/doc/install-quick.rst
59 60
/doc/news.rst
......
105 106
/htools/*.prof*
106 107
/htools/*.stat
107 108
/htools/*.tix
109
/.hpc/
108 110

  
109 111
/htools/Ganeti/HTools/Version.hs
b/Makefile.am
75 75
BUILDTIME_DIR_AUTOCREATE = \
76 76
	scripts \
77 77
	doc/api \
78
	doc/coverage
78
	doc/py-coverage \
79
	doc/hs-coverage \
80
	.hpc
79 81

  
80 82
BUILDTIME_DIRS = \
81 83
	$(BUILDTIME_DIR_AUTOCREATE) \
......
122 124
	tools/kvm-ifup \
123 125
	stamp-srclinks \
124 126
	$(nodist_pkgpython_PYTHON) \
125
	$(HALLPROGS) $(HSRCS2)
127
	$(HALLPROGS) $(HSRCS2) \
128
	.hpc/*.mix htools/*.tix
126 129

  
127 130
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
128 131
# it'll cause the target to rebuild every time.
......
283 286
HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS))
284 287
# we don't add -Werror by default
285 288
HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
289
# extra flags that can be overriden on the command line
286 290
HEXTRA =
291
# exclude options for coverage reports
292
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
287 293

  
288 294
HSRCS = \
289 295
	htools/Ganeti/HTools/CLI.hs \
......
418 424
	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
419 425
	  $@
420 426

  
427
# for the htools/test binary, we need to enable profiling/coverage
428
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
429
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
430
	-fno-warn-missing-methods -fno-warn-unused-imports
431

  
421 432
dist_sbin_SCRIPTS = \
422 433
	tools/ganeti-listrunner
423 434

  
......
600 611
	test/docs_unittest.py \
601 612
	test/tempfile_fork_unittest.py
602 613

  
614
haskell_tests = htools/test
615

  
603 616
dist_TESTS = \
604 617
	test/check-cert-expired_unittest.bash \
605 618
	test/daemon-util_unittest.bash \
......
608 621
	$(python_tests)
609 622

  
610 623
nodist_TESTS =
624
if WANT_HTOOLS
625
nodist_TESTS += $(haskell_tests)
626
endif
611 627

  
612 628
TESTS = $(dist_TESTS) $(nodist_TESTS)
613 629

  
......
997 1013
	  etags -l python -
998 1014

  
999 1015
.PHONY: coverage
1000
coverage: $(BUILT_SOURCES) $(python_tests)
1016
if WANT_HTOOLS
1017
coverage: py-coverage hs-coverage
1018
else
1019
coverage: py-coverage
1020
endif
1021

  
1022
.PHONY: py-coverage
1023
py-coverage: $(BUILT_SOURCES) $(python_tests)
1001 1024
	set -e; \
1002
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
1003
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
1004
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
1025
	COVERAGE_FILE=$(CURDIR)/doc/py-coverage/data \
1026
	TEXT_COVERAGE=$(CURDIR)/doc/py-coverage/report.txt \
1027
	HTML_COVERAGE=$(CURDIR)/doc/py-coverage \
1005 1028
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1006 1029
	$(python_tests)
1007 1030

  
1031
.PHONY: hs-coverage
1032
hs-coverage: $(haskell_tests)
1033
	cd htools && rm -f *.tix *.mix && ./test
1034
	mkdir -p doc/hs-coverage
1035
	hpc markup --destdir=doc/hs-coverage htools/test $(HPCEXCL)
1036
	hpc report htools/test $(HPCEXCL)
1037

  
1038

  
1008 1039
commit-check: distcheck lint apidoc
1009 1040

  
1010 1041
-include ./Makefile.local
b/autotools/run-in-tempdir
1 1
#!/bin/bash
2 2

  
3
# Helper for running things in a temporary directory; used for docs
4
# building, unittests, etc.
5

  
3 6
set -e
4 7

  
5 8
tmpdir=$(mktemp -d -t gntbuild.XXXXXXXX)
......
7 10

  
8 11
cp -r autotools daemons scripts lib tools test $tmpdir
9 12
mv $tmpdir/lib $tmpdir/ganeti
13
mkdir -p $tmpdir/htools
14
if [ -e htools/test ]; then
15
  cp -p htools/test $tmpdir/htools/
16
fi
10 17

  
11 18
cd $tmpdir && GANETI_TEMP_DIR="$tmpdir" "$@"

Also available in: Unified diff