Bug 1200311 - Build the gtest libxul during the compile tier instead of package-tests. r=ted
authorChris Manchester <cmanchester@mozilla.com>
Mon, 06 Feb 2017 14:34:07 -0800
changeset 341280 87afb64a7e5a09dac0db14d6bc77ef9e75e92adb
parent 341279 9a1db16ec7c2fe8054c244943a7444be5b8633f7
child 341281 cff9ca695cca7bf21d6c628f2007c28e778d42f1
push id86684
push usercbook@mozilla.com
push dateWed, 08 Feb 2017 10:31:03 +0000
treeherdermozilla-inbound@c5b88e4e70f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1200311
milestone54.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 1200311 - Build the gtest libxul during the compile tier instead of package-tests. r=ted MozReview-Commit-ID: HX2ORY8cUV9
moz.configure
testing/testsuite-targets.mk
toolkit/library/Makefile.in
toolkit/library/gtest/Makefile.in
--- a/moz.configure
+++ b/moz.configure
@@ -152,16 +152,27 @@ option('--build-backends', nargs='+', de
        choices=build_backends_choices, help='Build backends to generate')
 
 @depends('--build-backends')
 def build_backends(backends):
     return backends
 
 set_config('BUILD_BACKENDS', build_backends)
 
+# Determine whether to build the gtest xul. This happens in automation
+# on Desktop platforms with the exception of Windows PGO, where linking
+# xul-gtest.dll takes too long.
+@depends('MOZ_PGO', build_project, target, 'MOZ_AUTOMATION',
+         when='--enable-compile-environment')
+def build_gtest(pgo, build_project, target, automation):
+    if (automation and build_project == 'browser' and
+        not (pgo and target.os == 'WINNT')):
+        return True
+
+set_config('LINK_GTEST_DURING_COMPILE', build_gtest)
 
 # Awk detection
 # ==============================================================
 awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))
 
 # Until the AWK variable is not necessary in old-configure
 @depends(awk)
 def awk_for_old_configure(value):
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -7,30 +7,16 @@ TARGET_DEPTH = $(DEPTH)
 include $(topsrcdir)/build/binary-location.mk
 
 SYMBOLS_PATH := --symbols-path=$(DIST)/crashreporter-symbols
 
 ifndef TEST_PACKAGE_NAME
 TEST_PACKAGE_NAME := $(ANDROID_PACKAGE_NAME)
 endif
 
-# Linking xul-gtest.dll takes too long, so we disable GTest on
-# Windows PGO builds (bug 1028035).
-ifneq (1_WINNT,$(MOZ_PGO)_$(OS_ARCH))
-BUILD_GTEST=1
-endif
-
-ifneq (browser,$(MOZ_BUILD_APP))
-BUILD_GTEST=
-endif
-
-ifndef COMPILE_ENVIRONMENT
-BUILD_GTEST=
-endif
-
 ifndef NO_FAIL_ON_TEST_ERRORS
 define check_test_error_internal
   @errors=`grep 'TEST-UNEXPECTED-' $@.log` ;\
   if test "$$errors" ; then \
 	  echo '$@ failed:'; \
 	  echo "$$errors"; \
           $(if $(1),echo $(1);) \
 	  exit 1; \
@@ -147,17 +133,17 @@ TEST_PKGS := \
   cppunittest \
   mochitest \
   reftest \
   talos \
   web-platform \
   xpcshell \
   $(NULL)
 
-ifdef BUILD_GTEST
+ifdef LINK_GTEST_DURING_COMPILE
 stage-all: stage-gtest
 TEST_PKGS += gtest
 endif
 
 PKG_ARG = --$(1) '$(PKG_BASENAME).$(1).tests.zip'
 
 test-packages-manifest:
 	@rm -f $(MOZ_TEST_PACKAGES_FILE)
@@ -213,18 +199,16 @@ stage-mochitest: make-stage-dir
 ifeq ($(MOZ_BUILD_APP),mobile/android)
 	$(MAKE) -C $(DEPTH)/testing/mochitest stage-package
 endif
 
 stage-jstests: make-stage-dir
 	$(MAKE) -C $(DEPTH)/js/src/tests stage-package
 
 stage-gtest: make-stage-dir
-# FIXME: (bug 1200311) We should be generating the gtest xul as part of the build.
-	$(MAKE) -C $(DEPTH)/testing/gtest gtest
 	$(NSINSTALL) -D $(PKG_STAGE)/gtest/gtest_bin
 	cp -RL $(DIST)/bin/gtest $(PKG_STAGE)/gtest/gtest_bin
 	cp -RL $(DEPTH)/_tests/gtest $(PKG_STAGE)
 	cp $(topsrcdir)/testing/gtest/rungtests.py $(PKG_STAGE)/gtest
 	cp $(DIST)/bin/dependentlibs.list.gtest $(PKG_STAGE)/gtest
 	cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/gtest
 
 stage-android: make-stage-dir
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -9,9 +9,9 @@ include $(topsrcdir)/config/config.mk
 # Wrap linker to print linking status periodically to prevent the linking
 # process from getting killed
 EXPAND_LIBS_EXEC := $(PYTHON) $(topsrcdir)/config/link.py
 
 include $(topsrcdir)/config/rules.mk
 
 .PHONY: gtestxul
 gtestxul:
-	$(MAKE) -C $(DEPTH) toolkit/library/gtest/target LINK_GTEST=1
+	$(MAKE) -C $(DEPTH) toolkit/library/gtest/target LINK_GTEST_DURING_COMPILE=1
--- a/toolkit/library/gtest/Makefile.in
+++ b/toolkit/library/gtest/Makefile.in
@@ -1,20 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Enforce that the clean/distclean rules removes everything that needs
 # to be removed from this directory.
 ifneq (,$(filter clean distclean,$(MAKECMDGOALS)))
-LINK_GTEST = 1
+LINK_GTEST_DURING_COMPILE = 1
 endif
 
-ifndef LINK_GTEST
-# Force to not include backend.mk unless LINK_GTEST is defined.
+ifndef LINK_GTEST_DURING_COMPILE
+# Force to not include backend.mk unless LINK_GTEST_DURING_COMPILE is set.
 # Not including backend.mk makes traversing this directory do nothing.
 STANDALONE_MAKEFILE = 1
 
 else
 
 include $(topsrcdir)/toolkit/library/libxul.mk
 
 include $(topsrcdir)/config/config.mk