Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix not_cover_compiled error by analyzing coverage only for cover compiled modules #312

Closed
wants to merge 2 commits into from

3 participants

@shino
Collaborator

see #310

@tuncer tuncer was assigned
@ostinelli

thank you for this.

r.

@tuncer

Thanks, merged.

@tuncer tuncer closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 13, 2012
  1. @shino

    Analyze coverage only for cover compiled modules

    shino authored
    This change fixes not_cover_compiled bug.
  2. @shino
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 18 deletions.
  1. +3 −1 src/rebar_eunit.erl
  2. +27 −17 test/rebar_eunit_tests.erl
View
4 src/rebar_eunit.erl
@@ -397,7 +397,9 @@ cover_analyze(_Config, [], _SrcModules) ->
ok;
cover_analyze(Config, FilteredModules, SrcModules) ->
%% Generate coverage info for all the cover-compiled modules
- Coverage = lists:flatten([cover_analyze_mod(M) || M <- FilteredModules]),
+ Coverage = lists:flatten([cover_analyze_mod(M)
+ || M <- FilteredModules,
+ cover:is_compiled(M) =/= false]),
%% Write index of coverage info
cover_write_index(lists:sort(Coverage), SrcModules),
View
44 test/rebar_eunit_tests.erl
@@ -198,13 +198,18 @@ cover_test_() ->
setup, fun() -> setup_cover_project(), rebar("-v eunit") end,
fun teardown/1,
- [{"All cover reports are generated",
- assert_files_in("the temporary eunit directory",
- expected_cover_generated_files())},
+ fun(RebarOut) ->
+ [{"Error messages are not present",
+ ?_assert(string:str(RebarOut, "Cover analyze failed for") =:= 0)},
+
+ {"All cover reports are generated",
+ assert_files_in("the temporary eunit directory",
+ expected_cover_generated_files())},
- {"Only production modules get coverage reports",
- assert_files_not_in("the temporary eunit directory",
- [".eunit/myapp_mymod_tests.COVER.html"])}]}.
+ {"Only production modules get coverage reports",
+ assert_files_not_in("the temporary eunit directory",
+ [".eunit/myapp_mymod_tests.COVER.html"])}]
+ end}.
cover_with_suite_test_() ->
{"Ensure Cover runs with Tests in a test dir and a test suite",
@@ -215,17 +220,22 @@ cover_with_suite_test_() ->
end,
fun teardown/1,
- [{"Cover reports are generated for module",
- assert_files_in("the temporary eunit directory",
- [".eunit/index.html",
- ".eunit/mysuite.COVER.html"])},
-
- {"Only production modules get coverage reports",
- assert_files_not_in("the temporary eunit directory",
- [".eunit/myapp_app.COVER.html",
- ".eunit/myapp_mymod.COVER.html",
- ".eunit/myapp_sup.COVER.html",
- ".eunit/myapp_mymod_tests.COVER.html"])}]}.
+ fun(RebarOut) ->
+ [{"Error messages are not present",
+ ?_assert(string:str(RebarOut, "Cover analyze failed for") =:= 0)},
+
+ {"Cover reports are generated for module",
+ assert_files_in("the temporary eunit directory",
+ [".eunit/index.html",
+ ".eunit/mysuite.COVER.html"])},
+
+ {"Only production modules get coverage reports",
+ assert_files_not_in("the temporary eunit directory",
+ [".eunit/myapp_app.COVER.html",
+ ".eunit/myapp_mymod.COVER.html",
+ ".eunit/myapp_sup.COVER.html",
+ ".eunit/myapp_mymod_tests.COVER.html"])}]
+ end}.
expected_cover_generated_files() ->
[".eunit/index.html",
Something went wrong with that request. Please try again.