From 9b060f2de9d92d0245edf440b08b0a8eb6b52251 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 17 Jul 2014 20:03:56 +0200 Subject: rebar_utils:otp_release/0: handle vsn like x.y.z** As mentioned in the OTP documentation, licensed customers may use patched OTP installations where the otp_patch_apply tool adds a '**' suffix as a flag saying the system consists of application versions from multiple OTP versions. When we get such a version string, we drop the suffix, as we cannot obtain relevant information from it as far as tooling is concerned. --- test/rebar_otp_release_tests.erl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/rebar_otp_release_tests.erl b/test/rebar_otp_release_tests.erl index 05e9993..61efdad 100644 --- a/test/rebar_otp_release_tests.erl +++ b/test/rebar_otp_release_tests.erl @@ -28,16 +28,20 @@ -include_lib("eunit/include/eunit.hrl"). -otp_release_test() -> - ?_assert(check_otp_release()). - -check_otp_release() -> +check_otp_release_test() -> case rebar_utils:otp_release() of %% <= R16 [$R,N|_] when is_integer(N) -> - true; + ?assert(true); %% >= 17.x [N|_]=Rel when is_integer(N) -> %% Check that it has at least Major.Minor - length(string:tokens(Rel, ".")) > 1 + ?assert(length(string:tokens(Rel, ".")) > 1), + + %% If otp_patch_apply was used and the release version has + %% a "**" suffix, we drop that part in otp_release/0. + ?assertEqual(0, string:str(Rel, "*")), + + %% Check that "\n" is dropped in otp_release/0. + ?assertEqual(0, string:str(Rel, "\n")) end. -- cgit v1.2.1