Skip to contentSkip to conversation

ltp: make copyFrom scp command non-fatal

PATCH Superseded Matthew 2 participants 3 messages Aug 5, 2020

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Matthew

author
#0 lore raw

PATCH 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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta/lib/oeqa/core/target/ssh.py +7 -4
index 090b40a814..1b78e830d4 100644
@@ -61,9 +61,12 @@ class OESSHTarget(OETarget):
         self.logger.debug("[Command returned '%d' after %.2f seconds]"
                  "" % (status, time.time() - starttime))
 
-        if status and not ignore_status:
-            raise AssertionError("Command '%s' returned non-zero exit "
-                                 "status %d:\n%s" % (command, status, output))
+        if status:
+            if not ignore_status:
+                raise AssertionError("Command '%s' returned non-zero exit "
+                                     "status %d:\n%s" % (command, status, output))
+            else:
+                self.logger.warning("Command '%s' returned non-zero exit status %d:\n%s" % (command, status, output))
 
         return (status, output)
 
@@ -113,7 +116,7 @@ class OESSHTarget(OETarget):
         """
         remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc)
         scpCmd = self.scp + [remotePath, localDst]
-        return self._run(scpCmd, ignore_status=False)
+        return self._run(scpCmd, ignore_status=True)
 
     def copyDirTo(self, localSrc, remoteDst):
         """
Signature · 1 line
2.27.0
#1 lore raw
Quoted 31 lines · Matthew

[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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta/lib/oeqa/core/target/ssh.py +6 -3
index 090b40a814..1b78e830d4 100644
@@ -61,9 +61,12 @@ class OESSHTarget(OETarget):
         self.logger.debug("[Command returned '%d' after %.2f seconds]"
                  "" % (status, time.time() - starttime))
 
-        if status and not ignore_status:
-            raise AssertionError("Command '%s' returned non-zero exit "
-                                 "status %d:\n%s" % (command, status, output))
+        if status:
+            if not ignore_status:
+                raise AssertionError("Command '%s' returned non-zero exit "
+                                     "status %d:\n%s" % (command, status, output))
+            else:
+                self.logger.warning("Command '%s' returned non-zero exit status %d:\n%s" % (command, status, output))
 
         return (status, output)
 

meta/lib/oeqa/core/target/ssh.py class OESSHTarget(OETarget): · line 122

Quoted 8 lines
meta/lib/oeqa/core/target/ssh.py +1 -1
@@ -113,7 +116,7 @@ class OESSHTarget(OETarget):
         """
         remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc)
         scpCmd = self.scp + [remotePath, localDst]
-        return self._run(scpCmd, ignore_status=False)
+        return self._run(scpCmd, ignore_status=True)
 
     def copyDirTo(self, localSrc, remoteDst):
         """

I'm a little worried that these warnings may appear from places we don't expect them. I can run the test on the autobuilder and see if other tests trigger this I guess, I wondered if you'd looked into that?

An alternative may be to set ignore_status=True but check the return code at a higher level and issue the warning there?

Cheers,
Richard

author
#2 lore raw
Quoted 38 lines · Richard Purdie
Quoted 37 lines · Matthew

[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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta/lib/oeqa/core/target/ssh.py +7 -4
index 090b40a814..1b78e830d4 100644
@@ -61,9 +61,12 @@ class OESSHTarget(OETarget):
         self.logger.debug("[Command returned '%d' after %.2f seconds]"
                  "" % (status, time.time() - starttime))
 
-        if status and not ignore_status:
-            raise AssertionError("Command '%s' returned non-zero exit "
-                                 "status %d:\n%s" % (command, status, output))
+        if status:
+            if not ignore_status:
+                raise AssertionError("Command '%s' returned non-zero exit "
+                                     "status %d:\n%s" % (command, status, output))
+            else:
+                self.logger.warning("Command '%s' returned non-zero exit status %d:\n%s" % (command, status, output))
 
         return (status, output)
 
@@ -113,7 +116,7 @@ class OESSHTarget(OETarget):
         """
         remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc)
         scpCmd = self.scp + [remotePath, localDst]
-        return self._run(scpCmd, ignore_status=False)
+        return self._run(scpCmd, ignore_status=True)
 
Quoted 7 lines

meta/lib/oeqa/core/target/ssh.py class OESSHTarget(OETarget): · line 122

Quoted 2 lines
meta/lib/oeqa/core/target/ssh.py +0 -0
     def copyDirTo(self, localSrc, remoteDst):
         """

I'm a little worried that these warnings may appear from places we don't expect them. I can run the test on the autobuilder and see if other tests trigger this I guess, I wondered if you'd looked into that?

You're right, the better way might be adding an additional optional parameter ignore_error, so it won't break any existing behavior.

I'll quickly create a new patch and let you have a look.

Quoted 5 lines

An alternative may be to set ignore_status=True but check the return code at a higher level and issue the warning there?

Cheers,
Richard

--
Mingde (Matthew) Zeng