Bug 1369410 - Enable JSVM code coverage collection on linux64-ccov. r?jmaher
This patch enables linux64-ccov to run JSVM code coverage collection at the same time GCOV code coverage is being collected. It uploads the code coverage that was created in a file called 'code-coverage-jsvm.zip'.
MozReview-Commit-ID: 4x5GrjRJRo4
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -230,19 +230,34 @@ def main(argv):
sys.stderr.write("Exception thrown trying to read test file"
" '{}'\n".format(options.read_tests))
traceback.print_exc()
sys.stderr.write('---\n')
if read_all:
test_list = jittests.find_tests()
- # If code coverage is enabled, exclude tests. (bug 1347245)
+ # Exclude tests when code coverage is enabled.
+ # This part is equivalent to:
+ # skip-if = coverage
if os.getenv('GCOV_PREFIX') is not None:
- options.exclude += ['asm.js/testSIMD.js']
+ # GCOV errors.
+ options.exclude += ['asm.js/testSIMD.js'] # Bug 1347245
+
+ # JSVM errors.
+ options.exclude += ['basic/functionnames.js'] # Bug 1369783
+ options.exclude += ['debug/Debugger-findScripts-23.js']
+ options.exclude += ['debug/bug1160182.js']
+ options.exclude += ['xdr/incremental-encoder.js']
+ options.exclude += ['xdr/bug1186973.js'] # Bug 1369785
+ options.exclude += ['basic/werror.js']
+
+ # Prevent code coverage test that expects coverage
+ # to be off when it starts.
+ options.exclude += ['debug/Script-getOffsetsCoverage-02.js']
if options.exclude_from:
with open(options.exclude_from) as fh:
for line in fh:
line = line.strip()
if not line.startswith("#") and len(line):
options.exclude.append(line)
--- a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
+++ b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
@@ -29,16 +29,17 @@ code_coverage_config_options = [
class CodeCoverageMixin(object):
"""
Mixin for setting GCOV_PREFIX during test execution, packaging up
the resulting .gcda files and uploading them to blobber.
"""
gcov_dir = None
+ jsvm_dir = None
@property
def code_coverage_enabled(self):
try:
if self.config.get('code_coverage'):
return True
# XXX workaround because bug 1110465 is hard
@@ -56,22 +57,26 @@ class CodeCoverageMixin(object):
return False
@PreScriptAction('run-tests')
def _set_gcov_prefix(self, action):
if not self.code_coverage_enabled:
return
self.gcov_dir = tempfile.mkdtemp()
os.environ['GCOV_PREFIX'] = self.gcov_dir
+ # Set JSVM directory also.
+ self.jsvm_dir = tempfile.mkdtemp()
+ os.environ['JS_CODE_COVERAGE_OUTPUT_DIR'] = self.jsvm_dir
@PostScriptAction('run-tests')
def _package_coverage_data(self, action, success=None):
if not self.code_coverage_enabled:
return
del os.environ['GCOV_PREFIX']
+ del os.environ['JS_CODE_COVERAGE_OUTPUT_DIR']
if not self.ccov_upload_disabled:
# TODO This is fragile, find rel_topsrcdir properly somehow
# We need to find the path relative to the gecko topsrcdir. Use
# some known gecko directories as a test.
canary_dirs = ['browser', 'docshell', 'dom', 'js', 'layout', 'toolkit', 'xpcom', 'xpfe']
rel_topsrcdir = None
for root, dirs, files in os.walk(self.gcov_dir):
@@ -80,14 +85,24 @@ class CodeCoverageMixin(object):
rel_topsrcdir = root
break
else:
# Unable to upload code coverage files. Since this is the whole
# point of code coverage, making this fatal.
self.fatal("Could not find relative topsrcdir in code coverage "
"data!")
+ # Package GCOV coverage data.
dirs = self.query_abs_dirs()
file_path = os.path.join(
dirs['abs_blob_upload_dir'], 'code-coverage-gcda.zip')
command = ['zip', '-r', file_path, '.']
self.run_command(command, cwd=rel_topsrcdir)
+
+ # Package JSVM coverage data.
+ dirs = self.query_abs_dirs()
+ file_path = os.path.join(
+ dirs['abs_blob_upload_dir'], 'code-coverage-jsvm.zip')
+ command = ['zip', '-r', file_path, '.']
+ self.run_command(command, cwd=self.jsvm_dir)
+
shutil.rmtree(self.gcov_dir)
+ shutil.rmtree(self.jsvm_dir)
--- a/testing/mozharness/mozharness/mozilla/testing/firefox_ui_tests.py
+++ b/testing/mozharness/mozharness/mozilla/testing/firefox_ui_tests.py
@@ -249,19 +249,20 @@ class FirefoxUITests(TestingMixin, VCSTo
# Set further environment settings
env = env or self.query_env()
env.update({'MINIDUMP_SAVE_PATH': dirs['abs_blob_upload_dir']})
if self.query_minidump_stackwalk():
env.update({'MINIDUMP_STACKWALK': self.minidump_stackwalk_path})
env['RUST_BACKTRACE'] = '1'
- # If code coverage is enabled, set GCOV_PREFIX env variable
+ # If code coverage is enabled, set GCOV_PREFIX and JS_CODE_COVERAGE_OUTPUT_DIR env variables
if self.config.get('code_coverage'):
env['GCOV_PREFIX'] = self.gcov_dir
+ env['JS_CODE_COVERAGE_OUTPUT_DIR'] = self.jsvm_dir
if self.config['allow_software_gl_layers']:
env['MOZ_LAYERS_ALLOW_SOFTWARE_GL'] = '1'
if self.config['enable_webrender']:
env['MOZ_WEBRENDER'] = '1'
return_code = self.run_command(cmd,
cwd=dirs['abs_work_dir'],