diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-16 21:29:51 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-16 21:29:51 +0000 |
commit | 4207482503851f47b4f84943b6d6daabc244e30b (patch) | |
tree | 1f61b23d7424c7cc96c51b650f3031ef786eb12d | |
parent | a5c713fdc8d0bf21f65ebdae95827e423d14b07c (diff) | |
download | chromium_src-4207482503851f47b4f84943b6d6daabc244e30b.zip chromium_src-4207482503851f47b4f84943b6d6daabc244e30b.tar.gz chromium_src-4207482503851f47b4f84943b6d6daabc244e30b.tar.bz2 |
Minor tweaks to make coverage happier on OSX.
See 1st post at (XXX internal URL removed XXX)
Code coverage for base: 85% (!!!)
Review URL: http://codereview.chromium.org/67235
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13880 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/code_coverage/coverage_posix.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/tools/code_coverage/coverage_posix.py b/tools/code_coverage/coverage_posix.py index 88eb23c..876a117 100755 --- a/tools/code_coverage/coverage_posix.py +++ b/tools/code_coverage/coverage_posix.py @@ -32,6 +32,7 @@ class Coverage(object): def __init__(self, directory): super(Coverage, self).__init__() self.directory = directory + self.directory_parent = os.path.dirname(self.directory) self.output_directory = os.path.join(self.directory, 'coverage') if not os.path.exists(self.output_directory): os.mkdir(self.output_directory) @@ -40,7 +41,7 @@ class Coverage(object): self.lcov = os.path.join(self.lcov_directory, 'lcov') self.mcov = os.path.join(self.lcov_directory, 'mcov') self.genhtml = os.path.join(self.lcov_directory, 'genhtml') - self.coverage_info_file = self.directory + 'coverage.info' + self.coverage_info_file = os.path.join(self.directory, 'coverage.info') self.ConfirmPlatformAndPaths() def ConfirmPlatformAndPaths(self): @@ -67,7 +68,7 @@ class Coverage(object): def ClearData(self): """Clear old gcda files""" subprocess.call([self.lcov, - '--directory', self.directory, + '--directory', self.directory_parent, '--zerocounters']) def RunTests(self): @@ -79,24 +80,31 @@ class Coverage(object): # TODO(jrg): add timeout? # TODO(jrg): check return value and choke if it failed? # TODO(jrg): add --gtest_print_time like as run from XCode? + print 'Running test: ' + fulltest + # subprocess.call([fulltest, '--gtest_filter=TupleTest*']) # quick check subprocess.call([fulltest]) def GenerateOutput(self): """Convert profile data to html.""" if self.IsLinux(): - subprocess.call([self.lcov, - '--directory', self.directory, - '--capture', - '--output-file', - self.coverage_info_file]) + command = [self.lcov, + '--directory', self.directory, + '--capture', + '--output-file', + self.coverage_info_file] else: - subprocess.call([self.mcov, - '--directory', self.directory, - '--output', self.coverage_info_file]) - subprocess.call([self.genhtml, - self.coverage_info_file, - '--output-directory', - self.output_directory]) + command = [self.mcov, + '--directory', self.directory_parent, + '--output', self.coverage_info_file] + print 'Assembly command: ' + ' '.join(command) + subprocess.call(command) + + command = [self.genhtml, + self.coverage_info_file, + '--output-directory', + self.output_directory] + print 'html generation command: ' + ' '.join(command) + subprocess.call(command) def main(): parser = optparse.OptionParser() |