* [PATCH] scripts:/oe-selftest: Use timestamp instead of test names in coverage data file
@ 2016-03-24 0:32 Humberto Ibarra
2016-03-23 21:46 ` Randy Witt
0 siblings, 1 reply; 2+ messages in thread
From: Humberto Ibarra @ 2016-03-24 0:32 UTC (permalink / raw)
To: openembedded-core
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]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
---
scripts/oe-selftest | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index d18348d..9b61bfa 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -364,16 +364,21 @@ def list_tags():
print 'Tags:\t%s' % ', '.join(str(x) for x in tags)
-def coverage_setup(run_tests, run_all_tests, coverage_source, coverage_include, coverage_omit):
+def coverage_setup(coverage_source, coverage_include, coverage_omit):
""" Set up the coverage measurement for the testcases to be run """
+ import datetime
+ import subprocess
builddir = os.environ.get("BUILDDIR")
+ pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+ curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"])
coveragerc = "%s/.coveragerc" % builddir
data_file = "%s/.coverage." % builddir
- data_file += ((run_tests and '.'.join(run_tests)) or
- (run_all_tests and "all_tests") or "")
+ data_file += datetime.datetime.now().strftime('%Y%m%dT%H%M%S')
if os.path.isfile(data_file):
os.remove(data_file)
with open(coveragerc, 'w') as cps:
+ cps.write("# Generated with command '%s'\n" % " ".join(sys.argv))
+ cps.write("# HEAD commit %s\n" % curcommit.strip())
cps.write("[run]\n")
cps.write("data_file = %s\n" % data_file)
cps.write("branch = True\n")
@@ -586,7 +591,7 @@ def buildResultClass(args):
# value indicates where the coverage configuration file resides
# More info on https://pypi.python.org/pypi/coverage
if not os.environ.get('COVERAGE_PROCESS_START'):
- os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.run_tests, args.run_all_tests, args.coverage_source, args.coverage_include, args.coverage_omit)
+ os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit)
# Use default site.USER_SITE and write corresponding config file
site.ENABLE_USER_SITE = True
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] scripts:/oe-selftest: Use timestamp instead of test names in coverage data file
2016-03-24 0:32 [PATCH] scripts:/oe-selftest: Use timestamp instead of test names in coverage data file Humberto Ibarra
@ 2016-03-23 21:46 ` Randy Witt
0 siblings, 0 replies; 2+ messages in thread
From: Randy Witt @ 2016-03-23 21:46 UTC (permalink / raw)
To: Humberto Ibarra, openembedded-core
On 03/23/2016 05:32 PM, Humberto Ibarra wrote:
> This fixes the problem by changing the name to the coverage data file,
> using the timestamp as an identifier.
Fixes what problem?
>
> 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]
>
> Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
> ---
> scripts/oe-selftest | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/oe-selftest b/scripts/oe-selftest
> index d18348d..9b61bfa 100755
> --- a/scripts/oe-selftest
> +++ b/scripts/oe-selftest
> @@ -364,16 +364,21 @@ def list_tags():
>
> print 'Tags:\t%s' % ', '.join(str(x) for x in tags)
>
> -def coverage_setup(run_tests, run_all_tests, coverage_source, coverage_include, coverage_omit):
> +def coverage_setup(coverage_source, coverage_include, coverage_omit):
> """ Set up the coverage measurement for the testcases to be run """
> + import datetime
> + import subprocess
> builddir = os.environ.get("BUILDDIR")
> + pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
> + curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"])
> coveragerc = "%s/.coveragerc" % builddir
> data_file = "%s/.coverage." % builddir
> - data_file += ((run_tests and '.'.join(run_tests)) or
> - (run_all_tests and "all_tests") or "")
> + data_file += datetime.datetime.now().strftime('%Y%m%dT%H%M%S')
> if os.path.isfile(data_file):
> os.remove(data_file)
> with open(coveragerc, 'w') as cps:
> + cps.write("# Generated with command '%s'\n" % " ".join(sys.argv))
> + cps.write("# HEAD commit %s\n" % curcommit.strip())
> cps.write("[run]\n")
> cps.write("data_file = %s\n" % data_file)
> cps.write("branch = True\n")
> @@ -586,7 +591,7 @@ def buildResultClass(args):
> # value indicates where the coverage configuration file resides
> # More info on https://pypi.python.org/pypi/coverage
> if not os.environ.get('COVERAGE_PROCESS_START'):
> - os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.run_tests, args.run_all_tests, args.coverage_source, args.coverage_include, args.coverage_omit)
> + os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit)
>
> # Use default site.USER_SITE and write corresponding config file
> site.ENABLE_USER_SITE = True
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-23 21:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 0:32 [PATCH] scripts:/oe-selftest: Use timestamp instead of test names in coverage data file Humberto Ibarra
2016-03-23 21:46 ` Randy Witt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox