test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework ssh_pexpect: fix scp file truncated issue
@ 2017-01-23  1:36 Yong Liu
  0 siblings, 0 replies; only message in thread
From: Yong Liu @ 2017-01-23  1:36 UTC (permalink / raw)
  To: dts; +Cc: Yong Liu

Some times even scp command status show 100%, file still not scp to
destination integrated. Enable verbose option and wait for scp process
really exited.

Signed-off-by: Yong Liu <yong.liu@intel.com>

diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index d5b6616..8d6c3dd 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -143,9 +143,9 @@ class SSHPexpect(object):
         """
         Copies a file from a remote place into local.
         """
-        command = 'scp {0}@{1}:{2} {3}'.format(self.username, self.host, src, dst)
+        command = 'scp -v {0}@{1}:{2} {3}'.format(self.username, self.host, src, dst)
         if ':' in self.host:
-            command = 'scp -P {0} -o NoHostAuthenticationForLocalhost=yes {1}@{2}:{3} {4}'.format(
+            command = 'scp -v -P {0} -o NoHostAuthenticationForLocalhost=yes {1}@{2}:{3} {4}'.format(
                 str(self.port), self.username, self.ip, src, dst)
         if password == '':
             self._spawn_scp(command, self.password)
@@ -158,10 +158,10 @@ class SSHPexpect(object):
         """
         command = 'scp {0} {1}@{2}:{3}'.format(src, self.username, self.host, dst)
         if ':' in self.host:
-            command = 'scp -P {0} -o NoHostAuthenticationForLocalhost=yes {1} {2}@{3}:{4}'.format(
+            command = 'scp -v -P {0} -o NoHostAuthenticationForLocalhost=yes {1} {2}@{3}:{4}'.format(
                 str(self.port), src, self.username, self.ip, dst)
         else:
-            command = 'scp {0} {1}@{2}:{3}'.format(
+            command = 'scp -v {0} {1}@{2}:{3}'.format(
                 src, self.username, self.host, dst)
         if password == '':
             self._spawn_scp(command, self.password)
@@ -185,7 +185,7 @@ class SSHPexpect(object):
         if i == 1:
             time.sleep(0.5)
             p.sendline(password)
-            p.expect("100%", 60)
+            p.expect("Exit status 0", 60)
         if i == 4:
             self.logger.error("SCP TIMEOUT error %d" % i)
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-23  1:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23  1:36 [dts] [PATCH] framework ssh_pexpect: fix scp file truncated issue Yong Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).