From a0a088704e17a9c9f9a0013f07aa90d880a7a50e Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Tue, 9 Jun 2015 00:51:56 +0200 Subject: Change default start actions and update documentation --- lib/common_test/doc/src/ct_run.xml | 169 ++++++++++++++------------- lib/common_test/doc/src/run_test_chapter.xml | 8 ++ 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 @@ Run tests from command line
-	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]
     
Run tests using test specification
 	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]
     
Run tests in web based GUI
         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]
+ [-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]
Refresh the HTML index files @@ -188,10 +189,10 @@ Run CT in interactive mode
 	ct_run -shell
-	[-config ConfigFile1 ConfigFile2 ... ConfigFileN]
-	[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
-         ConfigString2 and .. and CallbackModuleN ConfigStringN]
-	[-decrypt_key Key] | [-decrypt_file KeyFile]
+ [-config ConfigFile1 ConfigFile2 ... ConfigFileN] + [-userconfig CallbackModule1 ConfigString1 and CallbackModule2 + ConfigString2 and .. and CallbackModuleN ConfigStringN] + [-decrypt_key Key] | [-decrypt_file KeyFile]
Start a Common Test Master node 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 @@

Other flags that may be used with ct_run:

+ , lists all available start flags. ]]>, specifies where the HTML log files are to be written. ]]>, associates the test run with a name that gets printed in the overview HTML log files. @@ -223,6 +224,9 @@ behaviour using start flag:

-exit_status ignore_config
+

Executing ct_run without start flags, is equal to the command: + ct_run -dir ./

+

For more information about the ct_run program, see the Reference Manual and the Installation chapter. @@ -251,6 +255,10 @@ {error,Reason}, where the term Reason explains the failure.

+

The default start option {dir,Cwd} (run all suites in the current + working directory) is used if the function is called with an empty + list of options.

+
Releasing the Erlang shell

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 ct_run. 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}}}) -- cgit v1.2.3