From 8b21b2ef5c46f6a831beb9ee4445582c4558e8ba Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Wed, 29 Aug 2018 15:45:33 +0200 Subject: common_test: Adjust some calls to io:format() --- lib/common_test/src/ct_framework.erl | 32 ++++++++++----------- lib/common_test/src/ct_logs.erl | 10 +++---- lib/common_test/src/ct_master.erl | 4 +-- lib/common_test/src/ct_repeat.erl | 2 +- lib/common_test/src/cth_log_redirect.erl | 24 ++++++++-------- lib/common_test/src/cth_surefire.erl | 2 +- lib/common_test/src/test_server_ctrl.erl | 42 +++++++++++++++------------- lib/common_test/test_server/ts_benchmark.erl | 2 +- 8 files changed, 60 insertions(+), 58 deletions(-) (limited to 'lib') diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index 7e98e6395f..506147474f 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -314,8 +314,8 @@ add_defaults(Mod,Func, GroupPath) -> ErrStr = io_lib:format("~n*** ERROR *** " "~w:suite/0 failed: ~tp~n", [Suite,Reason]), - io:format(ErrStr, []), - io:format(?def_gl, ErrStr, []), + io:format("~ts", [ErrStr]), + io:format(?def_gl, "~ts", [ErrStr]), {suite0_failed,{exited,Reason}}; SuiteInfo when is_list(SuiteInfo) -> case lists:all(fun(E) when is_tuple(E) -> true; @@ -337,16 +337,16 @@ add_defaults(Mod,Func, GroupPath) -> "Invalid return value from " "~w:suite/0: ~tp~n", [Suite,SuiteInfo]), - io:format(ErrStr, []), - io:format(?def_gl, ErrStr, []), + io:format("~ts", [ErrStr]), + io:format(?def_gl, "~ts", [ErrStr]), {suite0_failed,bad_return_value} end; SuiteInfo -> ErrStr = io_lib:format("~n*** ERROR *** " "Invalid return value from " "~w:suite/0: ~tp~n", [Suite,SuiteInfo]), - io:format(ErrStr, []), - io:format(?def_gl, ErrStr, []), + io:format("~ts", [ErrStr]), + io:format(?def_gl, "~ts", [ErrStr]), {suite0_failed,bad_return_value} end. @@ -373,8 +373,8 @@ add_defaults1(Mod,Func, GroupPath, SuiteInfo) -> "Invalid return value from " "~w:group(~tw): ~tp~n", [Mod,GrName,BadGr0Val]), - io:format(Gr0ErrStr, []), - io:format(?def_gl, Gr0ErrStr, []), + io:format("~ts", [Gr0ErrStr]), + io:format(?def_gl, "~ts", [Gr0ErrStr]), {group0_failed,bad_return_value}; _ -> Args = if Func == init_per_group ; Func == end_per_group -> @@ -395,8 +395,8 @@ add_defaults1(Mod,Func, GroupPath, SuiteInfo) -> "Invalid return value from " "~w:~tw/0: ~tp~n", [Mod,Func,BadTC0Val]), - io:format(TC0ErrStr, []), - io:format(?def_gl, TC0ErrStr, []), + io:format("~ts", [TC0ErrStr]), + io:format(?def_gl, "~ts", [TC0ErrStr]), {testcase0_failed,bad_return_value}; _ -> %% let test case info (also for all config funcs) override @@ -972,11 +972,10 @@ error_notification(Mod,Func,_Args,{Error,Loc}) -> end, PrintError = fun(ErrorFormat, ErrorArgs) -> - Div = "~n- - - - - - - - - - - - - - - - - - - " - "- - - - - - - - - - - - - - - - - - - - -~n", + Div = "\n- - - - - - - - - - - - - - - - - - - " + "- - - - - - - - - - - - - - - - - - - - -\n", ErrorStr2 = io_lib:format(ErrorFormat, ErrorArgs), - io:format(?def_gl, lists:concat([Div,ErrorStr2,Div,"~n"]), - []), + io:format(?def_gl, "~ts~n", [lists:concat([Div,ErrorStr2,Div])]), Link = "\n\n" "Full error description and stacktrace" @@ -985,7 +984,8 @@ error_notification(Mod,Func,_Args,{Error,Loc}) -> ct_logs:tc_log(ct_error_notify, ?MAX_IMPORTANCE, "CT Error Notification", - ErrorHtml2++Link, [], []) + "~ts", [ErrorHtml2++Link], + []) end, case Loc of [{?MODULE,error_in_suite}] -> @@ -1181,7 +1181,7 @@ get_all(Mod, ConfTests) -> ErrStr = io_lib:format("~n*** ERROR *** " "~w:all/0 failed: ~tp~n", [Mod,ExitReason]), - io:format(?def_gl, ErrStr, []), + io:format(?def_gl, "~ts", [ErrStr]), %% save the error info so it doesn't get printed twice ct_util:set_testdata_async({{error_in_suite,Mod}, ExitReason}); diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl index 07a1693d5d..814b80b8bd 100644 --- a/lib/common_test/src/ct_logs.erl +++ b/lib/common_test/src/ct_logs.erl @@ -542,7 +542,7 @@ tc_print(Category,Importance,Format,Args,Opts) -> undefined -> atom_to_list(Category); Hd -> Hd end, - Str = lists:concat([get_header(Heading),Format,"\n\n"]), + Str = lists:flatten([get_header(Heading),Format,"\n\n"]), try io:format(?def_gl, Str, Args) catch @@ -935,7 +935,7 @@ create_io_fun(FromPid, CtLogFd, EscChars) -> {_HdOrFt,S,A} -> {false,S,A}; {S,A} -> {true,S,A} end, - try io_lib:format(Str, Args) of + try io_lib:format(lists:flatten(Str), Args) of IoStr when Escapable, EscChars, IoList == [] -> escape_chars(IoStr); IoStr when Escapable, EscChars -> @@ -1138,10 +1138,10 @@ set_evmgr_gl(GL) -> open_ctlog(MiscIoName) -> {ok,Fd} = file:open(?ct_log_name,[write,{encoding,utf8}]), - io:format(Fd, header("Common Test Framework Log", {[],[1,2],[]}), []), + io:format(Fd, "~ts", [header("Common Test Framework Log", {[],[1,2],[]})]), case file:consult(ct_run:variables_file_name("../")) of {ok,Vars} -> - io:format(Fd, config_table(Vars), []); + io:format(Fd, "~ts", [config_table(Vars)]); {error,Reason} -> {ok,Cwd} = file:get_cwd(), Dir = filename:dirname(Cwd), @@ -1213,7 +1213,7 @@ print_style_error(Fd, IoFormat, StyleSheet, Reason) -> close_ctlog(Fd) -> io:format(Fd, "\n\n", []), - io:format(Fd, [xhtml("

\n", "

\n") | footer()], []), + io:format(Fd, "~ts", [[xhtml("

\n", "

\n") | footer()]]), ok = file:close(Fd). %%%----------------------------------------------------------------- diff --git a/lib/common_test/src/ct_master.erl b/lib/common_test/src/ct_master.erl index fd33ee2280..9fc169789c 100644 --- a/lib/common_test/src/ct_master.erl +++ b/lib/common_test/src/ct_master.erl @@ -350,7 +350,7 @@ master_loop(#state{node_ctrl_pids=[], io_lib:format("~-40.40.*ts~tp\n", [$_,atom_to_list(Node),Result]) end,lists:reverse(Finished)), - log(all,"TEST RESULTS",Str,[]), + log(all,"TEST RESULTS","~ts", [Str]), log(all,"Info","Updating log files",[]), refresh_logs(LogDirs,[]), @@ -574,7 +574,7 @@ refresh_logs([],Refreshed) -> io_lib:format("Refreshing logs in ~tp... ~tp", [D,Result]) end,Refreshed), - log(all,"Info",Str,[]). + log(all,"Info","~ts", [Str]). %%%----------------------------------------------------------------- %%% NODE CONTROLLER, runs and controls tests on a test node. diff --git a/lib/common_test/src/ct_repeat.erl b/lib/common_test/src/ct_repeat.erl index 8b1c7d47bb..b97c6e59e7 100644 --- a/lib/common_test/src/ct_repeat.erl +++ b/lib/common_test/src/ct_repeat.erl @@ -278,7 +278,7 @@ log_loop_info(Args) -> ForceStop -> io_lib:format("force_stop is set to: ~w",[ForceStop]) end, - ct_logs:log("Test loop info",LogStr1++LogStr2++LogStr3++LogStr4,[]) + ct_logs:log("Test loop info","~ts", [LogStr1++LogStr2++LogStr3++LogStr4]) end. ts(Secs) -> diff --git a/lib/common_test/src/cth_log_redirect.erl b/lib/common_test/src/cth_log_redirect.erl index 86081369b9..fe869a4373 100644 --- a/lib/common_test/src/cth_log_redirect.erl +++ b/lib/common_test/src/cth_log_redirect.erl @@ -194,10 +194,10 @@ handle_call({log, case LogFunc of tc_log -> ct_logs:tc_log(Category, ?STD_IMPORTANCE, - Header, String, [], []); + Header, "~ts", [String], []); tc_log_async -> ct_logs:tc_log_async(sasl, ?STD_IMPORTANCE, - Header, String, []) + Header, "~ts", [String]) end, {reply,ok,State}; @@ -261,34 +261,34 @@ handle_remote_events(Bool) -> format_header(#eh_state{curr_suite = undefined, curr_group = undefined, curr_func = undefined}) -> - io_lib:format("System report", []); + lists:flatten(io_lib:format("System report", [])); format_header(#eh_state{curr_suite = Suite, curr_group = undefined, curr_func = undefined}) -> - io_lib:format("System report during ~w", [Suite]); + lists:flatten(io_lib:format("System report during ~w", [Suite])); format_header(#eh_state{curr_suite = Suite, curr_group = undefined, curr_func = TcOrConf}) -> - io_lib:format("System report during ~w:~tw/1", - [Suite,TcOrConf]); + lists:flatten(io_lib:format("System report during ~w:~tw/1", + [Suite,TcOrConf])); format_header(#eh_state{curr_suite = Suite, curr_group = Group, curr_func = Conf}) when Conf == init_per_group; Conf == end_per_group -> - io_lib:format("System report during ~w:~w/2 for ~tw", - [Suite,Conf,Group]); + lists:flatten(io_lib:format("System report during ~w:~w/2 for ~tw", + [Suite,Conf,Group])); format_header(#eh_state{curr_suite = Suite, curr_group = Group, parallel_tcs = true}) -> - io_lib:format("System report during ~tw in ~w", - [Group,Suite]); + lists:flatten(io_lib:format("System report during ~tw in ~w", + [Group,Suite])); format_header(#eh_state{curr_suite = Suite, curr_group = Group, curr_func = TC}) -> - io_lib:format("System report during ~w:~tw/1 in ~tw", - [Suite,TC,Group]). + lists:flatten(io_lib:format("System report during ~w:~tw/1 in ~tw", + [Suite,TC,Group])). diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl index b0742717ae..c9b4cb10c6 100644 --- a/lib/common_test/src/cth_surefire.erl +++ b/lib/common_test/src/cth_surefire.erl @@ -235,7 +235,7 @@ close_suite(#state{ test_cases = TCs, url_base = UrlBase } = State) -> terminate(State = #state{ test_cases = [] }) -> {ok,D} = file:open(State#state.filepath,[write,{encoding,utf8}]), io:format(D, "", []), - io:format(D, to_xml(State), []), + io:format(D, "~ts", [to_xml(State)]), catch file:sync(D), catch file:close(D); terminate(State) -> diff --git a/lib/common_test/src/test_server_ctrl.erl b/lib/common_test/src/test_server_ctrl.erl index 34f2feb33c..1518c6e8d6 100644 --- a/lib/common_test/src/test_server_ctrl.erl +++ b/lib/common_test/src/test_server_ctrl.erl @@ -1558,7 +1558,7 @@ do_test_cases(TopCases, SkipCases, Html1} end, - print(html, Header), + print(html, "~ts", [Header]), print(html, xhtml("

", "

")), print_timestamp(html, "Test started at "), @@ -1605,10 +1605,10 @@ do_test_cases(TopCases, SkipCases, [?suitelog_name,CoverLog,?unexpected_io_log]), print(html, "

~ts

\n" ++ - xhtml(["\n", - "\n"], - ["
\n", - "\n"]) ++ + xhtml("
\n" ++ + "\n", + "
\n" ++ + "\n") ++ "" ++ "" ++ "\n\n\n", @@ -3306,7 +3306,8 @@ skip_case1(Type, CaseNum, Mod, Func, Comment, Mode) -> true -> print(2,"*** Skipping test case #~w ~tw ***", [CaseNum,{Mod,Func}]) end, - TR = xhtml("", [""]), + TR = xhtml("", + ""), GroupName = case get_name(Mode) of undefined -> ""; Name -> cast_to_list(Name) @@ -3796,8 +3797,8 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, end, print(minor, - escape_chars(io_lib:format("Config value:\n\n ~tp\n", [Args2Print])), - []), + "~ts", + [escape_chars(io_lib:format("Config value:\n\n ~tp\n", [Args2Print]))]), print(minor, "Current directory is ~tp\n", [Cwd]), GrNameStr = case GrName of @@ -3806,7 +3807,7 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, end, print(major, "=started ~s", [lists:flatten(timestamp_get(""))]), {{Col0,Col1},Style} = get_font_style((RunInit==run_init), Mode), - TR = xhtml("", [""]), + TR = xhtml("", ""), EncMinorBase = uri_encode(MinorBase), print(html, TR ++ "" "" @@ -3831,7 +3832,7 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, print(minor, "", [], internal_raw), print(minor, "\n", [], internal_raw), print_timestamp(minor, "Ended at "), - print(major, "=ended ~s", [lists:flatten(timestamp_get(""))]), + print(major, "=ended ~s", [timestamp_get("")]), do_unless_parallel(Main, fun() -> file:set_cwd(filename:dirname(TSDir)) end), @@ -4075,9 +4076,9 @@ progress(failed, CaseNum, Mod, Func, GrName, Loc, {testcase_aborted,Reason}, _T, FormatLoc = test_server_sup:format_loc(Loc), print(minor, "=== Location: ~ts", [FormatLoc]), print(minor, - escape_chars(io_lib:format("=== Reason: {testcase_aborted,~tp}", - [Reason])), - []), + "~ts", + [escape_chars(io_lib:format("=== Reason: {testcase_aborted,~tp}", + [Reason]))]), failed; progress(failed, CaseNum, Mod, Func, GrName, unknown, Reason, Time, @@ -4115,8 +4116,8 @@ progress(failed, CaseNum, Mod, Func, GrName, unknown, Reason, Time, print(minor, "=== Location: ~w", [unknown]), {FStr,FormattedReason} = format_exception(Reason), print(minor, - escape_chars(io_lib:format("=== Reason: " ++ FStr, [FormattedReason])), - []), + "~ts", + [escape_chars(io_lib:format("=== Reason: " ++ FStr, [FormattedReason]))]), failed; progress(failed, CaseNum, Mod, Func, GrName, Loc, Reason, Time, @@ -4150,8 +4151,9 @@ progress(failed, CaseNum, Mod, Func, GrName, Loc, Reason, Time, FormatLoc = test_server_sup:format_loc(LocMin), print(minor, "=== Location: ~ts", [FormatLoc]), {FStr,FormattedReason} = format_exception(Reason), - print(minor, "=== Reason: " ++ - escape_chars(io_lib:format(FStr, [FormattedReason])), []), + print(minor, "~ts", + ["=== Reason: " ++ + escape_chars(io_lib:format(FStr, [FormattedReason]))]), failed; progress(ok, _CaseNum, Mod, Func, GrName, _Loc, RetVal, Time, @@ -4184,8 +4186,8 @@ progress(ok, _CaseNum, Mod, Func, GrName, _Loc, RetVal, Time, "~ts\n", [TimeStr,Comment]), print(minor, - escape_chars(io_lib:format("=== Returned value: ~tp", [RetVal])), - []), + "~ts", + [escape_chars(io_lib:format("=== Returned value: ~tp", [RetVal]))]), ok. %%-------------------------------------------------------------------- @@ -4542,7 +4544,7 @@ timestamp_get(Leader) -> timestamp_get_internal(Leader, Format) -> {YY,MM,DD,H,M,S} = time_get(), - io_lib:format(Format, [Leader,YY,MM,DD,H,M,S]). + lists:flatten(io_lib:format(Format, [Leader,YY,MM,DD,H,M,S])). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% time_get() -> {YY,MM,DD,H,M,S} diff --git a/lib/common_test/test_server/ts_benchmark.erl b/lib/common_test/test_server/ts_benchmark.erl index e4e06b54c2..a9486262b3 100644 --- a/lib/common_test/test_server/ts_benchmark.erl +++ b/lib/common_test/test_server/ts_benchmark.erl @@ -45,7 +45,7 @@ run(Specs, Opts, Vars) -> || Spec <- Specs], file:delete(filename:join(Cwd,"latest_benchmark")), {ok,D} = file:open(filename:join(Cwd,"latest_benchmark"),[write]), - io:format(D,BDir,[]), + io:format(D,"~ts", [BDir]), file:close(D). -- cgit v1.2.3 From 205ef4a2ee3dee26196a5a212e89b6b4839639cc Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Wed, 29 Aug 2018 15:46:17 +0200 Subject: sasl: Adjust some calls to io:format() --- lib/sasl/src/systools.erl | 6 +++--- lib/sasl/src/systools_relup.erl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sasl/src/systools.erl b/lib/sasl/src/systools.erl index dd1a58c3c1..34eca6679f 100644 --- a/lib/sasl/src/systools.erl +++ b/lib/sasl/src/systools.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2016. All Rights Reserved. +%% Copyright Ericsson AB 1996-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ make_tar(RelName, Opt) -> script2boot(File) -> case systools_lib:file_term2binary(File ++ ".script", File ++ ".boot") of {error,Error} -> - io:format(systools_make:format_error(Error)), + io:format("~ts", [systools_make:format_error(Error)]), error; _ -> ok @@ -84,7 +84,7 @@ script2boot(File, Output0, _Opt) -> Output = Output0++".boot", case systools_lib:file_term2binary(Input, Output) of {error,Error} -> - io:format(systools_make:format_error(Error)), + io:format("~ts", [systools_make:format_error(Error)]), error; _ -> ok diff --git a/lib/sasl/src/systools_relup.erl b/lib/sasl/src/systools_relup.erl index e836d57670..5f1176ec69 100644 --- a/lib/sasl/src/systools_relup.erl +++ b/lib/sasl/src/systools_relup.erl @@ -587,7 +587,7 @@ default(warnings_as_errors) -> false. print_error({error, Mod, Error}) -> S = apply(Mod, format_error, [Error]), - io:format(S, []); + io:format("~ts", [S]); print_error(Other) -> io:format("Error: ~tp~n", [Other]). -- cgit v1.2.3 From f204804473fb73dd98158e6d5823db3ea0894cf7 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 14 Sep 2018 10:15:32 +0200 Subject: xmerl: Adjust a call to io:format() --- lib/xmerl/test/xmerl_xsd_lib.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/xmerl/test/xmerl_xsd_lib.erl b/lib/xmerl/test/xmerl_xsd_lib.erl index 6006cf500f..39300cd6cb 100644 --- a/lib/xmerl/test/xmerl_xsd_lib.erl +++ b/lib/xmerl/test/xmerl_xsd_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2016. All Rights Reserved. +%% Copyright Ericsson AB 2006-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -94,8 +94,9 @@ return_results2({NewFail, NewSuccess, NewMal, NewNotMal}, NumSucc, SkippedN, Tot _ -> io_lib:format("These ~p skipped tests were malicious, but succeeds now: ~p~n", [length(NewNotMal), NewNotMal]) end, - ct:comment(io_lib:format("~p successful tests, ~p skipped tests of totally ~p test cases. ~n" ++ - NFComm ++ NSComm ++ NMComm ++ NNMComm, [NumSucc, SkippedN, TotN])), + ct:comment(io_lib:format("~p successful tests, ~p skipped tests of totally ~p test cases. ~n~ts", + [NumSucc, SkippedN, TotN, + NFComm ++ NSComm ++ NMComm ++ NNMComm])), [] = NewFail. %% return_results2(Diff,{STErrs,STOther},{ITErrs,ITOther},TotN) -> -- cgit v1.2.3 From 2cc0d84b1ed8642521579975155c84d76c5866a4 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 14 Sep 2018 10:27:12 +0200 Subject: ssh: Adjust some calls to io:format() --- lib/ssh/test/ssh_connection_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl index 778e4a5fc8..6aa587dc7f 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -1124,12 +1124,12 @@ start_our_shell(_User, _Peer) -> ssh_exec_echo(Cmd) -> spawn(fun() -> - io:format("echo "++Cmd ++ "\n") + io:format("echo ~s\n", [Cmd]) end). ssh_exec_echo(Cmd, User) -> spawn(fun() -> - io:format(io_lib:format("echo ~s ~s\n",[User,Cmd])) + io:format("echo ~s ~s\n",[User,Cmd]) end). ssh_exec_echo(Cmd, User, _PeerAddr) -> ssh_exec_echo(Cmd,User). -- cgit v1.2.3
NumModuleGroupCaseLogTimeResultComment
" ++ Col0 ++ "~ts" ++ Col1 ++ "" ++ Col0 ++ "~w" ++ Col1 ++ "