diff options
Diffstat (limited to 'lib/tools')
-rw-r--r-- | lib/tools/src/fprof.erl | 2 | ||||
-rw-r--r-- | lib/tools/test/fprof_SUITE.erl | 17 | ||||
-rw-r--r-- | lib/tools/test/fprof_SUITE_data/fprof_unicode.erl | 36 |
3 files changed, 51 insertions, 4 deletions
diff --git a/lib/tools/src/fprof.erl b/lib/tools/src/fprof.erl index 2fe42beb03..fb657c2928 100644 --- a/lib/tools/src/fprof.erl +++ b/lib/tools/src/fprof.erl @@ -1136,7 +1136,7 @@ ensure_open(Pid, _Options) when is_pid(Pid) -> ensure_open([], _Options) -> {already_open, undefined}; ensure_open(Filename, Options) when is_atom(Filename); is_list(Filename) -> - file:open(Filename, Options). + file:open(Filename, [{encoding, utf8} | Options]). %%%--------------------------------- %%% Fairly generic utility functions diff --git a/lib/tools/test/fprof_SUITE.erl b/lib/tools/test/fprof_SUITE.erl index affb45b7a6..8fd164a4b3 100644 --- a/lib/tools/test/fprof_SUITE.erl +++ b/lib/tools/test/fprof_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2017. 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. @@ -27,7 +27,7 @@ %% Test suites -export([stack_seq/1, tail_seq/1, create_file_slow/1, spawn_simple/1, imm_tail_seq/1, imm_create_file_slow/1, imm_compile/1, - cpu_create_file_slow/1]). + cpu_create_file_slow/1, unicode/1]). %% Other exports -export([create_file_slow/2]). @@ -59,7 +59,7 @@ all() -> false -> [stack_seq, tail_seq, create_file_slow, spawn_simple, imm_tail_seq, imm_create_file_slow, imm_compile, - cpu_create_file_slow] + cpu_create_file_slow, unicode] end. @@ -533,6 +533,17 @@ cpu_create_file_slow(Config) when is_list(Config) -> TestResult. +unicode(Config) when is_list(Config) -> + DataDir = proplists:get_value(data_dir, Config), + SourceFile = filename:join(DataDir, "fprof_unicode.erl"), + PrivDir = proplists:get_value(priv_dir, Config), + AnalysisFile = filename:join(PrivDir, "fprof_unicode.analysis"), + {ok, fprof_unicode} = compile:file(SourceFile, [{outdir, PrivDir}]), + true = code:add_path(PrivDir), + fprof:apply(fprof_unicode, t, []), + ok = fprof:profile(dump, AnalysisFile), + ok = fprof:analyse(dest, AnalysisFile). + %%%--------------------------------------------------------------------- %%% Functions to test %%%--------------------------------------------------------------------- diff --git a/lib/tools/test/fprof_SUITE_data/fprof_unicode.erl b/lib/tools/test/fprof_SUITE_data/fprof_unicode.erl new file mode 100644 index 0000000000..8b58efc5fe --- /dev/null +++ b/lib/tools/test/fprof_SUITE_data/fprof_unicode.erl @@ -0,0 +1,36 @@ +-module(fprof_unicode). + +-export([t/0, 'кирилли́ческий атом'/0, annan/0, c_break/1, + 'кирилли́ческий атомB'/1]). + +t() -> + _Atom = 'кирилли́ческий атом', + 'кирилли́ческий атом'(). + +'кирилли́ческий атом'() -> + 'кирилли́ческий атом'('кирилли́ческий атом'). + +'кирилли́ческий атом'(_Atom) -> + self() ! 'кирилли́ческий атом', + G = fun (X) -> + catch foo:bar() + end, + G("кирилли́ческий атом"), % line 17 + Pid = spawn_link(fun() -> waiting() end), + true = register('кирилли́ческий атом', Pid), + F = fun() -> 'кирилли́ческий атом' end, + F(). + +annan() -> + foo. + +waiting() -> + receive + X -> X + end. + +c_break(_B) -> + true. + +'кирилли́ческий атомB'(_B) -> + true. |