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.

(From OE-Core rev: 7157fd3bfbf2d5ae07fd4e726884baf7138bb24f)

Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Humberto Ibarra 2016-04-05 22:15:53 -05:00 committed by Richard Purdie
parent 5edfec4305
commit 6e5e225217
1 changed files with 15 additions and 14 deletions

View File

@ -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()))
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:
coverage_report()
# remove the pth file
finally:
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