diff options
author | Ingela Anderton Andin <ingela@erlang.org> | 2015-09-08 16:39:38 +0200 |
---|---|---|
committer | Ingela Anderton Andin <ingela@erlang.org> | 2015-09-10 09:04:54 +0200 |
commit | 628553c2946649ef1715feacc05e8f75d38ef2e3 (patch) | |
tree | 4e3c55305a35454ad20e87783fe7838c5c184389 /lib/inets/test/inets_test_lib.erl | |
parent | da6854e9557a045ae1a858c6f2949594228341f7 (diff) | |
download | otp-628553c2946649ef1715feacc05e8f75d38ef2e3.tar.gz otp-628553c2946649ef1715feacc05e8f75d38ef2e3.tar.bz2 otp-628553c2946649ef1715feacc05e8f75d38ef2e3.zip |
inets: Add test suite for socket_wrap feature
On Linux systems a socket may be opened pre starting Erlang and
then passed to Erlangs ftpd or httpd daemon. This is useful as the wrap program
can open a privileged port and Erlang does not have to be run as root.
The test program will only open a random port, but it exercises the code
so that the feature will remain intact.
Diffstat (limited to 'lib/inets/test/inets_test_lib.erl')
-rw-r--r-- | lib/inets/test/inets_test_lib.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl index b471dcf784..f1185f7574 100644 --- a/lib/inets/test/inets_test_lib.erl +++ b/lib/inets/test/inets_test_lib.erl @@ -563,3 +563,12 @@ stop_apps(Apps) -> application:stop(App) end, Apps). +inet_port(Node) -> + {Port, Socket} = do_inet_port(Node), + rpc:call(Node, gen_tcp, close, [Socket]), + Port. + +do_inet_port(Node) -> + {ok, Socket} = rpc:call(Node, gen_tcp, listen, [0, [{reuseaddr, true}]]), + {ok, Port} = rpc:call(Node, inet, port, [Socket]), + {Port, Socket}. |