From 56cad32ecdfa36ea7a4cddac1579eb1e414ec0fe Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 23 May 2019 14:19:30 +0200 Subject: [esock|ttest] Updated the ttest command line tool Updated the ttest command line tool to the new API. OTP-15822 --- .../test/socket_test_ttest_tcp_client_socket.erl | 60 +++++++++++++++++----- 1 file changed, 47 insertions(+), 13 deletions(-) (limited to 'erts/emulator/test/socket_test_ttest_tcp_client_socket.erl') diff --git a/erts/emulator/test/socket_test_ttest_tcp_client_socket.erl b/erts/emulator/test/socket_test_ttest_tcp_client_socket.erl index acf2556793..5b2a494ba0 100644 --- a/erts/emulator/test/socket_test_ttest_tcp_client_socket.erl +++ b/erts/emulator/test/socket_test_ttest_tcp_client_socket.erl @@ -21,30 +21,64 @@ -module(socket_test_ttest_tcp_client_socket). -export([ - start/4, start/5, start/7, start/8, + start/3, start/4, start/6, start/7, stop/1 ]). -define(TRANSPORT_MOD, socket_test_ttest_tcp_socket). --define(MOD(M), {?TRANSPORT_MOD, #{method => Method}}). +-define(MOD(D, M), {?TRANSPORT_MOD, #{domain => D, method => M}}). -start(Method, Active, Addr, Port) -> - socket_test_ttest_tcp_client:start_monitor(?MOD(Method), Active, Addr, Port). +start(Method, ServerInfo = {Addr, _}, Active) + when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + Domain = inet, + socket_test_ttest_tcp_client:start_monitor(?MOD(Domain, Method), + ServerInfo, Active); +start(Method, ServerInfo = {Addr, _}, Active) + when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + Domain = inet6, + socket_test_ttest_tcp_client:start_monitor(?MOD(Domain, Method), + ServerInfo, Active). -start(Method, Active, Addr, Port, MsgID) -> - socket_test_ttest_tcp_client:start(?MOD(Method), - Active, Addr, Port, MsgID). +start(Method, ServerInfo = {Addr, _}, Active, MsgID) + when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + %% This is just a simplification + Domain = inet, + socket_test_ttest_tcp_client:start(?MOD(Domain, Method), + ServerInfo, Active, MsgID); +start(Method, ServerInfo = {Addr, _}, Active, MsgID) + when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + Domain = inet6, + socket_test_ttest_tcp_client:start(?MOD(Domain, Method), + ServerInfo, Active, MsgID). -start(Method, Active, Addr, Port, MsgID, MaxOutstanding, RunTime) -> +start(Method, ServerInfo = {Addr, _}, Active, MsgID, MaxOutstanding, RunTime) + when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + Domain = inet, socket_test_ttest_tcp_client:start(false, - ?MOD(Method), - Active, Addr, Port, + ?MOD(Domain, Method), + ServerInfo, Active, + MsgID, MaxOutstanding, RunTime); +start(Method, ServerInfo = {Addr, _}, Active, MsgID, MaxOutstanding, RunTime) + when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + Domain = inet6, + socket_test_ttest_tcp_client:start(false, + ?MOD(Domain, Method), + ServerInfo, Active, MsgID, MaxOutstanding, RunTime). -start(Quiet, Method, Active, Addr, Port, MsgID, MaxOutstanding, RunTime) -> +start(Quiet, Method, ServerInfo = {Addr, _}, Active, MsgID, MaxOutstanding, RunTime) + when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + Domain = inet, + socket_test_ttest_tcp_client:start(Quiet, + ?MOD(Domain, Method), + ServerInfo, Active, + MsgID, MaxOutstanding, RunTime); +start(Quiet, Method, ServerInfo = {Addr, _}, Active, MsgID, MaxOutstanding, RunTime) + when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + Domain = inet6, socket_test_ttest_tcp_client:start(Quiet, - ?MOD(Method), - Active, Addr, Port, + ?MOD(Domain, Method), + ServerInfo, Active, MsgID, MaxOutstanding, RunTime). stop(Pid) -> -- cgit v1.2.3