aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-07-17 16:03:04 +0200
committerMicael Karlberg <[email protected]>2019-07-17 16:03:04 +0200
commit58217e460bd121a05f006413adecc3feb3895a06 (patch)
treeb0077104705fffe2e909bd5b998ae253763f72b1 /erts
parentc1faea0e9e663d2d69a75f519d8f671419e6e226 (diff)
downloadotp-58217e460bd121a05f006413adecc3feb3895a06.tar.gz
otp-58217e460bd121a05f006413adecc3feb3895a06.tar.bz2
otp-58217e460bd121a05f006413adecc3feb3895a06.zip
[esock|test] Add an attempt to read out the new debug value
After a successful set of debug, also attempt to read it back to check that it actually took. OTP-15904
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/test/socket_SUITE.erl28
1 files changed, 21 insertions, 7 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl
index 8921cdde04..fd3206f2ef 100644
--- a/erts/emulator/test/socket_SUITE.erl
+++ b/erts/emulator/test/socket_SUITE.erl
@@ -9423,10 +9423,11 @@ api_opt_sock_broadcast() ->
%% Tests the socket option debug.
%% Only allowed for processes with the CAP_NET_ADMIN capability or an
-%% effective user ID of 0.
-%% Since we never run the test as root (I hope), this test will
-%% most likely be skipped (unless we give the test user CAP_NET_ADMIN
-%% capability).
+%% .
+%% On linux, this test requires that the user running the test to have
+%% CAP_NET_ADMIN capabilities or be root (effective user ID of 0),
+%% therefor we explicitly test for the result eacces when attempting to
+%% set, and skip if we get it.
api_opt_sock_debug(suite) ->
[];
@@ -9494,11 +9495,12 @@ api_opt_sock_debug() ->
end
end},
#{desc => "Try enable socket debug",
- cmd => fun(#{sock := Sock, debug := Debug} = _State) ->
- case Set(Sock, Debug + 1) of
+ cmd => fun(#{sock := Sock, debug := Debug} = State) ->
+ NewDebug = Debug + 1,
+ case Set(Sock, NewDebug) of
ok ->
?SEV_IPRINT("Expected Success"),
- ok;
+ {ok, State#{debug => NewDebug}};
{error, eacces = Reason} ->
?SEV_EPRINT("NO ACCESS => SKIP"),
{skip, Reason};
@@ -9508,6 +9510,18 @@ api_opt_sock_debug() ->
ERROR
end
end},
+ #{desc => "Get current (new) debug value",
+ cmd => fun(#{sock := Sock, debug := Debug} = State) ->
+ case Get(Sock) of
+ {ok, Debug} when is_integer(Debug) ->
+ ?SEV_IPRINT("Success: ~p", [Debug]),
+ ok;
+ {error, Reason} = ERROR ->
+ ?SEV_EPRINT("Unexpected failure: ~p",
+ [Reason]),
+ ERROR
+ end
+ end},
%% *** Termination ***
#{desc => "close UDP socket",