anchor.diff:  init_per_testcase(_TestCase, Config) ->
       Config.
   
  -end_per_testcase(TestCase, _Config) ->
  -    case lists:member(TestCase,[start,compile,analyse,misc]) of
  +end_per_testcase(TestCase, Config) ->
  +    NoStop = [start,compile,analyse,misc],
  +    DontStop = proplists:get_bool(ct_is_running_cover, Config) orelse
  +	lists:member(TestCase, NoStop),
  +    case DontStop of
   	true -> ok;
   	false -> cover:stop()
       end,
  +    ok.
  +
  +coverage(Config) when is_list(Config) ->
  +    {ok,?MODULE} = cover:compile_beam(?MODULE),
  +    ?MODULE:do_coverage(Config).
  +
  +do_coverage(Config) ->
  +    Outdir = ?config(priv_dir, Config),
  +    ExportFile = filename:join(Outdir, "export"),
  +    ok = cover:export(ExportFile, ?MODULE),
  +    {error,{already_started,_}} = cover:start(),
  +    {error,_} = cover:compile_beam(non_existing_module),
  +    _ = cover:which_nodes(),
  +    _ = cover:modules(),
  +    _ = cover:imported(),
  +    {error,{not_cover_compiled,lists}} = cover:analyze(lists),
  +
  +    %% Cover escaping of '&' in HTML files.
  +
  +    case proplists:get_bool(ct_is_running_cover, Config) of
  +	false ->
  +	    %% Cover server was implicitly started when this module
  +	    %% was cover-compiled. We must stop the cover server, but
  +	    %% we must ensure that this module is not on the call
  +	    %% stack when it is unloaded. Therefore, the call that
  +	    %% follows MUST be tail-recursive.
  +	    cover:stop();
  +	true ->
  +	    %% Cover server was started by common_test; don't stop it.
  +	    ok
  +    end.
  +
  +%% This test case will only be run when common_test is running cover.
  +coverage_analysis(Config) when is_list(Config) ->
  +    {ok,Analysis1} = cover:analyze(?MODULE),
  +    io:format("~p\n", [Analysis1]),
  +    {ok,Analysis2} = cover:analyze(?MODULE, calls),
  +    io:format("~p\n", [Analysis2]),
  +    {ok,_Analysis3} = cover:analyze(?MODULE, calls, line),
  +
  +    Outdir = ?config(priv_dir, Config),
  +    Outfile = filename:join(Outdir, ?MODULE),
  +
  +    {ok,Outfile} = cover:analyze_to_file(?MODULE, Outfile),
  +    {ok,Contents} = file:read_file(Outfile),
  +    ok = file:delete(Outfile),
  +    ok = io:put_chars(Contents),
  +    {ok,Outfile} = cover:analyze_to_file(?MODULE, Outfile, [html]),
       ok.
   
   start(suite) -> [];
  
positive.code:              ">>,
      ?line File = cc_mod(t, Test, Config),
      ?line ok = t:t(),
      ?line cover:stop(),
      ?line ok = file:delete(File),
  
      ok.
  
negative.code:     ?line File = cc_mod(t, Test, Config),
      ?line false = t:test(nok),
      ?line {ok,[{{t,11},1},{{t,12},1}]} = cover:analyse(t, calls, line),
      ?line ok = file:delete(File),
  
      %% Bit string comprehensions are now traversed;
  