summaryrefslogtreecommitdiffstats
path: root/scripts/oe-selftest
diff options
context:
space:
mode:
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>2016-03-23 18:32:02 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-28 15:55:50 +0100
commit3a934a8087c7a7541cf8ef35041d31f7765bb18d (patch)
treeaa27bc85042da2ff75e31d3355cc3a31901a416e /scripts/oe-selftest
parent71304d8ec7cd68ea98f2b195f181455263aa2358 (diff)
downloadpoky-3a934a8087c7a7541cf8ef35041d31f7765bb18d.tar.gz
scripts:/oe-selftest: Use timestamp instead of test names in coverage data file
This fixes the problem by changing the name to the coverage data file, using the timestamp as an identifier. The name for the coverage data file is constructed based on the tests ran; this has created a couple of issues so far, affecting coverage report. If --run-tests-by option is given, the data file name won't have any identifier, causing following runs to overwrite themselves. On the other hand, if too many tests are given, the file name exceeds linux limits and fails to store the coverage data all together. [Yocto #9253] (From OE-Core rev: 7c0c9d1411e04935675f4c4be8768723c1d09b50) Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-xscripts/oe-selftest13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index d18348d1c6..9b61bfaddd 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -364,16 +364,21 @@ def list_tags():
364 364
365 print 'Tags:\t%s' % ', '.join(str(x) for x in tags) 365 print 'Tags:\t%s' % ', '.join(str(x) for x in tags)
366 366
367def coverage_setup(run_tests, run_all_tests, coverage_source, coverage_include, coverage_omit): 367def coverage_setup(coverage_source, coverage_include, coverage_omit):
368 """ Set up the coverage measurement for the testcases to be run """ 368 """ Set up the coverage measurement for the testcases to be run """
369 import datetime
370 import subprocess
369 builddir = os.environ.get("BUILDDIR") 371 builddir = os.environ.get("BUILDDIR")
372 pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
373 curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"])
370 coveragerc = "%s/.coveragerc" % builddir 374 coveragerc = "%s/.coveragerc" % builddir
371 data_file = "%s/.coverage." % builddir 375 data_file = "%s/.coverage." % builddir
372 data_file += ((run_tests and '.'.join(run_tests)) or 376 data_file += datetime.datetime.now().strftime('%Y%m%dT%H%M%S')
373 (run_all_tests and "all_tests") or "")
374 if os.path.isfile(data_file): 377 if os.path.isfile(data_file):
375 os.remove(data_file) 378 os.remove(data_file)
376 with open(coveragerc, 'w') as cps: 379 with open(coveragerc, 'w') as cps:
380 cps.write("# Generated with command '%s'\n" % " ".join(sys.argv))
381 cps.write("# HEAD commit %s\n" % curcommit.strip())
377 cps.write("[run]\n") 382 cps.write("[run]\n")
378 cps.write("data_file = %s\n" % data_file) 383 cps.write("data_file = %s\n" % data_file)
379 cps.write("branch = True\n") 384 cps.write("branch = True\n")
@@ -586,7 +591,7 @@ def buildResultClass(args):
586 # value indicates where the coverage configuration file resides 591 # value indicates where the coverage configuration file resides
587 # More info on https://pypi.python.org/pypi/coverage 592 # More info on https://pypi.python.org/pypi/coverage
588 if not os.environ.get('COVERAGE_PROCESS_START'): 593 if not os.environ.get('COVERAGE_PROCESS_START'):
589 os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.run_tests, args.run_all_tests, args.coverage_source, args.coverage_include, args.coverage_omit) 594 os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit)
590 595
591 # Use default site.USER_SITE and write corresponding config file 596 # Use default site.USER_SITE and write corresponding config file
592 site.ENABLE_USER_SITE = True 597 site.ENABLE_USER_SITE = True