aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/inets_test_lib.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-12-22 12:00:55 +0100
committerMicael Karlberg <[email protected]>2012-02-06 12:31:58 +0100
commit0d580acdc51bd88a0d364b76ac35fcf2506c2d9e (patch)
treeeca18e4c62f62ecd5032538ea81293921e3e7601 /lib/inets/test/inets_test_lib.erl
parent67b0023a0756c69f58a40702ed9a808e1e5a66a7 (diff)
downloadotp-0d580acdc51bd88a0d364b76ac35fcf2506c2d9e.tar.gz
otp-0d580acdc51bd88a0d364b76ac35fcf2506c2d9e.tar.bz2
otp-0d580acdc51bd88a0d364b76ac35fcf2506c2d9e.zip
[inets] Improved test util error handling when copy dirs
Copy dirs failed for some cases, so added more info when that happens. Also added more info during httpd test case init.
Diffstat (limited to 'lib/inets/test/inets_test_lib.erl')
-rw-r--r--lib/inets/test/inets_test_lib.erl57
1 files changed, 43 insertions, 14 deletions
diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl
index 434fa17307..b03127691d 100644
--- a/lib/inets/test/inets_test_lib.erl
+++ b/lib/inets/test/inets_test_lib.erl
@@ -306,20 +306,49 @@ copy_files(FromDir, ToDir) ->
copy_dirs(FromDirRoot, ToDirRoot) ->
- {ok, Files} = file:list_dir(FromDirRoot),
- lists:foreach(
- fun(FileOrDir) ->
- %% Check if it's a directory or a file
- case filelib:is_dir(filename:join(FromDirRoot, FileOrDir)) of
- true ->
- FromDir = filename:join([FromDirRoot, FileOrDir]),
- ToDir = filename:join([ToDirRoot, FileOrDir]),
- ok = file:make_dir(ToDir),
- copy_dirs(FromDir, ToDir);
- false ->
- copy_file(FileOrDir, FromDirRoot, ToDirRoot)
- end
- end, Files).
+ case file:list_dir(FromDirRoot) of
+ {ok, Files} ->
+ lists:foreach(
+ fun(FileOrDir) ->
+ %% Check if it's a directory or a file
+ case filelib:is_dir(filename:join(FromDirRoot,
+ FileOrDir)) of
+ true ->
+ FromDir = filename:join([FromDirRoot, FileOrDir]),
+ ToDir = filename:join([ToDirRoot, FileOrDir]),
+ case file:make_dir(ToDir) of
+ ok ->
+ copy_dirs(FromDir, ToDir);
+ {error, Reason} ->
+ tsp("<ERROR> Failed creating directory: "
+ "~n ToDir: ~p"
+ "~n Reason: ~p"
+ "~nwhen"
+ "~n ToDirRoot: ~p"
+ "~n ToDirRoot file info: ~p",
+ [ToDir,
+ Reason,
+ ToDirRoot,
+ file:read_file_info(ToDirRoot)]),
+ tsf({failed_copy_dir, ToDir, Reason})
+ end;
+ false ->
+ copy_file(FileOrDir, FromDirRoot, ToDirRoot)
+ end
+ end, Files);
+ {error, Reason} ->
+ tsp("<ERROR> Failed get directory file list: "
+ "~n FromDirRoot: ~p"
+ "~n Reason: ~p"
+ "~nwhen"
+ "~n FromDirRoot file info: ~p",
+ [FromDirRoot,
+ Reason,
+ file:read_file_info(FromDirRoot)]),
+ tsf({failed_list_dir, FromDirRoot, Reason})
+ end.
+
+
del_dirs(Dir) ->
case file:list_dir(Dir) of