KVM test: allow setting shell line separator string in the config file
The shell line separator string is appended to strings sent by sendline().
The string is controlled by the parameter shell_linesep. It defaults to "\n".
Signed-off-by: Michael Goldish <mgoldish@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3788 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 88299be..53b664a 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -576,7 +576,7 @@
return remote_scp(command, password, timeout)
-def ssh(host, port, username, password, prompt, timeout=10):
+def ssh(host, port, username, password, prompt, linesep="\n", timeout=10):
"""
Log into a remote host (guest) using SSH.
@@ -591,10 +591,10 @@
"""
command = ("ssh -o UserKnownHostsFile=/dev/null -p %s %s@%s" %
(port, username, host))
- return remote_login(command, password, prompt, "\n", timeout)
+ return remote_login(command, password, prompt, linesep, timeout)
-def telnet(host, port, username, password, prompt, timeout=10):
+def telnet(host, port, username, password, prompt, linesep="\n", timeout=10):
"""
Log into a remote host (guest) using Telnet.
@@ -608,10 +608,10 @@
@return: kvm_spawn object on success and None on failure.
"""
command = "telnet -l %s %s %s" % (username, host, port)
- return remote_login(command, password, prompt, "\r\n", timeout)
+ return remote_login(command, password, prompt, linesep, timeout)
-def netcat(host, port, username, password, prompt, timeout=10):
+def netcat(host, port, username, password, prompt, linesep="\n", timeout=10):
"""
Log into a remote host (guest) using Netcat.
@@ -625,7 +625,7 @@
@return: kvm_spawn object on success and None on failure.
"""
command = "nc %s %s" % (host, port)
- return remote_login(command, password, prompt, "\n", timeout)
+ return remote_login(command, password, prompt, linesep, timeout)
# The following are utility functions related to ports.