bug 1507827 - start sccache server explicitly in rusttest builds. r?build draft
authorTed Mielczarek <ted@mielczarek.org>
Tue, 20 Nov 2018 10:29:33 -0500
changeset 1765512 b6bf963b3d70d41a36f6a3641073d1cc41d69c8e
parent 1765086 eeddcefcdad847bf8a5737153079e9619ee5aa66
child 1765513 14a523470bf9b5f05b2701b1feedbc7d4dbb85f5
child 1765590 61095a470d22f40e54f32499fe2ac3d106d6ce38
push id316687
push usertmielczarek@mozilla.com
push dateTue, 20 Nov 2018 16:16:24 +0000
treeherdertry@14a523470bf9 [default view] [failures only]
reviewersbuild
bugs1507827
milestone65.0a1
bug 1507827 - start sccache server explicitly in rusttest builds. r?build
Makefile.in
client.mk
taskcluster/ci/build/windows.yml
testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests.py
testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests_debug.py
testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests.py
testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests_debug.py
testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -200,21 +200,35 @@ profiledbuild::
 ifdef MOZ_PGO
 OVERRIDE_DEFAULT_GOAL := profiledbuild
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 ifdef SCCACHE_VERBOSE_STATS
 default::
+	$(MAKE) sccache-stats
+endif
+
+sccache-stats:
 	-$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
 	@echo "===SCCACHE STATS==="
 	-$(CCACHE) --show-stats
 	@echo "==================="
-endif
+
+# This gets invoked via client.mk and also directly via the rusttest jobs that don't
+# build using client.mk.
+start-sccache:
+	# Terminate any sccache server that might still be around.
+	-$(CCACHE) --stop-server > /dev/null 2>&1
+	# Start a new server, ensuring it gets the jobserver file descriptors
+	# from make (but don't use the + prefix when make -n is used, so that
+	# the command doesn't run in that case)
+	mkdir -p $(UPLOAD_PATH)
+	$(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env RUST_LOG=sccache=debug SCCACHE_ERROR_LOG=$(UPLOAD_PATH)/sccache.log $(CCACHE) --start-server
 
 distclean::
 	$(RM) $(DIST_GARBAGE)
 
 ifdef MOZ_CRASHREPORTER
 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
 endif
--- a/client.mk
+++ b/client.mk
@@ -69,26 +69,20 @@ CONFIGURES += $(TOPSRCDIR)/js/src/config
 build::
 
 ifndef MACH
 $(error client.mk must be used via `mach`. Try running \
 `./mach $(firstword $(MAKECMDGOALS) $(.DEFAULT_GOAL))`)
 endif
 
 # In automation, manage an sccache daemon. The starting of the server
-# needs to be in a make file so sccache inherits the jobserver.
+# needs to be in a makefile so sccache inherits the jobserver.
 ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON
 build::
-	# Terminate any sccache server that might still be around.
-	-$(MOZBUILD_MANAGE_SCCACHE_DAEMON) --stop-server > /dev/null 2>&1
-	# Start a new server, ensuring it gets the jobserver file descriptors
-	# from make (but don't use the + prefix when make -n is used, so that
-	# the command doesn't run in that case)
-	mkdir -p $(UPLOAD_PATH)
-	$(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env RUST_LOG=sccache=debug SCCACHE_ERROR_LOG=$(UPLOAD_PATH)/sccache.log $(MOZBUILD_MANAGE_SCCACHE_DAEMON) --start-server
+	+$(MAKE) -C $(OBJDIR) start-sccache
 endif
 
 ####################################
 # Configure
 
 $(CONFIGURES): %: %.in
 	@echo Generating $@
 	cp -f $< $@
--- a/taskcluster/ci/build/windows.yml
+++ b/taskcluster/ci/build/windows.yml
@@ -514,17 +514,17 @@ win32-rusttests/opt:
         script: mozharness/scripts/fx_desktop_build.py
         config:
             - builds/releng_base_firefox.py
             - builds/taskcluster_base_windows.py
             - builds/taskcluster_base_win32.py
         extra-config:
             stage_platform: win32-rusttests
             artifact_flag_build_variant_in_try: null
-            build_targets: ['pre-export', 'export', 'recurse_rusttests']
+            build_targets: ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats']
             disable_package_metrics: true
         mozconfig-variant: rusttests
     run-on-projects: ['trunk', 'try']
     toolchains:
         - win64-clang-cl
         - win64-rust
         - win64-cbindgen
         - win64-sccache
@@ -552,17 +552,17 @@ win32-rusttests/debug:
         script: mozharness/scripts/fx_desktop_build.py
         config:
             - builds/releng_base_firefox.py
             - builds/taskcluster_base_windows.py
             - builds/taskcluster_base_win32.py
         extra-config:
             stage_platform: win32-rusttests
             artifact_flag_build_variant_in_try: null
-            build_targets: ['pre-export', 'export', 'recurse_rusttests']
+            build_targets: ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats']
             disable_package_metrics: true
         mozconfig-variant: rusttests-debug
     run-on-projects: ['trunk', 'try']
     toolchains:
         - win64-clang-cl
         - win64-rust
         - win64-cbindgen
         - win64-sccache
--- a/testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests.py
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests.py
@@ -12,14 +12,14 @@ config = {
         'LC_ALL': 'C',
         # 32 bit specific
         'PATH': '/usr/local/bin:/bin:\
 /usr/bin:/usr/local/sbin:/usr/sbin:/sbin',
         'LD_LIBRARY_PATH': '%(abs_obj_dir)s/dist/bin',
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
         'TINDERBOX_OUTPUT': '1',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats'],
     'mozconfig_variant': 'rusttests',
     'artifact_flag_build_variant_in_try': None,
     'disable_package_metrics': True,
     #######################
 }
--- a/testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests_debug.py
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_rusttests_debug.py
@@ -13,13 +13,13 @@ config = {
         'LC_ALL': 'C',
         # 32 bit specific
         'PATH': '/usr/local/bin:/bin:\
 /usr/bin:/usr/local/sbin:/usr/sbin:/sbin',
         'LD_LIBRARY_PATH': '%(abs_obj_dir)s/dist/bin',
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
         'TINDERBOX_OUTPUT': '1',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats'],
     'artifact_flag_build_variant_in_try': None,
     'disable_package_metrics': True,
     #######################
 }
--- a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests.py
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests.py
@@ -12,13 +12,13 @@ config = {
         'TOOLTOOL_CACHE': '/builds/tooltool_cache',
         'TOOLTOOL_HOME': '/builds',
         'MOZ_CRASHREPORTER_NO_REPORT': '1',
         'LC_ALL': 'C',
         ## 64 bit specific
         'PATH': ':/usr/local/bin:/bin:\
 /usr/bin:/usr/local/sbin:/usr/sbin:/sbin',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats'],
     'artifact_flag_build_variant_in_try': None,
     'disable_package_metrics': True,
     #######################
 }
--- a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests_debug.py
+++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_rusttests_debug.py
@@ -12,12 +12,12 @@ config = {
         'LC_ALL': 'C',
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
         # 64 bit specific
         'PATH': '/usr/local/bin:/bin:\
 /usr/bin:/usr/local/sbin:/usr/sbin:/sbin',
         'LD_LIBRARY_PATH': '%(abs_obj_dir)s/dist/bin',
         'TINDERBOX_OUTPUT': '1',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats'],
     'artifact_flag_build_variant_in_try': None,
     'disable_package_metrics': True,
 }
--- a/testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py
+++ b/testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py
@@ -1,12 +1,12 @@
 config = {
     'default_actions': [
         'build',
     ],
     'stage_platform': 'win64-rusttests',
     'env': {
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests', 'sccache-stats'],
     'disable_package_metrics': True,
     'artifact_flag_build_variant_in_try': None,
 }