]> code.ossystems Code Review - openembedded-core.git/commitdiff
ltp: make copyFrom scp command non-fatal
authorMatthew <matthew.zeng@windriver.com>
Wed, 5 Aug 2020 18:51:33 +0000 (14:51 -0400)
committerSteve Sakoman <steve@sakoman.com>
Thu, 6 Aug 2020 16:20:49 +0000 (06:20 -1000)
[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.

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>
meta/lib/oeqa/core/target/ssh.py
meta/lib/oeqa/runtime/cases/ltp.py

index 090b40a8143503f321e0017245e7e1b518648ef2..aefb576805c3109af5395c0ad82517243e878365 100644 (file)
@@ -107,13 +107,16 @@ class OESSHTarget(OETarget):
             scpCmd = self.scp + [localSrc, remotePath]
             return self._run(scpCmd, ignore_status=False)
 
-    def copyFrom(self, remoteSrc, localDst):
+    def copyFrom(self, remoteSrc, localDst, warn_on_failure=False):
         """
             Copy file from target.
         """
         remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc)
         scpCmd = self.scp + [remotePath, localDst]
-        return self._run(scpCmd, ignore_status=False)
+        (status, output) = self._run(scpCmd, ignore_status=warn_on_failure)
+        if warn_on_failure and status:
+            self.logger.warning("Copy returned non-zero exit status %d:\n%s" % (status, output))
+        return (status, output)
 
     def copyDirTo(self, localSrc, remoteDst):
         """
index 6dc5ef22adf6e3420b44bc07a603f98720f2e898..a66d5d13d75f91da3f5847bfa3f04cb7968774fe 100644 (file)
@@ -78,9 +78,10 @@ class LtpTest(LtpTestBase):
             # copy nice log from DUT
             dst = os.path.join(self.ltptest_log_dir, "%s" %  ltp_group )
             remote_src = "/opt/ltp/results/%s" % ltp_group 
-            (status, output) = self.target.copyFrom(remote_src, dst)
+            (status, output) = self.target.copyFrom(remote_src, dst, True)
             msg = 'File could not be copied. Output: %s' % output
-            self.assertEqual(status, 0, msg=msg)
+            if status:
+                self.target.logger.warning(msg)
 
             parser = LtpParser()
             results, sections  = parser.parse(dst)