Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: tools/code_coverage/coverage_posix.py

Issue 11274053: Store coverage.info file in separate folders based on commandline parameters to coverage_posix.py. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/code_coverage/coverage_posix.py
===================================================================
--- tools/code_coverage/coverage_posix.py (revision 162133)
+++ tools/code_coverage/coverage_posix.py (working copy)
@@ -762,6 +762,12 @@
'--directory', self.directory_parent,
'--zerocounters'])
shutil.rmtree(os.path.join(self.directory, 'coverage'))
+ if self.options.all_unittests:
+ if os.path.exists(os.path.join(self.directory, 'unittests_coverage')):
+ shutil.rmtree(os.path.join(self.directory, 'unittests_coverage'))
+ else:
+ if os.path.exists(os.path.join(self.directory, 'total_coverage')):
+ shutil.rmtree(os.path.join(self.directory, 'total_coverage'))
def BeforeRunOneTest(self, testname):
"""Do things before running each test."""
@@ -948,6 +954,12 @@
del os.environ['DISPLAY']
self.xvfb_pid = 0
+ def CopyCoverageFileToDestination(self, coverage_folder):
+ coverage_dir = os.path.join(self.directory, coverage_folder)
+ if not os.path.exists(coverage_dir):
+ os.makedirs(coverage_dir)
+ shutil.copyfile(self.coverage_info_file, os.path.join(coverage_dir,
+ 'coverage.info'))
def GenerateLcovPosix(self):
"""Convert profile data to lcov on Mac or Linux."""
@@ -991,6 +1003,14 @@
sys.exit(retcode)
if self.IsLinux():
os.chdir(start_dir)
+
+ # Copy the unittests coverage information to a different folder.
+ if self.options.all_unittests:
+ self.CopyCoverageFileToDestination('unittests_coverage')
+ else:
+ # Save the overall coverage information.
+ self.CopyCoverageFileToDestination('total_coverage')
+
if not os.path.exists(self.coverage_info_file):
logging.fatal('%s was not created. Coverage run failed.' %
self.coverage_info_file)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698