Index: build/scripts/slave/chromium/archive_coverage.py |
=================================================================== |
--- build/scripts/slave/chromium/archive_coverage.py (revision 163846) |
+++ build/scripts/slave/chromium/archive_coverage.py (working copy) |
@@ -30,7 +30,7 @@ |
class ArchiveCoverage(object): |
"""Class to copy coverage HTML to the buildbot webserver.""" |
- def __init__(self, options): |
+ def __init__(self, options, coverage_folder_name): |
"""Constructor. |
Args: |
@@ -52,6 +52,7 @@ |
self.is_posix = True |
self.from_dir = os.path.join(os.path.dirname(options.build_dir), |
'out', options.target, # make, not scons |
+ coverage_folder_name, |
'coverage_croc_html') |
else: |
@@ -59,8 +60,13 @@ |
sys.exit(1) |
self.from_dir = os.path.normpath(self.from_dir) |
+ |
cmp
2012/11/01 23:46:22
remove this line
pshenoy
2012/11/05 18:47:22
Done.
|
print 'copy from: %s' % self.from_dir |
+ if not os.path.exists(self.from_dir): |
+ print '%s directory does not exist' % self.from_dir |
+ sys.exit(1) |
+ |
# Extract the build name of this slave (e.g., 'chrome-release') from its |
# configuration file. |
chrome_dir = os.path.abspath(options.build_dir) |
@@ -99,6 +105,10 @@ |
# TODO(jrg) use os.path.join here? |
self.archive_path = '%scoverage/%s/%s' % ( |
archive_config.www_dir_base, self.perf_subdir, self.last_change) |
+ # If this is for collecting coverage for unittests, then create |
+ # a separate path. |
+ if coverage_folder_name == 'unittests_coverage': |
+ self.archive_path = os.path.join(self.archive_path, coverage_folder_name) |
self.archive_path = os.path.normpath(self.archive_path) |
print 'archive path: %s' % self.archive_path |
@@ -114,29 +124,30 @@ |
Returns: |
0 if successful, or non-zero error code if error. |
""" |
- if self.is_posix: |
- self._MakeSourceWorldReadable() |
+ if os.path.exists(self.from_dir): |
+ if self.is_posix: |
cmp
2012/11/01 23:46:22
let's rewrite this so lines 127 is:
if os.path.ex
pshenoy
2012/11/05 18:47:22
Done.
|
+ self._MakeSourceWorldReadable() |
- cmd = ['ssh', self.archive_host, 'mkdir', '-p', self.archive_path] |
- print 'Running: ' + ' '.join(cmd) |
- retval = subprocess.call(cmd) |
- if retval: |
- return retval |
+ cmd = ['ssh', self.archive_host, 'mkdir', '-p', self.archive_path] |
+ print 'Running: ' + ' '.join(cmd) |
+ retval = subprocess.call(cmd) |
+ if retval: |
+ return retval |
- cmd = ['bash', '-c', 'scp -r -p %s/* %s:%s' % |
- (self.from_dir, self.archive_host, self.archive_path)] |
- print 'Running: ' + ' '.join(cmd) |
- retval = subprocess.call(cmd) |
- if retval: |
- return retval |
+ cmd = ['bash', '-c', 'scp -r -p %s/* %s:%s' % |
+ (self.from_dir, self.archive_host, self.archive_path)] |
+ print 'Running: ' + ' '.join(cmd) |
+ retval = subprocess.call(cmd) |
+ if retval: |
+ return retval |
- else: |
- # Windows |
- cmd = ['xcopy', '/S', '/I', '/Y', self.from_dir, self.archive_path] |
- print 'Running: ' + ' '.join(cmd) |
- retval = subprocess.call(cmd) |
- if retval: |
- return retval |
+ else: |
+ # Windows |
+ cmd = ['xcopy', '/S', '/I', '/Y', self.from_dir, self.archive_path] |
+ print 'Running: ' + ' '.join(cmd) |
+ retval = subprocess.call(cmd) |
+ if retval: |
+ return retval |
def Main(): |
@@ -162,9 +173,12 @@ |
options, args = option_parser.parse_args() |
if args: |
option_parser.error('Args not supported: %s' % args) |
- ac = ArchiveCoverage(options) |
- sys.exit(ac.Run()) |
+ ac = ArchiveCoverage(options, 'total_coverage') |
+ ac.Run() |
John Grabowski
2012/10/30 21:34:02
remove blank line
need to sys.exit(ac.run()) and
pshenoy
2012/11/05 18:47:22
Main() is called as sys.exit(Main())
|
+ auc = ArchiveCoverage(options, 'unittests_coverage') |
+ auc.Run() |
+ |
if '__main__' == __name__: |
Main() |
cmp
2012/11/01 23:46:22
let's put the sys.exit here:
sys.exit(Main())
an
pshenoy
2012/11/05 18:47:22
Done.
|