Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Matthew" <matthew.zeng@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCHv3] ltp: make copyFrom scp command non-fatal
Date: Wed, 5 Aug 2020 14:33:58 -0400	[thread overview]
Message-ID: <873651hrhl.fsf@windriver.com> (raw)
In-Reply-To: <83a3c9a961bec6ed39fb48d67a3c615e13d05fa3.camel@linuxfoundation.org>


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

> On Wed, 2020-08-05 at 14:10 -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   | 7 +++++--
>>  meta/lib/oeqa/runtime/cases/ltp.py | 2 +-
>>  2 files changed, 6 insertions(+), 3 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):
>>              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):
>>          """
>> diff --git a/meta/lib/oeqa/runtime/cases/ltp.py b/meta/lib/oeqa/runtime/cases/ltp.py
>> index 6dc5ef22ad..da529ce482 100644
>> --- a/meta/lib/oeqa/runtime/cases/ltp.py
>> +++ b/meta/lib/oeqa/runtime/cases/ltp.py
>> @@ -78,7 +78,7 @@ 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)
>
> The idea of this change is so "the ltp tests continue to run" yet if I
> understand that code, a copy failure will throw the assertEqual and
> hence stop the test so we don't get all the other logging information?

When warn_on_failure=True, so is ignore_status. Then 'status and not ignore_status' evaluates to false, and 'raise AssertionError("Command '%s' returned non-zero exit ...)' will not run.

>
> Cheers,
>
> Richard
>
> 


--
Mingde (Matthew) Zeng

  reply	other threads:[~2020-08-05 18:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 18:10 [PATCHv3] ltp: make copyFrom scp command non-fatal Matthew
2020-08-05 18:27 ` [OE-core] " Richard Purdie
2020-08-05 18:33   ` Matthew [this message]
2020-08-05 18:36     ` Richard Purdie
2020-08-05 18:44       ` Matthew
2020-08-05 18:32 ` ✗ patchtest: failure for ltp: make copyFrom scp command non-fatal (rev3) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873651hrhl.fsf@windriver.com \
    --to=matthew.zeng@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox