зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1393788 - Compress all JSDcov artifacts (.json files) into zip files after all tests are completed. r=gmierz,jmaher.
Building with "Linux x64 JSDCov", each suite of tests will produce a list of JSDCov artifacts (.json). This patch compresses all JSDCov artifacts into 1 zip file for each suite upon tests completion. MozReview-Commit-ID: DaNLOQuW2lc --HG-- extra : rebase_source : cceb912d0fe16f9921e1d13fe85d53af2abcb29c
This commit is contained in:
Родитель
ea7bdb1cbb
Коммит
40f03f9f5e
|
@ -680,6 +680,7 @@ def enable_code_coverage(config, tests):
|
|||
test['mozharness']['extra-options'].append('--tptimeout,15000')
|
||||
elif test['build-platform'] == 'linux64-jsdcov/opt':
|
||||
test['run-on-projects'] = ['mozilla-central']
|
||||
test['mozharness'].setdefault('extra-options', []).append('--jsd-code-coverage')
|
||||
yield test
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,12 @@ code_coverage_config_options = [
|
|||
"default": False,
|
||||
"help": "Whether test run should package and upload code coverage data."
|
||||
}],
|
||||
[["--jsd-code-coverage"],
|
||||
{"action": "store_true",
|
||||
"dest": "jsd_code_coverage",
|
||||
"default": False,
|
||||
"help": "Whether JSDebugger code coverage should be run."
|
||||
}],
|
||||
]
|
||||
|
||||
|
||||
|
@ -57,6 +63,17 @@ class CodeCoverageMixin(object):
|
|||
except (AttributeError, KeyError, TypeError):
|
||||
return False
|
||||
|
||||
@property
|
||||
def jsd_code_coverage_enabled(self):
|
||||
try:
|
||||
if self.config.get('jsd_code_coverage'):
|
||||
return True
|
||||
|
||||
# XXX workaround because bug 1110465 is hard
|
||||
return self.buildbot_config['properties']['stage_platform'] in ('linux64-jsdcov',)
|
||||
except (AttributeError, KeyError, TypeError):
|
||||
return False
|
||||
|
||||
@PreScriptAction('run-tests')
|
||||
def _set_gcov_prefix(self, action):
|
||||
if not self.code_coverage_enabled:
|
||||
|
@ -89,6 +106,24 @@ class CodeCoverageMixin(object):
|
|||
|
||||
@PostScriptAction('run-tests')
|
||||
def _package_coverage_data(self, action, success=None):
|
||||
if self.jsd_code_coverage_enabled:
|
||||
# Setup the command for compression
|
||||
dirs = self.query_abs_dirs()
|
||||
jsdcov_dir = dirs['abs_blob_upload_dir']
|
||||
zipFile = os.path.join(jsdcov_dir, "jsdcov_artifacts.zip")
|
||||
command = ["zip", "-r", zipFile, ".", "-i", "jscov*.json"]
|
||||
|
||||
self.info("Beginning compression of JSDCov artifacts...")
|
||||
self.run_command(command, cwd=jsdcov_dir)
|
||||
|
||||
# Delete already compressed JSCov artifacts.
|
||||
for filename in os.listdir(jsdcov_dir):
|
||||
if filename.startswith("jscov") and filename.endswith(".json"):
|
||||
os.remove(os.path.join(jsdcov_dir, filename))
|
||||
|
||||
self.info("Completed compression of JSDCov artifacts!")
|
||||
self.info("Path to JSDCov compressed artifacts: " + zipFile)
|
||||
|
||||
if not self.code_coverage_enabled:
|
||||
return
|
||||
del os.environ['GCOV_PREFIX']
|
||||
|
|
Загрузка…
Ссылка в новой задаче