summaryrefslogtreecommitdiff
path: root/src/rebar_prv_common_test.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_common_test.erl')
-rw-r--r--src/rebar_prv_common_test.erl22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 6b94f79..5712fbf 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -37,6 +37,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
+ setup_name(State),
Tests = prepare_tests(State),
case compile(State, Tests) of
%% successfully compiled apps
@@ -105,6 +106,10 @@ format_error({multiple_errors, Errors}) ->
%% Internal functions
%% ===================================================================
+setup_name(State) ->
+ {Long, Short, Opts} = rebar_dist_utils:find_options(State),
+ rebar_dist_utils:either(Long, Short, Opts).
+
prepare_tests(State) ->
%% command line test options
CmdOpts = cmdopts(State),
@@ -189,8 +194,10 @@ ensure_opts([{suite, Suites}|Rest], Acc) ->
ensure_opts(Rest, [NewSuites|Acc]);
ensure_opts([{K, V}|Rest], Acc) ->
ensure_opts(Rest, [{K, V}|Acc]);
-ensure_opts([V|_Rest], _Acc) ->
- ?PRV_ERROR({badconfig, {"Member `~p' of option `~p' must be a 2-tuple", {V, ct_opts}}}).
+%% pass through other options, in case of things like config terms
+%% in `ct_opts`
+ensure_opts([V|Rest], Acc) ->
+ ensure_opts(Rest, [V|Acc]).
add_hooks(Opts, State) ->
case {readable(State), lists:keyfind(ct_hooks, 1, Opts)} of
@@ -637,7 +644,10 @@ ct_opts(_State) ->
{create_priv_dir, undefined, "create_priv_dir", string, help(create_priv_dir)},
{include, undefined, "include", string, help(include)},
{readable, undefined, "readable", boolean, help(readable)},
- {verbose, $v, "verbose", boolean, help(verbose)}
+ {verbose, $v, "verbose", boolean, help(verbose)},
+ {name, undefined, "name", atom, help(name)},
+ {sname, undefined, "sname", atom, help(sname)},
+ {setcookie, undefined, "setcookie", atom, help(setcookie)}
].
help(dir) ->
@@ -692,5 +702,11 @@ help(readable) ->
"Shows test case names and only displays logs to shell on failures";
help(verbose) ->
"Verbose output";
+help(name) ->
+ "Gives a long name to the node";
+help(sname) ->
+ "Gives a short name to the node";
+help(setcookie) ->
+ "Sets the cookie if the node is distributed";
help(_) ->
"".