All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ltp: make copyFrom scp command non-fatal
@ 2020-08-05 15:50 Matthew
  2020-08-05 17:01 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew @ 2020-08-05 15:50 UTC (permalink / raw)
  To: openembedded-core

[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>
---
 meta/lib/oeqa/core/target/ssh.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 090b40a814..1b78e830d4 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -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):
         """
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] ltp: make copyFrom scp command non-fatal
  2020-08-05 15:50 [PATCH] ltp: make copyFrom scp command non-fatal Matthew
@ 2020-08-05 17:01 ` Richard Purdie
  2020-08-05 17:11   ` Matthew
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2020-08-05 17:01 UTC (permalink / raw)
  To: Matthew, openembedded-core

On Wed, 2020-08-05 at 11:50 -0400, Matthew wrote:
> [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>
> ---
>  meta/lib/oeqa/core/target/ssh.py | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
> index 090b40a814..1b78e830d4 100644
> --- a/meta/lib/oeqa/core/target/ssh.py
> +++ b/meta/lib/oeqa/core/target/ssh.py
> @@ -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):
>          """

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] ltp: make copyFrom scp command non-fatal
  2020-08-05 17:01 ` [OE-core] " Richard Purdie
@ 2020-08-05 17:11   ` Matthew
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew @ 2020-08-05 17:11 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core


Richard Purdie <richard.purdie@linuxfoundation.org> writes:

> On Wed, 2020-08-05 at 11:50 -0400, Matthew wrote:
>> [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>
>> ---
>>  meta/lib/oeqa/core/target/ssh.py | 11 +++++++----
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
>> index 090b40a814..1b78e830d4 100644
>> --- a/meta/lib/oeqa/core/target/ssh.py
>> +++ b/meta/lib/oeqa/core/target/ssh.py
>> @@ -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):
>>          """
>
> 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.

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-05 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 15:50 [PATCH] ltp: make copyFrom scp command non-fatal Matthew
2020-08-05 17:01 ` [OE-core] " Richard Purdie
2020-08-05 17:11   ` Matthew

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.