diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 04:46:23 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 04:46:23 +0000 |
commit | 862194135cffb729a7938cde3ec042e29bc50ffc (patch) | |
tree | cd3579682e2fd6a5e17c31643565f43df5c3dcbe /tools/code_coverage/coverage_posix.py | |
parent | d0b8e5f9bff9553c75bf78bdebeff855db03ebc9 (diff) | |
download | chromium_src-862194135cffb729a7938cde3ec042e29bc50ffc.zip chromium_src-862194135cffb729a7938cde3ec042e29bc50ffc.tar.gz chromium_src-862194135cffb729a7938cde3ec042e29bc50ffc.tar.bz2 |
Split coverage into build and run phases in preparation for splitting
it into 2 distinct buildbot phases. Add changes to reduce size or
increase speed of coverage builds.
Add 'bundle files' mechanism to process_coverage.py to make the above
split easier. Add unit test for said mechanism.
TEST=build coverage on 10.6 and watch it work.
Review URL: http://codereview.chromium.org/2121003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/code_coverage/coverage_posix.py')
-rwxr-xr-x | tools/code_coverage/coverage_posix.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tools/code_coverage/coverage_posix.py b/tools/code_coverage/coverage_posix.py index 340199d..b018ae4 100755 --- a/tools/code_coverage/coverage_posix.py +++ b/tools/code_coverage/coverage_posix.py @@ -48,6 +48,11 @@ Linux: --timeout=SECS: if a subprocess doesn't have output within SECS, assume it's a hang. Kill it and give up. +--bundles=BUNDLEFILE: a file containing a python list of coverage + bundles to be eval'd. E.g. + ['../base/base.gyp:base_unittests'] + This is used as part of the coverage bot. + Strings after all options are considered tests to run. Test names have all text before a ':' stripped to help with gyp compatibility. For example, ../base/base.gyp:base_unittests is interpreted as a test @@ -235,9 +240,28 @@ class Coverage(object): if self.options.all_unittests: self.tests += glob.glob(os.path.join(self.directory, '*_unittests')) + # Tests can come in as args or as a file of bundles. + all_testnames = self.args[:] # Copy since we might modify + tests_from_bundles = None + if self.options.bundles: + try: + tests_from_bundles = eval(open(self.options.bundles).read()) + except IOError: + logging.fatal('IO error in bundle file ' + + self.options.bundles + ' (doesn\'t exist?)') + except NameError, SyntaxError: + logging.fatal('Parse or syntax error in bundle file ' + + self.options.bundles) + if hasattr(tests_from_bundles, '__iter__'): + all_testnames += tests_from_bundles + else: + logging.fatal('Fatal error with bundle file; could not get list from' + + self.options.bundles) + sys.exit(1) + # If told explicit tests, run those (after stripping the name as # appropriate) - for testname in self.args: + for testname in all_testnames: if ':' in testname: self.tests += [os.path.join(self.directory, testname.split(':')[1])] else: @@ -582,6 +606,11 @@ def CoverageOptionParser(): default=9.9 * 60.0, help='Timeout before bailing if a subprocess has no output.' ' Default is a hair under 10min (Buildbot is 10min.)') + parser.add_option('-B', + '--bundles', + dest='bundles', + default=None, + help='Filename of bundles for coverage.') return parser |