From 8875e96f7d224a2f404ad76c77a0906d7f0782e5 Mon Sep 17 00:00:00 2001 From: Greg Mierzwinski Date: Sat, 23 Jul 2016 11:27:49 -0400 Subject: [PATCH] Bug 1278402 - Add linux64-ccov and linux64-jsdcov as code coverage build platforms to taskcluster. r=dustin,jmaher These builds can be run on taskcluster to obtain per-test (JSDebugger) code coverage with the linux64-jsdcov build and overall (GCOV) code coverage with the linux64-ccov build. The linux64-jsdcov build also needed to have leak checking disabled for debug mode. MozReview-Commit-ID: ASgrU2X7RQV --HG-- extra : rebase_source : af40a6e582665ffcb575092586731f595a362ae4 --- .../config/mozconfigs/linux64/code-coverage | 9 +++- taskcluster/ci/build/linux.yml | 48 +++++++++++++++++++ .../ci/desktop-test/test-platforms.yml | 6 +++ taskcluster/ci/desktop-test/test-sets.yml | 6 +++ taskcluster/ci/desktop-test/tests.yml | 38 +++++++++++++-- .../taskgraph/transforms/tests/all_kinds.py | 7 +++ .../transforms/tests/test_description.py | 15 ++++-- testing/mochitest/runtests.py | 23 +++++++-- .../64_code_coverage.py | 2 +- .../mozilla/testing/codecoverage.py | 2 +- 10 files changed, 140 insertions(+), 16 deletions(-) diff --git a/browser/config/mozconfigs/linux64/code-coverage b/browser/config/mozconfigs/linux64/code-coverage index a1e434c08e24..48ffa9b17654 100644 --- a/browser/config/mozconfigs/linux64/code-coverage +++ b/browser/config/mozconfigs/linux64/code-coverage @@ -1,6 +1,13 @@ . "$topsrcdir/browser/config/mozconfigs/linux64/nightly" +TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir} + +ac_add_options --disable-install-strip +ac_add_options --disable-jemalloc +ac_add_options --disable-crashreporter +ac_add_options --disable-elf-hack + MOZ_CODE_COVERAGE=1 export CFLAGS="-fprofile-arcs -ftest-coverage" export CXXFLAGS="-fprofile-arcs -ftest-coverage" -export LDFLAGS="-fprofile-arcs -ftest-coverage -lgcov" +export LDFLAGS="-fprofile-arcs -ftest-coverage -lgcov -L$TOOLTOOL_DIR/gtk3/usr/local/lib" diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index 3f6f4d129cbc..ca2a6e3bd624 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -174,3 +174,51 @@ linux64-asan/debug: tooltool-downloads: public need-xvfb: true +linux64-jsdcov/opt: + description: "Linux64-JSDCov Opt" + index: + product: firefox + job-name: linux64-jsdcov-opt + treeherder: + platform: linux64/jsdcov + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-linux + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build check-test generate-build-stats update] + config: + - builds/releng_base_linux_64_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + tooltool-downloads: public + need-xvfb: true + +linux64-ccov/opt: + description: "Linux64-CCov Opt" + index: + product: firefox + job-name: linux64-ccov-opt + treeherder: + platform: linux64/ccov + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-linux + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build check-test generate-build-stats update] + config: + - builds/releng_base_linux_64_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: code-coverage + tooltool-downloads: public + need-xvfb: true \ No newline at end of file diff --git a/taskcluster/ci/desktop-test/test-platforms.yml b/taskcluster/ci/desktop-test/test-platforms.yml index de91401b4e99..618afed7b297 100644 --- a/taskcluster/ci/desktop-test/test-platforms.yml +++ b/taskcluster/ci/desktop-test/test-platforms.yml @@ -25,3 +25,9 @@ linux64-pgo/opt: linux64-asan/opt: build-platform: linux64-asan/opt test-set: asan-tests +linux64-ccov/opt: + build-platform: linux64-ccov/opt + test-set: ccov-code-coverage-tests +linux64-jsdcov/opt: + build-platform: linux64-jsdcov/opt + test-set: jsdcov-code-coverage-tests \ No newline at end of file diff --git a/taskcluster/ci/desktop-test/test-sets.yml b/taskcluster/ci/desktop-test/test-sets.yml index cbee666f7818..c14d314feb79 100644 --- a/taskcluster/ci/desktop-test/test-sets.yml +++ b/taskcluster/ci/desktop-test/test-sets.yml @@ -56,3 +56,9 @@ asan-tests: - reftest - reftest-no-accel - xpcshell + +ccov-code-coverage-tests: + - mochitest-browser-chrome + +jsdcov-code-coverage-tests: + - mochitest-browser-chrome \ No newline at end of file diff --git a/taskcluster/ci/desktop-test/tests.yml b/taskcluster/ci/desktop-test/tests.yml index fb7693110a01..3910bedc7715 100644 --- a/taskcluster/ci/desktop-test/tests.yml +++ b/taskcluster/ci/desktop-test/tests.yml @@ -189,13 +189,30 @@ mochitest-a11y: - --mochitest-suite=a11y mochitest-browser-chrome: - description: "Mochitest browser-chrome run" - suite: mochitest/browser-chrome-chunked + description: + by-test-platform: + linux64-jsdcov/opt: "Mochitest browser-chrome JSDebugger code coverage run" + linux64-ccov/opt: "Mochitest browser-chrome GCOV code coverage run" + default: "Mochitest browser-chrome run" + suite: + by-test-platform: + linux64-jsdcov/opt: mochitest/browser-chrome-coverage + default: mochitest/browser-chrome-chunked treeherder-symbol: tc-M(bc) loopback-video: true - chunks: 7 + chunks: + by-test-platform: + linux64-jsdcov/opt: 35 + default: 7 + e10s: + by-test-platform: + linux64-jsdcov/opt: false + linux64-ccov/opt: false + default: both max-run-time: by-test-platform: + linux64-jsdcov/opt: 7200 + linux64-ccov/opt: 7200 linux64/debug: 5400 default: 3600 mozharness: @@ -207,9 +224,20 @@ mochitest-browser-chrome: - mozharness/configs/unittests/linux_unittest.py - mozharness/configs/remove_executables.py extra-options: - - --mochitest-suite=browser-chrome-chunked + by-test-platform: + linux64-jsdcov/opt: + - --mochitest-suite=browser-chrome-coverage + linux64-ccov/opt: + - --mochitest-suite=browser-chrome-chunked + - --code-coverage + default: + - --mochitest-suite=browser-chrome-chunked # Bug 1281241: migrating to m3.large instances - instance-size: legacy + instance-size: + by-test-platform: + linux64-jsdcov/opt: xlarge + linux64-ccov/opt: xlarge + default: legacy allow-software-gl-layers: false mochitest-chrome: diff --git a/taskcluster/taskgraph/transforms/tests/all_kinds.py b/taskcluster/taskgraph/transforms/tests/all_kinds.py index 8ef9ddf68f13..d74f064230a3 100644 --- a/taskcluster/taskgraph/transforms/tests/all_kinds.py +++ b/taskcluster/taskgraph/transforms/tests/all_kinds.py @@ -82,6 +82,9 @@ def resolve_keyed_by(config, tests): 'instance-size', 'max-run-time', 'chunks', + 'e10s', + 'suite', + 'description', ] for test in tests: for field in fields: @@ -90,6 +93,10 @@ def resolve_keyed_by(config, tests): field='mozharness', subfield='config', item_name=test['test-name']) + test['mozharness']['extra-options'] = get_keyed_by(item=test, + field='mozharness', + subfield='extra-options', + item_name=test['test-name']) yield test diff --git a/taskcluster/taskgraph/transforms/tests/test_description.py b/taskcluster/taskgraph/transforms/tests/test_description.py index 6919568b11b3..c54c9ae53c94 100644 --- a/taskcluster/taskgraph/transforms/tests/test_description.py +++ b/taskcluster/taskgraph/transforms/tests/test_description.py @@ -29,10 +29,16 @@ from voluptuous import ( # *****WARNING***** test_description_schema = Schema({ # description of the suite, for the task metadata - 'description': basestring, + Required('description'): Any( + basestring, + {'by-test-platform': {basestring: basestring}}, + ), # test suite name, or / - 'suite': basestring, + Required('suite'): Any( + basestring, + {'by-test-platform': {basestring: basestring}}, + ), # the name by which this test suite is addressed in try syntax; defaults to # the test-name @@ -138,7 +144,10 @@ test_description_schema = Schema({ # additional command-line options for mozharness, beyond those # automatically added - Required('extra-options', default=[]): [basestring], + Required('extra-options', default=[]): Any( + [basestring], + {'by-test-platform': {basestring: [basestring]}}, + ), # the artifact name (including path) to test on the build task; this is # generally set in a per-kind transformation diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 142adfd84fbb..8745f1b89423 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -2380,9 +2380,12 @@ class MochitestDesktop(MochitestBase): else: timeout = 330.0 # default JS harness timeout is 300 seconds - # detect shutdown leaks for m-bc runs - detectShutdownLeaks = mozinfo.info[ - "debug"] and options.flavor == 'browser' + # Detect shutdown leaks for m-bc runs if + # code coverage is not enabled. + detectShutdownLeaks = False + if options.jscov_dir_prefix is None: + detectShutdownLeaks = mozinfo.info[ + "debug"] and options.flavor == 'browser' self.start_script_args.append(self.normflavor(options.flavor)) marionette_args = { @@ -2427,10 +2430,20 @@ class MochitestDesktop(MochitestBase): finally: self.stopServers() + ignoreMissingLeaks = options.ignoreMissingLeaks + leakThresholds = options.leakThresholds + + # Stop leak detection if m-bc code coverage is enabled + # by maxing out the leak threshold for all processes. + if options.jscov_dir_prefix: + for processType in leakThresholds: + ignoreMissingLeaks.append(processType) + leakThresholds[processType] = sys.maxsize + mozleak.process_leak_log( self.leak_report_file, - leak_thresholds=options.leakThresholds, - ignore_missing_leaks=options.ignoreMissingLeaks, + leak_thresholds=leakThresholds, + ignore_missing_leaks=ignoreMissingLeaks, log=self.log, stack_fixer=get_stack_fixer_function(options.utilityPath, options.symbolsPath), diff --git a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_code_coverage.py b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_code_coverage.py index f596dd85706c..3ab4f25a3ea5 100644 --- a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_code_coverage.py +++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_code_coverage.py @@ -15,7 +15,7 @@ config = { # 'generate-build-stats', 'update', # decided by query_is_nightly() ], - 'stage_platform': 'linux64-cc', + 'stage_platform': 'linux64-ccov', 'platform_supports_post_upload_to_latest': False, 'enable_signing': False, 'enable_talos_sendchange': False, diff --git a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py index bccb2dc00d3e..6e1ff22f8a08 100644 --- a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py +++ b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py @@ -36,7 +36,7 @@ class CodeCoverageMixin(object): return True # XXX workaround because bug 1110465 is hard - return self.buildbot_config['properties']['stage_platform'] in ('linux64-cc',) + return self.buildbot_config['properties']['stage_platform'] in ('linux64-ccov',) except (AttributeError, KeyError, TypeError): return False