diff options
author | Peter Andersson <[email protected]> | 2012-03-21 16:03:46 +0100 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2012-03-21 16:03:46 +0100 |
commit | 390843117229d7d6e1e5f167aca9ea2ebe6df5f2 (patch) | |
tree | 4c01dca5f584400002e4ec573d4f7e4bdde077c3 /lib/common_test/test | |
parent | afe7a29a54a7958ac90e44b3bee6c572792bb96b (diff) | |
download | otp-390843117229d7d6e1e5f167aca9ea2ebe6df5f2.tar.gz otp-390843117229d7d6e1e5f167aca9ea2ebe6df5f2.tar.bz2 otp-390843117229d7d6e1e5f167aca9ea2ebe6df5f2.zip |
Update ct_master to use the Common Test CSS file for the logs
OTP-9973
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/ct_master_SUITE.erl | 99 | ||||
-rw-r--r-- | lib/common_test/test/ct_test_support.erl | 16 |
2 files changed, 69 insertions, 46 deletions
diff --git a/lib/common_test/test/ct_master_SUITE.erl b/lib/common_test/test/ct_master_SUITE.erl index 1471cc1e0c..d8cb6318c1 100644 --- a/lib/common_test/test/ct_master_SUITE.erl +++ b/lib/common_test/test/ct_master_SUITE.erl @@ -98,7 +98,7 @@ end_per_group(_GroupName, Config) -> %%-------------------------------------------------------------------- %% TEST CASES %%-------------------------------------------------------------------- -ct_master_test(Config) when is_list(Config)-> +ct_master_test(Config) when is_list(Config) -> NodeNames = proplists:get_value(node_names, Config), DataDir = ?config(data_dir, Config), PrivDir = ?config(priv_dir, Config), @@ -106,19 +106,14 @@ ct_master_test(Config) when is_list(Config)-> FileName = filename:join(PrivDir, "ct_master_spec.spec"), Suites = [master_SUITE], TSFile = make_spec(DataDir, FileName, NodeNames, Suites, Config), + ERPid = ct_test_support:start_event_receiver(Config), - spawn(ct@ancalagon, - fun() -> - dbg:tracer(),dbg:p(all,c), - dbg:tpl(erlang, spawn_link, 4,x), - receive ok -> ok end - end), - [{TSFile, ok}] = run_test(ct_master_test, FileName, Config), + [{TSFile,ok}] = run_test(ct_master_test, FileName, Config), Events = ct_test_support:get_events(ERPid, Config), - ct_test_support:log_events(groups_suite_1, + ct_test_support:log_events(ct_master_test, reformat(Events, ?eh), PrivDir, []), @@ -134,48 +129,59 @@ ct_master_test(Config) when is_list(Config)-> %%%----------------------------------------------------------------- %%% HELP FUNCTIONS %%%----------------------------------------------------------------- -make_spec(DataDir, FileName, NodeNames, Suites, Config)-> - {ok, HostName} = inet:gethostname(), +make_spec(DataDir, FileName, NodeNames, Suites, Config) -> + {ok,HostName} = inet:gethostname(), - N = lists:map(fun(NodeName)-> + N = lists:map(fun(NodeName) -> {node, NodeName, list_to_atom(atom_to_list(NodeName)++"@"++HostName)} end, NodeNames), - C = lists:map(fun(NodeName)-> - Rnd = random:uniform(2), - if Rnd == 1-> - {config, NodeName, filename:join(DataDir, "master/config.txt")}; - true-> - {userconfig, NodeName, {ct_config_xml, filename:join(DataDir, "master/config.xml")}} - end - end, - NodeNames), - - NS = lists:map(fun(NodeName)-> - {init, NodeName, [ - {node_start, [{startup_functions, []}, {monitor_master, true}]}, - {eval, {erlang, nodes, []}} - ] - } - end, - NodeNames), - + C = lists:map( + fun(NodeName) -> + Rnd = random:uniform(2), + if Rnd == 1-> + {config,NodeName,filename:join(DataDir, + "master/config.txt")}; + true -> + {userconfig,NodeName, + {ct_config_xml,filename:join(DataDir, + "master/config.xml")}} + end + end, + NodeNames), + + CM = [{config,master,filename:join(DataDir,"master/config.txt")}], + + NS = lists:map( + fun(NodeName) -> + {init,NodeName,[ + {node_start,[{startup_functions,[]}, + {monitor_master,true}]}, + {eval,{erlang,nodes,[]}} + ] + } + end, + NodeNames), + S = [{suites, NodeNames, filename:join(DataDir, "master"), Suites}], - + PrivDir = ?config(priv_dir, Config), - LD = lists:map(fun(NodeName)-> - {logdir, NodeName, get_log_dir(os:type(),PrivDir, NodeName)} - end, - NodeNames) ++ [{logdir, master, PrivDir}], + + LD = lists:map( + fun(NodeName) -> + {logdir,NodeName,get_log_dir(os:type(),PrivDir, NodeName)} + end, + NodeNames) ++ [{logdir,master,PrivDir}], + EvHArgs = [{cbm,ct_test_support},{trace_level,?config(trace_level,Config)}], EH = [{event_handler,master,[?eh],EvHArgs}], - + Include = [{include,filename:join([DataDir,"master/include"])}], + + ct_test_support:write_testspec(N++Include++EH++C++CM++S++LD++NS, FileName). - ct_test_support:write_testspec(N++Include++EH++C++S++LD++NS, FileName). - -get_log_dir({win32,_}, _PrivDir, NodeName)-> +get_log_dir({win32,_}, _PrivDir, NodeName) -> case filelib:is_dir(?TEMP_DIR) of false -> file:make_dir(?TEMP_DIR); @@ -188,8 +194,15 @@ get_log_dir(_,PrivDir,NodeName) -> file:make_dir(LogDir), LogDir. -run_test(_Name, FileName, Config)-> - [{FileName, ok}] = ct_test_support:run(ct_master, run, [FileName], Config). +run_test(_Name, FileName, Config) -> + %% run the test twice, using different html versions + [{FileName,ok}] = ct_test_support:run({ct_master,run,[FileName]}, + [{ct_master,basic_html,[true]}], + Config), + timer:sleep(5000), + [{FileName,ok}] = ct_test_support:run({ct_master,run,[FileName]}, + [{ct_master,basic_html,[false]}], + Config). reformat(Events, EH) -> ct_test_support:reformat(Events, EH). @@ -220,5 +233,5 @@ add_host(NodeName) -> {ok, HostName} = inet:gethostname(), list_to_atom(atom_to_list(NodeName)++"@"++HostName). -expected_events(_)-> +expected_events(_) -> []. diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index 6df02d12b7..42d4a1630d 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -29,7 +29,7 @@ -export([init_per_suite/1, init_per_suite/2, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, write_testspec/2, write_testspec/3, - run/2, run/4, get_opts/1, wait_for_ct_stop/1]). + run/2, run/3, run/4, get_opts/1, wait_for_ct_stop/1]). -export([handle_event/2, start_event_receiver/1, get_events/2, verify_events/3, reformat/2, log_events/4, @@ -223,7 +223,7 @@ get_opts(Config) -> %%%----------------------------------------------------------------- %%% -run(Opts, Config) -> +run(Opts, Config) when is_list(Opts) -> CTNode = proplists:get_value(ct_node, Config), Level = proplists:get_value(trace_level, Config), %% use ct interface @@ -256,9 +256,19 @@ run(Opts, Config) -> end. run(M, F, A, Config) -> + run({M,F,A}, [], Config). + +run({M,F,A}, InitCalls, Config) -> CTNode = proplists:get_value(ct_node, Config), Level = proplists:get_value(trace_level, Config), - test_server:format(Level, "~nCalling ~w:~w(~p) on ~p~n", + lists:foreach( + fun({IM,IF,IA}) -> + test_server:format(Level, "~nInit call ~w:~w(~p) on ~p...~n", + [IM, IF, IA, CTNode]), + Result = rpc:call(CTNode, IM, IF, IA), + test_server:format(Level, "~n...with result: ~p~n", [Result]) + end, InitCalls), + test_server:format(Level, "~nStarting test with ~w:~w(~p) on ~p~n", [M, F, A, CTNode]), rpc:call(CTNode, M, F, A). |