diff options
author | Peter Andersson <[email protected]> | 2016-03-10 13:01:35 +0100 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2016-03-10 13:01:35 +0100 |
commit | e1f935eedd9cfb8572c43f9d180b913fbf6af7b6 (patch) | |
tree | a98dcb647cc4f928c1984dc5ba3e9e2dd2a7cdac /lib/test_server/src | |
parent | 64619e6b2a5ddf9fa4d1c06a61b551c34a2b065c (diff) | |
parent | 52cee865fd9e5b4a1371c82075375a92b8f03fbe (diff) | |
download | otp-e1f935eedd9cfb8572c43f9d180b913fbf6af7b6.tar.gz otp-e1f935eedd9cfb8572c43f9d180b913fbf6af7b6.tar.bz2 otp-e1f935eedd9cfb8572c43f9d180b913fbf6af7b6.zip |
Merge branch 'peppe/common_test/misc_18.3_bugfixes' into maint
* peppe/common_test/misc_18.3_bugfixes:
Fix minor issues with escaping characters
OTP-13003
Diffstat (limited to 'lib/test_server/src')
-rw-r--r-- | lib/test_server/src/test_server_ctrl.erl | 11 | ||||
-rw-r--r-- | lib/test_server/src/test_server_gl.erl | 17 |
2 files changed, 20 insertions, 8 deletions
diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 958fe1a2b7..e0975ab744 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -1825,13 +1825,14 @@ start_minor_log_file1(Mod, Func, LogDir, AbsName, MFA) -> case {filelib:is_file(filename:join(LogDir, SrcListing)), lists:member(no_src, get(test_server_logopts))} of {true,false} -> - print(Lev, Info ++ "<a href=\"~ts#~ts\">~w:~w/~w</a> " - "(click for source code)\n", + print(Lev, ["$tc_html", + Info ++ "<a href=\"~ts#~ts\">~w:~w/~w</a> " + "(click for source code)\n"], [uri_encode(SrcListing), uri_encode(atom_to_list(Func)++"-1",utf8), Mod,Func,Arity]); _ -> - print(Lev, Info ++ "~w:~w/~w\n", [Mod,Func,Arity]) + print(Lev, ["$tc_html",Info ++ "~w:~w/~w\n"], [Mod,Func,Arity]) end end, @@ -4356,6 +4357,10 @@ print(Detail, Format) -> print(Detail, Format, Args) -> print(Detail, Format, Args, internal). +print(Detail, ["$tc_html",Format], Args, Printer) -> + Msg = io_lib:format(Format, Args), + print_or_buffer(Detail, ["$tc_html",Msg], Printer); + print(Detail, Format, Args, Printer) -> Msg = io_lib:format(Format, Args), print_or_buffer(Detail, Msg, Printer). diff --git a/lib/test_server/src/test_server_gl.erl b/lib/test_server/src/test_server_gl.erl index 6abc68db54..0acc73047c 100644 --- a/lib/test_server/src/test_server_gl.erl +++ b/lib/test_server/src/test_server_gl.erl @@ -37,7 +37,8 @@ reject_io :: boolean(), %Reject I/O requests... permit_io, %... and exceptions auto_nl=true :: boolean(), %Automatically add NL - levels %{Stdout,Major,Minor} + levels, %{Stdout,Major,Minor} + escape_chars=true %Switch escaping HTML on/off }). %% start_link() @@ -137,7 +138,8 @@ init([]) -> reject_io=false, permit_io=gb_sets:empty(), auto_nl=true, - levels={1,19,10} + levels={1,19,10}, + escape_chars=true }}. req(GL, Req) -> @@ -193,10 +195,11 @@ handle_info({io_request,From,ReplyAs,Req}=IoReq, St) -> #st{capture=CapturePid} -> CapturePid ! {captured,Data} end, - if EscapeHtml -> + case EscapeHtml andalso St#st.escape_chars of + true -> output(minor, test_server_ctrl:escape_chars(Data), From, From, St); - not EscapeHtml -> + false -> output(minor, Data, From, From, St) end end, @@ -218,7 +221,11 @@ handle_info({printout,Detail,Fun}, St) when is_function(Fun)-> {noreply,St}; handle_info({printout,Detail,Format,Args}, St) -> Str = io_lib:format(Format, Args), - output(Detail, Str, internal, none, St), + if not St#st.escape_chars -> + output(Detail, ["$tc_html",Str], internal, none, St); + true -> + output(Detail, Str, internal, none, St) + end, {noreply,St}; handle_info(Msg, #st{tc_supervisor=Pid}=St) when is_pid(Pid) -> %% The process overseeing the testcase process also used to be |