aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-02-08 14:50:39 +0100
committerHans Nilsson <[email protected]>2016-02-08 14:50:39 +0100
commitacc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6 (patch)
treeec6786b27ab2829541389a811dbcefe502c8af9c /lib
parent45ad9334c1963c1e1a294f327df60dbadb4b4f5a (diff)
parent98cc6495f768e4d191ac96eff1b2e830cfffd3f2 (diff)
downloadotp-acc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6.tar.gz
otp-acc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6.tar.bz2
otp-acc4ac9f421e064bc0e573a9d5ecd26afe7cb8d6.zip
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl8
-rw-r--r--lib/ssh/test/ssh_test_cli.erl15
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 6c4c215b3d..4b53f6ec57 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -601,10 +601,14 @@ cli(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
UserDir = ?config(priv_dir, Config),
-
+
+ TmpDir = filename:join(?config(priv_dir,Config), "tmp"),
+ ok = ssh_test_lib:del_dirs(TmpDir),
+ ok = file:make_dir(TmpDir),
+
{_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir},
{password, "morot"},
- {ssh_cli, {ssh_test_cli, [cli]}},
+ {ssh_cli, {ssh_test_cli, [cli,TmpDir]}},
{subsystems, []},
{failfun, fun ssh_test_lib:failfun/2}]),
ct:sleep(500),
diff --git a/lib/ssh/test/ssh_test_cli.erl b/lib/ssh/test/ssh_test_cli.erl
index cd9ad5f2ff..697ddb730d 100644
--- a/lib/ssh/test/ssh_test_cli.erl
+++ b/lib/ssh/test/ssh_test_cli.erl
@@ -4,20 +4,25 @@
-record(state, {
type,
+ tmpdir,
id,
ref,
port
}).
-init([Type]) ->
- {ok, #state{type = Type}}.
+
+init([Type]) -> init([Type,"/tmp"]);
+
+init([Type,TmpDir]) ->
+ {ok, #state{type = Type,
+ tmpdir = TmpDir}}.
handle_msg({ssh_channel_up, Id, Ref}, S) ->
User = get_ssh_user(Ref),
ok = ssh_connection:send(Ref,
Id,
<< "\r\nYou are accessing a dummy, type \"q\" to exit\r\n\n" >>),
- Port = run_portprog(User, S#state.type),
+ Port = run_portprog(User, S#state.type, S#state.tmpdir),
{ok, S#state{port = Port, id = Id, ref = Ref}};
handle_msg({Port, {data, Data}}, S = #state{port = Port}) ->
@@ -68,10 +73,10 @@ handle_ssh_msg({ssh_cm, _, {exit_signal, Id, _, _, _}},
terminate(_Why, _S) ->
nop.
-run_portprog(User, cli) ->
+run_portprog(User, cli, TmpDir) ->
Pty_bin = os:find_executable("cat"),
open_port({spawn_executable, Pty_bin},
- [stream, {cd, "/tmp"}, {env, [{"USER", User}]},
+ [stream, {cd, TmpDir}, {env, [{"USER", User}]},
{args, []}, binary,
exit_status, use_stdio, stderr_to_stdout]).