Bug 1271622 - migrate valgrind build to use mozharness r=kmoir
authorfkang
Fri, 03 Jun 2016 10:19:37 -0400
changeset 341473 7f5e5e52d06fdb6c2b3ac864a310f934541ab8b9
parent 341472 d2bdb3aba6c1df9c02fe0ab411d6a4b6b0d095b4
child 341474 b0139b57d0ccf65b95b7a3c60a693a0422c232dd
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmoir
bugs1271622
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1271622 - migrate valgrind build to use mozharness r=kmoir
testing/mozharness/configs/builds/releng_sub_linux_configs/64_valgrind.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
testing/mozharness/scripts/fx_desktop_build.py
testing/taskcluster/tasks/branches/base_job_flags.yml
testing/taskcluster/tasks/branches/base_jobs.yml
testing/taskcluster/tasks/builds/opt_linux64_valgrind.yml
new file mode 100644
--- /dev/null
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_valgrind.py
@@ -0,0 +1,49 @@
+import os
+
+MOZ_OBJDIR = 'obj-firefox'
+
+config = {
+    'default_actions': [
+        'clobber',
+        'clone-tools',
+        'checkout-sources',
+        #'setup-mock',
+        'build',
+        #'upload-files',
+        #'sendchange',
+        'check-test',
+        'valgrind-test',
+        #'generate-build-stats',
+        #'update',
+    ],
+    'stage_platform': 'linux64-valgrind',
+    'publish_nightly_en_US_routes': False,
+    'build_type': 'valgrind',
+    'tooltool_manifest_src': "browser/config/tooltool-manifests/linux64/\
+releng.manifest",
+    'platform_supports_post_upload_to_latest': False,
+    'enable_signing': False,
+    'enable_talos_sendchange': False,
+    #### 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': 'obj-firefox',
+        'TINDERBOX_OUTPUT': '1',
+        'TOOLTOOL_CACHE': '/builds/tooltool_cache',
+        'TOOLTOOL_HOME': '/builds',
+        'MOZ_CRASHREPORTER_NO_REPORT': '1',
+        'CCACHE_DIR': '/builds/ccache',
+        'CCACHE_COMPRESS': '1',
+        'CCACHE_UMASK': '002',
+        'LC_ALL': 'C',
+        ## 64 bit specific
+        'PATH': '/tools/buildbot/bin:/usr/local/bin:/usr/lib64/ccache:/bin:\
+/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/tools/git/bin:/tools/python27/bin:\
+/tools/python27-mercurial/bin:/home/cltbld/bin',
+    },
+    'src_mozconfig': 'browser/config/mozconfigs/linux64/valgrind',
+    #######################
+}
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -364,16 +364,17 @@ class BuildOptionParser(object):
         'api-11-debug': 'builds/releng_sub_%s_configs/%s_api_11_debug.py',
         'api-15-debug': 'builds/releng_sub_%s_configs/%s_api_15_debug.py',
         'x86': 'builds/releng_sub_%s_configs/%s_x86.py',
         'api-11-partner-sample1': 'builds/releng_sub_%s_configs/%s_api_11_partner_sample1.py',
         'api-15-partner-sample1': 'builds/releng_sub_%s_configs/%s_api_15_partner_sample1.py',
         'android-test': 'builds/releng_sub_%s_configs/%s_test.py',
         'android-checkstyle': 'builds/releng_sub_%s_configs/%s_checkstyle.py',
         'android-lint': 'builds/releng_sub_%s_configs/%s_lint.py',
+        'valgrind' : 'builds/releng_sub_%s_configs/%s_valgrind.py'
     }
     build_pool_cfg_file = 'builds/build_pool_specifics.py'
     branch_cfg_file = 'builds/branch_specifics.py'
 
     @classmethod
     def _query_pltfrm_and_bits(cls, target_option, options):
         """ determine platform and bits
 
@@ -2020,16 +2021,37 @@ or run without that action (ie: --no-{ac
 
         if self.submit_balrog_updates():
             # set the build to orange so it is at least caught
             self.return_code = self.worst_level(
                 EXIT_STATUS_DICT[TBPL_WARNING], self.return_code,
                 AUTOMATION_EXIT_CODES[::-1]
             )
 
+    def valgrind_test(self):
+        '''Execute mach's valgrind-test for memory leaks'''
+        env = self.query_build_env()
+        env.update(self.query_mach_build_env())
+
+        python = self.query_exe('python2.7')
+        return_code = self.run_command_m(
+            command=[python, 'mach', 'valgrind-test'],
+            cwd=self.query_abs_dirs()['abs_src_dir'],
+            env=env, output_timeout=self.config.get('max_build_output_timeout', 60 * 40)
+        )
+        if return_code:
+            self.return_code = self.worst_level(
+                EXIT_STATUS_DICT[TBPL_FAILURE],  self.return_code,
+                AUTOMATION_EXIT_CODES[::-1]
+            )
+            self.fatal("'mach valgrind-test' did not run successfully. Please check "
+                       "log for errors.")
+
+
+
     def _post_fatal(self, message=None, exit_code=None):
         if not self.return_code:  # only overwrite return_code if it's 0
             self.error('setting return code to 2 because fatal was called')
             self.return_code = 2
 
     @PostScriptRun
     def _summarize(self):
         """ If this is run in automation, ensure the return code is valid and
--- a/testing/mozharness/scripts/fx_desktop_build.py
+++ b/testing/mozharness/scripts/fx_desktop_build.py
@@ -32,16 +32,17 @@ class FxDesktopBuild(BuildScript, object
                 'clobber',
                 'clone-tools',
                 'checkout-sources',
                 'setup-mock',
                 'build',
                 'upload-files',  # upload from BB to TC
                 'sendchange',
                 'check-test',
+                'valgrind-test',
                 'package-source',
                 'generate-source-signing-manifest',
                 'multi-l10n',
                 'generate-build-stats',
                 'update',
             ],
             'require_config_file': True,
             # Default configuration
--- a/testing/taskcluster/tasks/branches/base_job_flags.yml
+++ b/testing/taskcluster/tasks/branches/base_job_flags.yml
@@ -94,16 +94,17 @@ flags:
     - android-api-15-frontend
     - android-partner-sample1
     - linux
     - linux64
     - linux64-st-an
     - linux64-artifact
     - linux64-asan
     - linux64-pgo
+    - linux64-valgrind
     - macosx64
     - macosx64-st-an
 
   tests:
     - cppunit
     - crashtest
     - crashtest-e10s
     - external-media-tests
--- a/testing/taskcluster/tasks/branches/base_jobs.yml
+++ b/testing/taskcluster/tasks/branches/base_jobs.yml
@@ -73,16 +73,22 @@ builds:
        - js/public/**
        - js/src/**
   linux64-pgo:
     platforms:
       - Linux64 PGO
     types:
       opt:
         task: tasks/builds/opt_linux64_pgo.yml
+  linux64-valgrind:
+    platforms:
+      - Linux64 Valgrind
+    types:
+      opt:
+        task: tasks/builds/opt_linux64_valgrind.yml
   macosx64:
     platforms:
       - MacOSX64
     types:
       opt:
         task: tasks/builds/opt_macosx64.yml
       debug:
         task: tasks/builds/dbg_macosx64.yml
new file mode 100644
--- /dev/null
+++ b/testing/taskcluster/tasks/builds/opt_linux64_valgrind.yml
@@ -0,0 +1,31 @@
+$inherits:
+  from: 'tasks/builds/base_linux64.yml'
+  variables:
+    build_name: 'linux64-valgrind'
+    build_type: 'opt'
+task:
+  metadata:
+      name: '[TC] Linux64 Valgrind Opt'
+      description: 'Linux64 Valgrind Opt'
+
+  routes:
+    - 'index.buildbot.branches.{{project}}.linux64-valgrind'
+    - 'index.buildbot.revisions.{{head_rev}}.{{project}}.linux64-valgrind'
+
+  workerType: opt-linux64
+
+  payload:
+    env:
+      MH_CUSTOM_BUILD_VARIANT_CFG: 'valgrind'
+      MOZHARNESS_ACTIONS: 'get-secrets build valgrind-test generate-build-stats'
+
+    maxRunTime: 72000
+
+  extra:
+    treeherder:
+      groupSymbol: tc
+      groupName: Submitted by taskcluster
+      symbol: V
+      machine:
+        # see https://github.com/mozilla/treeherder/blob/master/ui/js/values.js
+        platform: linux64
\ No newline at end of file