Erlang -- ct_slave

Common Test

Reference Manual

Version 1.19

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- common_test
  - Top of manual page
  - Module:Testcase/0
  - Module:Testcase/1
  - Module:all/0
  - Module:end_per_group/2
  - Module:end_per_suite/1
  - Module:end_per_testcase/2
  - Module:group/1
  - Module:groups/0
  - Module:init_per_group/2
  - Module:init_per_suite/1
  - Module:init_per_testcase/2
  - Module:suite/0
- ct_run
- ct
  - Top of manual page
  - abort_current_testcase/1
  - add_config/2
  - break/1
  - break/2
  - capture_get/0
  - capture_get/1
  - capture_start/0
  - capture_stop/0
  - comment/1
  - comment/2
  - continue/0
  - continue/1
  - decrypt_config_file/2
  - decrypt_config_file/3
  - encrypt_config_file/2
  - encrypt_config_file/3
  - fail/1
  - fail/2
  - get_config/1
  - get_config/2
  - get_config/3
  - get_event_mgr_ref/0
  - get_progname/0
  - get_status/0
  - get_target_name/1
  - get_testspec_terms/0
  - get_testspec_terms/1
  - get_timetrap_info/0
  - get_verbosity/1
  - install/1
  - listenv/1
  - log/1
  - log/2
  - log/3
  - log/4
  - log/5
  - make_priv_dir/0
  - notify/2
  - pal/1
  - pal/2
  - pal/3
  - pal/4
  - pal/5
  - parse_table/1
  - print/1
  - print/2
  - print/3
  - print/4
  - print/5
  - reload_config/1
  - remaining_test_procs/0
  - remove_config/2
  - require/1
  - require/2
  - run/1
  - run/2
  - run/3
  - run_test/1
  - run_testspec/1
  - set_verbosity/2
  - sleep/1
  - start_interactive/0
  - step/3
  - step/4
  - stop_interactive/0
  - sync_notify/2
  - testcases/2
  - timetrap/1
  - userdata/2
  - userdata/3
- ct_master
  - Top of manual page
  - abort/0
  - abort/1
  - basic_html/1
  - get_event_mgr_ref/0
  - progress/0
  - run/1
  - run/3
  - run/4
  - run_on_node/2
  - run_on_node/3
  - run_test/2
- ct_cover
  - Top of manual page
  - add_nodes/1
  - cross_cover_analyse/2
  - remove_nodes/1
- ct_ftp
  - Top of manual page
  - cd/2
  - close/1
  - delete/2
  - get/3
  - ls/2
  - open/1
  - put/3
  - recv/2
  - recv/3
  - send/2
  - send/3
  - type/2
- ct_ssh
  - Top of manual page
  - apread/4
  - apread/5
  - apwrite/4
  - apwrite/5
  - aread/3
  - aread/4
  - awrite/3
  - awrite/4
  - close/2
  - close/3
  - connect/1
  - connect/2
  - connect/3
  - del_dir/2
  - del_dir/3
  - delete/2
  - delete/3
  - disconnect/1
  - exec/2
  - exec/3
  - exec/4
  - get_file_info/2
  - get_file_info/3
  - list_dir/2
  - list_dir/3
  - make_dir/2
  - make_dir/3
  - make_symlink/3
  - make_symlink/4
  - open/3
  - open/4
  - opendir/2
  - opendir/3
  - position/3
  - position/4
  - pread/4
  - pread/5
  - pwrite/4
  - pwrite/5
  - read/3
  - read/4
  - read_file/2
  - read_file/3
  - read_file_info/2
  - read_file_info/3
  - read_link/2
  - read_link/3
  - read_link_info/2
  - read_link_info/3
  - receive_response/2
  - receive_response/3
  - receive_response/4
  - rename/3
  - rename/4
  - send/3
  - send/4
  - send/5
  - send_and_receive/3
  - send_and_receive/4
  - send_and_receive/5
  - send_and_receive/6
  - session_close/2
  - session_open/1
  - session_open/2
  - sftp_connect/1
  - shell/2
  - shell/3
  - subsystem/3
  - subsystem/4
  - write/3
  - write/4
  - write_file/3
  - write_file/4
  - write_file_info/3
  - write_file_info/4
- ct_netconfc
  - Top of manual page
  - action/2
  - action/3
  - close_session/1
  - close_session/2
  - connect/1
  - connect/2
  - copy_config/3
  - copy_config/4
  - create_subscription/2
  - create_subscription/3
  - delete_config/2
  - delete_config/3
  - disconnect/1
  - edit_config/3
  - edit_config/4
  - edit_config/5
  - get/2
  - get/3
  - get_capabilities/1
  - get_capabilities/2
  - get_config/3
  - get_config/4
  - get_event_streams/1
  - get_event_streams/2
  - get_event_streams/3
  - get_session_id/1
  - get_session_id/2
  - hello/1
  - hello/2
  - hello/3
  - kill_session/2
  - kill_session/3
  - lock/2
  - lock/3
  - only_open/1
  - only_open/2
  - open/1
  - open/2
  - send/2
  - send/3
  - send_rpc/2
  - send_rpc/3
  - session/1
  - session/2
  - session/3
  - unlock/2
  - unlock/3
- ct_rpc
  - Top of manual page
  - app_node/2
  - app_node/3
  - app_node/4
  - call/4
  - call/5
  - call/6
  - cast/4
  - cast/5
- ct_snmp
  - Top of manual page
  - get_next_values/3
  - get_values/3
  - load_mibs/1
  - register_agents/2
  - register_users/2
  - register_usm_users/2
  - set_info/1
  - set_values/4
  - start/2
  - start/3
  - stop/1
  - unload_mibs/1
  - unregister_agents/1
  - unregister_agents/2
  - unregister_users/1
  - unregister_users/2
  - unregister_usm_users/1
  - unregister_usm_users/2
- ct_telnet
  - Top of manual page
  - close/1
  - cmd/2
  - cmd/3
  - cmdf/3
  - cmdf/4
  - expect/2
  - expect/3
  - get_data/1
  - open/1
  - open/2
  - open/3
  - open/4
  - send/2
  - send/3
  - sendf/3
  - sendf/4
- unix_telnet
  - Top of manual page
  - connect/7
  - get_prompt_regexp/0
- ct_slave
  - Top of manual page
  - start/1
  - start/2
  - start/3
  - stop/1
  - stop/2
- ct_hooks
  - Top of manual page
  - Module:id/1
  - Module:init/2
  - Module:on_tc_fail/4
  - Module:on_tc_skip/4
  - Module:post_all/3
  - Module:post_end_per_group/5
  - Module:post_end_per_suite/4
  - Module:post_end_per_testcase/5
  - Module:post_groups/2
  - Module:post_init_per_group/5
  - Module:post_init_per_suite/4
  - Module:post_init_per_testcase/5
  - Module:pre_end_per_group/4
  - Module:pre_end_per_suite/3
  - Module:pre_end_per_testcase/4
  - Module:pre_init_per_group/4
  - Module:pre_init_per_suite/3
  - Module:pre_init_per_testcase/4
  - Module:terminate/1
- ct_property_test
  - Top of manual page
  - init_per_suite/1
  - present_result/4
  - present_result/5
  - quickcheck/2
- ct_testspec
  - Top of manual page
  - get_tests/1

# ct_slave

### Module

ct_slave

### Module Summary

Common Test framework functions for starting and stopping nodes for Large-Scale Testing.

### Since

Module ct_slave was introduced in OTP R14B.

### Description

Common Test framework functions for starting and stopping nodes for Large-Scale Testing.

This module exports functions used by the Common Test Master to start and stop "slave" nodes. It is the default callback module for the {init, node_start} term in the Test Specification.

### Exports

start(Node) -> Result | OTP R14B

### Types

Node = atom()
Result = {ok, NodeName} | {error, Reason, NodeName}
Reason = already_started | started_not_connected | boot_timeout | init_timeout | startup_timeout | not_alive
NodeName = atom()

Starts an Erlang node with name Node on the local host.

See also ct_slave:start/3.

start(HostOrNode, NodeOrOpts) -> Result | OTP R14B

### Types

HostOrNode = atom()
NodeOrOpts = atom() | list()
Result = {ok, NodeName} | {error, Reason, NodeName}
Reason = already_started | started_not_connected | boot_timeout | init_timeout | startup_timeout | not_alive
NodeName = atom()

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 is list-valued.

See also ct_slave:start/3.

start(Host, Node, Opts) -> Result | OTP R14B

### Types

Node = atom()
Host = atom()
Opts = [OptTuples]
OptTuples = {username, Username} | {password, Password} | {boot_timeout, BootTimeout} | {init_timeout, InitTimeout} | {startup_timeout, StartupTimeout} | {startup_functions, StartupFunctions} | {monitor_master, Monitor} | {kill_if_fail, KillIfFail} | {erl_flags, ErlangFlags} | {env, [{EnvVar, Value}]}
Username = string()
Password = string()
BootTimeout = integer()
InitTimeout = integer()
StartupTimeout = integer()
StartupFunctions = [StartupFunctionSpec]
StartupFunctionSpec = {Module, Function, Arguments}
Module = atom()
Function = atom()
Arguments = [term]
Monitor = bool()
KillIfFail = bool()
ErlangFlags = string()
EnvVar = string()
Value = string()
Result = {ok, NodeName} | {error, Reason, NodeName}
Reason = already_started | started_not_connected | boot_timeout | init_timeout | startup_timeout | not_alive
NodeName = atom()

Starts an Erlang node with name Node on host Host as specified by the combination of options in Opts.

Options Username and Password are used to log on to the remote host Host. Username, if omitted, defaults to the current username. Password is empty by default.

A list of functions specified in option Startup are executed after startup of the node. Notice that all used modules are to be present in the code path on Host.

The time-outs are applied as follows:

BootTimeout

  The time to start the Erlang node, in seconds. Defaults to 3 seconds. If the node is not pingable within this time, the result {error, boot_timeout, NodeName} is returned.

InitTimeout

  The time to wait for the node until it calls the internal callback function informing master about a successful startup. Defaults to 1 second. In case of a timed out message, the result {error, init_timeout, NodeName} is returned.

StartupTimeout

  The time to wait until the node stops to run StartupFunctions. Defaults to 1 second. If this time-out occurs, the result {error, startup_timeout, NodeName} is returned.

Options:

monitor_master

  Specifies if the slave node is to be stopped if the master node stops. Defaults to false.

kill_if_fail

  Specifies if the slave node is to be killed if a time-out occurs during initialization or startup. Defaults to true. Notice that the node can also be still alive it the boot time-out occurred, but it is not killed in this case.

erl_flags

  Specifies which flags are added to the parameters of the executable erl.

env

  Specifies a list of environment variables that will extend the environment.

Special return values:

- {error, already_started, NodeName} if the node with the specified name is already started on a specified host.

- {error, started_not_connected, NodeName} if the node is started, but not connected to the master node.

- {error, not_alive, NodeName} if the node on which ct_slave:start/3 is called, is not alive. Notice that NodeName is the name of the current node in this case.

stop(Node) -> Result | OTP R14B

### Types

Node = atom()
Result = {ok, NodeName} | {error, Reason, NodeName}
Reason = not_started | not_connected | stop_timeout

Stops the running Erlang node with name Node on the local host.

stop(Host, Node) -> Result | OTP R14B

### Types

Host = atom()
Node = atom()
Result = {ok, NodeName} | {error, Reason, NodeName}
Reason = not_started | not_connected | stop_timeout
NodeName = atom()

Stops the running Erlang node with name Node on host Host.