From 6423c1c0570336c85540d8db1126831d319251bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 10 Nov 2022 12:36:40 +0100 Subject: Fix code coverage for ct-* targets Thanks to David Ansari for the report. --- test/plugin_cover.mk | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/plugin_cover.mk b/test/plugin_cover.mk index a1d7e51..91b1b2c 100644 --- a/test/plugin_cover.mk +++ b/test/plugin_cover.mk @@ -150,6 +150,33 @@ endif $t test -f $(APP)/logs/ct_run.*/cow_http_hd.COVER.html $t ! test -e $(APP)/logs/ct_run.*/ranch_app.COVER.html +cover-ct-single-suite: init + + $i "Bootstrap a new OTP application named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v + + $i "Generate a Common Test suite" + $t mkdir $(APP)/test + $t printf "%s\n" \ + "-module($(APP)_SUITE)." \ + "-export([all/0, ok/1])." \ + "all() -> [ok]." \ + "ok(_) -> application:start($(APP))." > $(APP)/test/$(APP)_SUITE.erl + + $i "Run Common Test against this specific test suite with code coverage enabled" + $t $(MAKE) -C $(APP) ct-$(APP) COVER=1 $v + + $i "Check that the generated files exist" + $t test -f $(APP)/cover/ct.coverdata + $t test -f $(APP)/test/ct.cover.spec + + $i "Check that the generated files are removed on clean" + $t $(MAKE) -C $(APP) clean $v + $t test ! -e $(APP)/cover/ct.coverdata + $t test ! -e $(APP)/test/ct.cover.spec + cover-custom-dir: init $i "Bootstrap a new OTP application named $(APP)" -- cgit v1.2.3