[OE-core] [PATCH 1/5] oeqa/core/runner: refactor for OEQA to write json testresult

Yeoh, Ee Peng ee.peng.yeoh at intel.com
Mon Oct 15 08:47:51 UTC 2018


Hi Richard,

Thank you very much for the sharing! I will make the require enhancement asap.

Thanks,
Yeoh Ee Peng 

-----Original Message-----
From: richard.purdie at linuxfoundation.org [mailto:richard.purdie at linuxfoundation.org] 
Sent: Monday, October 15, 2018 4:25 PM
To: Yeoh, Ee Peng <ee.peng.yeoh at intel.com>; openembedded-core at lists.openembedded.org
Subject: Re: [OE-core] [PATCH 1/5] oeqa/core/runner: refactor for OEQA to write json testresult

On Mon, 2018-10-15 at 15:24 +0800, Yeoh Ee Peng wrote:
> Refactor the original _getDetailsNotPassed method to return testresult 
> details (test status and log), which will be reused by future OEQA 
> code to write json testresult.
> 
> Take the opportunity to consolidate and simplify the logic used to 
> gather test status and log within the TestResult instance.
> 
> Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh at intel.com>
> ---
>  meta/lib/oeqa/core/runner.py | 70 
> ++++++++++++++++++--------------------------
>  1 file changed, 29 insertions(+), 41 deletions(-)
> 
> diff --git a/meta/lib/oeqa/core/runner.py 
> b/meta/lib/oeqa/core/runner.py index eeb625b..56666ee 100644
> --- a/meta/lib/oeqa/core/runner.py
> +++ b/meta/lib/oeqa/core/runner.py
> @@ -76,40 +76,43 @@ class OETestResult(_TestResult):
>          else:
>              msg = "%s - FAIL - Required tests failed" % component
>          skipped = len(self.skipped)
> -        if skipped: 
> +        if skipped:
>              msg += " (skipped=%d)" % skipped
>          self.tc.logger.info(msg)
>  
> -    def _getDetailsNotPassed(self, case, type, desc):
> -        found = False
> +    def _getTestResultDetails(self, case):
> +        result_types = ['failures', 'errors', 'skipped', 'expectedFailures', 'successes']
> +        result_desc = ['FAILED', 'ERROR', 'SKIPPED', 'EXPECTEDFAIL', 
> + 'PASSED']

This patch is much better thanks! 

It could still do with one more minor tweak. You can use a dict above to simplfy this code and avoid using indexes which is not very pythonic, for example


result_types = {'failures' : 'FAILED', 'errors' : 'ERROR'}

then

for rtype in result_types:
    [...]
    return result_types[rtype], msg


The rest of the patch looks like a nice simplification now though!

Cheers,

Richard



More information about the Openembedded-core mailing list