mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fix bug 271
Moves ct_extra_params to the end of the generated ct_run command. This allows users to pass commands to the underlying emulator using -erl_args. The included rt test demonstrates that it is possible to pass an addtional option to ct_run and -erl_args at the same time. Finally, the test executes in regular and verbose modes because rebar constructs the ct_run command differently in verbose mode.
This commit is contained in:
parent
6e24cd6ac7
commit
35ee457176
6 changed files with 25 additions and 11 deletions
1
THANKS
1
THANKS
|
@ -120,3 +120,4 @@ Pedram Nimreezi
|
||||||
Sylvain Benner
|
Sylvain Benner
|
||||||
Oliver Ferrigni
|
Oliver Ferrigni
|
||||||
Dave Thomas
|
Dave Thomas
|
||||||
|
Drew Varner
|
||||||
|
|
2
inttest/ct1/app.config
Normal file
2
inttest/ct1/app.config
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
%% This file is an application config file, not a CT test config file
|
||||||
|
[{a1, [{foo, bar}]}].
|
|
@ -7,10 +7,12 @@ files() ->
|
||||||
[{create, "ebin/a1.app", app(a1)},
|
[{create, "ebin/a1.app", app(a1)},
|
||||||
{copy, "../../rebar", "rebar"},
|
{copy, "../../rebar", "rebar"},
|
||||||
{copy, "rebar.config", "rebar.config"},
|
{copy, "rebar.config", "rebar.config"},
|
||||||
|
{copy, "app.config", "app.config"},
|
||||||
{copy, "test_SUITE.erl", "itest/test_SUITE.erl"}].
|
{copy, "test_SUITE.erl", "itest/test_SUITE.erl"}].
|
||||||
|
|
||||||
run(_Dir) ->
|
run(_Dir) ->
|
||||||
{ok, _} = retest:sh("./rebar compile ct"),
|
{ok, _} = retest:sh("./rebar compile ct"),
|
||||||
|
{ok, _} = retest:sh("./rebar compile ct -v"),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
{ct_dir, "itest"}.
|
{ct_dir, "itest"}.
|
||||||
|
{ct_extra_params, "-repeat 2 -erl_args -config app"}.
|
||||||
|
|
|
@ -5,7 +5,13 @@
|
||||||
-include_lib("ct.hrl").
|
-include_lib("ct.hrl").
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
[simple_test].
|
[simple_test,
|
||||||
|
app_config_file_test].
|
||||||
|
|
||||||
simple_test(Config) ->
|
simple_test(Config) ->
|
||||||
io:format("Test: ~p\n", [Config]).
|
io:format("Test: ~p\n", [Config]).
|
||||||
|
|
||||||
|
app_config_file_test(_Config) ->
|
||||||
|
application:start(a1),
|
||||||
|
{ok, bar} = application:get_env(a1, foo),
|
||||||
|
application:stop(a1).
|
||||||
|
|
|
@ -217,15 +217,13 @@ make_cmd(TestDir, RawLogDir, Config) ->
|
||||||
" ~s"
|
" ~s"
|
||||||
" ~s"
|
" ~s"
|
||||||
" -logdir \"~s\""
|
" -logdir \"~s\""
|
||||||
" -env TEST_DIR \"~s\""
|
" -env TEST_DIR \"~s\"",
|
||||||
" ~s",
|
|
||||||
[BaseCmd,
|
[BaseCmd,
|
||||||
CodePathString,
|
CodePathString,
|
||||||
Include,
|
Include,
|
||||||
build_name(Config),
|
build_name(Config),
|
||||||
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) ++
|
||||||
|
@ -237,19 +235,18 @@ make_cmd(TestDir, RawLogDir, Config) ->
|
||||||
" ~s"
|
" ~s"
|
||||||
" ~s"
|
" ~s"
|
||||||
" -logdir \"~s\""
|
" -logdir \"~s\""
|
||||||
" -env TEST_DIR \"~s\""
|
" -env TEST_DIR \"~s\"",
|
||||||
" ~s",
|
|
||||||
[BaseCmd,
|
[BaseCmd,
|
||||||
CodePathString,
|
CodePathString,
|
||||||
Include,
|
Include,
|
||||||
build_name(Config),
|
build_name(Config),
|
||||||
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,
|
||||||
|
Cmd1 = Cmd ++ get_extra_params(Config),
|
||||||
RawLog = filename:join(LogDir, "raw.log"),
|
RawLog = filename:join(LogDir, "raw.log"),
|
||||||
{Cmd, RawLog}.
|
{Cmd1, RawLog}.
|
||||||
|
|
||||||
build_name(Config) ->
|
build_name(Config) ->
|
||||||
case rebar_config:get_local(Config, ct_use_short_names, false) of
|
case rebar_config:get_local(Config, ct_use_short_names, false) of
|
||||||
|
@ -258,7 +255,12 @@ build_name(Config) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_extra_params(Config) ->
|
get_extra_params(Config) ->
|
||||||
rebar_config:get_local(Config, ct_extra_params, "").
|
case rebar_config:get_local(Config, ct_extra_params, undefined) of
|
||||||
|
undefined ->
|
||||||
|
"";
|
||||||
|
Defined ->
|
||||||
|
" " ++ Defined
|
||||||
|
end.
|
||||||
|
|
||||||
get_ct_specs(Cwd) ->
|
get_ct_specs(Cwd) ->
|
||||||
case collect_glob(Cwd, ".*\.test\.spec\$") of
|
case collect_glob(Cwd, ".*\.test\.spec\$") of
|
||||||
|
|
Loading…
Reference in a new issue