Automatic startup of the test target nodes
- Is is possible to start nodes acting like a test targets automatically
- using a new term in the test specification, node_start:
+ Is is possible to perform initial actions on test target nodes
+ automatically using a new term in the test specification, init.
+ Currently, two sub-terms are supported, node_start and eval.
{node, node1, node1@host1}.
{node, node2, node1@host2}.
{node, node3, node2@host2}.
- {node_start, node1, [{callback_module, my_slave_callback}]}.
- {node_start, [node2, node3], [{username, "ct_user"}, {password, "ct_password"}]}.
+ {node, node4, node1@host3}.
+ {init, node1, [{node_start, [{callback_module, my_slave_callback}]}]}.
+ {init, [node2, node3], {node_start, [{username, "ct_user"}, {password, "ct_password"}]}}.
+ {init, node4, {eval, {module, function, []}}}.
This test specification declares that node1@host1 is to be started using
user's callback my_slave_callback with no parameters, and nodes node1@host2 and
node2@host2 will be started with the default callback module ct_slave,
- using the given user name and password to log into remote host host2.
- Default ct_slave callback module delivered with the Common Test has the following features:
+ using the given user name and password to log into remote host host2.
+ Also, there will be function module:function/0 evaluated on the
+ node1@host3, and result of this call will be printed to the log.
+ Default ct_slave callback module
+ delivered with the Common Test has the following features:
- - Starting the Erlang nodes or local or remote hosts (ssh is used for remote ones);
- - Ability to start Erlang emulator with the additional flags (any flags supported by erl are supported);
- - Supervision of the node being start using internal callback functions. Used to prevent hanging of started nodes. Configurable;
- - Monitoring of the master node by the slaves. Slave node may be stopped in case of master node termination. Configurable;
- - Execution of the user's functions after slave node is started. Functions can be given as a list of {Module, Function, Arguments} tuples.
+ - Starting the Erlang nodes or local or remote hosts
+ (ssh is used for remote ones);
+
+ - Ability to start Erlang emulator with the additional flags
+ (any flags supported by erl are supported);
+
+ - Supervision of the node being start using internal callback
+ functions. Used to prevent hanging of started nodes. Configurable;
+
+ - Monitoring of the master node by the slaves. Slave node may be
+ stopped in case of master node termination. Configurable;
+
+ - Execution of the user's functions after slave node is started.
+ Functions can be given as a list of {Module, Function, Arguments} tuples.
+
- If any eval term is specified for a node which has node_start term
- defined for it, the evaluation of the functions will be deferred until the node is started.
- The functions to be evaluated are simply added to the end of the startup_functions list
- (see ct_slave chapter in the Reference Manual).
+ Note that it is possible to specify eval term for the node as well
+ as startup_functions in the node_start options list. In this
+ case first node will be started, then the startup_functions are
+ executed, and finally functions specified with eval will be called.
+
diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml
index f5dc477c6f..44b4077ec4 100644
--- a/lib/common_test/doc/src/run_test_chapter.xml
+++ b/lib/common_test/doc/src/run_test_chapter.xml
@@ -384,8 +384,8 @@
{event_handler, EventHandlers, InitArgs}.
{event_handler, NodeRefs, EventHandlers, InitArgs}.
- {eval, [{Module, Function, Arguments}]}.
- {eval, [NodeAlias], [{Module, Function, Arguments}]}.
+ {init, Options}.
+ {init, [NodeAlias], Options}.
@@ -461,15 +461,9 @@
- Lastly, all suites for systems t3 are to be completely skipped and this
should be explicitly noted in the log files.
- It is possible to evaluate any function(s) during processing of the test
- specification. This feature may be used e.g. to add some directories to
- the code path, initialise some ETS table etc. New eval terms can be
- used for this purpose.
- If only a list of functions is given, then all functions from the list
- will be consequently applied on the current node. If at least one node
- alias is given, then the functions will be called remotely on all nodes
- specified. Please note that in case when node is defined to be started by
- the CT Master, the evaluation will be deferred.
+
It is possible to specify initialization options for nodes defined in the
+ test specification. Currently, there are options to start the node and/or to
+ evaluate any function on the node.
See the Automatic startup of
the test target nodes chapter for details.
It is possible for the user to provide a test specification that
--
cgit v1.2.3