1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # include automation-build.mk to get the path to the binary
6 TARGET_DEPTH
= $(DEPTH
)
7 include $(topsrcdir
)/build
/binary-location.mk
9 SYMBOLS_PATH
:= --symbols-path
=$(DIST
)/crashreporter-symbols
11 ifndef TEST_PACKAGE_NAME
12 TEST_PACKAGE_NAME
:= $(ANDROID_PACKAGE_NAME
)
15 ifndef NO_FAIL_ON_TEST_ERRORS
16 define check_test_error_internal
17 @errors
=`grep 'TEST-UNEXPECTED-' $@.log` ;\
18 if
test "$$errors" ; then \
21 $(if
$(1),echo
$(1);) \
25 CHECK_TEST_ERROR
= $(call check_test_error_internal
)
26 CHECK_TEST_ERROR_RERUN
= $(call check_test_error_internal
,'To rerun your failures please run "make $@-rerun-failures"')
29 # Usage: |make [EXTRA_TEST_ARGS=...] *test|.
30 RUN_REFTEST
= rm -f .
/$@.log
&& $(PYTHON3
) _tests
/reftest
/runreftest.py \
31 --extra-profile-file
=$(DIST
)/plugins \
32 $(SYMBOLS_PATH
) $(EXTRA_TEST_ARGS
) $(1) | tee .
/$@.log
34 REMOTE_REFTEST
= rm -f .
/$@.log
&& $(PYTHON3
) _tests
/reftest
/remotereftest.py \
35 --ignore-window-size \
36 --app
=$(TEST_PACKAGE_NAME
) --deviceIP
=${TEST_DEVICE} --xre-path
=${MOZ_HOST_BIN} \
37 --httpd-path
=_tests
/modules
--suite reftest \
38 --extra-profile-file
=$(topsrcdir
)/mobile
/android
/fonts \
39 $(SYMBOLS_PATH
) $(EXTRA_TEST_ARGS
) $(1) | tee .
/$@.log
41 ifeq ($(OS_ARCH
),WINNT
) #{
42 # GPU-rendered shadow layers are unsupported here
43 OOP_CONTENT
= --setpref
=layers.async-pan-zoom.enabled
=true
--setpref
=layers.acceleration.disabled
=true
46 OOP_CONTENT
= --setpref
=layers.async-pan-zoom.enabled
=true
47 GPU_RENDERING
= --setpref
=layers.acceleration.force-enabled
=true
50 reftest
: TEST_PATH?
=layout
/reftests
/reftest.list
52 $(call RUN_REFTEST
,'$(topsrcdir)/$(TEST_PATH)')
55 reftest-remote
: TEST_PATH?
=layout
/reftests
/reftest.list
57 @if
[ '${MOZ_HOST_BIN}' = '' ]; then \
58 echo
'environment variable MOZ_HOST_BIN must be set to a directory containing host xpcshell'; \
59 elif
[ ! -d
${MOZ_HOST_BIN} ]; then \
60 echo
'MOZ_HOST_BIN does not specify a directory'; \
61 elif
[ ! -f
${MOZ_HOST_BIN}/xpcshell
]; then \
62 echo
'xpcshell not found in MOZ_HOST_BIN'; \
64 ln
-s
$(abspath
$(topsrcdir
)) _tests
/reftest
/tests
; \
65 $(call REMOTE_REFTEST
,'tests/$(TEST_PATH)'); \
66 $(CHECK_TEST_ERROR
); \
69 crashtest
: TEST_PATH?
=testing
/crashtest
/crashtests.list
71 $(call RUN_REFTEST
,'$(topsrcdir)/$(TEST_PATH)')
74 jstestbrowser
: TESTS_PATH?
=test-stage
/jsreftest
/tests
/
76 $(MAKE
) -C
$(DEPTH
)/config
78 $(call RUN_REFTEST
,'$(DIST)/$(TESTS_PATH)/jstests.list' --extra-profile-file
=$(DIST
)/test-stage
/jsreftest
/tests
/user.js
)
81 REMOTE_CPPUNITTESTS
= \
82 $(PYTHON3
) -u
$(topsrcdir
)/testing
/remotecppunittests.py \
83 --xre-path
=$(DEPTH
)/dist/bin \
84 --localLib
=$(DEPTH
)/dist/geckoview \
85 --deviceIP
=${TEST_DEVICE} \
86 $(TEST_PATH
) $(EXTRA_TEST_ARGS
)
88 # Usage: |make [TEST_PATH=...] [EXTRA_TEST_ARGS=...] cppunittests-remote|.
90 $(call REMOTE_CPPUNITTESTS
);
92 # Package up the tests and test harnesses
93 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
95 PKG_STAGE
= $(DIST
)/test-stage
103 test-packages-manifest \
106 ifdef COMPILE_ENVIRONMENT
107 stage-all
: stage-cppunittests
128 ifdef LINK_GTEST_DURING_COMPILE
129 stage-all
: stage-gtest
130 TEST_PKGS_TARGZ
+= gtest
133 PKG_ARG
= --$(1) '$(PKG_BASENAME).$(1).tests.$(2)'
135 test-packages-manifest
:
136 @
rm -f
$(MOZ_TEST_PACKAGES_FILE
)
137 $(NSINSTALL
) -D
$(dir $(MOZ_TEST_PACKAGES_FILE
))
138 $(PYTHON3
) $(topsrcdir
)/build
/gen_test_packages_manifest.py \
139 --jsshell
$(JSSHELL_NAME
) \
140 --dest-file
'$(MOZ_TEST_PACKAGES_FILE)' \
141 $(call PKG_ARG
,common
,zip
) \
142 $(foreach pkg
,$(TEST_PKGS_TARGZ
),$(call PKG_ARG
,$(pkg
),tar.gz
))
145 test_archive_dir
= $(UPLOAD_PATH
)
147 test_archive_dir
= $(DIST
)/$(PKG_PATH
)
150 package-tests-prepare-dest
:
151 $(NSINSTALL
) -D
$(test_archive_dir
)
153 download-wpt-manifest
:
154 $(call py_action
,download_wpt_manifest
)
156 define package_archive
157 package-tests-
$(1): stage-all package-tests-prepare-dest download-wpt-manifest
158 $$(call py_action
,test_archive
, \
160 '$$(abspath $$(test_archive_dir))/$$(PKG_BASENAME).$(1).tests.$(2)')
161 package-tests
: package-tests-
$(1)
164 $(foreach name
,$(TEST_PKGS_TARGZ
),$(eval
$(call package_archive
,$(name
),tar.gz
)))
166 ifeq ($(MOZ_BUILD_APP
),mobile
/android
)
167 stage-all
: stage-android
170 # Prepare _tests before any of the other staging/packaging steps.
171 # make-stage-dir is a prerequisite to all the stage-* targets in testsuite-targets.mk.
172 make-stage-dir
: install-test-files
174 $(NSINSTALL
) -D
$(PKG_STAGE
)
175 $(NSINSTALL
) -D
$(PKG_STAGE
)/bin
176 $(NSINSTALL
) -D
$(PKG_STAGE
)/bin
/components
177 $(NSINSTALL
) -D
$(PKG_STAGE
)/certs
178 $(NSINSTALL
) -D
$(PKG_STAGE
)/config
179 $(NSINSTALL
) -D
$(PKG_STAGE
)/modules
180 $(NSINSTALL
) -D
$(PKG_STAGE
)/tools
/mach
182 stage-config
: make-stage-dir
183 $(NSINSTALL
) -D
$(PKG_STAGE
)/config
184 @
(cd
$(topsrcdir
)/testing
/config
&& tar $(TAR_CREATE_FLAGS
) - *) |
(cd
$(PKG_STAGE
)/config
&& tar -xf
-)
186 stage-mach
: make-stage-dir
187 @
(cd
$(topsrcdir
)/python
/mach
&& tar $(TAR_CREATE_FLAGS
) - *) |
(cd
$(PKG_STAGE
)/tools
/mach
&& tar -xf
-)
188 cp
$(topsrcdir
)/testing
/tools
/mach_test_package_initialize.py
$(PKG_STAGE
)/tools
/mach_initialize.py
189 cp
$(topsrcdir
)/mach
$(PKG_STAGE
)
191 stage-mochitest
: make-stage-dir
;
193 stage-jstests
: make-stage-dir
194 $(MAKE
) -C
$(DEPTH
)/js
/src
/tests stage-package
197 ifneq ($(OBJCOPY
), :) # see build/autoconf/toolchain.m4:102 for why this is necessary
199 STRIP_COMPILED_TESTS
:= 1
204 stage-gtest
: make-stage-dir
205 $(NSINSTALL
) -D
$(PKG_STAGE
)/gtest
/gtest_bin
/gtest
206 ifdef STRIP_COMPILED_TESTS
207 # The libxul file basename will vary per platform. Fortunately
208 # dependentlibs.list always lists the library name as its final line, so we
209 # can get the value from there.
210 LIBXUL_BASE
=`tail -1 $(DIST)/bin/dependentlibs.list` && \
211 $(OBJCOPY
) $(or
$(STRIP_FLAGS
),--strip-unneeded
) \
212 $(DIST
)/bin
/gtest
/$$LIBXUL_BASE $(PKG_STAGE
)/gtest
/gtest_bin
/gtest
/$$LIBXUL_BASE
214 cp
-RL
$(DIST
)/bin
/gtest
$(PKG_STAGE
)/gtest
/gtest_bin
216 cp
-RL
$(DEPTH
)/_tests
/gtest
$(PKG_STAGE
)
217 cp
$(topsrcdir
)/testing
/gtest
/rungtests.py
$(PKG_STAGE
)/gtest
218 cp
$(topsrcdir
)/testing
/gtest
/remotegtests.py
$(PKG_STAGE
)/gtest
219 cp
$(topsrcdir
)/testing
/gtest
/mach_test_package_commands.py
$(PKG_STAGE
)/gtest
220 cp
$(DIST
)/bin
/dependentlibs.list.gtest
$(PKG_STAGE
)/gtest
221 cp
$(DEPTH
)/mozinfo.json
$(PKG_STAGE
)/gtest
223 stage-android
: make-stage-dir
224 $(NSINSTALL
) $(topsrcdir
)/mobile
/android
/fonts
$(DEPTH
)/_tests
/reftest
225 $(NSINSTALL
) $(topsrcdir
)/mobile
/android
/fonts
$(DEPTH
)/_tests
/testing
/mochitest
228 CPP_UNIT_TEST_BINS
=$(filter-out $(wildcard $(DIST
)/cppunittests
/*.pdb
), $(wildcard $(DIST
)/cppunittests
/*))
230 CPP_UNIT_TEST_BINS
=$(wildcard $(DIST
)/cppunittests
/*)
233 stage-cppunittests
: make-stage-dir
234 $(NSINSTALL
) -D
$(PKG_STAGE
)/cppunittest
235 ifdef STRIP_COMPILED_TESTS
236 $(foreach bin
,$(CPP_UNIT_TEST_BINS
),$(OBJCOPY
) $(or
$(STRIP_FLAGS
),--strip-unneeded
) $(bin
) $(bin
:$(DIST
)/cppunittests
/%=$(PKG_STAGE
)/cppunittest
/%);)
238 cp
-RL
$(CPP_UNIT_TEST_BINS
) $(PKG_STAGE
)/cppunittest
241 cp
-RL
$(addsuffix .pdb
,$(basename $(CPP_UNIT_TEST_BINS
))) $(PKG_STAGE
)/cppunittest
243 ifdef STRIP_COMPILED_TESTS
244 $(OBJCOPY
) $(or
$(STRIP_FLAGS
),--strip-unneeded
) $(DIST
)/bin
/jsapi-tests
$(BIN_SUFFIX
) $(PKG_STAGE
)/cppunittest
/jsapi-tests
$(BIN_SUFFIX
)
246 cp
-RL
$(DIST
)/bin
/jsapi-tests
$(BIN_SUFFIX
) $(PKG_STAGE
)/cppunittest
249 cp
-RL
$(DIST
)/bin
/jsapi-tests.pdb
$(PKG_STAGE
)/cppunittest
253 specialpowers@mozilla.org.xpi \
256 stage-extensions
: make-stage-dir
257 $(NSINSTALL
) -D
$(PKG_STAGE
)/extensions
/
258 @
$(foreach ext
,$(TEST_EXTENSIONS
), cp
-RL
$(DIST
)/xpi-stage
/$(ext
) $(PKG_STAGE
)/extensions
;)
267 download-wpt-manifest \
268 package-tests-prepare-dest \
269 package-tests-common \
276 test-packages-manifest \