aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-12-01 15:22:41 +0100
committerHans Nilsson <[email protected]>2016-12-14 11:46:47 +0100
commiteec0a0751e2a7ca7e32731fcd05f0a6032e1062f (patch)
treeaa6b59454dceaab04ea3beb2badb32003d515703 /lib/ssh/test/ssh_test_lib.erl
parent7300d01bedaed1fbb213378d43589b4448aa5d3b (diff)
downloadotp-eec0a0751e2a7ca7e32731fcd05f0a6032e1062f.tar.gz
otp-eec0a0751e2a7ca7e32731fcd05f0a6032e1062f.tar.bz2
otp-eec0a0751e2a7ca7e32731fcd05f0a6032e1062f.zip
ssh: [test] remove 'known_hosts' interference in test suite
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.