diff options
author | Björn Gustavsson <[email protected]> | 2016-03-23 14:06:47 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-23 14:06:47 +0100 |
commit | 7805944629441961adc38250319fdac02c9390bb (patch) | |
tree | daa34c9efc61d28e0cceb22268d4905bb6ee9a36 /lib/asn1/test/asn1_test_lib.erl | |
parent | 8cfa50ef32fb61e8f87fa051a59a2b82fde12b1f (diff) | |
download | otp-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/asn1/test/asn1_test_lib.erl')
-rw-r--r-- | lib/asn1/test/asn1_test_lib.erl | 13 |
1 files changed, 13 insertions, 0 deletions
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 >>. |