From dc61c50b72d607d118b3ae01430c6ac805aa1701 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 21 Jul 2010 18:43:12 -0400
Subject: [PATCH] Preliminary support for coverage during live-test

While this doesn't work correctly yet (hpc sum seems to only take common
modules, not the sum of modules?), it prepares for gathering coverage
data during live-test (as an alternative to unittest coverage data).
---
 Makefile | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 189190528..e59d6dd8a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ all: $(HPROGS)
 $(HALLPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
 	$(GHC) --make $(HFLAGS) $(HEXTRA) $@
 
-test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
+test live-test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
 	-fno-warn-monomorphism-restriction -fno-warn-orphans \
 	-fno-warn-missing-methods -fno-warn-unused-imports
 
@@ -94,6 +94,18 @@ else
 	hpc report test $(HPCEXCL)
 endif
 
+live-test: all
+	rm -f *.tix *.mix
+	./live-test.sh
+	# combine the tix files
+	hpc sum $(HPCEXCL) $(addsuffix .tix,$(HPROGS)) --output=live-test.tix
+ifeq ($(T),markup)
+	mkdir -p coverage
+	hpc markup --destdir=coverage live-test $(HPCEXCL)
+else
+	hpc report live-test $(HPCEXCL)
+endif
+
 tags:
 	find -name '*.hs' | xargs hasktags -e
 
-- 
GitLab