[oe-commits] [openembedded-core] 06/07: scripts/oe-selftest: remove coverage file if any coverage option is given

git at git.openembedded.org git at git.openembedded.org
Tue Apr 5 22:13:46 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 7157fd3bfbf2d5ae07fd4e726884baf7138bb24f
Author: Humberto Ibarra <humberto.ibarra.lopez at intel.com>
AuthorDate: Tue Apr 5 22:15:53 2016 -0500

    scripts/oe-selftest: remove coverage file if any coverage option is given
    
    Coverage temporal file for sub-processing is being removed only
    when the --coverage option was found. This is wrong since the
    file is created when any coverage option (source, include or omit)
    is given, even if --coverage is not one of them.
    
    This patch makes sure to remove the file if any coverage option was
    given.
    
    Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/oe-selftest | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index 2348b47..375ba5c 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -602,22 +602,23 @@ def buildResultClass(args):
         def stopTestRun(self):
             """ Report coverage data after the testcases are run """
 
-            if args.coverage and self.coverage_installed:
-                with open(os.environ['COVERAGE_PROCESS_START']) as ccf:
-                    log.info("Coverage configuration file (%s)" % os.environ.get('COVERAGE_PROCESS_START'))
-                    log.info("===========================")
-                    log.info("\n%s" % "".join(ccf.readlines()))
-
-                log.info("Coverage Report")
-                log.info("===============")
-                try:
-                    coverage_report()
-                    # remove the pth file
-                finally:
+            if args.coverage or args.coverage_source or args.coverage_include or args.coverage_omit:
+                if self.coverage_installed:
+                    with open(os.environ['COVERAGE_PROCESS_START']) as ccf:
+                        log.info("Coverage configuration file (%s)" % os.environ.get('COVERAGE_PROCESS_START'))
+                        log.info("===========================")
+                        log.info("\n%s" % "".join(ccf.readlines()))
+
+                    log.info("Coverage Report")
+                    log.info("===============")
                     try:
-                        os.remove(self.coveragepth)
-                    except OSError:
-                        log.warn("Expected temporal file from coverage is missing, ignoring removal.")
+                        coverage_report()
+                    finally:
+                        # remove the pth file
+                        try:
+                            os.remove(self.coveragepth)
+                        except OSError:
+                            log.warn("Expected temporal file from coverage is missing, ignoring removal.")
 
     return StampedResult
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list