Skip to content

Commit

Permalink
Skip dist tests unless stipulated or gen_leader present
Browse files Browse the repository at this point in the history
If GPROC_DIST==false, dist tests are skipped
If GPROC_DIST==true, they are attempted
If GPROC_DIST not set, dist tests are run if gen_leader is found.
  • Loading branch information
uwiger committed Aug 14, 2013
1 parent 349ee56 commit b859ef3
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions test/gproc_dist_tests.erl
Expand Up @@ -25,18 +25,25 @@ dist_test_() ->
{timeout, 120,
[{setup,
fun() ->
Ns = start_slaves([dist_test_n1, dist_test_n2]),
?assertMatch({[ok,ok],[]},
rpc:multicall(Ns, application, set_env,
[gproc, gproc_dist, Ns])),
?assertMatch({[ok,ok],[]},
rpc:multicall(Ns, application, start, [gproc])),
Ns
case run_dist_tests() of
true ->
Ns = start_slaves([dist_test_n1, dist_test_n2]),
?assertMatch({[ok,ok],[]},
rpc:multicall(Ns, application, set_env,
[gproc, gproc_dist, Ns])),
?assertMatch({[ok,ok],[]},
rpc:multicall(
Ns, application, start, [gproc])),
Ns;
false ->
skip
end
end,
fun(_Ns) ->
ok
end,
fun(Ns) ->
fun(skip) -> [];
(Ns) when is_list(Ns) ->
{inorder,
[
{inparallel, [
Expand Down Expand Up @@ -94,6 +101,19 @@ dist_test_() ->
end
}]}.

run_dist_tests() ->
case os:getenv("GPROC_DIST") of
"true" -> true;
"false" -> false;
false ->
case code:ensure_loaded(gen_leader) of
{error, nofile} ->
false;
_ ->
true
end
end.

-define(T_NAME, {n, g, {?MODULE, ?LINE}}).
-define(T_KVL, [{foo, "foo"}, {bar, "bar"}]).
-define(T_COUNTER, {c, g, {?MODULE, ?LINE}}).
Expand Down

0 comments on commit b859ef3

Please sign in to comment.