summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2014-07-17 20:03:56 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2014-07-17 21:18:43 +0200
commit9b060f2de9d92d0245edf440b08b0a8eb6b52251 (patch)
treeefff75f017a1b2bde736304a468a00efd5c4ebb4 /test
parent873d236ce9b4b88d46c4bb1c6868df70363e8a57 (diff)
downloadrebar-9b060f2de9d92d0245edf440b08b0a8eb6b52251.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/rebar_otp_release_tests.erl16
1 files changed, 10 insertions, 6 deletions
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.