From e344a3027b7cd5d6510cda8c9d80527de11e24f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 14 May 2018 13:55:30 +0200 Subject: Don't run cover when there's no ebin files in the directory --- plugins/eunit.mk | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'plugins/eunit.mk') diff --git a/plugins/eunit.mk b/plugins/eunit.mk index af614f6..6ef0778 100644 --- a/plugins/eunit.mk +++ b/plugins/eunit.mk @@ -21,20 +21,25 @@ help:: # Plugin-specific targets. define eunit.erl - case "$(COVER)" of - "" -> ok; + Enabled = case "$(COVER)" of + "" -> false; _ -> - case cover:compile_beam_directory("ebin") of - {error, _} -> halt(1); - _ -> ok + case filelib:is_dir("ebin") of + false -> false; + true -> + case cover:compile_beam_directory("ebin") of + {error, _} -> halt(1); + _ -> true + end end end, case eunit:test($1, [$(EUNIT_OPTS)]) of ok -> ok; error -> halt(2) end, - case "$(COVER)" of - "" -> ok; + case {Enabled, "$(COVER)"} of + {false, _} -> ok; + {_, ""} -> ok; _ -> cover:export("$(COVER_DATA_DIR)/eunit.coverdata") end, -- cgit v1.2.3