summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew <matthew.zeng@windriver.com>2020-08-05 14:51:33 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-12 10:53:46 +0100
commit481c27a227cf4f44a22017645d558c36a5219cea (patch)
tree3092948b478ae8263331f83da2afcd5bd2a574a4
parenta93c7cd0ba1436476fff8cae8e9eecb1a5cae938 (diff)
downloadpoky-481c27a227cf4f44a22017645d558c36a5219cea.tar.gz
ltp: make copyFrom scp command non-fatal
[YOCTO #13802] Make the scp failure non-fatal so the ltp tests continue to run and the rest of the logs will be available to see afterwards. (From OE-Core rev: 9390846e2abdd6837094a619ba4703a1be4a04cf) Signed-off-by: Mingde (Matthew) Zeng <matthew.zeng@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 0f7d093038274f4f21f6cca39a96aac4f6c32ee3) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/core/target/ssh.py7
-rw-r--r--meta/lib/oeqa/runtime/cases/ltp.py5
2 files changed, 8 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 090b40a814..aefb576805 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -107,13 +107,16 @@ class OESSHTarget(OETarget):
107 scpCmd = self.scp + [localSrc, remotePath] 107 scpCmd = self.scp + [localSrc, remotePath]
108 return self._run(scpCmd, ignore_status=False) 108 return self._run(scpCmd, ignore_status=False)
109 109
110 def copyFrom(self, remoteSrc, localDst): 110 def copyFrom(self, remoteSrc, localDst, warn_on_failure=False):
111 """ 111 """
112 Copy file from target. 112 Copy file from target.
113 """ 113 """
114 remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc) 114 remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc)
115 scpCmd = self.scp + [remotePath, localDst] 115 scpCmd = self.scp + [remotePath, localDst]
116 return self._run(scpCmd, ignore_status=False) 116 (status, output) = self._run(scpCmd, ignore_status=warn_on_failure)
117 if warn_on_failure and status:
118 self.logger.warning("Copy returned non-zero exit status %d:\n%s" % (status, output))
119 return (status, output)
117 120
118 def copyDirTo(self, localSrc, remoteDst): 121 def copyDirTo(self, localSrc, remoteDst):
119 """ 122 """
diff --git a/meta/lib/oeqa/runtime/cases/ltp.py b/meta/lib/oeqa/runtime/cases/ltp.py
index 6dc5ef22ad..a66d5d13d7 100644
--- a/meta/lib/oeqa/runtime/cases/ltp.py
+++ b/meta/lib/oeqa/runtime/cases/ltp.py
@@ -78,9 +78,10 @@ class LtpTest(LtpTestBase):
78 # copy nice log from DUT 78 # copy nice log from DUT
79 dst = os.path.join(self.ltptest_log_dir, "%s" % ltp_group ) 79 dst = os.path.join(self.ltptest_log_dir, "%s" % ltp_group )
80 remote_src = "/opt/ltp/results/%s" % ltp_group 80 remote_src = "/opt/ltp/results/%s" % ltp_group
81 (status, output) = self.target.copyFrom(remote_src, dst) 81 (status, output) = self.target.copyFrom(remote_src, dst, True)
82 msg = 'File could not be copied. Output: %s' % output 82 msg = 'File could not be copied. Output: %s' % output
83 self.assertEqual(status, 0, msg=msg) 83 if status:
84 self.target.logger.warning(msg)
84 85
85 parser = LtpParser() 86 parser = LtpParser()
86 results, sections = parser.parse(dst) 87 results, sections = parser.parse(dst)