aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2010-05-27 00:46:37 +0200
committerRaimo Niskanen <[email protected]>2010-06-09 16:19:19 +0200
commit7b33aa92bb2558ba04a6436203638fd46592b8d2 (patch)
treed0ca16d7a4d816aef05300a810703e676ed1a013 /lib/common_test
parent80d1a5c5753a18491bfe29740ab5b0af22f0bff2 (diff)
downloadotp-7b33aa92bb2558ba04a6436203638fd46592b8d2.tar.gz
otp-7b33aa92bb2558ba04a6436203638fd46592b8d2.tar.bz2
otp-7b33aa92bb2558ba04a6436203638fd46592b8d2.zip
Improve documentation and fix minor problems
General documentation and code updates.
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/Makefile6
-rw-r--r--lib/common_test/doc/src/ct_master_chapter.xml52
-rw-r--r--lib/common_test/doc/src/run_test_chapter.xml14
-rw-r--r--lib/common_test/src/ct_config_plain.erl2
-rw-r--r--lib/common_test/src/ct_config_xml.erl5
-rw-r--r--lib/common_test/src/ct_run.erl46
6 files changed, 43 insertions, 82 deletions
diff --git a/lib/common_test/Makefile b/lib/common_test/Makefile
index ebca4523ab..c166e48df7 100644
--- a/lib/common_test/Makefile
+++ b/lib/common_test/Makefile
@@ -25,12 +25,12 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
#
ifeq ($(findstring linux,$(TARGET)),linux)
-SUB_DIRECTORIES = doc/src src priv
+SUB_DIRECTORIES = doc/src src
else
ifeq ($(findstring solaris,$(TARGET)),solaris)
-SUB_DIRECTORIES = doc/src src priv
+SUB_DIRECTORIES = doc/src src
else
-SUB_DIRECTORIES = doc/src src priv
+SUB_DIRECTORIES = doc/src src
endif
endif
diff --git a/lib/common_test/doc/src/ct_master_chapter.xml b/lib/common_test/doc/src/ct_master_chapter.xml
index 14f318759e..bc51957aee 100644
--- a/lib/common_test/doc/src/ct_master_chapter.xml
+++ b/lib/common_test/doc/src/ct_master_chapter.xml
@@ -30,6 +30,7 @@
</header>
<section>
+ <marker id="general"></marker>
<title>General</title>
<p>Large scale automated testing requires running multiple independent
test sessions in parallel. This is accomplished by running
@@ -105,6 +106,7 @@
<seealso marker="ct_master">manual page</seealso> for this module.</p>
</section>
<section>
+ <marker id="test_specifications"></marker>
<title>Test Specifications</title>
<p>The test specifications used as input to CT Master are fully compatible with the
specifications used as input to the regular CT server. The syntax is described in the
@@ -195,11 +197,12 @@
</section>
<section>
- <title>Automatic startup of the test target nodes</title>
+ <title>Automatic startup of test target nodes</title>
<marker id="ct_slave"></marker>
- <p>Is is possible to perform initial actions on test target nodes
- automatically using a new term in the test specification, <c>init</c>.</p>
+ <p>Is is possible to automatically start, and perform initial actions, on
+ test target nodes by using the test specification term <c>init</c>.</p>
<p>Currently, two sub-terms are supported, <c>node_start</c> and <c>eval</c>.</p>
+ <p>Example:</p>
<pre>
{node, node1, node1@host1}.
{node, node2, node1@host2}.
@@ -207,38 +210,39 @@
{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, []}}}.
- </pre>
+ {init, node4, {eval, {module, function, []}}}.</pre>
+
<p>This test specification declares that <c>node1@host1</c> is to be started using
- user's callback <c>my_slave_callback</c> with no parameters, and nodes <c>node1@host2</c> and
- <c>node2@host2</c> will be started with the default callback module <c>ct_slave</c>,
- using the given user name and password to log into remote host <c>host2</c>.
- Also, there will be function module:function/0 evaluated on the
- <c>node1@host3</c>, and result of this call will be printed to the log.</p>
- <p>Default <seealso marker="ct_slave">ct_slave</seealso> callback module
- delivered with the Common Test has the following features:
+ the user callback function <c>callback_module:my_slave_callback/0</c>, and nodes
+ <c>node1@host2</c> and <c>node2@host2</c> will be started with the default callback
+ module <c>ct_slave</c>. The given user name and password is used to log into remote
+ host <c>host2</c>. Also, the function <c>module:function/0</c> will be evaluated on
+ <c>node1@host3</c>, and the result of this call will be printed to the log.</p>
+
+ <p>The default <seealso marker="ct_slave">ct_slave</seealso> callback module,
+ which is part of the Common Test application, has the following features:
<list>
- <item>Starting the Erlang nodes or local or remote hosts
- (ssh is used for remote ones);
+ <item>Starting Erlang target nodes on local or remote hosts
+ (ssh is used for communication).
</item>
- <item>Ability to start Erlang emulator with the additional flags
- (any flags supported by <c>erl</c> are supported);
+ <item>Ability to start an Erlang emulator with additional flags
+ (any flags supported by <c>erl</c> are supported).
</item>
- <item>Supervision of the node being start using internal callback
- functions. Used to prevent hanging of started nodes. Configurable;
+ <item>Supervision of a node being started by means of internal callback
+ functions. Used to prevent hanging nodes. (Configurable).
</item>
- <item>Monitoring of the master node by the slaves. Slave node may be
- stopped in case of master node termination. Configurable;
+ <item>Monitoring of the master node by the slaves. A slave node may be
+ stopped in case the master node terminates. (Configurable).
</item>
- <item>Execution of the user's functions after slave node is started.
+ <item>Execution of user functions after a slave node is started.
Functions can be given as a list of {Module, Function, Arguments} tuples.
</item>
</list>
</p>
- <p>Note that it is possible to specify <c>eval</c> term for the node as well
+ <p>Note that it is possible to specify an <c>eval</c> term for the node as well
as <c>startup_functions</c> in the <c>node_start</c> options list. In this
- case first node will be started, then the <c>startup_functions</c> are
- executed, and finally functions specified with <c>eval</c> will be called.
+ case first the node will be started, then the <c>startup_functions</c> are
+ executed, and finally functions specified with <c>eval</c> are called.
</p>
</section>
diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml
index 917f3374db..7fd3174e71 100644
--- a/lib/common_test/doc/src/run_test_chapter.xml
+++ b/lib/common_test/doc/src/run_test_chapter.xml
@@ -354,13 +354,17 @@
<p>Below is the test specification syntax. Test specifications can
be used to run tests both in a single test host environment and in
- a distributed Common Test environment. Node parameters are only relevant in the
- latter (see the chapter about running Common Test in distributed mode for information).
- For details on the event_handler term, see the
+ a distributed Common Test environment (Large Scale Testing). The init term,
+ as well as node parameters, are only relevant in the latter (see the
+ <seealso marker="ct_master_chapter#test_specifications">Large Scale Testing</seealso>
+ chapter for information). For details on the event_handler term, see the
<seealso marker="event_handler_chapter#event_handling">Event Handling</seealso>
chapter.</p>
<p>Config terms:</p>
<pre>
+ {init, InitOptions}.
+ {init, [NodeAlias], InitOptions}.
+
{node, NodeAlias, Node}.
{cover, CoverSpecFile}.
@@ -384,9 +388,6 @@
{event_handler, NodeRefs, EventHandlers}.
{event_handler, EventHandlers, InitArgs}.
{event_handler, NodeRefs, EventHandlers, InitArgs}.
-
- {init, Options}.
- {init, [NodeAlias], Options}.
</pre>
<p>Test terms:</p>
<pre>
@@ -404,6 +405,7 @@
</pre>
<p>Types:</p>
<pre>
+ InitOptions = term()
NodeAlias = atom()
Node = node()
NodeRef = NodeAlias | Node | master
diff --git a/lib/common_test/src/ct_config_plain.erl b/lib/common_test/src/ct_config_plain.erl
index 0fed58e45a..3fbc8af9fb 100644
--- a/lib/common_test/src/ct_config_plain.erl
+++ b/lib/common_test/src/ct_config_plain.erl
@@ -65,7 +65,7 @@ read_config(ConfigFile) ->
end
end.
-% check against existence of config file
+% check if config file exists
check_parameter(File)->
case filelib:is_file(File) of
true->
diff --git a/lib/common_test/src/ct_config_xml.erl b/lib/common_test/src/ct_config_xml.erl
index 4ced80aeac..8a6e75e635 100644
--- a/lib/common_test/src/ct_config_xml.erl
+++ b/lib/common_test/src/ct_config_xml.erl
@@ -33,7 +33,7 @@ read_config(ConfigFile) ->
{error, Error, ErroneousString}
end.
-% check against existence of the file
+% check file exists
check_parameter(File)->
case filelib:is_file(File) of
true->
@@ -107,8 +107,7 @@ transform_entity({Tag, String})->
throw(Error)
end.
-% transform a string with Erlang terms to the terms
-% stolen from trapexit.org :-)
+% transform a string with Erlang terms
list_to_term(String) ->
{ok, T, _} = erl_scan:string(String++"."),
case catch erl_parse:parse_term(T) of
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index 4f8e3e1a98..021bda2951 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -101,11 +101,6 @@ script_start() ->
Res.
script_start1(Parent, Args) ->
- case lists:keymember(preload, 1, Args) of
- true -> preload();
- false -> ok
- end,
-
VtsOrShell =
case lists:keymember(vts, 1, Args) of
true ->
@@ -467,7 +462,7 @@ install(Opts, LogDir) ->
case whereis(ct_util_server) of
undefined ->
VarFile = variables_file_name(LogDir),
- io:format("Varfile=~p~n", [VarFile]),
+ %% io:format("Varfile=~p~n", [VarFile]),
case file:open(VarFile, [write]) of
{ok,Fd} ->
[io:format(Fd, "~p.\n", [Opt]) || Opt <- Opts],
@@ -1780,45 +1775,6 @@ stop_trace(true) ->
dbg:stop_clear();
stop_trace(false) ->
ok.
-
-preload() ->
- io:format("~nLoading Common Test and Test Server modules...~n~n"),
- preload_mod([ct_logs,
- ct_make,
- ct_telnet,
- ct,
- ct_master,
- ct_testspec,
- ct_cover,
- ct_master_event,
- ct_util,
- ct_event,
- ct_master_logs,
- ct_framework,
- teln,
- ct_ftp,
- ct_rpc,
- unix_telnet,
- ct_gen_conn,
- ct_line,
- ct_snmp,
- test_server_sup,
- test_server,
- test_server_ctrl,
- test_server_h,
- test_server_line,
- test_server_node]).
-
-preload_mod([M|Ms]) ->
- case code:is_loaded(M) of
- false ->
- {module,M} = code:load_file(M),
- preload_mod(Ms);
- _ ->
- ok
- end;
-preload_mod([]) ->
- ok.
ensure_atom(Atom) when is_atom(Atom) ->
Atom;