Skip to content
Browse files

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.
  • Loading branch information...
1 parent 05f1189 commit a60680bb3a066df123b96cee12660057a989fab3 Anders Svensson committed Mar 7, 2013
Showing with 13 additions and 6 deletions.
  1. +13 −6 lib/common_test/src/ct_slave.erl
View
19 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, []).

0 comments on commit a60680b

Please sign in to comment.
Something went wrong with that request. Please try again.