diff options
| author | Marek Majkowski <majek@lshift.net> | 2009-07-21 12:30:02 +0100 |
|---|---|---|
| committer | Marek Majkowski <majek@lshift.net> | 2009-07-21 12:30:02 +0100 |
| commit | 3744e9042d23445ca5742316efc32f1bd95cf5da (patch) | |
| tree | 0967f1c41efa1103710c6bc3f894f6b75128b55b | |
| parent | 98d1423b60938225c7e0797a5b191928193bfa82 (diff) | |
| download | rabbitmq-server-git-3744e9042d23445ca5742316efc32f1bd95cf5da.tar.gz | |
code coverage is a bit more generic now, removed reference to hardcoded ebin directory
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | src/rabbit_misc.erl | 13 |
2 files changed, 11 insertions, 6 deletions
@@ -115,8 +115,10 @@ force-snapshot: all stop-node: -$(ERL_CALL) -q +COVER_DIR=$(EBIN_DIR) + start-cover: all - echo "cover:start(), rabbit_misc:enable_cover()." | $(ERL_CALL) + echo "cover:start(), rabbit_misc:enable_cover([\"$(COVER_DIR)\"])." | $(ERL_CALL) stop-cover: all echo "rabbit_misc:report_cover(), cover:stop()." | $(ERL_CALL) diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 72e16f0fc0..58c8f0d33d 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -40,7 +40,7 @@ -export([get_config/1, get_config/2, set_config/2]). -export([dirty_read/1]). -export([r/3, r/2, r_arg/4, rs/1]). --export([enable_cover/0, report_cover/0]). +-export([enable_cover/1, report_cover/0]). -export([throw_on_error/2, with_exit_handler/2, filter_exit_map/2]). -export([with_user/2, with_vhost/2, with_user_and_vhost/3]). -export([execute_mnesia_transaction/1]). @@ -87,7 +87,7 @@ -spec(r_arg/4 :: (vhost() | r(atom()), K, amqp_table(), binary()) -> undefined | r(K) when is_subtype(K, atom())). -spec(rs/1 :: (r(atom())) -> string()). --spec(enable_cover/0 :: () -> 'ok' | {'error', any()}). +-spec(enable_cover/1 :: () -> 'ok' | {'error', any()}). -spec(report_cover/0 :: () -> 'ok'). -spec(throw_on_error/2 :: (atom(), thunk({error, any()} | {ok, A} | A)) -> A). @@ -187,9 +187,12 @@ rs(#resource{virtual_host = VHostPath, kind = Kind, name = Name}) -> lists:flatten(io_lib:format("~s '~s' in vhost '~s'", [Kind, Name, VHostPath])). -enable_cover() -> - case cover:compile_beam_directory("ebin") of - {error,Reason} -> {error,Reason}; + + +enable_cover(Dirs) -> + Results = lists:map(fun cover:compile_beam_directory/1, Dirs), + case lists:filter(fun(X) -> X /= [] end, Results) of + [{error, Reason} | _] -> {error, Reason}; _ -> ok end. |
