Commit 25cdf177 authored by Iustin Pop's avatar Iustin Pop
Browse files

Build a coverage-enabled version of the tools



This allows the offline tests to also generate coverage data, and the
hs-coverage target is changed to show both unit-test and offline-tests
coverage.

The downside is that now we build yet-another-binary, which makes the
unit-test time slower…
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 04d15e63
...@@ -102,11 +102,13 @@ ...@@ -102,11 +102,13 @@
/htools/htools /htools/htools
/htools/hconfd /htools/hconfd
/htools/htools-hpc
/htools/test /htools/test
/htools/*.prof* /htools/*.prof*
/htools/*.stat /htools/*.stat
/htools/*.tix /htools/*.tix
/.hpc/ /.hpc/
/*.tix
/htools/Ganeti/HTools/Version.hs /htools/Ganeti/HTools/Version.hs
/htools/Ganeti/Constants.hs /htools/Ganeti/Constants.hs
...@@ -354,7 +354,7 @@ docrst = \ ...@@ -354,7 +354,7 @@ docrst = \
HS_PROGS = htools/htools htools/hconfd HS_PROGS = htools/htools htools/hconfd
HS_BIN_ROLES = hbal hscan hspace hinfo HS_BIN_ROLES = hbal hscan hspace hinfo
HS_ALL_PROGS = $(HS_PROGS) htools/test HS_ALL_PROGS = $(HS_PROGS) htools/test htools/htools-hpc
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS)) HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
# we don't add -Werror by default # we don't add -Werror by default
HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
...@@ -538,8 +538,11 @@ htools/test: HEXTRA_INT=-fhpc -Wwarn -fno-warn-missing-signatures \ ...@@ -538,8 +538,11 @@ htools/test: HEXTRA_INT=-fhpc -Wwarn -fno-warn-missing-signatures \
-fno-warn-monomorphism-restriction -fno-warn-orphans \ -fno-warn-monomorphism-restriction -fno-warn-orphans \
-fno-warn-missing-methods -fno-warn-unused-imports -fno-warn-missing-methods -fno-warn-unused-imports
# we compile the htools-hpc binary with the program coverage
htools/htools-hpc: HEXTRA_INT=-fhpc
# test dependency # test dependency
htools/offline-tests.sh: htools/htools htools/offline-tests.sh: htools/htools-hpc
# rules for building profiling-enabled versions of the haskell # rules for building profiling-enabled versions of the haskell
# programs: hs-prof does the full two-step build, whereas # programs: hs-prof does the full two-step build, whereas
...@@ -1217,10 +1220,10 @@ check-local: check-dirs $(BUILT_SOURCES) ...@@ -1217,10 +1220,10 @@ check-local: check-dirs $(BUILT_SOURCES)
done done
.PHONY: hs-check .PHONY: hs-check
hs-check: htools/test htools/htools hs-check: htools/test htools/htools-hpc
@rm -f test.tix @rm -f test.tix
./htools/test ./htools/test
HBINARY="./htools/htools" ./htools/offline-test.sh HBINARY="./htools/htools-hpc" ./htools/offline-test.sh
# E111: indentation is not a multiple of four # E111: indentation is not a multiple of four
# E261: at least two spaces before inline comment # E261: at least two spaces before inline comment
...@@ -1385,11 +1388,12 @@ py-coverage: $(BUILT_SOURCES) $(python_tests) ...@@ -1385,11 +1388,12 @@ py-coverage: $(BUILT_SOURCES) $(python_tests)
$(python_tests) $(python_tests)
.PHONY: hs-coverage .PHONY: hs-coverage
hs-coverage: $(haskell_tests) hs-coverage: $(haskell_tests) htools/htools-hpc
cd htools && rm -f *.tix *.mix && ./test rm -f *.tix && $(MAKE) hs-check
@mkdir_p@ $(COVERAGE_HS_DIR) @mkdir_p@ $(COVERAGE_HS_DIR)
hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL) hpc combine $(HPCEXCL) test.tix htools-hpc.tix > htools-coverage.tix
hpc report htools/test $(HPCEXCL) hpc markup --destdir=$(COVERAGE_HS_DIR) htools-coverage.tix
hpc report htools-coverage.tix
$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
# Special "kind-of-QA" target for htools, needs special setup (all # Special "kind-of-QA" target for htools, needs special setup (all
......
...@@ -12,7 +12,7 @@ cp -r autotools daemons scripts lib tools test $tmpdir ...@@ -12,7 +12,7 @@ cp -r autotools daemons scripts lib tools test $tmpdir
mv $tmpdir/lib $tmpdir/ganeti mv $tmpdir/lib $tmpdir/ganeti
ln -T -s $tmpdir/ganeti $tmpdir/lib ln -T -s $tmpdir/ganeti $tmpdir/lib
mkdir -p $tmpdir/htools mkdir -p $tmpdir/htools
for htest in htools test offline-test.sh cli-tests-defs.sh; do for htest in htools htools-hpc test offline-test.sh cli-tests-defs.sh; do
if [ -e htools/$htest ]; then if [ -e htools/$htest ]; then
cp -p htools/$htest $tmpdir/htools/ cp -p htools/$htest $tmpdir/htools/
fi fi
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# This is an shell testing configuration fragment. # This is an shell testing configuration fragment.
HBINARY=${HBINARY:-./htools/htools} HBINARY=${HBINARY:-./htools/htools-hpc}
hbal() { hbal() {
HTOOLS=hbal $HBINARY "$@" HTOOLS=hbal $HBINARY "$@"
......
htools.hs
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment