aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2013-05-21 18:21:06 +0200
committerSiri Hansen <[email protected]>2013-05-21 18:21:06 +0200
commit5ad4e9787c072ae8cea1ed1c9f2212551b307267 (patch)
treecfb940ea4b1d1510fe922713dc6ec2d796d5cfeb /lib
parentf5592219f5fb7f69b94b8c60e0cdf4a503a5899b (diff)
downloadotp-5ad4e9787c072ae8cea1ed1c9f2212551b307267.tar.gz
otp-5ad4e9787c072ae8cea1ed1c9f2212551b307267.tar.bz2
otp-5ad4e9787c072ae8cea1ed1c9f2212551b307267.zip
[sasl] Clean priv_dir after systools_SUITE
Some files with icky names (unicode) can not be deleted with the cleanup scripts after daily tests. Therefore it is better to clean up directly from the erlang node after test is run.
Diffstat (limited to 'lib')
-rw-r--r--lib/sasl/test/release_handler_SUITE.erl45
-rw-r--r--lib/sasl/test/rh_test_lib.erl50
-rw-r--r--lib/sasl/test/systools_SUITE.erl6
3 files changed, 54 insertions, 47 deletions
diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl
index b343bd0be6..816dc7b36c 100644
--- a/lib/sasl/test/release_handler_SUITE.erl
+++ b/lib/sasl/test/release_handler_SUITE.erl
@@ -20,7 +20,6 @@
-include_lib("common_test/include/ct.hrl").
-include("test_lib.hrl").
--include_lib("kernel/include/file.hrl").
-compile(export_all).
@@ -1963,49 +1962,7 @@ copy_client(Conf,Master,Sname,Client) ->
clean_priv_dir(Conf,Save) ->
PrivDir = priv_dir(Conf),
-
- ?t:format("======== current dir ~tp~n",[PrivDir]),
- Dirs = filelib:wildcard(filename:join(PrivDir,"*")),
- ?t:format("======== deleting ~tp~n",[Dirs]),
-
- ok = rm_rf(Dirs,Save),
- Remaining = filelib:wildcard(filename:join(PrivDir,"*")),
- ?t:format("======== remaining ~tp~n",[Remaining]),
-
- case Remaining of
- [] ->
- ok;
- _ ->
- rm_rf(Remaining,Save),
- Remaining2 = filelib:wildcard(filename:join(PrivDir,"*")),
- ?t:format("======== remaining after second try ~tp~n",[Remaining2])
- end,
-
- ok.
-
-
-rm_rf([File|Files],Save) ->
- case Save andalso filename:basename(File)=="save" of
- true ->
- rm_rf(Files,Save);
- false ->
- case file:read_link_info(File) of
- {ok,#file_info{type=directory}} ->
- MoreFiles = filelib:wildcard(filename:join(File,"*")),
- rm_rf(MoreFiles,Save),
- file:del_dir(File),
- rm_rf(Files,Save);
- {ok,#file_info{}} ->
- file:delete(File),
- rm_rf(Files,Save);
- Other ->
- ?t:format("======== could not delete file ~p~n"
- "read_link_info -> ~p~n",[File,Other]),
- rm_rf(Files,Save)
- end
- end;
-rm_rf([],_) ->
- ok.
+ rh_test_lib:clean_dir(PrivDir,Save).
node_name(Sname) when is_atom(Sname) ->
{ok,Host} = inet:gethostname(),
diff --git a/lib/sasl/test/rh_test_lib.erl b/lib/sasl/test/rh_test_lib.erl
index 06efa4acea..36996f7ab2 100644
--- a/lib/sasl/test/rh_test_lib.erl
+++ b/lib/sasl/test/rh_test_lib.erl
@@ -9,7 +9,10 @@
get_start_erl_args/3,
get_client_args/3,
get_client_args/4]).
+-export([clean_dir/1,
+ clean_dir/2]).
+-include_lib("kernel/include/file.hrl").
cmd(Cmd,Args,Env) ->
case open_port({spawn_executable, Cmd}, [{args,Args},{env,Env}]) of
@@ -109,3 +112,50 @@ single_quote() ->
_ ->
"\\'"
end.
+
+clean_dir(Dir) ->
+ clean_dir(Dir,false).
+clean_dir(Dir,Save) ->
+ test_server:format("======== current dir ~tp~n",[Dir]),
+ Dirs = filelib:wildcard(filename:join(Dir,"*")),
+ test_server:format("======== deleting ~tp~n",[Dirs]),
+
+ ok = rm_rf(Dirs,Save),
+ Remaining = filelib:wildcard(filename:join(Dir,"*")),
+ test_server:format("======== remaining ~tp~n",[Remaining]),
+
+ case Remaining of
+ [] ->
+ ok;
+ _ ->
+ rm_rf(Remaining,Save),
+ Remaining2 = filelib:wildcard(filename:join(Dir,"*")),
+ test_server:format("======== remaining after second try ~tp~n",
+ [Remaining2])
+ end,
+
+ ok.
+
+
+rm_rf([File|Files],Save) ->
+ case Save andalso filename:basename(File)=="save" of
+ true ->
+ rm_rf(Files,Save);
+ false ->
+ case file:read_link_info(File) of
+ {ok,#file_info{type=directory}} ->
+ MoreFiles = filelib:wildcard(filename:join(File,"*")),
+ rm_rf(MoreFiles,Save),
+ file:del_dir(File),
+ rm_rf(Files,Save);
+ {ok,#file_info{}} ->
+ file:delete(File),
+ rm_rf(Files,Save);
+ Other ->
+ test_server:format("======== could not delete file ~p~n"
+ "read_link_info -> ~p~n",[File,Other]),
+ rm_rf(Files,Save)
+ end
+ end;
+rm_rf([],_) ->
+ ok.
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl
index 5e95b13077..1cc9eb6986 100644
--- a/lib/sasl/test/systools_SUITE.erl
+++ b/lib/sasl/test/systools_SUITE.erl
@@ -137,9 +137,9 @@ compile_source(File) ->
ok = file:write_file(OutFileTemp, Code),
file:rename(OutFileTemp, OutFile).
-end_per_suite(Conf) when is_list(Conf) ->
- %% Nothing.
- Conf.
+end_per_suite(Config) when is_list(Config) ->
+ rh_test_lib:clean_dir(?privdir),
+ Config.
init_per_testcase(link_tar, Config) ->
case os:type() of