aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/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/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/file_SUITE.erl')
-rw-r--r--lib/kernel/test/file_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl
index 4218cfa646..e4c8f0ffaf 100644
--- a/lib/kernel/test/file_SUITE.erl
+++ b/lib/kernel/test/file_SUITE.erl
@@ -2651,6 +2651,8 @@ symlinks(Config) when is_list(Config) ->
?line #file_info{links=1, type=symlink} = Info2,
?line {ok, Name} = ?FILE_MODULE:read_link(Alias),
{ok, Name} = ?FILE_MODULE:read_link_all(Alias),
+ %% If all is good, delete dir again (avoid hanging dir on windows)
+ rm_rf(?FILE_MODULE,NewDir),
ok
end,
@@ -4304,3 +4306,18 @@ disc_free(Path) ->
memsize() ->
{Tot,_Used,_} = memsup:get_memory_data(),
Tot.
+
+%%%-----------------------------------------------------------------
+%%% 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.