aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 27fc9ed6ad..286ac6e882 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -847,3 +847,15 @@ get_kex_init(Conn, Ref, TRef) ->
%%%
random_chars(N) -> [crypto:rand_uniform($a,$z) || _<-lists:duplicate(N,x)].
+
+create_random_dir(Config) ->
+ PrivDir = proplists:get_value(priv_dir, Config),
+ Name = filename:join(PrivDir, random_chars(15)),
+ case file:make_dir(Name) of
+ ok ->
+ Name;
+ {error,eexist} ->
+ %% The Name already denotes an existing file system object, try again.
+ %% The likelyhood of always generating an existing file name is low
+ create_random_dir(Config)
+ end.