diff options
-rw-r--r-- | lib/common_test/src/ct.erl | 6 | ||||
-rw-r--r-- | lib/common_test/src/ct_run.erl | 50 | ||||
-rw-r--r-- | lib/common_test/src/ct_testspec.erl | 26 | ||||
-rw-r--r-- | lib/common_test/src/ct_util.hrl | 2 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE.erl | 96 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_run.spec | 5 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_tc.spec | 5 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/manual_per_tc.spec | 5 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/priv_dir_SUITE.erl | 4 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/unique_auto.spec | 5 | ||||
-rw-r--r-- | lib/common_test/test/ct_priv_dir_SUITE_data/unique_manual.spec | 5 | ||||
-rw-r--r-- | lib/test_server/src/test_server_ctrl.erl | 56 |
12 files changed, 146 insertions, 119 deletions
diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl index 83ed0a66d7..63a8adbc63 100644 --- a/lib/common_test/src/ct.erl +++ b/lib/common_test/src/ct.erl @@ -676,9 +676,9 @@ send_html_comment(Comment) -> %%%----------------------------------------------------------------- %%% @spec make_priv_dir() -> ok | {error,Reason} %%% Reason = term() -%%% @doc If the test has been started with the unique_priv_dir -%%% option set to manual, in order for the test case to use the -%%% private directory, it must first create it by calling +%%% @doc If the test has been started with the create_priv_dir +%%% option set to manual_per_tc, in order for the test case to use +%%% the private directory, it must first create it by calling %%% this function. make_priv_dir() -> test_server:make_priv_dir(). diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 19afb4b9f6..ef3e1b6a32 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -63,7 +63,7 @@ stylesheet, multiply_timetraps = 1, scale_timetraps = false, - unique_priv_dir, + create_priv_dir, testspecs = [], tests}). @@ -179,9 +179,9 @@ script_start1(Parent, Args) -> fun([CT]) -> list_to_atom(CT); ([]) -> true end, false, Args), - UniquePrivDir = get_start_opt(unique_priv_dir, - fun([UPD]) -> list_to_atom(UPD); - ([]) -> auto + CreatePrivDir = get_start_opt(create_priv_dir, + fun([PD]) -> list_to_atom(PD); + ([]) -> auto_per_tc end, Args), EvHandlers = event_handler_args2opts(Args), CTHooks = ct_hooks_args2opts(Args), @@ -261,7 +261,7 @@ script_start1(Parent, Args) -> stylesheet = Stylesheet, multiply_timetraps = MultTT, scale_timetraps = ScaleTT, - unique_priv_dir = UniquePrivDir}, + create_priv_dir = CreatePrivDir}, %% check if log files should be refreshed or go on to run tests... Result = run_or_refresh(StartOpts, Args), @@ -335,9 +335,9 @@ script_start2(StartOpts = #opts{vts = undefined, choose_val(StartOpts#opts.scale_timetraps, SpecStartOpts#opts.scale_timetraps), - UniquePrivDir = - choose_val(StartOpts#opts.unique_priv_dir, - SpecStartOpts#opts.unique_priv_dir), + CreatePrivDir = + choose_val(StartOpts#opts.create_priv_dir, + SpecStartOpts#opts.create_priv_dir), AllEvHs = merge_vals([StartOpts#opts.event_handlers, @@ -370,7 +370,7 @@ script_start2(StartOpts = #opts{vts = undefined, include = AllInclude, multiply_timetraps = MultTT, scale_timetraps = ScaleTT, - unique_priv_dir = UniquePrivDir}} + create_priv_dir = CreatePrivDir}} end; _ -> {undefined,StartOpts} @@ -583,7 +583,7 @@ script_usage() -> "\n\t[-no_auto_compile]" "\n\t[-multiply_timetraps N]" "\n\t[-scale_timetraps]" - "\n\t[-unique_priv_dir [auto | manual]]" + "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" "\n\t[-basic_html]\n\n"), io:format("Run tests from command line:\n\n" "\tct_run [-dir TestDir1 TestDir2 .. TestDirN] |" @@ -603,7 +603,7 @@ script_usage() -> "\n\t[-no_auto_compile]" "\n\t[-multiply_timetraps N]" "\n\t[-scale_timetraps]" - "\n\t[-unique_priv_dir [auto | manual]]" + "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" "\n\t[-basic_html]" "\n\t[-repeat N [-force_stop]] |" "\n\t[-duration HHMMSS [-force_stop]] |" @@ -624,7 +624,7 @@ script_usage() -> "\n\t[-no_auto_compile]" "\n\t[-multiply_timetraps N]" "\n\t[-scale_timetraps]" - "\n\t[-unique_priv_dir [auto | manual]]" + "\n\t[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]" "\n\t[-basic_html]" "\n\t[-repeat N [-force_stop]] |" "\n\t[-duration HHMMSS [-force_stop]] |" @@ -802,7 +802,7 @@ run_test2(StartOpts) -> ScaleTT = get_start_opt(scale_timetraps, value, false, StartOpts), %% create unique priv dir names - UniquePrivDir = get_start_opt(unique_priv_dir, value, StartOpts), + CreatePrivDir = get_start_opt(create_priv_dir, value, StartOpts), %% auto compile & include files Include = @@ -865,7 +865,7 @@ run_test2(StartOpts) -> stylesheet = Stylesheet, multiply_timetraps = MultiplyTT, scale_timetraps = ScaleTT, - unique_priv_dir = UniquePrivDir}, + create_priv_dir = CreatePrivDir}, %% test specification case proplists:get_value(spec, StartOpts) of @@ -912,8 +912,8 @@ run_spec_file(Relaxed, SpecOpts#opts.multiply_timetraps), ScaleTT = choose_val(Opts#opts.scale_timetraps, SpecOpts#opts.scale_timetraps), - UniquePrivDir = choose_val(Opts#opts.unique_priv_dir, - SpecOpts#opts.unique_priv_dir), + CreatePrivDir = choose_val(Opts#opts.create_priv_dir, + SpecOpts#opts.create_priv_dir), AllEvHs = merge_vals([Opts#opts.event_handlers, SpecOpts#opts.event_handlers]), AllInclude = merge_vals([Opts#opts.include, @@ -937,7 +937,7 @@ run_spec_file(Relaxed, testspecs = AbsSpecs, multiply_timetraps = MultTT, scale_timetraps = ScaleTT, - unique_priv_dir = UniquePrivDir, + create_priv_dir = CreatePrivDir, ct_hooks = AllCTHooks, enable_builtin_hooks = EnableBuiltinHooks }, @@ -1197,7 +1197,7 @@ get_data_for_node(#testspec{label = Labels, include = Incl, multiply_timetraps = MTs, scale_timetraps = STs, - unique_priv_dir = UPDs}, Node) -> + create_priv_dir = PDs}, Node) -> Label = proplists:get_value(Node, Labels), Profile = proplists:get_value(Node, Profiles), LogDir = case proplists:get_value(Node, LogDirs) of @@ -1211,7 +1211,7 @@ get_data_for_node(#testspec{label = Labels, Cover = proplists:get_value(Node, CoverFs), MT = proplists:get_value(Node, MTs), ST = proplists:get_value(Node, STs), - UniquePrivDir = proplists:get_value(Node, UPDs), + CreatePrivDir = proplists:get_value(Node, PDs), ConfigFiles = [{?ct_config_txt,F} || {N,F} <- Cfgs, N==Node] ++ [CBF || {N,CBF} <- UsrCfgs, N==Node], EvHandlers = [{H,A} || {N,H,A} <- EvHs, N==Node], @@ -1229,7 +1229,7 @@ get_data_for_node(#testspec{label = Labels, include = Include, multiply_timetraps = MT, scale_timetraps = ST, - unique_priv_dir = UniquePrivDir}. + create_priv_dir = CreatePrivDir}. refresh_logs(LogDir) -> {ok,Cwd} = file:get_cwd(), @@ -1871,8 +1871,8 @@ do_run_test(Tests, Skip, Opts) -> test_server_ctrl:multiply_timetraps(Opts#opts.multiply_timetraps), test_server_ctrl:scale_timetraps(Opts#opts.scale_timetraps), - test_server_ctrl:unique_priv_dir(choose_val(Opts#opts.unique_priv_dir, - false)), + test_server_ctrl:create_priv_dir(choose_val(Opts#opts.create_priv_dir, + auto_per_run)), ct_event:notify(#event{name=start_info, node=node(), data={NoOfTests,NoOfSuites,NoOfCases}}), @@ -2450,10 +2450,10 @@ opts2args(EnvStartOpts) -> [{scale_timetraps,[]}]; ({scale_timetraps,false}) -> []; - ({unique_priv_dir,false}) -> + ({create_priv_dir,auto_per_run}) -> []; - ({unique_priv_dir,UPD}) when is_atom(UPD) -> - [{unique_priv_dir,[atom_to_list(UPD)]}]; + ({create_priv_dir,PD}) when is_atom(PD) -> + [{create_priv_dir,[atom_to_list(PD)]}]; ({force_stop,true}) -> [{force_stop,[]}]; ({force_stop,false}) -> diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index 9e8065c636..5b197c0c81 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -568,20 +568,20 @@ add_tests([{scale_timetraps,Node,ST}|Ts],Spec) -> add_tests([{scale_timetraps,ST}|Ts],Spec) -> add_tests([{scale_timetraps,all_nodes,ST}|Ts],Spec); -%% --- unique_priv_dir --- -add_tests([{unique_priv_dir,all_nodes,UPD}|Ts],Spec) -> - Tests = lists:map(fun(N) -> {unique_priv_dir,N,UPD} end, list_nodes(Spec)), +%% --- create_priv_dir --- +add_tests([{create_priv_dir,all_nodes,PD}|Ts],Spec) -> + Tests = lists:map(fun(N) -> {create_priv_dir,N,PD} end, list_nodes(Spec)), add_tests(Tests++Ts,Spec); -add_tests([{unique_priv_dir,Nodes,UPD}|Ts],Spec) when is_list(Nodes) -> - Ts1 = separate(Nodes,unique_priv_dir,[UPD],Ts,Spec#testspec.nodes), +add_tests([{create_priv_dir,Nodes,PD}|Ts],Spec) when is_list(Nodes) -> + Ts1 = separate(Nodes,create_priv_dir,[PD],Ts,Spec#testspec.nodes), add_tests(Ts1,Spec); -add_tests([{unique_priv_dir,Node,UPD}|Ts],Spec) -> - UPDs = Spec#testspec.unique_priv_dir, - UPDs1 = [{ref2node(Node,Spec#testspec.nodes),UPD} | - lists:keydelete(ref2node(Node,Spec#testspec.nodes),1,UPDs)], - add_tests(Ts,Spec#testspec{unique_priv_dir=UPDs1}); -add_tests([{unique_priv_dir,UPD}|Ts],Spec) -> - add_tests([{unique_priv_dir,all_nodes,UPD}|Ts],Spec); +add_tests([{create_priv_dir,Node,PD}|Ts],Spec) -> + PDs = Spec#testspec.create_priv_dir, + PDs1 = [{ref2node(Node,Spec#testspec.nodes),PD} | + lists:keydelete(ref2node(Node,Spec#testspec.nodes),1,PDs)], + add_tests(Ts,Spec#testspec{create_priv_dir=PDs1}); +add_tests([{create_priv_dir,PD}|Ts],Spec) -> + add_tests([{create_priv_dir,all_nodes,PD}|Ts],Spec); %% --- config --- add_tests([{config,all_nodes,Files}|Ts],Spec) -> @@ -1174,7 +1174,7 @@ valid_terms() -> {skip_groups,7}, {skip_cases,5}, {skip_cases,6}, - {unique_priv_dir,2} + {create_priv_dir,2} ]. %% this function "guesses" if the user has misspelled a term name diff --git a/lib/common_test/src/ct_util.hrl b/lib/common_test/src/ct_util.hrl index da96743732..082599a9c6 100644 --- a/lib/common_test/src/ct_util.hrl +++ b/lib/common_test/src/ct_util.hrl @@ -43,7 +43,7 @@ include=[], multiply_timetraps=[], scale_timetraps=[], - unique_priv_dir=[], + create_priv_dir=[], alias=[], tests=[], merge_tests=true}). diff --git a/lib/common_test/test/ct_priv_dir_SUITE.erl b/lib/common_test/test/ct_priv_dir_SUITE.erl index bfc579d7f1..f6942d59bf 100644 --- a/lib/common_test/test/ct_priv_dir_SUITE.erl +++ b/lib/common_test/test/ct_priv_dir_SUITE.erl @@ -21,7 +21,7 @@ %%% File: ct_priv_dir_SUITE %%% %%% Description: -%%% Test that it works to use the unique_priv_dir option. +%%% Test that it works to use the create_priv_dir option. %%% %%%------------------------------------------------------------------- -module(ct_priv_dir_SUITE). @@ -60,11 +60,13 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [ default, - unique_auto, - unique_manual, + auto_per_run, + auto_per_tc, + manual_per_tc, spec_default, - spec_unique_auto, - spec_unique_manual + spec_auto_per_run, + spec_auto_per_run, + spec_manual_per_tc ]. %%-------------------------------------------------------------------- @@ -82,23 +84,33 @@ default(Config) when is_list(Config) -> %%%----------------------------------------------------------------- %%% -unique_auto(Config) when is_list(Config) -> +auto_per_run(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), Suite = filename:join(DataDir, "priv_dir_SUITE"), - {Opts,ERPid} = setup([{suite,Suite},{testcase,unique_auto}, - {label,unique_auto}, - {unique_priv_dir,auto}], Config), - ok = execute(unique_auto, Opts, ERPid, Config). + {Opts,ERPid} = setup([{suite,Suite},{testcase,default}, + {label,auto_per_run}, + {create_priv_dir,auto_per_run}], Config), + ok = execute(auto_per_run, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +auto_per_tc(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "priv_dir_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{testcase,auto_per_tc}, + {label,auto_per_tc}, + {create_priv_dir,auto_per_tc}], Config), + ok = execute(auto_per_tc, Opts, ERPid, Config). %%%----------------------------------------------------------------- %%% -unique_manual(Config) when is_list(Config) -> +manual_per_tc(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), Suite = filename:join(DataDir, "priv_dir_SUITE"), - {Opts,ERPid} = setup([{suite,Suite},{testcase,unique_manual}, - {label,unique_manual}, - {unique_priv_dir,manual}], Config), - ok = execute(unique_manual, Opts, ERPid, Config). + {Opts,ERPid} = setup([{suite,Suite},{testcase,manual_per_tc}, + {label,manual_per_tc}, + {create_priv_dir,manual_per_tc}], Config), + ok = execute(manual_per_tc, Opts, ERPid, Config). %%%----------------------------------------------------------------- %%% @@ -111,21 +123,30 @@ spec_default(Config) when is_list(Config) -> %%%----------------------------------------------------------------- %%% -spec_unique_auto(Config) when is_list(Config) -> +spec_auto_per_run(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Spec = filename:join(DataDir, "auto_per_run.spec"), + {Opts,ERPid} = setup([{spec,Spec}, + {label,spec_auto_per_run}], Config), + ok = execute(spec_auto_per_run, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +spec_auto_per_tc(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), - Spec = filename:join(DataDir, "unique_auto.spec"), + Spec = filename:join(DataDir, "auto_per_tc.spec"), {Opts,ERPid} = setup([{spec,Spec}, - {label,spec_unique_auto}], Config), - ok = execute(spec_unique_auto, Opts, ERPid, Config). + {label,spec_auto_per_tc}], Config), + ok = execute(spec_auto_per_tc, Opts, ERPid, Config). %%%----------------------------------------------------------------- %%% -spec_unique_manual(Config) when is_list(Config) -> +spec_manual_per_tc(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), - Spec = filename:join(DataDir, "unique_manual.spec"), + Spec = filename:join(DataDir, "manual_per_tc.spec"), {Opts,ERPid} = setup([{spec,Spec}, - {label,spec_unique_manual}], Config), - ok = execute(spec_unique_manual, Opts, ERPid, Config). + {label,spec_manual_per_tc}], Config), + ok = execute(spec_manual_per_tc, Opts, ERPid, Config). %%%----------------------------------------------------------------- @@ -168,7 +189,7 @@ events_to_check(Test, N) -> test_events(Test) ++ events_to_check(Test, N-1). -test_events(default) -> +test_events(DEF) when DEF == default ; DEF == auto_per_run -> [ {?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, @@ -183,35 +204,36 @@ test_events(default) -> {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; -test_events(unique_auto) -> +test_events(auto_per_tc) -> [{?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,1}}, {?eh,tc_start,{priv_dir_SUITE,init_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{priv_dir_SUITE,unique_auto}}, - {?eh,tc_done,{priv_dir_SUITE,unique_auto,ok}}, + {?eh,tc_start,{priv_dir_SUITE,auto_per_tc}}, + {?eh,tc_done,{priv_dir_SUITE,auto_per_tc,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{priv_dir_SUITE,end_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,end_per_suite,ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; -test_events(unique_manual) -> +test_events(manual_per_tc) -> [{?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,1}}, {?eh,tc_start,{priv_dir_SUITE,init_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{priv_dir_SUITE,unique_manual}}, - {?eh,tc_done,{priv_dir_SUITE,unique_manual,ok}}, + {?eh,tc_start,{priv_dir_SUITE,manual_per_tc}}, + {?eh,tc_done,{priv_dir_SUITE,manual_per_tc,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{priv_dir_SUITE,end_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,end_per_suite,ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; -test_events(spec_default) -> +test_events(SPECDEF) when SPECDEF == spec_default ; + SPECDEF == spec_auto_per_run -> [{?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,1}}, @@ -225,28 +247,28 @@ test_events(spec_default) -> {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; -test_events(spec_unique_auto) -> +test_events(spec_auto_per_tc) -> [{?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,1}}, {?eh,tc_start,{priv_dir_SUITE,init_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{priv_dir_SUITE,unique_auto}}, - {?eh,tc_done,{priv_dir_SUITE,unique_auto,ok}}, + {?eh,tc_start,{priv_dir_SUITE,auto_per_tc}}, + {?eh,tc_done,{priv_dir_SUITE,auto_per_tc,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{priv_dir_SUITE,end_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,end_per_suite,ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; -test_events(spec_unique_manual) -> +test_events(spec_manual_per_tc) -> [{?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,1}}, {?eh,tc_start,{priv_dir_SUITE,init_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{priv_dir_SUITE,unique_manual}}, - {?eh,tc_done,{priv_dir_SUITE,unique_manual,ok}}, + {?eh,tc_start,{priv_dir_SUITE,manual_per_tc}}, + {?eh,tc_done,{priv_dir_SUITE,manual_per_tc,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{priv_dir_SUITE,end_per_suite}}, {?eh,tc_done,{priv_dir_SUITE,end_per_suite,ok}}, diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_run.spec b/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_run.spec new file mode 100644 index 0000000000..4dde0ed1f4 --- /dev/null +++ b/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_run.spec @@ -0,0 +1,5 @@ +{create_priv_dir, auto_per_run}. + +{alias, curr, "./"}. + +{cases, curr, priv_dir_SUITE, default}.
\ No newline at end of file diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_tc.spec b/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_tc.spec new file mode 100644 index 0000000000..c265500865 --- /dev/null +++ b/lib/common_test/test/ct_priv_dir_SUITE_data/auto_per_tc.spec @@ -0,0 +1,5 @@ +{create_priv_dir, auto_per_tc}. + +{alias, curr, "./"}. + +{cases, curr, priv_dir_SUITE, auto_per_tc}.
\ No newline at end of file diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/manual_per_tc.spec b/lib/common_test/test/ct_priv_dir_SUITE_data/manual_per_tc.spec new file mode 100644 index 0000000000..4f98734d5f --- /dev/null +++ b/lib/common_test/test/ct_priv_dir_SUITE_data/manual_per_tc.spec @@ -0,0 +1,5 @@ +{create_priv_dir, manual_per_tc}. + +{alias, curr, "./"}. + +{cases, curr, priv_dir_SUITE, manual_per_tc}.
\ No newline at end of file diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/priv_dir_SUITE.erl b/lib/common_test/test/ct_priv_dir_SUITE_data/priv_dir_SUITE.erl index 0fe337135b..423cb2999b 100644 --- a/lib/common_test/test/ct_priv_dir_SUITE_data/priv_dir_SUITE.erl +++ b/lib/common_test/test/ct_priv_dir_SUITE_data/priv_dir_SUITE.erl @@ -113,12 +113,12 @@ default(Config) -> "log_private" = filename:basename(PrivDir), {ok,_} = file:list_dir(PrivDir). -unique_auto(Config) -> +auto_per_tc(Config) -> PrivDir = proplists:get_value(priv_dir, Config), ["log_private",_] = string:tokens(filename:basename(PrivDir), "."), {ok,_} = file:list_dir(PrivDir). -unique_manual(Config) -> +manual_per_tc(Config) -> PrivDir = proplists:get_value(priv_dir, Config), ["log_private",_] = string:tokens(filename:basename(PrivDir), "."), {error,_} = file:list_dir(PrivDir), diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/unique_auto.spec b/lib/common_test/test/ct_priv_dir_SUITE_data/unique_auto.spec deleted file mode 100644 index a64a09ecf0..0000000000 --- a/lib/common_test/test/ct_priv_dir_SUITE_data/unique_auto.spec +++ /dev/null @@ -1,5 +0,0 @@ -{unique_priv_dir, auto}. - -{alias, curr, "./"}. - -{cases, curr, priv_dir_SUITE, unique_auto}.
\ No newline at end of file diff --git a/lib/common_test/test/ct_priv_dir_SUITE_data/unique_manual.spec b/lib/common_test/test/ct_priv_dir_SUITE_data/unique_manual.spec deleted file mode 100644 index 9af9197c18..0000000000 --- a/lib/common_test/test/ct_priv_dir_SUITE_data/unique_manual.spec +++ /dev/null @@ -1,5 +0,0 @@ -{unique_priv_dir, manual}. - -{alias, curr, "./"}. - -{cases, curr, priv_dir_SUITE, unique_manual}.
\ No newline at end of file diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index ecb1125b1e..50720a45c8 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -164,7 +164,7 @@ -export([start_get_totals/1, stop_get_totals/0]). -export([get_levels/0, set_levels/3]). -export([multiply_timetraps/1, scale_timetraps/1, get_timetrap_parameters/0]). --export([unique_priv_dir/1]). +-export([create_priv_dir/1]). -export([cover/2, cover/3, cover/7, cross_cover_analyse/1, cross_cover_analyse/2, trc/1, stop_trace/0]). -export([testcase_callback/1]). @@ -221,7 +221,7 @@ -record(state,{jobs=[],levels={1,19,10}, multiply_timetraps=1, scale_timetraps=true, - unique_priv_dir=false, finish=false, + create_priv_dir=auto_per_run, finish=false, target_info, trc=false, cover=false, wait_for_node=[], testcase_callback=undefined, idle_notify=[], get_totals=false, random_seed=undefined}). @@ -507,8 +507,8 @@ scale_timetraps(Bool) -> get_timetrap_parameters() -> controller_call(get_timetrap_parameters). -unique_priv_dir(Value) -> - controller_call({unique_priv_dir,Value}). +create_priv_dir(Value) -> + controller_call({create_priv_dir,Value}). trc(TraceFile) -> controller_call({trace,TraceFile}, 2*?ACCEPT_TIMEOUT). @@ -815,7 +815,7 @@ handle_call({add_job,Dir,Name,TopCase,Skip}, _From, State) -> [SpecName,{State#state.multiply_timetraps, State#state.scale_timetraps}], LogDir, Name, State#state.levels, - State#state.unique_priv_dir, + State#state.create_priv_dir, State#state.testcase_callback, ExtraTools1), NewJobs = [{Name,Pid}|State#state.jobs], {reply, ok, State#state{jobs=NewJobs}}; @@ -825,7 +825,7 @@ handle_call({add_job,Dir,Name,TopCase,Skip}, _From, State) -> [SpecList,{State#state.multiply_timetraps, State#state.scale_timetraps}], LogDir, Name, State#state.levels, - State#state.unique_priv_dir, + State#state.create_priv_dir, State#state.testcase_callback, ExtraTools1), NewJobs = [{Name,Pid}|State#state.jobs], {reply, ok, State#state{jobs=NewJobs}}; @@ -843,7 +843,7 @@ handle_call({add_job,Dir,Name,TopCase,Skip}, _From, State) -> {State#state.multiply_timetraps, State#state.scale_timetraps}], LogDir, Name, State#state.levels, - State#state.unique_priv_dir, + State#state.create_priv_dir, State#state.testcase_callback, ExtraTools1), NewJobs = [{Name,Pid}|State#state.jobs], {reply, ok, State#state{jobs=NewJobs}} @@ -1052,16 +1052,16 @@ handle_call({cover,App,Analyse}, _From, State) -> {reply,ok,State#state{cover={App,Analyse}}}; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% handle_call({unique_priv_dir,Value}, _, State) -> ok | {error,Reason} +%% handle_call({create_priv_dir,Value}, _, State) -> ok | {error,Reason} %% -%% Set unique_priv_dir to either false (create common priv dir once -%% per test run), manual (the priv dir name will be unique for each test -%% case, but the user has to call test_server:make_priv_dir/0 to create -%% it), or auto (unique priv dir created automatically for each test +%% Set create_priv_dir to either auto_per_run (create common priv dir once +%% per test run), manual_per_tc (the priv dir name will be unique for each +%% test case, but the user has to call test_server:make_priv_dir/0 to create +%% it), or auto_per_tc (unique priv dir created automatically for each test %% case). -handle_call({unique_priv_dir,Value}, _From, State) -> - {reply,ok,State#state{unique_priv_dir=Value}}; +handle_call({create_priv_dir,Value}, _From, State) -> + {reply,ok,State#state{create_priv_dir=Value}}; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% handle_call({testcase_callback,{Mod,Func}}, _, State) -> ok | {error,Reason} @@ -1340,7 +1340,7 @@ kill_all_jobs([]) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% spawn_tester(Mod, Func, Args, Dir, Name, Levels, UniquePrivDir, +%% spawn_tester(Mod, Func, Args, Dir, Name, Levels, CreatePrivDir, %% TestCaseCallback, ExtraTools) -> Pid %% Mod = atom() %% Func = atom() @@ -1348,7 +1348,7 @@ kill_all_jobs([]) -> %% Dir = string() %% Name = string() %% Levels = {integer(),integer(),integer()} -%% UniquePrivDir = false | manual | auto +%% CreatePrivDir = auto_per_run | manual_per_tc | auto_per_tc %% TestCaseCallback = {CBMod,CBFunc} | undefined %% ExtraTools = [ExtraTool,...] %% ExtraTool = CoverInfo | TraceInfo | RandomSeed @@ -1360,14 +1360,14 @@ kill_all_jobs([]) -> %% is printed to the log files. spawn_tester(Mod, Func, Args, Dir, Name, Levels, - UniquePrivDir, TCCallback, ExtraTools) -> + CreatePrivDir, TCCallback, ExtraTools) -> spawn_link( fun() -> init_tester(Mod, Func, Args, Dir, Name, Levels, - UniquePrivDir, TCCallback, ExtraTools) + CreatePrivDir, TCCallback, ExtraTools) end). init_tester(Mod, Func, Args, Dir, Name, {SumLev,MajLev,MinLev}, - UniquePrivDir, TCCallback, ExtraTools) -> + CreatePrivDir, TCCallback, ExtraTools) -> process_flag(trap_exit, true), put(test_server_name, Name), put(test_server_dir, Dir), @@ -1378,7 +1378,7 @@ init_tester(Mod, Func, Args, Dir, Name, {SumLev,MajLev,MinLev}, put(test_server_summary_level, SumLev), put(test_server_major_level, MajLev), put(test_server_minor_level, MinLev), - put(test_server_unique_priv_dir, UniquePrivDir), + put(test_server_create_priv_dir, CreatePrivDir), put(test_server_random_seed, proplists:get_value(random_seed, ExtraTools)), put(test_server_testcase_callback, TCCallback), %% before first print, read and set logging options @@ -2777,8 +2777,8 @@ run_test_cases_loop([{conf,Ref,Props,{Mod,Func}}|_Cases]=Cs0, {failed,TcFail}]}] end, - case get(test_server_unique_priv_dir) of - false -> % use common priv_dir + case get(test_server_create_priv_dir) of + auto_per_run -> % use common priv_dir TSDirs = [{priv_dir,get(test_server_priv_dir)}, {data_dir,get_data_dir(Mod)}]; _ -> @@ -2946,8 +2946,8 @@ run_test_cases_loop([{conf,_Ref,_Props,_X}=Conf|_Cases0], run_test_cases_loop([{Mod,Case}|Cases], Config, TimetrapData, Mode, Status) -> ActualCfg = - case get(test_server_unique_priv_dir) of - false -> + case get(test_server_create_priv_dir) of + auto_per_run -> update_config(hd(Config), [{priv_dir,get(test_server_priv_dir)}, {data_dir,get_data_dir(Mod)}]); _ -> @@ -3702,8 +3702,8 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, UpdatedArgs = %% maybe create unique private directory for test case or config func - case get(test_server_unique_priv_dir) of - false -> + case get(test_server_create_priv_dir) of + auto_per_run -> update_config(hd(Args), [{tc_logfile,MinorName}]); PrivDirMode -> RunDir = filename:dirname(MinorName), @@ -3717,9 +3717,9 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, lists:flatten(io_lib:format(".~w", [Num])) end, PrivDir = filename:join(RunDir, ?priv_dir) ++ Ext, - if PrivDirMode == auto -> + if PrivDirMode == auto_per_tc -> ok = file:make_dir(PrivDir); - PrivDirMode == manual -> + PrivDirMode == manual_per_tc -> ok end, update_config(hd(Args), [{priv_dir,PrivDir++"/"}, |