From a60680bb3a066df123b96cee12660057a989fab3 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 7 Mar 2013 09:23:19 +0100 Subject: 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. --- lib/common_test/src/ct_slave.erl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/common_test') 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 Node on host -%%% Host 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 start(Host, Node) when the +%%% second argument is atom-valued and start(Node, Opts) +%%% 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, []). -- cgit v1.2.3