From 248e2eb0462e5d180b2c35a726aba734ce2c2182 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 23 May 2013 12:08:46 +0200 Subject: test_server: Fix ts write unicode in config files --- lib/test_server/src/test_server_ctrl.erl | 6 +++--- lib/test_server/src/ts_lib.erl | 2 +- lib/test_server/src/ts_make.erl | 6 +++--- lib/test_server/src/ts_run.erl | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 352e58f91c..e24d6ceacb 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -4840,7 +4840,7 @@ start_node(Name, Type, Options) -> case controller_call({start_node,Name,Type,Options}, T) of {{ok,Nodename}, Host, Cmd, Info, Warning} -> format(minor, - "Successfully started node ~w on ~tp with command: ~tp", + "Successfully started node ~w on ~tp with command: ~ts", [Nodename, Host, Cmd]), format(major, "=node_start ~w", [Nodename]), case Info of @@ -4856,7 +4856,7 @@ start_node(Name, Type, Options) -> {ok, Nodename}; {fail,{Ret, Host, Cmd}} -> format(minor, - "Failed to start node ~tp on ~tp with command: ~tp~n" + "Failed to start node ~tp on ~tp with command: ~ts~n" "Reason: ~p", [Name, Host, Cmd, Ret]), {fail,Ret}; @@ -4865,7 +4865,7 @@ start_node(Name, Type, Options) -> Ret; {Ret, Host, Cmd} -> format(minor, - "Failed to start node ~tp on ~tp with command: ~tp~n" + "Failed to start node ~tp on ~tp with command: ~ts~n" "Reason: ~p", [Name, Host, Cmd, Ret]), Ret diff --git a/lib/test_server/src/ts_lib.erl b/lib/test_server/src/ts_lib.erl index 9f56f59fed..5368960446 100644 --- a/lib/test_server/src/ts_lib.erl +++ b/lib/test_server/src/ts_lib.erl @@ -164,7 +164,7 @@ subst_file(In, Out, Vars) -> case file:read_file(In) of {ok, Bin} -> Subst = subst(b2s(Bin), Vars, []), - case file:write_file(Out, Subst) of + case file:write_file(Out, unicode:characters_to_binary(Subst)) of ok -> ok; {error, Reason} -> diff --git a/lib/test_server/src/ts_make.erl b/lib/test_server/src/ts_make.erl index f3266f5836..8727f7ebfe 100644 --- a/lib/test_server/src/ts_make.erl +++ b/lib/test_server/src/ts_make.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2012. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -67,7 +67,7 @@ get_port_data(Port, Last0, Complete0) -> end. update_last([C|Rest], Line, true) -> - io:put_chars(Line), + io:put_chars(list_to_binary(Line)), %% Utf-8 list to utf-8 binary io:nl(), update_last([C|Rest], [], false); update_last([$\r|Rest], Result, Complete) -> @@ -79,7 +79,7 @@ update_last([C|Rest], Result, Complete) -> update_last([], Result, Complete) -> {Result, Complete}; update_last(eof, Result, _) -> - Result. + unicode:characters_to_list(list_to_binary(Result)). run_make_script({win32, _}, Make, Dir, Makefile) -> {"run_make.bat", diff --git a/lib/test_server/src/ts_run.erl b/lib/test_server/src/ts_run.erl index 60c9a7a4b7..d96abfc55a 100644 --- a/lib/test_server/src/ts_run.erl +++ b/lib/test_server/src/ts_run.erl @@ -224,7 +224,7 @@ make_command(Vars, Spec, State) -> CrashFile = filename:join(Cwd,State#state.file ++ "_erl_crash.dump"), case filelib:is_file(CrashFile) of true -> - io:format("ts_run: Deleting dump: ~s\n",[CrashFile]), + io:format("ts_run: Deleting dump: ~ts\n",[CrashFile]), file:delete(CrashFile); false -> ok @@ -258,8 +258,8 @@ make_command(Vars, Spec, State) -> run_batch(Vars, _Spec, State) -> process_flag(trap_exit, true), Command = State#state.command ++ " -noinput -s erlang halt", - ts_lib:progress(Vars, 1, "Command: ~s~n", [Command]), - io:format(user, "Command: ~s~n",[Command]), + ts_lib:progress(Vars, 1, "Command: ~ts~n", [Command]), + io:format(user, "Command: ~ts~n",[Command]), Port = open_port({spawn, Command}, [stream, in, eof]), Timeout = 30000 * case os:getenv("TS_RUN_VALGRIND") of false -> 1; -- cgit v1.2.3 From 048400b08872d95ce7a8b48e346b49971acb6506 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 28 Aug 2013 14:05:08 +0200 Subject: Fix testing with unicode paths re needs unicode option --- lib/compiler/test/compilation_SUITE.erl | 6 +++--- lib/kernel/test/code_SUITE.erl | 7 +++++-- lib/stdlib/test/shell_SUITE.erl | 18 +++++++++--------- lib/syntax_tools/test/syntax_tools_SUITE.erl | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl index 93b2fb4ea5..f7b1dbdddf 100644 --- a/lib/compiler/test/compilation_SUITE.erl +++ b/lib/compiler/test/compilation_SUITE.erl @@ -196,7 +196,7 @@ redundant_case_1(_) -> d. failure(Module, Conf) -> ?line Src = filename:join(?config(data_dir, Conf), atom_to_list(Module)), ?line Out = ?config(priv_dir,Conf), - ?line io:format("Compiling: ~s\n", [Src]), + ?line io:format("Compiling: ~ts\n", [Src]), ?line CompRc = compile:file(Src, [{outdir,Out},return,time]), ?line io:format("Result: ~p\n",[CompRc]), ?line case CompRc of @@ -476,8 +476,8 @@ self_compile_node(CompilerDir, OutDir, Version, Opts) -> ok. compile_compiler(Files, OutDir, Version, InlineOpts) -> - io:format("~s", [code:which(compile)]), - io:format("Compiling ~s into ~s", [Version,OutDir]), + io:format("~ts", [code:which(compile)]), + io:format("Compiling ~s into ~ts", [Version,OutDir]), Opts = [report, bin_opt_info, {outdir,OutDir}, diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 17983e972d..95fc5e398c 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -653,7 +653,7 @@ clash(Config) when is_list(Config) -> DDir = ?config(data_dir,Config)++"clash/", P = code:get_path(), [TestServerPath|_] = [Path || Path <- code:get_path(), - re:run(Path,"test_server/?$",[]) /= nomatch], + re:run(Path,"test_server/?$",[unicode]) /= nomatch], %% test non-clashing entries @@ -1527,7 +1527,10 @@ create_big_script(Config,Local) -> Leftover <- UnloadFix, lists:keymember(Leftover,1,InitialApplications) ], %% Now we should have only "real" applications... - [application:load(list_to_atom(Y)) || {match,[Y]} <- [ re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin",[{capture,[1],list}]) || X <- code:get_path()],filter_app(Y,Local)], + [application:load(list_to_atom(Y)) + || {match,[Y]} <- [ re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin", + [{capture,[1],list, unicode}]) || + X <- code:get_path()],filter_app(Y,Local)], Apps = [ {N,V} || {N,_,V} <- application:loaded_applications()], {ok,Fd} = file:open(Name ++ ".rel", [write]), io:format(Fd, diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index 233ba0764f..692dfe0faa 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -146,7 +146,7 @@ start_restricted_from_shell(Config) when is_list(Config) -> "test_restricted) end.">>), ?line {ok, test_restricted} = application:get_env(stdlib, restricted_shell), - ?line "Module" ++ _ = t(<<"begin m() end.">>), + ?line "Module" ++ _ = t({<<"begin m() end.">>, utf8}), ?line "exception exit: restricted shell does not allow c(foo)" = comm_err(<<"begin c(foo) end.">>), ?line "exception exit: restricted shell does not allow init:stop()" = @@ -225,7 +225,7 @@ start_restricted_on_command_line(Config) when is_list(Config) -> ?line {ok,Node2} = start_node(shell_suite_helper_2, "-pa "++?config(priv_dir,Config)++ " -stdlib restricted_shell test_restricted2"), - ?line "Module" ++ _ = t({Node2,<<"begin m() end.">>}), + ?line "Module" ++ _ = t({Node2,<<"begin m() end.">>, utf8}), ?line "exception exit: restricted shell does not allow c(foo)" = comm_err({Node2,<<"begin c(foo) end.">>}), ?line "exception exit: restricted shell does not allow init:stop()" = @@ -2927,14 +2927,14 @@ t1(Parent, {Bin,Enc}, F) -> server_loop(S) catch exit:R -> Parent ! {self(), R}; throw:{?MODULE,LoopReply,latin1} -> - L0 = binary_to_list(list_to_binary(LoopReply)), - [$\n | L1] = lists:dropwhile(fun(X) -> X =/= $\n end, L0), - Parent ! {self(), dotify(L1)}; + L0 = binary_to_list(list_to_binary(LoopReply)), + [$\n | L1] = lists:dropwhile(fun(X) -> X =/= $\n end, L0), + Parent ! {self(), dotify(L1)}; throw:{?MODULE,LoopReply,_Uni} -> - Tmp = unicode:characters_to_binary(LoopReply), - L0 = unicode:characters_to_list(Tmp), - [$\n | L1] = lists:dropwhile(fun(X) -> X =/= $\n end, L0), - Parent ! {self(), dotify(L1)} + Tmp = unicode:characters_to_binary(LoopReply), + L0 = unicode:characters_to_list(Tmp), + [$\n | L1] = lists:dropwhile(fun(X) -> X =/= $\n end, L0), + Parent ! {self(), dotify(L1)} after group_leader(S#state.leader, self()) end. diff --git a/lib/syntax_tools/test/syntax_tools_SUITE.erl b/lib/syntax_tools/test/syntax_tools_SUITE.erl index fd381f0b25..0d8ed377bb 100644 --- a/lib/syntax_tools/test/syntax_tools_SUITE.erl +++ b/lib/syntax_tools/test/syntax_tools_SUITE.erl @@ -73,7 +73,7 @@ print_error_markers(F, File) -> case erl_syntax:type(F) of error_marker -> {L,M,Info} = erl_syntax:error_marker_info(F), - io:format("~s:~p: ~s", [File,L,M:format_error(Info)]); + io:format("~ts:~p: ~s", [File,L,M:format_error(Info)]); _ -> ok end. -- cgit v1.2.3 From 39c0803372e168dc4841ca640072eac2dd088e41 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 30 Aug 2013 12:09:07 +0200 Subject: stdlib: Fix format if module resides in a unicode directory --- lib/stdlib/src/c.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl index fb6b8c8661..30140e20af 100644 --- a/lib/stdlib/src/c.erl +++ b/lib/stdlib/src/c.erl @@ -450,7 +450,7 @@ m() -> foreach(fun ({Mod,File}) -> mformat(Mod, File) end, sort(code:all_loaded())). mformat(A1, A2) -> - format("~-20s ~s\n", [A1,A2]). + format("~-20s ~ts\n", [A1,A2]). %% erlangrc(Home) %% Try to run a ".erlang" file, first in the current directory @@ -716,7 +716,7 @@ ls(Dir) -> {error, enotdir} -> ls_print([Dir]); {error, Error} -> - format("~s\n", [file:format_error(Error)]) + format("~ts\n", [file:format_error(Error)]) end. ls_print([]) -> ok; -- cgit v1.2.3 From 470478847dcf03a88a517d281a25c3c92e9ae129 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 8 Oct 2013 16:34:38 +0200 Subject: Fix (unicode) debug info in test cases --- lib/snmp/test/snmp_agent_test.erl | 10 +++++----- lib/ssl/test/ssl_dist_SUITE.erl | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 50336fcf6e..89a6ce1253 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -1524,11 +1524,11 @@ app_info(Config) when is_list(Config) -> false -> "undefined" end, - io:format("Root dir: ~s~n" - "SNMP: Application dir: ~s~n" - " Application ver: ~s~n" - "SSL: Application dir: ~s~n" - "CRYPTO: Application dir: ~s~n", + io:format("Root dir: ~ts~n" + "SNMP: Application dir: ~ts~n" + " Application ver: ~ts~n" + "SSL: Application dir: ~ts~n" + "CRYPTO: Application dir: ~ts~n", [code:root_dir(), SnmpDir, AppVsn, SslDir, CryptoDir]), ok. diff --git a/lib/ssl/test/ssl_dist_SUITE.erl b/lib/ssl/test/ssl_dist_SUITE.erl index d3b523ca8c..1a1b2af8d4 100644 --- a/lib/ssl/test/ssl_dist_SUITE.erl +++ b/lib/ssl/test/ssl_dist_SUITE.erl @@ -324,7 +324,7 @@ start_ssl_node_raw(Name, Args) -> [binary, {packet, 4}, {active, false}]), {ok, ListenPort} = inet:port(LSock), CmdLine = mk_node_cmdline(ListenPort, Name, Args), - ?t:format("Attempting to start ssl node ~s: ~s~n", [Name, CmdLine]), + ?t:format("Attempting to start ssl node ~ts: ~ts~n", [Name, CmdLine]), case open_port({spawn, CmdLine}, []) of Port when is_port(Port) -> unlink(Port), -- cgit v1.2.3 From 8a841f13cd393cd174310d22cf2e7c195bbd1a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 23 Oct 2013 16:33:03 +0200 Subject: kernel: code_SUITE fix unicode option --- lib/kernel/test/code_SUITE.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 95fc5e398c..42b81d16b3 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -1528,9 +1528,9 @@ create_big_script(Config,Local) -> lists:keymember(Leftover,1,InitialApplications) ], %% Now we should have only "real" applications... [application:load(list_to_atom(Y)) - || {match,[Y]} <- [ re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin", - [{capture,[1],list, unicode}]) || - X <- code:get_path()],filter_app(Y,Local)], + || {match,[Y]} <- [re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin", + [{capture,[1],list},unicode]) || + X <- code:get_path()],filter_app(Y,Local)], Apps = [ {N,V} || {N,_,V} <- application:loaded_applications()], {ok,Fd} = file:open(Name ++ ".rel", [write]), io:format(Fd, -- cgit v1.2.3 From dd694884e4883f6ddc4f83f2ca62b63dc8f828a2 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 20 Dec 2013 15:40:43 +0100 Subject: rt_tools: Handle unicode chars in printouts --- lib/runtime_tools/src/system_information.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/runtime_tools/src/system_information.erl b/lib/runtime_tools/src/system_information.erl index 1d4b878d79..603b698d5e 100644 --- a/lib/runtime_tools/src/system_information.erl +++ b/lib/runtime_tools/src/system_information.erl @@ -280,7 +280,7 @@ print_environments([],_) -> print_environment({_Key, false},_) -> ok; print_environment({Key, Value},_) -> - io:format(" - ~s = ~s~n", [Key, Value]). + io:format(" - ~s = ~ts~n", [Key, Value]). print_modules_from_code(M, [Info|Ms], Opts) -> print_module_from_code(M, Info), @@ -292,14 +292,14 @@ print_modules_from_code(_, [], _) -> ok. print_module_from_code(M, {Path, [{M,ModInfo}]}) -> - io:format(" from path \"~s\" (no application):~n", [Path]), + io:format(" from path \"~ts\" (no application):~n", [Path]), io:format(" - compiler: ~s~n", [get_value([compiler], ModInfo)]), io:format(" - md5: ~s~n", [get_value([md5], ModInfo)]), io:format(" - native: ~w~n", [get_value([native], ModInfo)]), io:format(" - loaded: ~w~n", [get_value([loaded], ModInfo)]), ok; print_module_from_code(M, {App,Vsn,Path,[{M,ModInfo}]}) -> - io:format(" from path \"~s\" (~w-~s):~n", [Path,App,Vsn]), + io:format(" from path \"~ts\" (~w-~s):~n", [Path,App,Vsn]), io:format(" - compiler: ~s~n", [get_value([compiler], ModInfo)]), io:format(" - md5: ~s~n", [get_value([md5], ModInfo)]), io:format(" - native: ~w~n", [get_value([native], ModInfo)]), -- cgit v1.2.3 From c0d320e028ce4a4b6af99ad5e20dee8ea95d6fce Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 20 Dec 2013 15:49:39 +0100 Subject: sasl test: Quote executable paths (can contain spaces) --- lib/sasl/test/release_handler_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index a3db2b23db..7e9d7c984a 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1786,7 +1786,7 @@ no_dot_erlang(Conf) -> try ok = file:set_cwd(PrivDir), - Erl = filename:join([code:root_dir(),"bin","erl"]), + Erl = "\"" ++ filename:join([code:root_dir(),"bin","erl"]) ++ "\"", Args = " -noinput -run io put_chars \"TESTOK\" -run erlang halt", ok = file:write_file(".erlang", <<"io:put_chars(\"DOT_ERLANG_READ\\n\").\n">>), -- cgit v1.2.3