|
26 | 26 | -export([table_lookup/2, set_table_value/4, amqp_table/1, to_amqp_table/1]).
|
27 | 27 | -export([r/3, r/2, r_arg/4, rs/1,
|
28 | 28 | queue_resource/2, exchange_resource/2]).
|
29 |
| --export([enable_cover/0, report_cover/0]). |
30 |
| --export([enable_cover/1, report_cover/1]). |
31 |
| --export([start_cover/1]). |
32 | 29 | -export([throw_on_error/2, with_exit_handler/2, is_abnormal_exit/1,
|
33 | 30 | filter_exit_map/2]).
|
34 | 31 | -export([ensure_ok/2]).
|
|
165 | 162 | {invalid_type, rabbit_framing:amqp_field_type()}) |
|
166 | 163 | rabbit_types:r(K) when is_subtype(K, atom()).
|
167 | 164 | -spec rs(rabbit_types:r(atom())) -> string().
|
168 |
| --spec enable_cover() -> ok_or_error(). |
169 |
| --spec start_cover([{string(), string()} | string()]) -> 'ok'. |
170 |
| --spec report_cover() -> 'ok'. |
171 |
| --spec enable_cover([file:filename() | atom()]) -> ok_or_error(). |
172 |
| --spec report_cover([file:filename() | atom()]) -> 'ok'. |
173 | 165 | -spec throw_on_error
|
174 | 166 | (atom(), thunk(rabbit_types:error(any()) | {ok, A} | A)) -> A.
|
175 | 167 | -spec with_exit_handler(thunk(A), thunk(A)) -> A.
|
@@ -449,59 +441,6 @@ queue_resource(VHostPath, Name) ->
|
449 | 441 | exchange_resource(VHostPath, Name) ->
|
450 | 442 | r(VHostPath, exchange, Name).
|
451 | 443 |
|
452 |
| -enable_cover() -> enable_cover(["."]). |
453 |
| - |
454 |
| -enable_cover(Dirs) -> |
455 |
| - lists:foldl(fun (Dir, ok) -> |
456 |
| - case cover:compile_beam_directory( |
457 |
| - filename:join(lists:concat([Dir]),"ebin")) of |
458 |
| - {error, _} = Err -> Err; |
459 |
| - _ -> ok |
460 |
| - end; |
461 |
| - (_Dir, Err) -> |
462 |
| - Err |
463 |
| - end, ok, Dirs). |
464 |
| - |
465 |
| -start_cover(NodesS) -> |
466 |
| - {ok, _} = cover:start([rabbit_nodes_common:make(N) || N <- NodesS]), |
467 |
| - ok. |
468 |
| - |
469 |
| -report_cover() -> report_cover(["."]). |
470 |
| - |
471 |
| -report_cover(Dirs) -> [report_cover1(lists:concat([Dir])) || Dir <- Dirs], ok. |
472 |
| - |
473 |
| -report_cover1(Root) -> |
474 |
| - Dir = filename:join(Root, "cover"), |
475 |
| - ok = filelib:ensure_dir(filename:join(Dir, "junk")), |
476 |
| - lists:foreach(fun (F) -> file:delete(F) end, |
477 |
| - filelib:wildcard(filename:join(Dir, "*.html"))), |
478 |
| - {ok, SummaryFile} = file:open(filename:join(Dir, "summary.txt"), [write]), |
479 |
| - {CT, NCT} = |
480 |
| - lists:foldl( |
481 |
| - fun (M,{CovTot, NotCovTot}) -> |
482 |
| - {ok, {M, {Cov, NotCov}}} = cover:analyze(M, module), |
483 |
| - ok = report_coverage_percentage(SummaryFile, |
484 |
| - Cov, NotCov, M), |
485 |
| - {ok,_} = cover:analyze_to_file( |
486 |
| - M, |
487 |
| - filename:join(Dir, atom_to_list(M) ++ ".html"), |
488 |
| - [html]), |
489 |
| - {CovTot+Cov, NotCovTot+NotCov} |
490 |
| - end, |
491 |
| - {0, 0}, |
492 |
| - lists:sort(cover:modules())), |
493 |
| - ok = report_coverage_percentage(SummaryFile, CT, NCT, 'TOTAL'), |
494 |
| - ok = file:close(SummaryFile), |
495 |
| - ok. |
496 |
| - |
497 |
| -report_coverage_percentage(File, Cov, NotCov, Mod) -> |
498 |
| - io:fwrite(File, "~6.2f ~tp~n", |
499 |
| - [if |
500 |
| - Cov+NotCov > 0 -> 100.0*Cov/(Cov+NotCov); |
501 |
| - true -> 100.0 |
502 |
| - end, |
503 |
| - Mod]). |
504 |
| - |
505 | 444 | %% @doc Halts the emulator returning the given status code to the os.
|
506 | 445 | %% On Windows this function will block indefinitely so as to give the io
|
507 | 446 | %% subsystem time to flush stdout completely.
|
|
0 commit comments