Skip to content

Commit

Permalink
Merge branch 'peppe/common_test/r14b04_docs' into dev
Browse files Browse the repository at this point in the history
* peppe/common_test/r14b04_docs:
  Update documentation
  Rid ct_telnet of doc build warnings
  • Loading branch information
Peter Andersson committed Sep 30, 2011
2 parents 1f17c7b + 09fbbcc commit 1a42cde
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
7 changes: 5 additions & 2 deletions lib/common_test/doc/src/ct_run.xml
Expand Up @@ -83,7 +83,7 @@
<title>Run tests from command line</title>
<pre>
ct_run [-dir TestDir1 TestDir2 .. TestDirN] |
[-suite Suite1 Suite2 .. SuiteN
[[-dir TestDir] -suite Suite1 Suite2 .. SuiteN
[[-group Group1 Group2 .. GroupN] [-case Case1 Case2 .. CaseN]]]
[-step [config | keep_inactive]]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
Expand All @@ -92,6 +92,7 @@
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
[-cover CoverCfgFile]
Expand All @@ -117,6 +118,7 @@
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-allow_user_terms]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
Expand All @@ -138,10 +140,11 @@
<pre>
ct_run -vts [-browser Browser]
[-dir TestDir1 TestDir2 .. TestDirN] |
[-suite Suite [[-group Group] [-case Case]]]
[[dir TestDir] -suite Suite [[-group Group] [-case Case]]]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. and CallbackModuleN ConfigStringN]
[-logopts LogOpts]
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-include InclDir1 InclDir2 .. InclDirN]
[-no_auto_compile]
Expand Down
35 changes: 35 additions & 0 deletions lib/common_test/doc/src/run_test_chapter.xml
Expand Up @@ -128,6 +128,15 @@
<p><c>$ ct_run -suite $SYS1_TEST/setup_SUITE -case start stop</c></p>
<p><c>$ ct_run -suite $SYS1_TEST/setup_SUITE -group installation -case start stop</c></p>

<p>It is also possible to combine the <c>dir</c>, <c>suite</c> and <c>group/case</c> flags. E.g, to run
<c>x_SUITE</c> and <c>y_SUITE</c> in directory <c>testdir</c>:</p>

<p><c>$ ct_run -dir ./testdir -suite x_SUITE y_SUITE</c></p>

<p>This has the same effect as calling:</p>

<p><c>$ ct_run -suite ./testdir/x_SUITE ./testdir/y_SUITE</c></p>

<p>Other flags that may be used with <c>ct_run</c>:</p>
<list>
<item><c><![CDATA[-logdir <dir>]]></c>, specifies where the HTML log files are to be written.</item>
Expand Down Expand Up @@ -165,6 +174,8 @@
<item><c><![CDATA[-decrypt_file <key_file>]]></c>, points out a file containing a decryption key for
<seealso marker="config_file_chapter#encrypted_config_files">encrypted configuration files</seealso>.</item>
<item><c><![CDATA[-basic_html]]></c>, switches off html enhancements that might not be compatible with older browsers.</item>
<item><c><![CDATA[-logopts <opts>]]></c>, makes it possible to modify aspects of the logging behaviour, see
<seealso marker="run_test_chapter#logopts">Log options</seealso> below.</item>
</list>

<note><p>Directories passed to Common Test may have either relative or absolute paths.</p></note>
Expand Down Expand Up @@ -645,6 +656,30 @@
to follow test progress simply by refreshing pages in the HTML browser.
Statistics totals are not presented until a test is complete however.</p>

<section>
<marker id="logopts"></marker>
<title>Log options</title>
<p>With the <c>logopts</c> start flag, it's possible to specify
options that modify some aspects of the logging behaviour.
Currently, the following options are available:</p>
<list>
<item><c>no_src</c></item>
<item><c>no_nl</c></item>
</list>
<p>With <c>no_src</c>, the html version of the test suite source
code will not be generated during the test run (and consequently
not be available in the log file system).</p>
<p>With <c>no_nl</c>, Common Test will not add a newline character
(\n) to the end of an output string that it receives from a call to e.g.
<c>io:format/2</c>, and which it prints to the test case log.</p>
<p>For example, if a test is started with:</p>
<p><c>$ ct_run -suite my_SUITE -logopts no_src</c></p>
<p>then printouts during the test made by successive calls to <c>io:format("x")</c>,
will appear in the test case log as:</p>
<p><c>xxx</c></p>
<p>instead of each <c>x</c> printed on a new line, which is the default behaviour.</p>
</section>

</section>

<section>
Expand Down
9 changes: 4 additions & 5 deletions lib/common_test/src/ct_telnet.erl
Expand Up @@ -245,7 +245,6 @@ cmdf(Connection,CmdFormat,Args) ->
%%% Data = [string()]
%%% @doc Send a telnet command and wait for prompt
%%% (uses a format string and list of arguments to build the command).
%%%-----------------------------------------------------------------
cmdf(Connection,CmdFormat,Args,Timeout) when is_list(Args) ->
Cmd = lists:flatten(io_lib:format(CmdFormat,Args)),
cmd(Connection,Cmd,Timeout).
Expand Down Expand Up @@ -360,15 +359,15 @@ expect(Connection,Patterns) ->
%%% will also be a <code>HaltReason</code> returned.</p>
%%%
%%% <p><underline>Examples:</underline><br/>
%%% <code>expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],
%%% [sequence,{halt,[{nnn,"NNN"}]}]).</code><br/> will try to match
%%% <code>expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],</code>
%%% <code>[sequence,{halt,[{nnn,"NNN"}]}]).</code><br/> will try to match
%%% "ABC" first and then "XYZ", but if "NNN" appears the function will
%%% return <code>{error,{nnn,["NNN"]}}</code>. If both "ABC" and "XYZ"
%%% are matched, the function will return
%%% <code>{ok,[AbcMatch,XyzMatch]}</code>.</p>
%%%
%%% <p><code>expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],
%%% [{repeat,2},{halt,[{nnn,"NNN"}]}]).</code><br/> will try to match
%%% <p><code>expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],</code>
%%% <code>[{repeat,2},{halt,[{nnn,"NNN"}]}]).</code><br/> will try to match
%%% "ABC" or "XYZ" twice. If "NNN" appears the function will return
%%% with <code>HaltReason = {nnn,["NNN"]}</code>.</p>
%%%
Expand Down

0 comments on commit 1a42cde

Please sign in to comment.