aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-05-24 12:52:53 +0200
committerMicael Karlberg <[email protected]>2019-05-29 13:47:40 +0200
commit347cc4649f784c1a0fe57d2ce6ed1ccf41446b39 (patch)
tree78ef645040c9f988a46d7759a341d823597ccd84
parent0eb29c0eebd4e58f294005dbe355e270208756d9 (diff)
downloadotp-347cc4649f784c1a0fe57d2ce6ed1ccf41446b39.tar.gz
otp-347cc4649f784c1a0fe57d2ce6ed1ccf41446b39.tar.bz2
otp-347cc4649f784c1a0fe57d2ce6ed1ccf41446b39.zip
[esock|test] Add condition for running ping pong test case
Add condition for running the large ping-pong sendmsg/recvmsg test case. Also add a limit to the path creation (max number of tries). OTP-15822
-rw-r--r--erts/emulator/test/socket_SUITE.erl28
1 files changed, 24 insertions, 4 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl
index 85f2e47812..49b0fcccc2 100644
--- a/erts/emulator/test/socket_SUITE.erl
+++ b/erts/emulator/test/socket_SUITE.erl
@@ -11281,6 +11281,7 @@ traffic_ping_pong_large_sendmsg_and_recvmsg_tcp4(_Config) when is_list(_Config)
Msg = l2b(?TPP_LARGE),
Num = ?TPP_LARGE_NUM,
tc_try(traffic_ping_pong_large_sendmsg_and_recvmsg_tcp4,
+ fun() -> traffic_ping_pong_large_sendmsg_and_recvmsg_cond() end,
fun() ->
?TT(?SECS(30)),
InitState = #{domain => inet,
@@ -11291,6 +11292,16 @@ traffic_ping_pong_large_sendmsg_and_recvmsg_tcp4(_Config) when is_list(_Config)
end).
+traffic_ping_pong_large_sendmsg_and_recvmsg_cond() ->
+ traffic_ping_pong_large_sendmsg_and_recvmsg_cond(os:type(), os:version()).
+
+traffic_ping_pong_large_sendmsg_and_recvmsg_cond({unix, linux}, {M, _, _})
+ when (M < 3) ->
+ skip("TC may not work on this version");
+traffic_ping_pong_large_sendmsg_and_recvmsg_cond(_, _) ->
+ ok.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This test case is intended to test that the sendmsg and recvmsg functions
%% by repeatedly sending a meassage between two entities.
@@ -11308,7 +11319,10 @@ traffic_ping_pong_large_sendmsg_and_recvmsg_tcp6(_Config) when is_list(_Config)
Msg = l2b(?TPP_LARGE),
Num = ?TPP_LARGE_NUM,
tc_try(traffic_ping_pong_large_sendmsg_and_recvmsg_tcp6,
- fun() -> has_support_ipv6() end,
+ fun() ->
+ has_support_ipv6(),
+ traffic_ping_pong_large_sendmsg_and_recvmsg_cond()
+ end,
fun() ->
?TT(?SECS(30)),
InitState = #{domain => inet6,
@@ -19915,18 +19929,24 @@ ensure_unique_path(Path) ->
case file:read_file_info(Path) of
{ok, _} -> % Ouch, append a unique ID and try again
ensure_unique_path(Path, 1);
- {error, _} -> % We assume this means it does not exist yet...
+ {error, _} ->
+ %% We assume this means it does not exist yet...
+ %% If we have several process in paralell trying to create
+ %% (unique) path's, then we are in trouble. To *really* be
+ %% on the safe side we should have a (central) path registry...
Path
end.
-ensure_unique_path(Path, ID) ->
+ensure_unique_path(Path, ID) when (ID < 100) -> % If this is not enough...
NewPath = ?LIB:f("~s_~w", [Path, ID]),
case file:read_file_info(NewPath) of
{ok, _} -> % Ouch, this also existed, increment and try again
ensure_unique_path(Path, ID + 1);
{error, _} -> % We assume this means it does not exist yet...
NewPath
- end.
+ end;
+ensure_unique_path(_, _) ->
+ skip("Could not create unique path").
which_local_socket_addr(local = Domain) ->