anchor.diff:  %% -------------------------------------------------------------------
   -module(rebar_ct).
   
  --export([test/2,
  -         int_test/2,
  -         perf_test/2]).
  -
  --compile([export_all]).
  +-export([ct/2]).
   
   -include("rebar.hrl").
   
  
positive.code: 
  get_suite(TestDir) ->
      case rebar_config:get_global(suite, undefined) of
  	undefined ->
  	    " -dir " ++ TestDir;
  	Suite ->
  	    Filename = filename:join(TestDir, Suite ++ "_SUITE.erl"),
  	    case filelib:is_regular(Filename) of
  		false ->
  		    ?ERROR("Suite ~s not found\n", [Suite]),
  		    ?FAIL;
  		true ->
  		    " -suite " ++ Filename
  	    end
      end.
  
  get_case() ->
      case rebar_config:get_global('case', undefined) of
  	undefined ->
  	    "";
  	Case ->
  	    " -case " ++ Case
      end.
  
negative.code: run_test_if_present(TestDir, Config, File) ->
      case filelib:is_dir(TestDir) of
          false ->
              ?WARN("~s directory not present - skipping\n", [TestDir]),
              ok;
          true ->
              run_test(TestDir, Config, File)
      end.
  
  run_test(TestDir, Config, _File) ->
      {Cmd, RawLog} = make_cmd(TestDir, Config),
      clear_log(RawLog),
      case rebar_config:get_global(verbose, "0") of
          "0" ->
              Output = " >> " ++ RawLog ++ " 2>&1";
          _ ->
              Output = " 2>&1 | tee -a " ++ RawLog
      end,
  
      case rebar_utils:sh(Cmd ++ Output, [{"TESTDIR", TestDir}]) of
          ok ->
              check_log(RawLog);
          {error, _Rc} ->
              show_log(RawLog),
              ?ERROR("Executing tests failed.\n", []),
              ?FAIL
      end.
  
  
  