aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_slave.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-03-07 09:23:19 +0100
committerAnders Svensson <[email protected]>2013-03-12 17:06:46 +0100
commita60680bb3a066df123b96cee12660057a989fab3 (patch)
tree688efee763c6ce96cd70dd68f077a54364c64992 /lib/common_test/src/ct_slave.erl
parent05f11890bdfec4bfc3a78e191a87e70a937ffc54 (diff)
downloadotp-a60680bb3a066df123b96cee12660057a989fab3.tar.gz
otp-a60680bb3a066df123b96cee12660057a989fab3.tar.bz2
otp-a60680bb3a066df123b96cee12660057a989fab3.zip
Add ct_slave:start(Node, Opts) to start a node on the local host
This is convenient when starting nodes locally since there's otherwise no trivial way to specify the local hostname.
Diffstat (limited to 'lib/common_test/src/ct_slave.erl')
-rw-r--r--lib/common_test/src/ct_slave.erl19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/common_test/src/ct_slave.erl b/lib/common_test/src/ct_slave.erl
index 1fd8c04f8b..bcb27f66b5 100644
--- a/lib/common_test/src/ct_slave.erl
+++ b/lib/common_test/src/ct_slave.erl
@@ -1,7 +1,7 @@
%%--------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -56,9 +56,9 @@ start(Node) ->
start(gethostname(), Node).
%%%-----------------------------------------------------------------
-%%% @spec start(Host, Node) -> Result
-%%% Node = atom()
-%%% Host = atom()
+%%% @spec start(HostOrNode, NodeOrOpts) -> Result
+%%% HostOrNode = atom()
+%%% NodeOrOpts = atom() | list()
%%% Result = {ok, NodeName} |
%%% {error, already_started, NodeName} |
%%% {error, started_not_connected, NodeName} |
@@ -67,9 +67,16 @@ start(Node) ->
%%% {error, startup_timeout, NodeName} |
%%% {error, not_alive, NodeName}
%%% NodeName = atom()
-%%% @doc Starts an Erlang node with name <code>Node</code> on host
-%%% <code>Host</code> with the default options.
+%%% @doc Starts an Erlang node with default options on a specified
+%%% host, or on the local host with specified options. That is,
+%%% the call is interpreted as <code>start(Host, Node)</code> when the
+%%% second argument is atom-valued and <code>start(Node, Opts)</code>
+%%% when it's list-valued.
%%% @see start/3
+start(_HostOrNode = Node, _NodeOrOpts = Opts) %% match to satiate edoc
+ when is_list(Opts) ->
+ start(gethostname(), Node, Opts);
+
start(Host, Node) ->
start(Host, Node, []).