aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-03-05 01:34:16 +0100
committerAnders Svensson <[email protected]>2015-03-05 01:34:16 +0100
commit71b52f31772210a7160317966ca46e36140b935a (patch)
treed8be0b5213f4d3deb6ab7031a2f4a71af0ea246d /lib/diameter/test
parent5e5b22215e3f0a60b7afc2393b3ef68892360b07 (diff)
parent0e1c7db504dc9fdc4e42bd1b9fb0c0e820341b0c (diff)
downloadotp-71b52f31772210a7160317966ca46e36140b935a.tar.gz
otp-71b52f31772210a7160317966ca46e36140b935a.tar.bz2
otp-71b52f31772210a7160317966ca46e36140b935a.zip
Merge branch 'anders/diameter/17/time/OTP-12439' into maint
* anders/diameter/17/time/OTP-12439: Ignore undefined calls to OTP 18 time api in app suite
Diffstat (limited to 'lib/diameter/test')
-rw-r--r--lib/diameter/test/diameter_app_SUITE.erl43
1 files changed, 37 insertions, 6 deletions
diff --git a/lib/diameter/test/diameter_app_SUITE.erl b/lib/diameter/test/diameter_app_SUITE.erl
index f68a18b5c2..cf34c762e1 100644
--- a/lib/diameter/test/diameter_app_SUITE.erl
+++ b/lib/diameter/test/diameter_app_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -187,15 +187,14 @@ xref(Config) ->
xref:stop(XRef),
+ Rel = release(), %% otp_release-ish
+
%% Only care about calls from our own application.
- [] = lists:filter(fun({{F,_,_},{T,_,_}}) ->
+ [] = lists:filter(fun({{F,_,_} = From, {_,_,_} = To}) ->
lists:member(F, Mods)
- andalso {F,T} /= {diameter_tcp, ssl}
+ andalso not ignored(From, To, Rel)
end,
Undefs),
- %% diameter_tcp does call ssl despite the latter not being listed
- %% as a dependency in the app file since ssl is only required for
- %% TLS security: it's up to a client who wants TLS to start ssl.
%% Ensure that only runtime or info modules call runtime modules.
%% It's not strictly necessary that diameter compiler modules not
@@ -214,6 +213,38 @@ xref(Config) ->
[] = lists:filter(fun(M) -> not lists:member(app(M), Deps) end,
RTdeps -- Mods).
+ignored({FromMod,_,_}, {ToMod,_,_} = To, Rel)->
+ %% diameter_tcp does call ssl despite the latter not being listed
+ %% as a dependency in the app file since ssl is only required for
+ %% TLS security: it's up to a client who wants TLS to start ssl.
+ %% The OTP 18 time api is also called if it exists, so that the
+ %% same code can be run on older releases.
+ {FromMod, ToMod} == {diameter_tcp, ssl}
+ orelse (FromMod == diameter_lib
+ andalso Rel < 18
+ andalso lists:member(To, time_api())).
+
+%% New time api in OTP 18.
+time_api() ->
+ [{erlang, F, A} || {F,A} <- [{convert_time_resolution,3},
+ {monotonic_time,0},
+ {monotonic_time,1},
+ {time_offset,0},
+ {time_offset,1},
+ {time_resolution,0},
+ {timestamp,0},
+ {unique_integer,0},
+ {unique_integer,1}]].
+
+release() ->
+ Rel = erlang:system_info(otp_release),
+ try list_to_integer(Rel) of
+ N -> N
+ catch
+ error:_ ->
+ 0 %% aka < 17
+ end.
+
unversion(App) ->
T = lists:dropwhile(fun is_vsn_ch/1, lists:reverse(App)),
lists:reverse(case T of [$-|TT] -> TT; _ -> T end).