Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Skip dist tests unless stipulated or gen_leader present

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...
commit b859ef3ba213d73c5c3ea8d05f79e4476ce9ba0d 1 parent 349ee56
@uwiger uwiger authored
Showing with 28 additions and 8 deletions.
  1. +28 −8 test/gproc_dist_tests.erl
View
36 test/gproc_dist_tests.erl
@@ -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, [
@@ -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}}).
Please sign in to comment.
Something went wrong with that request. Please try again.