anchor.diff:      end.
   
   make_cmd(TestDir, _Config) ->
  -    {ok, Cwd} = file:get_cwd(),
  +    Cwd = rebar_utils:get_cwd(),
       LogDir = filename:join(Cwd, "logs"),
  -    Ebin = filename:join(Cwd, "ebin"),
  +    EbinDir = filename:absname(filename:join(Cwd, "ebin")),
       IncludeDir = filename:join(Cwd, "include"),
       case filelib:is_dir(IncludeDir) of
  -	true ->
  -	    Include = " -I \"" ++ IncludeDir ++ "\"";
  -	false ->
  -	    Include = ""
  +        true ->
  +            Include = " -I \"" ++ IncludeDir ++ "\"";
  +        false ->
  +            Include = ""
       end,
   
  -    Cmd = lists:flatten(io_lib:format("erl " % should we expand ERL_PATH?
  -				      " -noshell -pa \"~s\" ~s"
  -				      " -s ct_run script_start -s erlang halt"
  -				      " -name test@~s"
  -				      " -logdir \"~s\""
  -				      " -env TEST_DIR \"~s\"",
  -				      [Ebin,
  -				       Include,
  -				       net_adm:localhost(),
  -				       LogDir,
  -				       filename:join(Cwd, TestDir)])) ++
  -	get_ct_config_file(TestDir) ++
  -	get_config_file(TestDir) ++
  -	get_suite(TestDir) ++
  -	get_case(),
  +    Cmd = ?FMT("erl " % should we expand ERL_PATH?
  +               " -noshell -pa \"~s\" ~s"
  +               " -s ct_run script_start -s erlang halt"
  +               " -name test@~s"
  +               " -logdir \"~s\""
  +               " -env TEST_DIR \"~s\"",
  +               [EbinDir,
  +                Include,
  +                net_adm:localhost(),
  +                LogDir,
  +                filename:join(Cwd, TestDir)]) ++
  +        get_ct_config_file(TestDir) ++
  +        get_config_file(TestDir) ++
  +        get_suite(TestDir) ++
  +        get_case(),
       RawLog = filename:join(LogDir, "raw.log"),
       {Cmd, RawLog}.
   
  
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: %% Public API
  %% ===================================================================
  
  ct(Config, File) ->
      run_test_if_present("test", Config, File).
  
  
  %% ===================================================================
  %% Internal functions
  