bug 1495798 - shut down sccache server in mozharness after all build steps. r=firefox-build-system-reviewers,gps
authorTed Mielczarek <ted@mielczarek.org>
Tue, 09 Oct 2018 18:27:26 +0000
changeset 450422 917ca5e550d438d624fd00f763352a4df1429bca
parent 450421 8534b1aac6ea8d3f46907f339d0b5db19be80f0d
child 450423 d3cf44592bbdf59309f44ec44b53eba5630890dc
push id234
push usermozilla@hocat.ca
push dateSat, 10 Nov 2018 00:08:05 +0000
treeherdermozilla-esr60@f2569ad7bd92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, gps
bugs1495798
milestone60.3.1
bug 1495798 - shut down sccache server in mozharness after all build steps. r=firefox-build-system-reviewers,gps In builds that use sccache, the sccache server would be shut down at the end of the build step in client.mk. Unfortunately in rusttest builds the check step winds up compiling more Rust code which restarts the sccache server but without the proper configuration. This patch moves sccache shutdown to a post-script step in mozharness so that the server will stay running through the check step. Differential Revision: https://phabricator.services.mozilla.com/D7651
client.mk
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/client.mk
+++ b/client.mk
@@ -168,22 +168,16 @@ endif
 build::  $(OBJDIR)/Makefile $(OBJDIR)/config.status
 	+$(MOZ_MAKE)
 
 ifdef MOZ_AUTOMATION
 build::
 	+$(MOZ_MAKE) automation/build
 endif
 
-ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON
-build::
-	# Terminate sccache server. This prints sccache stats.
-	-$(MOZBUILD_MANAGE_SCCACHE_DAEMON) --stop-server
-endif
-
 # This makefile doesn't support parallel execution. It does pass
 # MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
 # in parallel.
 .NOTPARALLEL:
 
 .PHONY: \
     build \
     configure
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1590,16 +1590,26 @@ or run without that action (ie: --no-{ac
             self.mkdir_p(env['UPLOAD_PATH'])
 
     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 _shutdown_sccache(self):
+        '''If sccache was in use for this build, shut down the sccache server.'''
+        if os.environ.get('USE_SCCACHE') == '1':
+            topsrcdir = self.query_abs_dirs()['abs_src_dir']
+            sccache = os.path.join(topsrcdir, 'sccache2', 'sccache')
+            if self._is_windows():
+                sccache += '.exe'
+            self.run_command([sccache, '--stop-server'], cwd=topsrcdir)
+
+    @PostScriptRun
     def _summarize(self):
         """ If this is run in automation, ensure the return code is valid and
         set it to one if it's not. Finally, log any summaries we collected
         from the script run.
         """
         if self.config.get("is_automation"):
             # let's ignore all mention of tbpl status until this
             # point so it will be easier to manage