From c2e9683679686c5078ca16e8ac84433cb806c4c1 Mon Sep 17 00:00:00 2001 From: soranoba Date: Thu, 7 Apr 2016 18:51:39 +0900 Subject: supported dist_node in ct and eunit --- src/rebar_prv_common_test.erl | 5 +++++ src/rebar_prv_eunit.erl | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 14dc4cc..4e169e8 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), diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 46ea48d..eaa32b4 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -51,6 +51,7 @@ do(State) -> do(State, Tests) -> ?INFO("Performing EUnit tests...", []), + setup_name(State), rebar_utils:update_code(rebar_state:code_paths(State, all_deps), [soft_purge]), %% Run eunit provider prehooks @@ -106,6 +107,10 @@ format_error({error, Error}) -> %% Internal functions %% =================================================================== +setup_name(State) -> + {Long, Short, Opts} = rebar_dist_utils:find_options(State), + rebar_dist_utils:either(Long, Short, Opts). + prepare_tests(State) -> %% parse and translate command line tests CmdTests = resolve_tests(State), -- cgit v1.1 From f420ccab9831fe6180f1a4dc3fa098ffbc01a40c Mon Sep 17 00:00:00 2001 From: soranoba Date: Thu, 7 Apr 2016 22:20:03 +0900 Subject: Add sname, name, setcookie option in eunit, ct --- src/rebar_prv_common_test.erl | 11 ++++++++++- src/rebar_prv_eunit.erl | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 4e169e8..5712fbf 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -644,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) -> @@ -699,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(_) -> "". diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index eaa32b4..942fd10 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -484,11 +484,17 @@ eunit_opts(_State) -> {file, $f, "file", string, help(file)}, {module, $m, "module", string, help(module)}, {suite, $s, "suite", string, help(module)}, - {verbose, $v, "verbose", boolean, help(verbose)}]. - -help(app) -> "Comma separated list of application test suites to run. Equivalent to `[{application, App}]`."; -help(cover) -> "Generate cover data. Defaults to false."; -help(dir) -> "Comma separated list of dirs to load tests from. Equivalent to `[{dir, Dir}]`."; -help(file) -> "Comma separated list of files to load tests from. Equivalent to `[{file, File}]`."; -help(module) -> "Comma separated list of modules to load tests from. Equivalent to `[{module, Module}]`."; -help(verbose) -> "Verbose output. Defaults to false.". + {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(app) -> "Comma separated list of application test suites to run. Equivalent to `[{application, App}]`."; +help(cover) -> "Generate cover data. Defaults to false."; +help(dir) -> "Comma separated list of dirs to load tests from. Equivalent to `[{dir, Dir}]`."; +help(file) -> "Comma separated list of files to load tests from. Equivalent to `[{file, File}]`."; +help(module) -> "Comma separated list of modules to load tests from. Equivalent to `[{module, Module}]`."; +help(verbose) -> "Verbose output. Defaults to false."; +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". -- cgit v1.1