Merge branch 'stable'

This commit is contained in:
Michael Klishin 2017-06-27 09:18:22 +03:00
commit 872a61417d
2 changed files with 17 additions and 2 deletions

View File

@ -66,7 +66,7 @@
-export([os_cmd/1]).
-export([is_os_process_alive/1]).
-export([gb_sets_difference/2]).
-export([version/0, otp_release/0, which_applications/0]).
-export([version/0, otp_release/0, platform_and_version/0, which_applications/0]).
-export([sequence_error/1]).
-export([check_expiry/1]).
-export([base64url/1]).
@ -238,6 +238,7 @@
-spec gb_sets_difference(gb_sets:set(), gb_sets:set()) -> gb_sets:set().
-spec version() -> string().
-spec otp_release() -> string().
-spec platform_and_version() -> string().
-spec which_applications() -> [{atom(), string(), string()}].
-spec sequence_error([({'error', any()} | any())]) ->
{'error', any()} | any().
@ -1023,6 +1024,9 @@ otp_release() ->
erlang:system_info(otp_release)
end.
platform_and_version() ->
string:join(["Erlang/OTP", otp_release()], " ").
%% application:which_applications(infinity) is dangerous, since it can
%% cause deadlocks on shutdown. So we have to use a timeout variant,
%% but w/o creating spurious timeout errors. The timeout value is twice

View File

@ -34,13 +34,24 @@ groups() ->
version_equivalence,
version_minor_equivalence_properties,
version_comparison,
pid_decompose_compose
pid_decompose_compose,
platform_and_version
]}
].
init_per_group(_, Config) -> Config.
end_per_group(_, Config) -> Config.
platform_and_version(_Config) ->
MajorVersion = erlang:system_info(otp_release),
Result = rabbit_misc:platform_and_version(),
RegExp = "^Erlang/OTP\s" ++ MajorVersion,
case re:run(Result, RegExp) of
nomatch -> ct:fail("~p does not match ~p", [Result, RegExp]);
{error, ErrType} -> ct:fail("~p", [ErrType]);
_ -> ok
end.
pid_decompose_compose(_Config) ->
Pid = self(),
{Node, Cre, Id, Ser} = rabbit_misc:decompose_pid(Pid),