diff options
author | Micael Karlberg <[email protected]> | 2019-05-02 15:07:41 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-05-29 18:41:30 +0200 |
commit | d5a78e4fab8e0039f59bfd20368e5c05a19b8439 (patch) | |
tree | eb8a2437733457b4361497df7d0489dc71c51696 /erts | |
parent | 64c4668a65195283c7dbc24a677f8d3d46ac5513 (diff) | |
download | otp-d5a78e4fab8e0039f59bfd20368e5c05a19b8439.tar.gz otp-d5a78e4fab8e0039f59bfd20368e5c05a19b8439.tar.bz2 otp-d5a78e4fab8e0039f59bfd20368e5c05a19b8439.zip |
[esock|test] Fixed async ttest
Updated the ttest test(s) to handle async properly.
OTP-15731
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/socket_SUITE.erl | 2 | ||||
-rw-r--r-- | erts/emulator/test/socket_test_ttest_tcp_socket.erl | 42 |
2 files changed, 22 insertions, 22 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index 66cbdda9c7..f7250f6725 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -22592,7 +22592,7 @@ which_ttest_runtime_env(false) -> %% ms: milliseconds %% s: seconds (default) %% m: minutes -which_ttest_runtime_env2([$m, $s | MS]) when (length(MS) > 0) -> +which_ttest_runtime_env2([$s, $m | MS]) when (length(MS) > 0) -> convert_time(MS, fun(X) -> X end); which_ttest_runtime_env2([$m | M]) when (length(M) > 0) -> convert_time(M, fun(X) -> ?MINS(X) end); diff --git a/erts/emulator/test/socket_test_ttest_tcp_socket.erl b/erts/emulator/test/socket_test_ttest_tcp_socket.erl index 65fbba44c6..3aa3b2c504 100644 --- a/erts/emulator/test/socket_test_ttest_tcp_socket.erl +++ b/erts/emulator/test/socket_test_ttest_tcp_socket.erl @@ -399,9 +399,9 @@ reader_loop(#{active := false, end; %% Read *once* and then change to false -reader_loop(#{async := false, - active := once, - sock := Sock, +reader_loop(#{active := once, + async := false, + sock := Sock, method := Method, ctrl_proc := Pid} = State) -> case do_recv(Method, Sock) of @@ -443,14 +443,14 @@ reader_loop(#{async := false, Pid ! ?ERROR_MSG(Sock, Method, Reason), reader_exit(State, E2) end; -reader_loop(#{async := true, +reader_loop(#{active := once, + async := true, select_info := undefined, - active := once, - sock := Sock, + sock := Sock, method := Method, ctrl_proc := Pid} = State) -> case do_recv(Method, Sock, nowait) of - {ok, {select, _, _} = SelectInfo} -> + {select, SelectInfo} -> reader_loop(State#{select_info => SelectInfo}); {ok, Data} -> Pid ! ?DATA_MSG(Sock, Method, Data), @@ -464,11 +464,11 @@ reader_loop(#{async := true, Pid ! ?ERROR_MSG(Sock, Method, Reason), reader_exit(State, E2) end; -reader_loop(#{async := true, - select_info := {select, _, Ref}, +reader_loop(#{active := once, + async := true, + select_info := {select_info, _, Ref}, select_num := N, - active := once, - sock := Sock, + sock := Sock, method := Method, ctrl_proc := Pid} = State) -> receive @@ -513,8 +513,8 @@ reader_loop(#{async := true, end; %% Read and forward data continuously -reader_loop(#{async := false, - active := true, +reader_loop(#{active := true, + async := false, sock := Sock, method := Method, ctrl_proc := Pid} = State) -> @@ -557,14 +557,14 @@ reader_loop(#{async := false, Pid ! ?ERROR_MSG(Sock, Method, Reason), reader_exit(State, E2) end; -reader_loop(#{async := true, +reader_loop(#{active := true, + async := true, select_info := undefined, - active := true, sock := Sock, method := Method, ctrl_proc := Pid} = State) -> case do_recv(Method, Sock) of - {ok, {select, _, _} = SelectInfo} -> + {select, SelectInfo} -> reader_loop(State#{select_info => SelectInfo}); {ok, Data} -> Pid ! ?DATA_MSG(Sock, Method, Data), @@ -578,10 +578,10 @@ reader_loop(#{async := true, Pid ! ?ERROR_MSG(Sock, Method, Reason), reader_exit(State, E2) end; -reader_loop(#{async := true, - select_info := {select, _, Ref}, +reader_loop(#{active := true, + async := true, + select_info := {select_info, _, Ref}, select_num := N, - active := true, sock := Sock, method := Method, ctrl_proc := Pid} = State) -> @@ -635,8 +635,8 @@ do_recv(msg, Sock, Timeout) -> case socket:recvmsg(Sock, 0, 0, [], Timeout) of {ok, #{iov := [Bin]}} -> {ok, Bin}; - {ok, {select, _, _}} = OK -> - OK; + {select, _} = SELECT -> + SELECT; {error, _} = ERROR -> ERROR end. |