Add rebar code path to common test code path

This commit is contained in:
Benjamin Nortier 2010-12-08 18:12:46 +00:00 committed by Tuncer Ayaz
parent 6e9cec31ef
commit ab4e0a32ab

View file

@ -130,13 +130,22 @@ make_cmd(TestDir, Config) ->
Include = "" Include = ""
end, end,
%% Add the code path of the rebar process to the code path. This
%% includes the dependencies in the code path. The directories
%% that are part of the root Erlang install are filtered out to
%% avoid duplication
R = code:root_dir(),
NonLibCodeDirs = [P || P <- code:get_path(), lists:prefix(R, P) == false],
CodeDirs = [io_lib:format("\"~s\"", [Dir]) ||
Dir <- [EbinDir|NonLibCodeDirs]],
CodePathString = string:join(CodeDirs, " "),
Cmd = ?FMT("erl " % should we expand ERL_PATH? Cmd = ?FMT("erl " % should we expand ERL_PATH?
" -noshell -pa \"~s\" ~s" " -noshell -pa ~s ~s"
" -s ct_run script_start -s erlang halt" " -s ct_run script_start -s erlang halt"
" -name test@~s" " -name test@~s"
" -logdir \"~s\"" " -logdir \"~s\""
" -env TEST_DIR \"~s\"", " -env TEST_DIR \"~s\"",
[EbinDir, [CodePathString,
Include, Include,
net_adm:localhost(), net_adm:localhost(),
LogDir, LogDir,