aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-20 11:57:24 +0100
committerBjörn Gustavsson <[email protected]>2013-02-20 12:02:19 +0100
commit8370c974835f7b71cf1b12a44988168927475255 (patch)
tree73df9c6a4a873a1a24462b15d30c664bd9244677 /lib/kernel/test
parentbc95be2fcdf9ecf27398a6240f2148388ec649ab (diff)
downloadotp-8370c974835f7b71cf1b12a44988168927475255.tar.gz
otp-8370c974835f7b71cf1b12a44988168927475255.tar.bz2
otp-8370c974835f7b71cf1b12a44988168927475255.zip
prim_file: Fix error return from prim_file:list_dir/1
When the run-time system was started with +fnue, the error tuple indicating a non-translatable filename was added as a non-proper list tail inside an {ok,Files} term.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/file_SUITE.erl40
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">>},