diff options
Diffstat (limited to 'lib/common_test')
| -rw-r--r-- | lib/common_test/doc/src/ct_run.xml | 169 | ||||
| -rw-r--r-- | lib/common_test/doc/src/run_test_chapter.xml | 8 | ||||
| -rw-r--r-- | lib/common_test/src/ct_run.erl | 146 | 
3 files changed, 169 insertions, 154 deletions
| diff --git a/lib/common_test/doc/src/ct_run.xml b/lib/common_test/doc/src/ct_run.xml index d8e79ca80e..3ac8691fb5 100644 --- a/lib/common_test/doc/src/ct_run.xml +++ b/lib/common_test/doc/src/ct_run.xml @@ -86,98 +86,99 @@    <marker id="ct_run"></marker>      <title>Run tests from command line</title>      <pre> -	ct_run [-dir TestDir1 TestDir2 .. TestDirN] | -	[[-dir TestDir] -suite Suite1 Suite2 .. SuiteN -	 [[-group Groups1 Groups2 .. GroupsN] [-case Case1 Case2 .. CaseN]]] -	[-step [config | keep_inactive]] -	[-config ConfigFile1 ConfigFile2 .. ConfigFileN] -	[-userconfig CallbackModule1 ConfigString1 and CallbackModule2 -	 ConfigString2 and .. CallbackModuleN ConfigStringN] -	[-decrypt_key Key] | [-decrypt_file KeyFile] -	[-label Label] -	[-logdir LogDir] -	[-logopts LogOpts] -	[-verbosity GenVLevel | [Category1 VLevel1 and -	 Category2 VLevel2 and .. CategoryN VLevelN]] -	[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]] -	[-stylesheet CSSFile] -	[-cover CoverCfgFile] -	[-cover_stop Bool] -	[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] | -        [-event_handler_init EvHandler1 InitArg1 and -	 EvHandler2 InitArg2 and .. EvHandlerN InitArgN] -	[-include InclDir1 InclDir2 .. InclDirN] -	[-no_auto_compile] -	[-abort_if_missing_suites] -	[-muliply_timetraps Multiplier] -	[-scale_timetraps] -	[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] -        [-repeat N] | -        [-duration HHMMSS [-force_stop [skip_rest]]] | -        [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]] -	[-basic_html] -    	[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and .. -	 CTHModuleN CTHOptsN] -	[-exit_status ignore_config] +	ct_run -dir TestDir1 TestDir2 .. TestDirN | +	  [-dir TestDir] -suite Suite1 Suite2 .. SuiteN +	   [-group Groups1 Groups2 .. GroupsN] [-case Case1 Case2 .. CaseN] +	 [-step [config | keep_inactive]] +	 [-config ConfigFile1 ConfigFile2 .. ConfigFileN] +	 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2 +	  ConfigString2 and .. CallbackModuleN ConfigStringN] +	 [-decrypt_key Key] | [-decrypt_file KeyFile] +	 [-label Label] +	 [-logdir LogDir] +	 [-logopts LogOpts] +	 [-verbosity GenVLevel | [Category1 VLevel1 and +	  Category2 VLevel2 and .. CategoryN VLevelN]] +	 [-silent_connections [ConnType1 ConnType2 .. ConnTypeN]] +	 [-stylesheet CSSFile] +	 [-cover CoverCfgFile] +	 [-cover_stop Bool] +	 [-event_handler EvHandler1 EvHandler2 .. EvHandlerN] | +         [-event_handler_init EvHandler1 InitArg1 and +	  EvHandler2 InitArg2 and .. EvHandlerN InitArgN] +	 [-include InclDir1 InclDir2 .. InclDirN] +	 [-no_auto_compile] +	 [-abort_if_missing_suites] +	 [-muliply_timetraps Multiplier] +	 [-scale_timetraps] +	 [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] +         [-repeat N] | +         [-duration HHMMSS [-force_stop [skip_rest]]] | +         [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]] +	 [-basic_html] +    	 [-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and .. +	  CTHModuleN CTHOptsN] +	 [-exit_status ignore_config] +	 [-help]      </pre>    </section>    <section>      <title>Run tests using test specification</title>      <pre>  	ct_run -spec TestSpec1 TestSpec2 .. TestSpecN -	[-join_specs] -	[-config ConfigFile1 ConfigFile2 .. ConfigFileN] -	[-userconfig CallbackModule1 ConfigString1 and CallbackModule2 -         ConfigString2 and .. and CallbackModuleN ConfigStringN] -	[-decrypt_key Key] | [-decrypt_file KeyFile] -	[-label Label] -	[-logdir LogDir] -	[-logopts LogOpts] -	[-verbosity GenVLevel | [Category1 VLevel1 and -	 Category2 VLevel2 and .. CategoryN VLevelN]] -	[-allow_user_terms] -	[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]] -	[-stylesheet CSSFile] -	[-cover CoverCfgFile] -	[-cover_stop Bool] -	[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] | -        [-event_handler_init EvHandler1 InitArg1 and -	 EvHandler2 InitArg2 and .. EvHandlerN InitArgN] -	[-include InclDir1 InclDir2 .. InclDirN] -	[-no_auto_compile] -	[-abort_if_missing_suites] -	[-muliply_timetraps Multiplier] -	[-scale_timetraps] -	[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] -        [-repeat N] | -        [-duration HHMMSS [-force_stop [skip_rest]]] | -        [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]] -	[-basic_html] -    	[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and .. -	 CTHModuleN CTHOptsN] -	[-exit_status ignore_config] +	 [-join_specs] +	 [-config ConfigFile1 ConfigFile2 .. ConfigFileN] +	 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2 +          ConfigString2 and .. and CallbackModuleN ConfigStringN] +	 [-decrypt_key Key] | [-decrypt_file KeyFile] +	 [-label Label] +	 [-logdir LogDir] +	 [-logopts LogOpts] +	 [-verbosity GenVLevel | [Category1 VLevel1 and +	  Category2 VLevel2 and .. CategoryN VLevelN]] +	 [-allow_user_terms] +	 [-silent_connections [ConnType1 ConnType2 .. ConnTypeN]] +	 [-stylesheet CSSFile] +	 [-cover CoverCfgFile] +	 [-cover_stop Bool] +	 [-event_handler EvHandler1 EvHandler2 .. EvHandlerN] | +         [-event_handler_init EvHandler1 InitArg1 and +	  EvHandler2 InitArg2 and .. EvHandlerN InitArgN] +	 [-include InclDir1 InclDir2 .. InclDirN] +	 [-no_auto_compile] +	 [-abort_if_missing_suites] +	 [-muliply_timetraps Multiplier] +	 [-scale_timetraps] +	 [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] +         [-repeat N] | +         [-duration HHMMSS [-force_stop [skip_rest]]] | +         [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]] +	 [-basic_html] +    	 [-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and .. +	  CTHModuleN CTHOptsN] +	 [-exit_status ignore_config]      </pre>    </section>    <section>      <title>Run tests in web based GUI</title>      <pre>          ct_run -vts [-browser Browser] -        [-dir TestDir1 TestDir2 .. TestDirN] | -        [[dir TestDir] -suite Suite [[-group Group] [-case Case]]] -	[-config ConfigFile1 ConfigFile2 .. ConfigFileN] -	[-userconfig CallbackModule1 ConfigString1 and CallbackModule2 -         ConfigString2 and .. and CallbackModuleN ConfigStringN] -	[-logopts LogOpts] -	[-verbosity GenVLevel | [Category1 VLevel1 and -	 Category2 VLevel2 and .. CategoryN VLevelN]] -	[-decrypt_key Key] | [-decrypt_file KeyFile] -	[-include InclDir1 InclDir2 .. InclDirN] -	[-no_auto_compile] -	[-abort_if_missing_suites] -	[-muliply_timetraps Multiplier] -	[-scale_timetraps] -	[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] -	[-basic_html]</pre> +         [-dir TestDir1 TestDir2 .. TestDirN] | +         [[dir TestDir] -suite Suite [[-group Group] [-case Case]]] +	 [-config ConfigFile1 ConfigFile2 .. ConfigFileN] +	 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2 +          ConfigString2 and .. and CallbackModuleN ConfigStringN] +	 [-logopts LogOpts] +	 [-verbosity GenVLevel | [Category1 VLevel1 and +	  Category2 VLevel2 and .. CategoryN VLevelN]] +	 [-decrypt_key Key] | [-decrypt_file KeyFile] +	 [-include InclDir1 InclDir2 .. InclDirN] +	 [-no_auto_compile] +	 [-abort_if_missing_suites] +	 [-muliply_timetraps Multiplier] +	 [-scale_timetraps] +	 [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc] +	 [-basic_html]</pre>    </section>    <section>      <title>Refresh the HTML index files</title> @@ -188,10 +189,10 @@      <title>Run CT in interactive mode</title>      <pre>  	ct_run -shell -	[-config ConfigFile1 ConfigFile2 ... ConfigFileN] -	[-userconfig CallbackModule1 ConfigString1 and CallbackModule2 -         ConfigString2 and .. and CallbackModuleN ConfigStringN] -	[-decrypt_key Key] | [-decrypt_file KeyFile]</pre> +	 [-config ConfigFile1 ConfigFile2 ... ConfigFileN] +	 [-userconfig CallbackModule1 ConfigString1 and CallbackModule2 +          ConfigString2 and .. and CallbackModuleN ConfigStringN] +	 [-decrypt_key Key] | [-decrypt_file KeyFile]</pre>    </section>    <section>      <title>Start a Common Test Master node</title> diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml index df60e5f7f2..fc8d82c2c3 100644 --- a/lib/common_test/doc/src/run_test_chapter.xml +++ b/lib/common_test/doc/src/run_test_chapter.xml @@ -149,6 +149,7 @@      <p>Other flags that may be used with <c>ct_run</c>:</p>      <list> +      <item><c><![CDATA[-help]]></c>, lists all available start flags.</item>        <item><c><![CDATA[-logdir <dir>]]></c>, specifies where the HTML log files are to be written.</item>        <item><c><![CDATA[-label <name_of_test_run>]]></c>, associates the test run with a name that gets printed  	in the overview HTML log files.</item> @@ -223,6 +224,9 @@        behaviour using start flag:</p>      <pre>-exit_status ignore_config</pre> +    <note><p>Executing <c>ct_run</c> without start flags, is equal to the command: +    <c>ct_run -dir ./</c></p></note> +      <p>For more information about the <c>ct_run</c> program, see the        <seealso marker="ct_run">Reference Manual</seealso> and the        <seealso marker="install_chapter#general">Installation</seealso> chapter. @@ -251,6 +255,10 @@  	<c>{error,Reason}</c>, where the term <c>Reason</c> explains the  	failure.</p> +      <p>The default start option <c>{dir,Cwd}</c> (run all suites in the current +      working directory) is used if the function is called with an empty +      list of options.</p> +  	<section>  	  <title>Releasing the Erlang shell</title>  	  <p>During execution of tests, started with diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 0eafe72020..0df74fdff2 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -687,8 +687,10 @@ script_start3(Opts, Args) ->  	    if Opts#opts.vts ; Opts#opts.shell ->  		    script_start4(Opts#opts{tests = []}, Args);  	       true -> -		    script_usage(), -		    {error,missing_start_options} +		    %% no start options, use default "-dir ./" +		    {ok,Dir} = file:get_cwd(), +		    io:format("ct_run -dir ~ts~n~n", [Dir]), +		    script_start4(Opts#opts{tests = tests([Dir])}, Args)  	    end      end. @@ -767,82 +769,84 @@ script_start4(Opts = #opts{tests = Tests}, Args) ->  %%% @spec script_usage() -> ok  %%% @doc Print usage information for <code>ct_run</code>.  script_usage() -> -    io:format("\n\nUsage:\n\n"), +    io:format("\nUsage:\n\n"),      io:format("Run tests from command line:\n\n" -	      "\tct_run [-dir TestDir1 TestDir2 .. TestDirN] |" -	      "\n\t[[-dir TestDir] -suite Suite1 Suite2 .. SuiteN" -	      "\n\t [[-group Groups1 Groups2 .. GroupsN] [-case Case1 Case2 .. CaseN]]]" -	      "\n\t[-step [config | keep_inactive]]" -	      "\n\t[-config ConfigFile1 ConfigFile2 .. ConfigFileN]" -	      "\n\t[-userconfig CallbackModule ConfigFile1 .. ConfigFileN]" -	      "\n\t[-decrypt_key Key] | [-decrypt_file KeyFile]" -	      "\n\t[-logdir LogDir]" -	      "\n\t[-logopts LogOpt1 LogOpt2 .. LogOptN]" -	      "\n\t[-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" -	      "\n\t[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]" -	      "\n\t[-stylesheet CSSFile]"	      -	      "\n\t[-cover CoverCfgFile]" -	      "\n\t[-cover_stop Bool]" -	      "\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" -	      "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]" -	      "\n\t[-include InclDir1 InclDir2 .. InclDirN]" -	      "\n\t[-no_auto_compile]" -	      "\n\t[-abort_if_missing_suites]" -	      "\n\t[-multiply_timetraps N]" -	      "\n\t[-scale_timetraps]" -	      "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" -	      "\n\t[-basic_html]" -	      "\n\t[-repeat N] |" -	      "\n\t[-duration HHMMSS [-force_stop [skip_rest]]] |" -	      "\n\t[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]\n\n"), +	      "\tct_run -dir TestDir1 TestDir2 .. TestDirN |" +	      "\n\t  [-dir TestDir] -suite Suite1 Suite2 .. SuiteN" +	      "\n\t   [-group Group1 Group2 .. GroupN] [-case Case1 Case2 .. CaseN]" +	      "\n\t [-step [config | keep_inactive]]" +	      "\n\t [-config ConfigFile1 ConfigFile2 .. ConfigFileN]" +	      "\n\t [-userconfig CallbackModule ConfigFile1 .. ConfigFileN]" +	      "\n\t [-decrypt_key Key] | [-decrypt_file KeyFile]" +	      "\n\t [-logdir LogDir]" +	      "\n\t [-logopts LogOpt1 LogOpt2 .. LogOptN]" +	      "\n\t [-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" +	      "\n\t [-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]" +	      "\n\t [-stylesheet CSSFile]"	      +	      "\n\t [-cover CoverCfgFile]" +	      "\n\t [-cover_stop Bool]" +	      "\n\t [-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" +	      "\n\t [-ct_hooks CTHook1 CTHook2 .. CTHookN]" +	      "\n\t [-include InclDir1 InclDir2 .. InclDirN]" +	      "\n\t [-no_auto_compile]" +	      "\n\t [-abort_if_missing_suites]" +	      "\n\t [-multiply_timetraps N]" +	      "\n\t [-scale_timetraps]" +	      "\n\t [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" +	      "\n\t [-basic_html]" +	      "\n\t [-repeat N] |" +	      "\n\t [-duration HHMMSS [-force_stop [skip_rest]]] |" +	      "\n\t [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]" +	      "\n\t [-exit_status ignore_config]" +	      "\n\t [-help]\n\n"),      io:format("Run tests using test specification:\n\n"  	      "\tct_run -spec TestSpec1 TestSpec2 .. TestSpecN" -	      "\n\t[-config ConfigFile1 ConfigFile2 .. ConfigFileN]" -	      "\n\t[-decrypt_key Key] | [-decrypt_file KeyFile]" -	      "\n\t[-logdir LogDir]" -	      "\n\t[-logopts LogOpt1 LogOpt2 .. LogOptN]" -	      "\n\t[-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" -	      "\n\t[-allow_user_terms]" -	      "\n\t[-join_specs]" -	      "\n\t[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]" -	      "\n\t[-stylesheet CSSFile]" -	      "\n\t[-cover CoverCfgFile]" -	      "\n\t[-cover_stop Bool]" -	      "\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" -	      "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]" -	      "\n\t[-include InclDir1 InclDir2 .. InclDirN]" -	      "\n\t[-no_auto_compile]" -	      "\n\t[-abort_if_missing_suites]" -	      "\n\t[-multiply_timetraps N]" -	      "\n\t[-scale_timetraps]" -	      "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" -	      "\n\t[-basic_html]" -	      "\n\t[-repeat N] |" -	      "\n\t[-duration HHMMSS [-force_stop [skip_rest]]] |" -	      "\n\t[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]\n\n"), +	      "\n\t [-config ConfigFile1 ConfigFile2 .. ConfigFileN]" +	      "\n\t [-decrypt_key Key] | [-decrypt_file KeyFile]" +	      "\n\t [-logdir LogDir]" +	      "\n\t [-logopts LogOpt1 LogOpt2 .. LogOptN]" +	      "\n\t [-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" +	      "\n\t [-allow_user_terms]" +	      "\n\t [-join_specs]" +	      "\n\t [-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]" +	      "\n\t [-stylesheet CSSFile]" +	      "\n\t [-cover CoverCfgFile]" +	      "\n\t [-cover_stop Bool]" +	      "\n\t [-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" +	      "\n\t [-ct_hooks CTHook1 CTHook2 .. CTHookN]" +	      "\n\t [-include InclDir1 InclDir2 .. InclDirN]" +	      "\n\t [-no_auto_compile]" +	      "\n\t [-abort_if_missing_suites]" +	      "\n\t [-multiply_timetraps N]" +	      "\n\t [-scale_timetraps]" +	      "\n\t [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" +	      "\n\t [-basic_html]" +	      "\n\t [-repeat N] |" +	      "\n\t [-duration HHMMSS [-force_stop [skip_rest]]] |" +	      "\n\t [-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]\n\n"),      io:format("Refresh the HTML index files:\n\n"  	      "\tct_run -refresh_logs [LogDir]" -	      "[-logdir LogDir] " -	      "[-basic_html]\n\n"), +	      " [-logdir LogDir] " +	      " [-basic_html]\n\n"),      io:format("Run CT in interactive mode:\n\n"  	      "\tct_run -shell" -	      "\n\t[-config ConfigFile1 ConfigFile2 .. ConfigFileN]" -	      "\n\t[-decrypt_key Key] | [-decrypt_file KeyFile]\n\n"), +	      "\n\t [-config ConfigFile1 ConfigFile2 .. ConfigFileN]" +	      "\n\t [-decrypt_key Key] | [-decrypt_file KeyFile]\n\n"),      io:format("Run tests in web based GUI:\n\n"  	      "\tct_run -vts [-browser Browser]" -	      "\n\t[-config ConfigFile1 ConfigFile2 .. ConfigFileN]" -	      "\n\t[-decrypt_key Key] | [-decrypt_file KeyFile]" -	      "\n\t[-dir TestDir1 TestDir2 .. TestDirN] |" -	      "\n\t[-suite Suite [-case Case]]" -	      "\n\t[-logopts LogOpt1 LogOpt2 .. LogOptN]" -	      "\n\t[-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" -	      "\n\t[-include InclDir1 InclDir2 .. InclDirN]" -	      "\n\t[-no_auto_compile]" -	      "\n\t[-abort_if_missing_suites]" -	      "\n\t[-multiply_timetraps N]" -	      "\n\t[-scale_timetraps]" -	      "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" -	      "\n\t[-basic_html]\n\n"). +	      "\n\t [-config ConfigFile1 ConfigFile2 .. ConfigFileN]" +	      "\n\t [-decrypt_key Key] | [-decrypt_file KeyFile]" +	      "\n\t [-dir TestDir1 TestDir2 .. TestDirN] |" +	      "\n\t [-suite Suite [-case Case]]" +	      "\n\t [-logopts LogOpt1 LogOpt2 .. LogOptN]" +	      "\n\t [-verbosity GenVLvl | [CategoryVLvl1 .. CategoryVLvlN]]" +	      "\n\t [-include InclDir1 InclDir2 .. InclDirN]" +	      "\n\t [-no_auto_compile]" +	      "\n\t [-abort_if_missing_suites]" +	      "\n\t [-multiply_timetraps N]" +	      "\n\t [-scale_timetraps]" +	      "\n\t [-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" +	      "\n\t [-basic_html]\n\n").  %%%-----------------------------------------------------------------  %%% @hidden @@ -1347,7 +1351,9 @@ run_dir(Opts = #opts{logdir = LogDir,  	    end;  	{undefined,undefined,[]} -> -	    exit({error,no_test_specified}); +	    {ok,Dir} = file:get_cwd(), +	    %% No start options, use default {dir,CWD} +	    reformat_result(catch do_run(tests(Dir), [], Opts1, StartOpts));  	{Dir,Suite,GsAndCs} ->  	    exit({error,{incorrect_start_options,{Dir,Suite,GsAndCs}}}) | 
