Merge pull request #230 from hyperthunk/ct-name

Support ct_run using short name
This commit is contained in:
Dave Smith 2012-06-08 07:11:00 -07:00
commit 9ec6f37444
2 changed files with 13 additions and 4 deletions

View file

@ -85,6 +85,9 @@
%% Option to pass extra parameters when launching Common Test %% Option to pass extra parameters when launching Common Test
{ct_extra_params, "-boot start_sasl -s myapp"}. {ct_extra_params, "-boot start_sasl -s myapp"}.
%% Option to use short names (i.e., -sname test) when starting ct
{ct_use_short_names, true}.
%% == Cleanup == %% == Cleanup ==
%% Which files to cleanup %% Which files to cleanup

View file

@ -145,14 +145,14 @@ make_cmd(TestDir, Config) ->
undefined -> undefined ->
?FMT("erl " % should we expand ERL_PATH? ?FMT("erl " % should we expand ERL_PATH?
" -noshell -pa ~s ~s" " -noshell -pa ~s ~s"
" -name test@~s" " ~s"
" -logdir \"~s\"" " -logdir \"~s\""
" -env TEST_DIR \"~s\"" " -env TEST_DIR \"~s\""
" ~s" " ~s"
" -s ct_run script_start -s erlang halt", " -s ct_run script_start -s erlang halt",
[CodePathString, [CodePathString,
Include, Include,
net_adm:localhost(), build_name(Config),
LogDir, LogDir,
filename:join(Cwd, TestDir), filename:join(Cwd, TestDir),
get_extra_params(Config)]) ++ get_extra_params(Config)]) ++
@ -164,14 +164,14 @@ make_cmd(TestDir, Config) ->
SpecFlags -> SpecFlags ->
?FMT("erl " % should we expand ERL_PATH? ?FMT("erl " % should we expand ERL_PATH?
" -noshell -pa ~s ~s" " -noshell -pa ~s ~s"
" -name test@~s" " ~s"
" -logdir \"~s\"" " -logdir \"~s\""
" -env TEST_DIR \"~s\"" " -env TEST_DIR \"~s\""
" ~s" " ~s"
" -s ct_run script_start -s erlang halt", " -s ct_run script_start -s erlang halt",
[CodePathString, [CodePathString,
Include, Include,
net_adm:localhost(), build_name(Config),
LogDir, LogDir,
filename:join(Cwd, TestDir), filename:join(Cwd, TestDir),
get_extra_params(Config)]) ++ get_extra_params(Config)]) ++
@ -180,6 +180,12 @@ make_cmd(TestDir, Config) ->
RawLog = filename:join(LogDir, "raw.log"), RawLog = filename:join(LogDir, "raw.log"),
{Cmd, RawLog}. {Cmd, RawLog}.
build_name(Config) ->
case rebar_config:get_local(Config, ct_use_short_names, false) of
true -> "-sname test";
false -> " -name test@" ++ net_adm:localhost()
end.
get_extra_params(Config) -> get_extra_params(Config) ->
rebar_config:get_local(Config, ct_extra_params, ""). rebar_config:get_local(Config, ct_extra_params, "").