diff options
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/file_SUITE.erl | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index e4eca4b756..2ffdf30cb3 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -416,14 +416,13 @@ make_del_dir(Config) when is_list(Config) -> % because there are processes having that directory as current. ?line ok = ?FILE_MODULE:make_dir(NewDir), ?line {ok,CurrentDir} = file:get_cwd(), - case {os:type(), length(NewDir) >= 260 } of - {{win32,_}, true} -> - io:format("Skip set_cwd for windows path longer than 260 (MAX_PATH)\n", []), - io:format("\nNewDir = ~p\n", [NewDir]), - ok; - _ -> - ?line ok = ?FILE_MODULE:set_cwd(NewDir) - end, + case {os:type(), length(NewDir) >= 260 } of + {{win32,_}, true} -> + io:format("Skip set_cwd for windows path longer than 260 (MAX_PATH)\n", []), + io:format("\nNewDir = ~p\n", [NewDir]); + _ -> + ?line ok = ?FILE_MODULE:set_cwd(NewDir) + end, try %% Check that we get an error when trying to create... %% a deep directory @@ -480,39 +479,38 @@ cur_dir_0(Config) when is_list(Config) -> atom_to_list(?MODULE) ++"_curdir"), ?line ok = ?FILE_MODULE:make_dir(NewDir), - case {os:type(), length(NewDir) >= 260} of - {{win32,_}, true} -> - io:format("Skip set_cwd for windows path longer than 260 (MAX_PATH):\n"), - io:format("\nNewDir = ~p\n", [NewDir]), - ok; - _ -> - io:format("cd to ~s",[NewDir]), - ok = ?FILE_MODULE:set_cwd(NewDir), - - %% Create a file in the new current directory, and check that it - %% really is created there - UncommonName = "uncommon.fil", - {ok,Fd} = ?FILE_MODULE:open(UncommonName,read_write), - ok = ?FILE_MODULE:close(Fd), - {ok,NewDirFiles} = ?FILE_MODULE:list_dir("."), - true = lists:member(UncommonName,NewDirFiles), - - %% Delete the directory and return to the old current directory - %% and check that the created file isn't there (too!) - expect({error, einval}, {error, eacces}, - ?FILE_MODULE:del_dir(NewDir)), - ?FILE_MODULE:delete(UncommonName), - {ok,[]} = ?FILE_MODULE:list_dir("."), - ok = ?FILE_MODULE:set_cwd(Dir1), - io:format("cd back to ~s",[Dir1]), - - ok = ?FILE_MODULE:del_dir(NewDir), - {error, enoent} = ?FILE_MODULE:set_cwd(NewDir), - ok = ?FILE_MODULE:set_cwd(Dir1), - io:format("cd back to ~s",[Dir1]), - {ok,OldDirFiles} = ?FILE_MODULE:list_dir("."), - false = lists:member(UncommonName,OldDirFiles) - end, + case {os:type(), length(NewDir) >= 260} of + {{win32,_}, true} -> + io:format("Skip set_cwd for windows path longer than 260 (MAX_PATH):\n"), + io:format("\nNewDir = ~p\n", [NewDir]); + _ -> + io:format("cd to ~s",[NewDir]), + ok = ?FILE_MODULE:set_cwd(NewDir), + + %% Create a file in the new current directory, and check that it + %% really is created there + UncommonName = "uncommon.fil", + {ok,Fd} = ?FILE_MODULE:open(UncommonName,read_write), + ok = ?FILE_MODULE:close(Fd), + {ok,NewDirFiles} = ?FILE_MODULE:list_dir("."), + true = lists:member(UncommonName,NewDirFiles), + + %% Delete the directory and return to the old current directory + %% and check that the created file isn't there (too!) + expect({error, einval}, {error, eacces}, + ?FILE_MODULE:del_dir(NewDir)), + ?FILE_MODULE:delete(UncommonName), + {ok,[]} = ?FILE_MODULE:list_dir("."), + ok = ?FILE_MODULE:set_cwd(Dir1), + io:format("cd back to ~s",[Dir1]), + + ok = ?FILE_MODULE:del_dir(NewDir), + {error, enoent} = ?FILE_MODULE:set_cwd(NewDir), + ok = ?FILE_MODULE:set_cwd(Dir1), + io:format("cd back to ~s",[Dir1]), + {ok,OldDirFiles} = ?FILE_MODULE:list_dir("."), + false = lists:member(UncommonName,OldDirFiles) + end, %% Try doing some bad things ?line {error, badarg} = ?FILE_MODULE:set_cwd({foo,bar}), |