aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/prim_file_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2013-05-23 09:52:12 +0200
committerSiri Hansen <[email protected]>2013-06-04 11:04:35 +0200
commite0e8b6d2c016d62c8ada8664ec4ba1ce291979d0 (patch)
tree4a7bc89bfed58889ff4f906a6bc7b0c3bfaec86b /lib/kernel/test/prim_file_SUITE.erl
parenta2a30c6e89249f4683d0d3359845eb4f9dacd0ec (diff)
downloadotp-e0e8b6d2c016d62c8ada8664ec4ba1ce291979d0.tar.gz
otp-e0e8b6d2c016d62c8ada8664ec4ba1ce291979d0.tar.bz2
otp-e0e8b6d2c016d62c8ada8664ec4ba1ce291979d0.zip
Delete 'icky' dirs and symlinks after kernel tests
This is to avoid lingering files on windows.
Diffstat (limited to 'lib/kernel/test/prim_file_SUITE.erl')
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl
index ac75037536..199e597e78 100644
--- a/lib/kernel/test/prim_file_SUITE.erl
+++ b/lib/kernel/test/prim_file_SUITE.erl
@@ -2039,6 +2039,8 @@ symlinks(Config, Handle, Suffix) ->
?PRIM_FILE_call(read_link, Handle, [Alias]),
{ok, Name} =
?PRIM_FILE_call(read_link_all, Handle, [Alias]),
+ %% If all is good, delete dir again (avoid hanging dir on windows)
+ rm_rf(?PRIM_FILE,NewDir),
ok
end,
@@ -2245,3 +2247,18 @@ zip_data([], Bs) ->
Bs;
zip_data(As, []) ->
As.
+
+%%%-----------------------------------------------------------------
+%%% Utilities
+rm_rf(Mod,Dir) ->
+ case Mod:read_link_info(Dir) of
+ {ok, #file_info{type = directory}} ->
+ {ok, Content} = Mod:list_dir_all(Dir),
+ [ rm_rf(Mod,filename:join(Dir,C)) || C <- Content ],
+ Mod:del_dir(Dir),
+ ok;
+ {ok, #file_info{}} ->
+ Mod:delete(Dir);
+ _ ->
+ ok
+ end.