aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-05-10 15:51:05 +0200
committerMicael Karlberg <[email protected]>2019-06-24 15:17:02 +0200
commite7ee9e1b3810d695f910d8a2fcdb38b04c8042b7 (patch)
tree1b1584563491c0160f22d6a17ccff2a2bd4c2fd6
parentb7b650e20da47861f3d2e5ac32f720056391bf43 (diff)
downloadotp-e7ee9e1b3810d695f910d8a2fcdb38b04c8042b7.tar.gz
otp-e7ee9e1b3810d695f910d8a2fcdb38b04c8042b7.tar.bz2
otp-e7ee9e1b3810d695f910d8a2fcdb38b04c8042b7.zip
[esock|test] Add test case for debug
OTP-15817
-rw-r--r--erts/emulator/test/socket_SUITE.erl52
1 files changed, 52 insertions, 0 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl
index d8cb1013e9..3a45339ce1 100644
--- a/erts/emulator/test/socket_SUITE.erl
+++ b/erts/emulator/test/socket_SUITE.erl
@@ -67,6 +67,9 @@
%% Test cases
-export([
+ %% *** API Misc ***
+ api_m_debug/1,
+
%% *** API Basic ***
api_b_open_and_close_udp4/1,
api_b_open_and_close_tcp4/1,
@@ -582,6 +585,7 @@ use_group(Group, Env, Default) ->
groups() ->
[{api, [], api_cases()},
+ {api_misc, [], api_misc_cases()},
{api_basic, [], api_basic_cases()},
{api_async, [], api_async_cases()},
{api_options, [], api_options_cases()},
@@ -657,12 +661,18 @@ groups() ->
api_cases() ->
[
+ {group, api_misc},
{group, api_basic},
{group, api_async},
{group, api_options},
{group, api_op_with_timeout}
].
+api_misc_cases() ->
+ [
+ api_m_debug
+ ].
+
api_basic_cases() ->
[
api_b_open_and_close_udp4,
@@ -1636,6 +1646,48 @@ quiet_mode(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
+%% API MISC %%
+%% %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% A simple test case that tests that the global debug can be channged.
+%% At the same time, it will test the info function (since it uses it
+%% for verification).
+
+api_m_debug(suite) ->
+ [];
+api_m_debug(doc) ->
+ [];
+api_m_debug(_Config) when is_list(_Config) ->
+ ?TT(?SECS(5)),
+ tc_try(api_m_debug,
+ fun() ->
+ ok = api_m_debug()
+ end).
+
+api_m_debug() ->
+ i("get initial info"),
+ #{debug := D0} = socket:info(),
+ D1 = not D0,
+ i("set new debug (~w => ~w)", [D0, D1]),
+ ok = socket:debug(D1),
+ i("get updated info (~w)", [D1]),
+ #{debug := D1} = socket:info(),
+ D2 = not D1,
+ i("set new debug (~w => ~w)", [D1, D2]),
+ ok = socket:debug(D2),
+ i("get updated info (~w)", [D2]),
+ #{debug := D2} = socket:info(),
+ i("ok"),
+ ok.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% %%
%% API BASIC %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%