Browse Source

Test support for OTP-19

pull/1207/head
Fred Hebert 9 years ago
parent
commit
be79259e32
2 changed files with 18 additions and 6 deletions
  1. +1
    -0
      rebar.config
  2. +17
    -6
      test/rebar_test_utils.erl

+ 1
- 0
rebar.config View File

@ -20,6 +20,7 @@
{"rebar/priv/templates/*", "_build/default/lib/"}]}.
{erl_opts, [{platform_define, "^[0-9]+", namespaced_types},
{platform_define, "^(19|2)", rand_only},
no_debug_info,
warnings_as_errors]}.

+ 17
- 6
test/rebar_test_utils.erl View File

@ -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]) ->

Loading…
Cancel
Save