diff options
author | Björn Gustavsson <[email protected]> | 2013-02-21 15:12:12 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-02-21 15:12:12 +0100 |
commit | 2c0ecc9a21b282b2b08c6594fa2d77dd0bd7aa00 (patch) | |
tree | 4e407b07b7bb1dd374578cba75c75888f95aaccf /lib/kernel | |
parent | 348178af5a16329b2030604fa79bd3f9c1048ff0 (diff) | |
parent | 8370c974835f7b71cf1b12a44988168927475255 (diff) | |
download | otp-2c0ecc9a21b282b2b08c6594fa2d77dd0bd7aa00.tar.gz otp-2c0ecc9a21b282b2b08c6594fa2d77dd0bd7aa00.tar.bz2 otp-2c0ecc9a21b282b2b08c6594fa2d77dd0bd7aa00.zip |
Merge branch 'pan/unicode_filename_warnings'
* pan/unicode_filename_warnings:
prim_file: Fix error return from prim_file:list_dir/1
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/file_SUITE.erl | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index eda901f3d6..a7993dc21b 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -45,7 +45,8 @@ init_per_testcase/2, end_per_testcase/2, read_write_file/1, names/1]). -export([cur_dir_0/1, cur_dir_1/1, make_del_dir/1, - list_dir/1,list_dir_error/1, untranslatable_names/1, + list_dir/1,list_dir_error/1, + untranslatable_names/1, untranslatable_names_error/1, pos1/1, pos2/1]). -export([close/1, consult1/1, path_consult/1, delete/1]). -export([ eval1/1, path_eval/1, script1/1, path_script/1, @@ -117,7 +118,8 @@ all() -> groups() -> [{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1, - list_dir, list_dir_error, untranslatable_names]}, + list_dir, list_dir_error, untranslatable_names, + untranslatable_names_error]}, {files, [], [{group, open}, {group, pos}, {group, file_info}, {group, consult}, {group, eval}, {group, script}, @@ -598,6 +600,40 @@ untranslatable_names_1(Config) -> end, ok. +untranslatable_names_error(Config) -> + case no_untranslatable_names() of + true -> + {skip,"Not a problem on this OS"}; + false -> + untranslatable_names_error_1(Config) + end. + +untranslatable_names_error_1(Config) -> + {ok,OldCwd} = file:get_cwd(), + PrivDir = ?config(priv_dir, Config), + Dir = filename:join(PrivDir, "untranslatable_names_error"), + ok = file:make_dir(Dir), + Node = start_node(untranslatable_names, "+fnue"), + try + ok = file:set_cwd(Dir), + [ok = file:write_file(F, F) || {_,F} <- untranslatable_names()], + + ExpectedListDir0 = [unicode:characters_to_list(N, utf8) || + {utf8,N} <- untranslatable_names()], + ExpectedListDir = lists:sort(ExpectedListDir0), + io:format("ExpectedListDir: ~p\n", [ExpectedListDir]), + {error,{no_translation,BadFile}} = + rpc:call(Node, file, list_dir, [Dir]), + true = lists:keymember(BadFile, 2, untranslatable_names()) + + after + catch test_server:stop_node(Node), + file:set_cwd(OldCwd), + [file:delete(F) || {_,F} <- untranslatable_names()], + file:del_dir(Dir) + end, + ok. + untranslatable_names() -> [{utf8,<<"abc">>}, {utf8,<<"def">>}, |