Bug 1470079 - Add fuzzing coverage build to taskcluster draft
authorrforbes <rforbes@mozilla.com>
Sun, 24 Jun 2018 18:48:52 -0700
changeset 810395 32d5291e27dabea49aa8c6f4df1926fef4271ff6
parent 810007 15c95df467be553beb39f2e8102c206639e05fde
push id113973
push userbmo:rforbes@mozilla.com
push dateMon, 25 Jun 2018 19:42:43 +0000
bugs1470079
milestone62.0a1
Bug 1470079 - Add fuzzing coverage build to taskcluster MozReview-Commit-ID: 5TyxY2KmLCs
browser/config/mozconfigs/linux64/nightly-fuzzing-cov
taskcluster/ci/build/linux.yml
taskcluster/taskgraph/transforms/tests.py
testing/mozharness/configs/builds/releng_sub_linux_configs/64_fuzzing_cov.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
new file mode 100644
--- /dev/null
+++ b/browser/config/mozconfigs/linux64/nightly-fuzzing-cov
@@ -0,0 +1,38 @@
+MOZ_AUTOMATION_L10N_CHECK=0
+# We still need to build with debug symbols
+ac_add_options --disable-debug
+ac_add_options --enable-optimize="-O2 -gline-tables-only"
+
+#add-on signing is checked but not enforced
+MOZ_REQUIRE_SIGNING=0
+# Enable MOZ_ALLOW_LEGACY_EXTENSIONS
+ac_add_options "MOZ_ALLOW_LEGACY_EXTENSIONS=1"
+
+. $topsrcdir/build/mozconfig.stylo
+
+# ASan specific options on Linux
+ac_add_options --enable-valgrind
+
+. $topsrcdir/build/unix/mozconfig.asan
+ac_add_options --disable-elf-hack
+
+ac_add_options --disable-sandbox
+ac_add_options --disable-profiling
+ac_add_options --disable-warnings-as-errors
+ac_add_options --enable-coverage
+
+export CFLAGS="--coverage"
+export CXXFLAGS="--coverage"
+export LDFLAGS="--coverage"
+
+ac_add_options --enable-fuzzing
+unset MOZ_STDCXX_COMPAT
+
+# Package js shell.
+export MOZ_PACKAGE_JSSHELL=1
+
+# Need this to prevent name conflicts with the normal nightly build packages
+export MOZ_PKG_SPECIAL=asan-cov
+
+. "$topsrcdir/build/mozconfig.common.override"
+
--- a/taskcluster/ci/build/linux.yml
+++ b/taskcluster/ci/build/linux.yml
@@ -554,17 +554,16 @@ linux64-asan/opt:
         need-xvfb: true
     toolchains:
         - linux64-clang
         - linux64-gcc
         - linux64-rust
         - linux64-rust-size
         - linux64-sccache
 
-
 linux64-asan-fuzzing/opt:
     description: "Linux64 Fuzzing Opt ASAN"
     index:
         product: firefox
         job-name: linux64-fuzzing-asan-opt
     treeherder:
         platform: linux64/asan
         symbol: Bof
@@ -586,16 +585,48 @@ linux64-asan-fuzzing/opt:
         need-xvfb: true
     toolchains:
         - linux64-clang
         - linux64-gcc
         - linux64-rust
         - linux64-rust-size
         - linux64-sccache
 
+linux64-asan-fuzzing-ccov/opt:
+    description: "Linux64 Fuzzing Opt ASAN w/ Coverage"
+    index:
+        product: firefox
+        job-name: linux64-fuzzing-asan-opt-cov
+    treeherder:
+        platform: linux64/asan
+        symbol: Bocf
+    run-on-projects: ['mozilla-central', 'try']
+    worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+    worker:
+        env:
+            PERFHERDER_EXTRA_OPTIONS: asan-fuzzing-ccov
+        max-run-time: 3600
+    run:
+        using: mozharness
+        actions: [get-secrets build check-test update]
+        config:
+            - builds/releng_base_firefox.py
+            - builds/releng_base_linux_64_builds.py
+        script: "mozharness/scripts/fx_desktop_build.py"
+        secrets: true
+        custom-build-variant-cfg: fuzzing-cov
+        tooltool-downloads: public
+        need-xvfb: true
+    toolchains:
+        - linux64-clang
+        - linux64-gcc
+        - linux64-rust
+        - linux64-rust-size
+        - linux64-sccache
+
 linux64-asan-reporter-nightly/opt:
     description: "Linux64 Opt ASAN Reporter Nightly"
     attributes:
         nightly: true
     index:
         product: firefox
         job-name: linux64-asan-reporter-opt
         type: nightly
@@ -947,17 +978,17 @@ linux64-ccov/opt:
     description: "Linux64-CCov Opt"
     index:
         product: firefox
         job-name: linux64-ccov-opt
     treeherder:
         platform: linux64-ccov/opt
         symbol: B
         tier: 2
-    run-on-projects: ['try']
+    run-on-projects: ['mozilla-central', 'try']
     worker-type: aws-provisioner-v1/gecko-{level}-b-linux
     worker:
         max-run-time: 7200
     run:
         using: mozharness
         actions: [get-secrets build check-test update]
         config:
             - builds/releng_base_firefox.py
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -701,16 +701,20 @@ def handle_suite_category(config, tests)
         yield test
 
 
 @transforms.add
 def enable_code_coverage(config, tests):
     """Enable code coverage for the ccov and jsdcov build-platforms"""
     for test in tests:
         if 'ccov' in test['build-platform']:
+            # do not run tests on fuzzing or opt build
+            if 'opt' in test['build-platform'] or 'fuzzing' in test['build-platform']:
+                test['run-on-projects'] = []
+                continue
             test['mozharness'].setdefault('extra-options', []).append('--code-coverage')
             test['instance-size'] = 'xlarge'
             # Ensure we always run on the projects defined by the build, unless the test
             # is try only or shouldn't run at all.
             if test['run-on-projects'] not in [[], ['try']]:
                 test['run-on-projects'] = 'built-projects'
 
             # Ensure we don't optimize test suites out.
new file mode 100644
--- /dev/null
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_fuzzing_cov.py
@@ -0,0 +1,30 @@
+import os
+
+config = {
+    'default_actions': [
+        'clobber',
+        'build',
+        'check-test',
+        # 'update',
+    ],
+    'stage_platform': 'linux64-fuzzing-cov',
+    #### 64 bit build specific #####
+    'env': {
+        'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'),
+        'MOZ_AUTOMATION': '1',
+        'DISPLAY': ':2',
+        'HG_SHARE_BASE_DIR': '/builds/hg-shared',
+        'MOZ_OBJDIR': '%(abs_obj_dir)s',
+        'TINDERBOX_OUTPUT': '1',
+        'TOOLTOOL_CACHE': '/builds/tooltool_cache',
+        'TOOLTOOL_HOME': '/builds',
+        'MOZ_CRASHREPORTER_NO_REPORT': '1',
+        'LC_ALL': 'C',
+        'ASAN_OPTIONS': 'detect_leaks=0',
+        ## 64 bit specific
+        'PATH': '/usr/local/bin:/bin:\
+/usr/bin:/usr/local/sbin:/usr/sbin:/sbin',
+    },
+    'mozconfig_variant': 'nightly-fuzzing-cov',
+    #######################
+}
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -409,16 +409,17 @@ class BuildOptionParser(object):
         'cross-debug': 'builds/releng_sub_%s_configs/%s_cross_debug.py',
         'cross-debug-searchfox': 'builds/releng_sub_%s_configs/%s_cross_debug_searchfox.py',
         'cross-debug-artifact': 'builds/releng_sub_%s_configs/%s_cross_debug_artifact.py',
         'cross-noopt-debug': 'builds/releng_sub_%s_configs/%s_cross_noopt_debug.py',
         'cross-fuzzing-asan': 'builds/releng_sub_%s_configs/%s_cross_fuzzing_asan.py',
         'cross-artifact': 'builds/releng_sub_%s_configs/%s_cross_artifact.py',
         'debug': 'builds/releng_sub_%s_configs/%s_debug.py',
         'fuzzing-debug': 'builds/releng_sub_%s_configs/%s_fuzzing_debug.py',
+        'fuzzing-cov': 'builds/releng_sub_%s_configs/%s_fuzzing_cov.py',
         'asan-and-debug': 'builds/releng_sub_%s_configs/%s_asan_and_debug.py',
         'asan-tc-and-debug': 'builds/releng_sub_%s_configs/%s_asan_tc_and_debug.py',
         'lto-tc': 'builds/releng_sub_%s_configs/%s_lto_tc.py',
         'lto-tc-and-debug': 'builds/releng_sub_%s_configs/%s_lto_tc_and_debug.py',
         'stat-and-debug': 'builds/releng_sub_%s_configs/%s_stat_and_debug.py',
         'code-coverage-debug': 'builds/releng_sub_%s_configs/%s_code_coverage_debug.py',
         'code-coverage-opt': 'builds/releng_sub_%s_configs/%s_code_coverage_opt.py',
         'source': 'builds/releng_sub_%s_configs/%s_source.py',