summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rebar_test_utils.erl23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl
index 8c2d36d..7e62109 100644
--- a/test/rebar_test_utils.erl
+++ b/test/rebar_test_utils.erl
@@ -7,6 +7,13 @@
create_config/2, create_config/3, package_app/3]).
-export([create_random_name/1, create_random_vsn/0, write_src_file/2]).
+%% Pick the right random module
+-ifdef(rand_only).
+-define(random, rand).
+-else.
+-define(random, random).
+-endif.
+
%%%%%%%%%%%%%%
%%% Public %%%
%%%%%%%%%%%%%%
@@ -126,20 +133,24 @@ create_config(_AppDir, ConfFilename, Contents) ->
%% @doc Util to create a random variation of a given name.
create_random_name(Name) ->
random_seed(),
- Name ++ erlang:integer_to_list(random:uniform(1000000)).
+ Name ++ erlang:integer_to_list(?random:uniform(1000000)).
%% @doc Util to create a random variation of a given version.
create_random_vsn() ->
random_seed(),
- lists:flatten([erlang:integer_to_list(random:uniform(100)),
- ".", erlang:integer_to_list(random:uniform(100)),
- ".", erlang:integer_to_list(random:uniform(100))]).
+ lists:flatten([erlang:integer_to_list(?random:uniform(100)),
+ ".", erlang:integer_to_list(?random:uniform(100)),
+ ".", erlang:integer_to_list(?random:uniform(100))]).
+-ifdef(rand_only).
+random_seed() ->
+ %% the rand module self-seeds
+ ok.
+-else.
random_seed() ->
<<A:32, B:32, C:32>> = crypto:rand_bytes(12),
random:seed({A,B,C}).
-
-
+-endif.
expand_deps(_, []) -> [];
expand_deps(git, [{Name, Deps} | Rest]) ->