diff options
author | Peter Andersson <[email protected]> | 2015-04-08 15:41:47 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2015-05-04 12:17:16 +0200 |
commit | f1d838ddbe364c37e85c159255b52eb354a3a3ce (patch) | |
tree | ee9a6c09fdb83aa4a4c4013a328eca7206a08358 /lib/common_test/src | |
parent | 6e1258fc79e388d56b472c13250d6f21ea031dd0 (diff) | |
download | otp-f1d838ddbe364c37e85c159255b52eb354a3a3ce.tar.gz otp-f1d838ddbe364c37e85c159255b52eb354a3a3ce.tar.bz2 otp-f1d838ddbe364c37e85c159255b52eb354a3a3ce.zip |
Get the VTS mode working with private CT version of webtool
OTP-12704
Diffstat (limited to 'lib/common_test/src')
-rw-r--r-- | lib/common_test/src/Makefile | 1 | ||||
-rw-r--r-- | lib/common_test/src/ct_run.erl | 42 | ||||
-rw-r--r-- | lib/common_test/src/ct_webtool.erl | 24 | ||||
-rw-r--r-- | lib/common_test/src/ct_webtool_sup.erl | 74 |
4 files changed, 108 insertions, 33 deletions
diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index 1c8068ace7..449cba6c83 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -63,6 +63,7 @@ MODULES= \ ct_make \ vts \ ct_webtool \ + ct_webtool_sup \ unix_telnet \ ct_config \ ct_config_plain \ diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index a45c170c8e..be547b443b 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -225,18 +225,24 @@ finish(Tracing, ExitStatus, Args) -> if ExitStatus == interactive_mode -> interactive_mode; true -> - %% it's possible to tell CT to finish execution with a call - %% to a different function than the normal halt/1 BIF - %% (meant to be used mainly for reading the CT exit status) - case get_start_opt(halt_with, - fun([HaltMod,HaltFunc]) -> - {list_to_atom(HaltMod), - list_to_atom(HaltFunc)} end, - Args) of - undefined -> - halt(ExitStatus); - {M,F} -> - apply(M, F, [ExitStatus]) + case get_start_opt(vts, true, Args) of + true -> + %% VTS mode, don't halt the node + ok; + _ -> + %% it's possible to tell CT to finish execution with a call + %% to a different function than the normal halt/1 BIF + %% (meant to be used mainly for reading the CT exit status) + case get_start_opt(halt_with, + fun([HaltMod,HaltFunc]) -> + {list_to_atom(HaltMod), + list_to_atom(HaltFunc)} end, + Args) of + undefined -> + halt(ExitStatus); + {M,F} -> + apply(M, F, [ExitStatus]) + end end end. @@ -244,7 +250,7 @@ script_start1(Parent, Args) -> %% read general start flags Label = get_start_opt(label, fun([Lbl]) -> Lbl end, Args), Profile = get_start_opt(profile, fun([Prof]) -> Prof end, Args), - Vts = get_start_opt(vts, true, Args), + Vts = get_start_opt(vts, true, undefined, Args), Shell = get_start_opt(shell, true, Args), Cover = get_start_opt(cover, fun([CoverFile]) -> ?abs(CoverFile) end, Args), CoverStop = get_start_opt(cover_stop, @@ -330,8 +336,8 @@ script_start1(Parent, Args) -> Stylesheet = get_start_opt(stylesheet, fun([SS]) -> ?abs(SS) end, Args), %% basic_html - used by ct_logs - BasicHtml = case proplists:get_value(basic_html, Args) of - undefined -> + BasicHtml = case {Vts,proplists:get_value(basic_html, Args)} of + {undefined,undefined} -> application:set_env(common_test, basic_html, false), undefined; _ -> @@ -364,16 +370,10 @@ script_start1(Parent, Args) -> scale_timetraps = ScaleTT, create_priv_dir = CreatePrivDir, starter = script}, - -%%! --- Wed Apr 8 00:08:19 2015 --- peppe was here! -io:format(user, "RUNNING with VTS = ~p~n", [Vts]), %% check if log files should be refreshed or go on to run tests... Result = run_or_refresh(Opts, Args), -%%! --- Wed Apr 8 00:09:48 2015 --- peppe was here! -io:format(user, "RETURNING NOW: ~p~n", [Result]), - %% send final results to starting process waiting in script_start/0 Parent ! {self(), Result}. diff --git a/lib/common_test/src/ct_webtool.erl b/lib/common_test/src/ct_webtool.erl index 52252599b2..b67a7c2a92 100644 --- a/lib/common_test/src/ct_webtool.erl +++ b/lib/common_test/src/ct_webtool.erl @@ -60,7 +60,7 @@ -define(DEFAULT_PORT,8888).% must be >1024 or the user must be root on unix -define(DEFAULT_ADDR,{127,0,0,1}). --define(WEBTOOL_ALIAS,{webtool,[{alias,{erl_alias,"/webtool",[webtool]}}]}). +-define(WEBTOOL_ALIAS,{ct_webtool,[{alias,{erl_alias,"/ct_webtool",[ct_webtool]}}]}). -define(HEADER,"Pragma:no-cache\r\n Content-type: text/html\r\n\r\n"). -define(HTML_HEADER,"<HTML>\r\n<HEAD>\r\n<TITLE>WebTool</TITLE>\r\n</HEAD>\r\n<BODY BGCOLOR=\"#FFFFFF\">\r\n"). -define(HTML_HEADER_RELOAD,"<HTML>\r\n<HEAD>\r\n<TITLE>WebTool @@ -217,10 +217,10 @@ usage() -> get_applications() -> - gen_server:call(web_tool,get_applications). + gen_server:call(ct_web_tool,get_applications). get_port() -> - gen_server:call(web_tool,get_port). + gen_server:call(ct_web_tool,get_port). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -253,31 +253,31 @@ start(Path,Port) when is_integer(Port)-> start(Path,Data0)-> Data = Data0 ++ rest_of_standard_data(), - gen_server:start({local,web_tool},webtool,{Path,Data},[]). + gen_server:start({local,ct_web_tool},ct_webtool,{Path,Data},[]). stop()-> - gen_server:call(web_tool,stoppit). + gen_server:call(ct_web_tool,stoppit). %---------------------------------------------------------------------- %Web Api functions called by the web %---------------------------------------------------------------------- started_tools(Env,Input)-> - gen_server:call(web_tool,{started_tools,Env,Input}). + gen_server:call(ct_web_tool,{started_tools,Env,Input}). toolbar(Env,Input)-> - gen_server:call(web_tool,{toolbar,Env,Input}). + gen_server:call(ct_web_tool,{toolbar,Env,Input}). start_tools(Env,Input)-> - gen_server:call(web_tool,{start_tools,Env,Input}). + gen_server:call(ct_web_tool,{start_tools,Env,Input}). stop_tools(Env,Input)-> - gen_server:call(web_tool,{stop_tools,Env,Input}). + gen_server:call(ct_web_tool,{stop_tools,Env,Input}). %---------------------------------------------------------------------- %Support API for other tools %---------------------------------------------------------------------- is_localhost()-> - gen_server:call(web_tool,is_localhost). + gen_server:call(ct_web_tool,is_localhost). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% @@ -341,7 +341,7 @@ init({Path,Config})-> true -> {ok, Table} = get_tool_files_data(), insert_app(?WEBTOOL_ALIAS, Table), - case webtool_sup:start_link() of + case ct_webtool_sup:start_link() of {ok, Pid} -> case start_webserver(Table, Path, Config) of {ok, _} -> @@ -630,7 +630,7 @@ shutdown_apps(State)-> %---------------------------------------------------------------------- shutdown_supervisor(State)-> %io:format("~n==================~n"), - webtool_sup:stop(State#state.supvis). + ct_webtool_sup:stop(State#state.supvis). %io:format("~n==================~n"). %---------------------------------------------------------------------- diff --git a/lib/common_test/src/ct_webtool_sup.erl b/lib/common_test/src/ct_webtool_sup.erl new file mode 100644 index 0000000000..1d612a2d18 --- /dev/null +++ b/lib/common_test/src/ct_webtool_sup.erl @@ -0,0 +1,74 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(ct_webtool_sup). + +-behaviour(supervisor). + +%% External exports +-export([start_link/0,stop/1]). + +%% supervisor callbacks +-export([init/1]). + +%%%---------------------------------------------------------------------- +%%% API +%%%---------------------------------------------------------------------- +start_link() -> + supervisor:start_link({local,ct_websup},ct_webtool_sup, []). + +stop(Pid)-> + exit(Pid,normal). +%%%---------------------------------------------------------------------- +%%% Callback functions from supervisor +%%%---------------------------------------------------------------------- + +%%---------------------------------------------------------------------- +%% Func: init/1 +%% Returns: {ok, {SupFlags, [ChildSpec]}} | +%% ignore | +%% {error, Reason} +%%---------------------------------------------------------------------- +init(_StartArgs) -> + %%Child1 = + %%Child2 ={webcover_backend,{webcover_backend,start_link,[]},permanent,2000,worker,[webcover_backend]}, + %%{ok,{{simple_one_for_one,5,10},[Child1]}}. + {ok,{{one_for_one,100,10},[]}}. + +%%%---------------------------------------------------------------------- +%%% Internal functions +%%%---------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + |