diff options
author | Micael Karlberg <bmk@erlang.org> | 2018-12-19 18:06:03 +0100 |
---|---|---|
committer | Micael Karlberg <bmk@erlang.org> | 2018-12-21 12:23:28 +0100 |
commit | ff3ce49e25ea150c0637bcb584cffdd88e560e5b (patch) | |
tree | e1193d489fc44a5cab140151b55443605cd50716 /erts | |
parent | 10e9fef8a1d28095c18e735ccc1102c972fa14c9 (diff) | |
download | otp-ff3ce49e25ea150c0637bcb584cffdd88e560e5b.tar.gz otp-ff3ce49e25ea150c0637bcb584cffdd88e560e5b.tar.bz2 otp-ff3ce49e25ea150c0637bcb584cffdd88e560e5b.zip |
[socket-nif|test] Updated test case api_b_open_and_close
The test case tried to validate the (socket option) protocol,
which is not actually available on OpenBSD. So, add a check
if the option is supported.
OTP-14831
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/socket_SUITE.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index 9ad15f06dc..f77eb5502c 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -1444,11 +1444,20 @@ api_b_open_and_close(InitState) -> end}, #{desc => "get protocol", cmd => fun(#{socket := Sock} = State) -> - Res = socket:getopt(Sock, socket, protocol), - {ok, {State, Res}} + case socket:supports(options, socket, protocol) of + true -> + Res = socket:getopt(Sock, socket, protocol), + {ok, {State, Res}}; + false -> + {ok, {State, not_supported}} + end end}, #{desc => "validate protocol", - cmd => fun({#{protocol := Protocol} = State, {ok, Protocol}}) -> + cmd => fun({State, not_supported}) -> + ?SEV_IPRINT("socket option 'protocol' " + "not supported"), + {ok, State}; + ({#{protocol := Protocol} = State, {ok, Protocol}}) -> {ok, State}; ({#{protocol := ExpProtocol}, {ok, Protocol}}) -> {error, {unexpected_type, ExpProtocol, Protocol}}; |