浏览代码

Pass extra params to ct (thanks Mickael Remond)

This patch adds a `ct_extra_params` option to rebar.config, the value
of which is appended to the shell command when executing common test.
pull/3/head
Tim Watson 14 年前
提交者 Tuncer Ayaz
父节点
当前提交
2d385970bf
共有 2 个文件被更改,包括 18 次插入6 次删除
  1. +5
    -0
      rebar.config.sample
  2. +13
    -6
      src/rebar_ct.erl

+ 5
- 0
rebar.config.sample 查看文件

@ -75,6 +75,11 @@
%% Whether to print coverage report to console. Default is `false' %% Whether to print coverage report to console. Default is `false'
{cover_print_enabled, false}. {cover_print_enabled, false}.
%% == Common Test ==
%% Option to pass extra parameters when launching Common Test
{ct_extra_params, "-boot start_sasl -s myapp"}.
%% == Dialyzer == %% == Dialyzer ==
%% Options for running dialyzer %% Options for running dialyzer

+ 13
- 6
src/rebar_ct.erl 查看文件

@ -145,15 +145,17 @@ 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"
" -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\""
" ~s"
" -s ct_run script_start -s erlang halt",
[CodePathString, [CodePathString,
Include, Include,
net_adm:localhost(), net_adm:localhost(),
LogDir, LogDir,
filename:join(Cwd, TestDir)]) ++
filename:join(Cwd, TestDir),
get_extra_params(Config)]) ++
get_cover_config(Config, Cwd) ++ get_cover_config(Config, Cwd) ++
get_ct_config_file(TestDir) ++ get_ct_config_file(TestDir) ++
get_config_file(TestDir) ++ get_config_file(TestDir) ++
@ -162,20 +164,25 @@ 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"
" -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\""
" ~s"
" -s ct_run script_start -s erlang halt",
[CodePathString, [CodePathString,
Include, Include,
net_adm:localhost(), net_adm:localhost(),
LogDir, LogDir,
filename:join(Cwd, TestDir)]) ++
filename:join(Cwd, TestDir),
get_extra_params(Config)]) ++
SpecFlags ++ get_cover_config(Config, Cwd) SpecFlags ++ get_cover_config(Config, Cwd)
end, end,
RawLog = filename:join(LogDir, "raw.log"), RawLog = filename:join(LogDir, "raw.log"),
{Cmd, RawLog}. {Cmd, RawLog}.
get_extra_params(Config) ->
rebar_config:get_local(Config, ct_extra_params, "").
get_ct_specs(Cwd) -> get_ct_specs(Cwd) ->
case collect_glob(Cwd, ".*\.test\.spec\$") of case collect_glob(Cwd, ".*\.test\.spec\$") of
[] -> undefined; [] -> undefined;

正在加载...
取消
保存