From 53e920c49505e6835f8d69604e5bd2018edefe85 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 30 Nov 2011 15:38:27 +0100 Subject: Bugfixes and improvements of the the CSS stylesheet implementation --- lib/common_test/priv/ct_default.css | 2 +- lib/common_test/src/ct_logs.erl | 28 +++++++++++++--------------- lib/test_server/src/test_server.erl | 20 ++++++++++++++------ lib/test_server/src/test_server_ctrl.erl | 8 +++++--- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/lib/common_test/priv/ct_default.css b/lib/common_test/priv/ct_default.css index a64e1ec576..75f8d5db8a 100644 --- a/lib/common_test/priv/ct_default.css +++ b/lib/common_test/priv/ct_default.css @@ -147,7 +147,7 @@ td a:visited { } tr:hover th[scope=row], tr:hover td { - background-color: #808080; + background-color: #D1D1D1; color: #fff; } diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl index d66a31d9a5..19ad7b26d8 100644 --- a/lib/common_test/src/ct_logs.erl +++ b/lib/common_test/src/ct_logs.erl @@ -223,7 +223,6 @@ init_tc(RefreshLog) -> %%% %%%

This function is called by ct_framework:end_tc/3

end_tc(TCPid) -> - io:format(xhtml("
", "
")), %% use call here so that the TC process will wait and receive %% possible exit signals from ct_logs before end_tc returns ok call({end_tc,TCPid}). @@ -745,20 +744,19 @@ print_style(Fd,StyleSheet) -> 0 -> string:str(Str,"") of - 0 -> string:str(Str,""); - N1 -> N1 - end, - case Pos1 of - 0 -> - print_style_error(Fd,StyleSheet,missing_style_end_tag); - _ -> - Style = string:sub_string(Str,Pos0,Pos1+7), - io:format(Fd,"~s\n",[Style]) - end + Pos1 = case string:str(Str,"") of + 0 -> string:str(Str,""); + N1 -> N1 + end, + if (Pos0 == 0) and (Pos1 /= 0) -> + print_style_error(Fd,StyleSheet,missing_style_start_tag); + (Pos0 /= 0) and (Pos1 == 0) -> + print_style_error(Fd,StyleSheet,missing_style_end_tag); + Pos0 /= 0 -> + Style = string:sub_string(Str,Pos0,Pos1+7), + io:format(Fd,"~s\n",[Style]); + Pos0 == 0 -> + io:format(Fd,"\n",[Str]) end; {error,Reason} -> print_style_error(Fd,StyleSheet,Reason) diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index 743e6c1d29..98a2e21e21 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -611,7 +611,7 @@ do_run_test_case_apply(Mod, Func, Args, Name, RunInit, TimetrapData) -> print(minor, "Test case started with:\n~s:~s(~p)\n", [Mod,Func,Args2Print]), print(minor, "Current directory is ~p\n", [Cwd]), print_timestamp(minor,"Started at "), - print(minor, "", []), + print(minor, "", [], internal_raw), TCCallback = get(test_server_testcase_callback), LogOpts = get(test_server_logopts), Ref = make_ref(), @@ -1007,8 +1007,11 @@ spawn_fw_call(Mod,{end_per_testcase,Func},EndConf,Pid, end, %% if end_per_testcase fails a warning should be %% printed as comment - Comment1 = if Comment == "" -> ""; - true -> Comment ++ "
" + Comment1 = if Comment == "" -> + ""; + true -> + Comment ++ test_server_ctrl:xhtml("
", + "
") end, %% finished, report back SendTo ! {self(),fw_notify_done, @@ -1473,7 +1476,8 @@ do_end_per_testcase(Mod,EndFunc,Func,Conf) -> throw:Other -> Comment0 = case read_comment() of "" -> ""; - Cmt -> Cmt ++ "
" + Cmt -> Cmt ++ test_server_ctrl:xhtml("
", + "
") end, set_loc(erlang:get_stacktrace()), comment(io_lib:format("~s" @@ -1496,7 +1500,8 @@ do_end_per_testcase(Mod,EndFunc,Func,Conf) -> end, Comment0 = case read_comment() of "" -> ""; - Cmt -> Cmt ++ "
" + Cmt -> Cmt ++ test_server_ctrl:xhtml("
", + "
") end, comment(io_lib:format("~s" "WARNING: ~w crashed!" @@ -1572,7 +1577,7 @@ fw_error_notify(Mod, Func, Args, Error, Loc) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% print(Detail,Format,Args) -> ok +%% print(Detail,Format,Args,Printer) -> ok %% Detail = integer() %% Format = string() %% Args = [term()] @@ -1583,6 +1588,9 @@ fw_error_notify(Mod, Func, Args, Error, Loc) -> print(Detail,Format,Args) -> local_or_remote_apply({test_server_ctrl,print,[Detail,Format,Args]}). +print(Detail,Format,Args,Printer) -> + local_or_remote_apply({test_server_ctrl,print,[Detail,Format,Args,Printer]}). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% print_timsteamp(Detail,Leader) -> ok %% diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 9fd0adbfc8..642bb14c88 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -171,7 +171,7 @@ -export([kill_slavenodes/0]). %%% TEST_SERVER INTERFACE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([output/2, print/2, print/3, print_timestamp/2]). +-export([output/2, print/2, print/3, print/4, print_timestamp/2]). -export([start_node/3, stop_node/1, wait_for_node/1, is_release_available/1]). -export([format/1, format/2, format/3, to_string/1]). -export([get_target_info/0]). @@ -187,6 +187,7 @@ -export([handle_call/3, handle_cast/2, handle_info/2]). -export([do_test_cases/4]). -export([do_spec/2, do_spec_list/2]). +-export([xhtml/2]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -3627,7 +3628,7 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, test_server_sup:framework_call(report, [tc_start,{?pl2a(Mod),Func}]), print(major, "=case ~p:~p", [Mod, Func]), MinorName = start_minor_log_file(Mod, Func), - print(minor, "", []), + print(minor, "", [], internal_raw), MinorBase = filename:basename(MinorName), print(major, "=logfile ~s", [filename:basename(MinorName)]), print_props((RunInit==skip_init), get_props(Mode)), @@ -3651,7 +3652,8 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, {died,DReason,DLoc,DCmt} -> {died,DReason,DLoc,[],DCmt} end, - print(minor, "", []), + print(minor, "", [], internal_raw), + print(minor, "\n", [], internal_raw), print_timestamp(minor, "Ended at "), print(major, "=ended ~s", [lists:flatten(timestamp_get(""))]), -- cgit v1.2.3