Skip to contentSkip to conversation

ltp: make copyFrom scp command non-fatal

PATCH Superseded Matthew 3 participants 5 messages Aug 5, 2020

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Matthew

author
#0 lore raw

PATCH v4 1/1 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.

---
 meta/lib/oeqa/core/target/ssh.py   | 7 +++++--
 meta/lib/oeqa/runtime/cases/ltp.py | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)
meta/lib/oeqa/core/target/ssh.py +5 -2
index 090b40a814..aefb576805 100644
@@ -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):
         """
meta/lib/oeqa/runtime/cases/ltp.py +3 -2
index 6dc5ef22ad..a66d5d13d7 100644
@@ -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)

--
2.27.0

#1 lore raw

✗ patchtest: failure for ltp: make copyFrom scp command non-fatal (rev4)

== Series Details ==

Series: ltp: make copyFrom scp command non-fatal (rev4)
Revision: 4
URL : https://patchwork.openembedded.org/series/25475/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 10221e578f)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
author
#2 lore raw

Re: ✗ patchtest: failure for ltp: make copyFrom scp command non-fatal (rev4)

My poky master is the latest commit (5e1bc3ef5a * net-tools: fix upstream version check) and my patch applies perfectly. Why is Patchwork complaining?

Quoted 29 lines · Patchwork

== Series Details ==

Series: ltp: make copyFrom scp command non-fatal (rev4)
Revision: 4
URL : https://patchwork.openembedded.org/series/25475/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 10221e578f)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

Quoted 4 lines

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe

--
Mingde (Matthew) Zeng

#3 lore raw

Re: [OE-core] ✗ patchtest: failure for ltp: make copyFrom scp command non-fatal (rev4)

Quoted 3 lines · Matthew

My poky master is the latest commit (5e1bc3ef5a * net-tools: fix upstream version check) and my patch applies perfectly. Why is Patchwork complaining?

FWIW I just tried to apply the patch and it doesn't apply for me :(.

(Stripping trailing CRs from patch; use --binary to disable.)
patching file meta/lib/oeqa/core/target/ssh.py
(Stripping trailing CRs from patch; use --binary to disable.)
patching file meta/lib/oeqa/runtime/cases/ltp.py
Hunk #1 FAILED at 78.
1 out of 1 hunk FAILED -- saving rejects to file meta/lib/oeqa/runtime/cases/ltp.py.rej

The difference is trailing whitespace which is present on the line:

remote_src = "/opt/ltp/results/%s" % ltp_group

but has been stripped in your patch.

Cheers,

Richard

author
#4 lore raw

Re: [OE-core] ✗ patchtest: failure for ltp: make copyFrom scp command non-fatal (rev4)

Quoted 14 lines · Richard Purdie
Quoted 3 lines · Matthew

My poky master is the latest commit (5e1bc3ef5a * net-tools: fix upstream version check) and my patch applies perfectly. Why is Patchwork complaining?

FWIW I just tried to apply the patch and it doesn't apply for me :(.

(Stripping trailing CRs from patch; use --binary to disable.)
patching file meta/lib/oeqa/core/target/ssh.py
(Stripping trailing CRs from patch; use --binary to disable.)
patching file meta/lib/oeqa/runtime/cases/ltp.py
Hunk #1 FAILED at 78.
1 out of 1 hunk FAILED -- saving rejects to file meta/lib/oeqa/runtime/cases/ltp.py.rej

Quoted 5 lines

The difference is trailing whitespace which is present on the line:

remote_src = "/opt/ltp/results/%s" % ltp_group

but has been stripped in your patch.

Arghh, I configured automatic remove trailing whitespace on save, that must be the issue.

Patch with the whitespace sent.

Quoted 4 lines

Cheers,

Richard

--
Mingde (Matthew) Zeng