[OE-core] [PATCH 2/3] scripts/oe-selftest: remove coverage file if any coverage option is given

Humberto Ibarra humberto.ibarra.lopez at intel.com
Wed Apr 6 03:15:53 UTC 2016


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>
---
 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
 
-- 
2.1.4




More information about the Openembedded-core mailing list