aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_util.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diameter/test/diameter_util.erl')
-rw-r--r--lib/diameter/test/diameter_util.erl31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl
index f9942c3408..3313e6ab75 100644
--- a/lib/diameter/test/diameter_util.erl
+++ b/lib/diameter/test/diameter_util.erl
@@ -23,12 +23,19 @@
%% Utility functions.
%%
+%% generic
-export([consult/2,
run/1,
fold/3,
foldl/3,
- scramble/1,
- write_priv/3,
+ scramble/1]).
+
+%% diameter-specific
+-export([lport/2,
+ lport/3]).
+
+%% common_test-specific
+-export([write_priv/3,
read_priv/2]).
-define(L, atom_to_list).
@@ -172,6 +179,26 @@ eval(F)
when is_function(F,0) ->
F().
+%% lport/2-3
+
+lport(M, Ref) ->
+ lport(M, Ref, 1).
+
+lport(M, Ref, Tries) ->
+ lp(tmod(M), Ref, Tries).
+
+tmod(sctp) -> diameter_sctp;
+tmod(tcp) -> diameter_tcp.
+
+lp(M, Ref, T) ->
+ L = [N || {listen, N, _} <- M:ports(Ref)],
+ if [] /= L orelse T =< 1 ->
+ L;
+ true ->
+ receive after 50 -> ok end,
+ lp(M, Ref, T-1)
+ end.
+
%% write_priv/3
write_priv(Config, Name, Term) ->