summaryrefslogtreecommitdiff
path: root/lib/kernel
diff options
context:
space:
mode:
authorMicael Karlberg <bmk@erlang.org>2023-04-05 16:16:20 +0200
committerMicael Karlberg <bmk@erlang.org>2023-04-05 17:56:36 +0200
commit2bbcf3d17c19cb0883a75717849d531277dfe339 (patch)
tree100db044c5856b9c7623e3cfb1704244f39a22f3 /lib/kernel
parent817921ca851b88c9d7c1c7294c7657bc522064fc (diff)
downloaderlang-2bbcf3d17c19cb0883a75717849d531277dfe339.tar.gz
[kernel|esock|test] Handle timing issues
Sometimes (on Windows) timestamps seems to not update. Check and if so skip instead. OTP-18029
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/socket_SUITE.erl129
1 files changed, 82 insertions, 47 deletions
diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl
index 0d99dd63db..62fcd6cfb2 100644
--- a/lib/kernel/test/socket_SUITE.erl
+++ b/lib/kernel/test/socket_SUITE.erl
@@ -41116,36 +41116,63 @@ traffic_ping_pong_send_and_receive_tcp2(InitState) ->
{CSent, CReceived, _, CStart, CStop} = CRes,
STime = tdiff(SStart, SStop),
CTime = tdiff(CStart, CStop),
- %% Note that the sizes we are counting is only
- %% the "data" part of the messages. There is also
- %% fixed header for each message, which of course
- %% is small for the large messages, but comparatively
- %% big for the small messages!
- ?SEV_IPRINT("Results: ~w messages exchanged"
- "~n Server: ~w msec"
- "~n ~.2f msec/message (roundtrip)"
- "~n ~.2f messages/msec (roundtrip)"
- "~n ~w bytes/msec sent"
- "~n ~w bytes/msec received"
- "~n Client: ~w msec"
- "~n ~.2f msec/message (roundtrip)"
- "~n ~.2f messages/msec (roundtrip)"
- "~n ~w bytes/msec sent"
- "~n ~w bytes/msec received",
+ ?SEV_IPRINT("process result data:"
+ "~n Num: ~p"
+ "~n Server Sent: ~p"
+ "~n Server Recv: ~p"
+ "~n Server Start: ~p"
+ "~n Server Stop: ~p"
+ "~n Server Time: ~p"
+ "~n Client Sent: ~p"
+ "~n Client Recv: ~p"
+ "~n Client Start: ~p"
+ "~n Client Stop: ~p"
+ "~n Client Time: ~p",
[Num,
+ SSent, SReceived, SStart, SStop,
STime,
- STime / Num,
- Num / STime,
- SSent div STime,
- SReceived div STime,
- CTime,
- CTime / Num,
- Num / CTime,
- CSent div CTime,
- CReceived div CTime]),
- State1 = maps:remove(server_result, State),
- State2 = maps:remove(client_result, State1),
- {ok, State2}
+ CSent, CReceived, CStart, CStop,
+ CTime]),
+ if
+ (STime =:= 0) orelse
+ (CTime =:= 0) ->
+ {skip,
+ ?F("Invalid exec time(s): ~w , ~w",
+ [STime, CTime])};
+ true ->
+ %% Note that the sizes we are counting is
+ %% only the "data" part of the messages.
+ %% There is also fixed header for each
+ %% message, which of course is small for
+ %% the large messages, but comparatively
+ %% big for the small messages!
+ ?SEV_IPRINT(
+ "Results: ~w messages exchanged"
+ "~n Server: ~w msec"
+ "~n ~.2f msec/message (roundtrip)"
+ "~n ~.2f messages/msec (roundtrip)"
+ "~n ~w bytes/msec sent"
+ "~n ~w bytes/msec received"
+ "~n Client: ~w msec"
+ "~n ~.2f msec/message (roundtrip)"
+ "~n ~.2f messages/msec (roundtrip)"
+ "~n ~w bytes/msec sent"
+ "~n ~w bytes/msec received",
+ [Num,
+ STime,
+ STime / Num,
+ Num / STime,
+ SSent div STime,
+ SReceived div STime,
+ CTime,
+ CTime / Num,
+ Num / CTime,
+ CSent div CTime,
+ CReceived div CTime]),
+ State1 = maps:remove(server_result, State),
+ State2 = maps:remove(client_result, State1),
+ {ok, State2}
+ end
end},
%% Terminations
@@ -42028,25 +42055,33 @@ traffic_ping_pong_send_and_receive_udp2(InitState) ->
num := Num} = State) ->
{CSent, CReceived, CStart, CStop} = CRes,
CTime = tdiff(CStart, CStop),
- %% Note that the sizes we are counting is only
- %% the "data" part of the messages. There is also
- %% fixed header for each message, which of course
- %% is small for the large messages, but comparatively
- %% big for the small messages!
- ?SEV_IPRINT("Results: ~w messages exchanged"
- "~n Client: ~w msec"
- "~n ~.2f msec/message (roundtrip)"
- "~n ~.2f messages/msec (roundtrip)"
- "~n ~w bytes/msec sent"
- "~n ~w bytes/msec received",
- [Num,
- CTime,
- CTime / Num,
- Num / CTime,
- CSent div CTime,
- CReceived div CTime]),
- State1 = maps:remove(client_result, State),
- {ok, State1}
+ if
+ (CTime =:= 0) ->
+ {skip,
+ ?F("Invalid exec time: ~w ", [CTime])};
+ true ->
+ %% Note that the sizes we are counting is
+ %% only the "data" part of the messages.
+ %% There is also fixed header for each
+ %% message, which of course is small for
+ %% the large messages, but comparatively
+ %% big for the small messages!
+ ?SEV_IPRINT(
+ "Results: ~w messages exchanged"
+ "~n Client: ~w msec"
+ "~n ~.2f msec/message (roundtrip)"
+ "~n ~.2f messages/msec (roundtrip)"
+ "~n ~w bytes/msec sent"
+ "~n ~w bytes/msec received",
+ [Num,
+ CTime,
+ CTime / Num,
+ Num / CTime,
+ CSent div CTime,
+ CReceived div CTime]),
+ State1 = maps:remove(client_result, State),
+ {ok, State1}
+ end
end},
%% Terminations