aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-23 14:06:47 +0100
committerBjörn Gustavsson <[email protected]>2016-03-23 14:06:47 +0100
commit7805944629441961adc38250319fdac02c9390bb (patch)
treedaa34c9efc61d28e0cceb22268d4905bb6ee9a36 /lib
parent8cfa50ef32fb61e8f87fa051a59a2b82fde12b1f (diff)
downloadotp-7805944629441961adc38250319fdac02c9390bb.tar.gz
otp-7805944629441961adc38250319fdac02c9390bb.tar.bz2
otp-7805944629441961adc38250319fdac02c9390bb.zip
asn1_SUITE: Remove temporary files
Some test machines have quite small hard drives. Help them by remove temporary files in end_per_test_case/2.
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/test/asn1_SUITE.erl4
-rw-r--r--lib/asn1/test/asn1_test_lib.erl13
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl
index 77f78b2716..4d5120221d 100644
--- a/lib/asn1/test/asn1_SUITE.erl
+++ b/lib/asn1/test/asn1_SUITE.erl
@@ -202,7 +202,9 @@ init_per_testcase(Func, Config) ->
[{case_dir, CaseDir}|Config].
end_per_testcase(_Func, Config) ->
- code:del_path(proplists:get_value(case_dir, Config)).
+ CaseDir = proplists:get_value(case_dir, Config),
+ asn1_test_lib:rm_dirs([CaseDir]),
+ code:del_path(CaseDir).
%%------------------------------------------------------------------------------
%% Test runners
diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl
index 21f00b0968..b151546140 100644
--- a/lib/asn1/test/asn1_test_lib.erl
+++ b/lib/asn1/test/asn1_test_lib.erl
@@ -21,6 +21,7 @@
-module(asn1_test_lib).
-export([compile/3,compile_all/3,compile_erlang/3,
+ rm_dirs/1,
hex_to_bin/1,
match_value/2,
parallel/0,
@@ -105,6 +106,18 @@ compile_erlang(Mod, Config, Options) ->
{ok, M} = compile:file(filename:join(DataDir, Mod),
[report,{i,CaseDir},{outdir,CaseDir}|Options]).
+rm_dirs([Dir|Dirs]) ->
+ {ok,L0} = file:list_dir(Dir),
+ L = [filename:join(Dir, F) || F <- L0],
+ IsDir = fun(F) -> filelib:is_dir(F) end,
+ {Subdirs,Files} = lists:partition(IsDir, L),
+ _ = [ok = file:delete(F) || F <- Files],
+ rm_dirs(Subdirs),
+ ok = file:del_dir(Dir),
+ rm_dirs(Dirs);
+rm_dirs([]) ->
+ ok.
+
hex_to_bin(S) ->
<< <<(hex2num(C)):4>> || C <- S, C =/= $\s >>.