Backed out 6 changesets (bug 1712140) for causing Linux related wpt failures in nsHtm...
[gecko.git] / testing / testsuite-targets.mk
blobcba88a1d6f7d0e0124ee3c26200c8ebbc6cd038f
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)
13 endif
15 ifndef NO_FAIL_ON_TEST_ERRORS
16 define check_test_error_internal
17 @errors=`grep 'TEST-UNEXPECTED-' $@.log` ;\
18 if test "$$errors" ; then \
19 echo '$@ failed:'; \
20 echo "$$errors"; \
21 $(if $(1),echo $(1);) \
22 exit 1; \
24 endef
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"')
27 endif
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=browser.tabs.remote.autostart=true --setpref=layers.acceleration.disabled=true
44 GPU_RENDERING =
45 else
46 OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true
47 GPU_RENDERING = --setpref=layers.acceleration.force-enabled=true
48 endif #}
50 reftest: TEST_PATH?=layout/reftests/reftest.list
51 reftest:
52 $(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)')
53 $(CHECK_TEST_ERROR)
55 reftest-remote: TEST_PATH?=layout/reftests/reftest.list
56 reftest-remote:
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'; \
63 else \
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
70 crashtest:
71 $(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)')
72 $(CHECK_TEST_ERROR)
74 jstestbrowser: TESTS_PATH?=test-stage/jsreftest/tests/
75 jstestbrowser:
76 $(MAKE) -C $(DEPTH)/config
77 $(MAKE) stage-jstests
78 $(call RUN_REFTEST,'$(DIST)/$(TESTS_PATH)/jstests.list' --extra-profile-file=$(DIST)/test-stage/jsreftest/tests/user.js)
79 $(CHECK_TEST_ERROR)
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|.
89 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
97 stage-all: \
98 stage-config \
99 stage-mach \
100 stage-extensions \
101 stage-mochitest \
102 stage-jstests \
103 test-packages-manifest \
104 $(NULL)
106 ifdef COMPILE_ENVIRONMENT
107 stage-all: stage-cppunittests
108 endif
110 TEST_PKGS_TARGZ := \
111 common \
112 condprof \
113 cppunittest \
114 mochitest \
115 reftest \
116 talos \
117 raptor \
118 awsy \
119 xpcshell \
120 web-platform \
121 updater-dep \
122 jsreftest \
123 jittest \
124 perftests \
125 fuzztest \
126 $(NULL)
128 ifdef LINK_GTEST_DURING_COMPILE
129 stage-all: stage-gtest
130 TEST_PKGS_TARGZ += gtest
131 endif
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))
144 ifdef UPLOAD_PATH
145 test_archive_dir = $(UPLOAD_PATH)
146 else
147 test_archive_dir = $(DIST)/$(PKG_PATH)
148 endif
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, \
159 $(1) \
160 '$$(abspath $$(test_archive_dir))/$$(PKG_BASENAME).$(1).tests.$(2)')
161 package-tests: package-tests-$(1)
162 endef
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
168 endif
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
173 rm -rf $(PKG_STAGE)
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
196 ifdef OBJCOPY
197 ifneq ($(OBJCOPY), :) # see build/autoconf/toolchain.m4:102 for why this is necessary
198 ifdef PKG_STRIP
199 STRIP_COMPILED_TESTS := 1
200 endif
201 endif
202 endif
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
213 else
214 cp -RL $(DIST)/bin/gtest $(PKG_STAGE)/gtest/gtest_bin
215 endif
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
227 ifdef MOZ_COPY_PDBS
228 CPP_UNIT_TEST_BINS=$(filter-out $(wildcard $(DIST)/cppunittests/*.pdb), $(wildcard $(DIST)/cppunittests/*))
229 else
230 CPP_UNIT_TEST_BINS=$(wildcard $(DIST)/cppunittests/*)
231 endif
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/%);)
237 else
238 cp -RL $(CPP_UNIT_TEST_BINS) $(PKG_STAGE)/cppunittest
239 endif
240 ifdef MOZ_COPY_PDBS
241 cp -RL $(addsuffix .pdb,$(basename $(CPP_UNIT_TEST_BINS))) $(PKG_STAGE)/cppunittest
242 endif
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)
245 else
246 cp -RL $(DIST)/bin/jsapi-tests$(BIN_SUFFIX) $(PKG_STAGE)/cppunittest
247 endif
248 ifdef MOZ_COPY_PDBS
249 cp -RL $(DIST)/bin/jsapi-tests.pdb $(PKG_STAGE)/cppunittest
250 endif
252 TEST_EXTENSIONS := \
253 specialpowers@mozilla.org.xpi \
254 $(NULL)
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;)
261 .PHONY: \
262 reftest \
263 crashtest \
264 xpcshell-tests \
265 jstestbrowser \
266 package-tests \
267 download-wpt-manifest \
268 package-tests-prepare-dest \
269 package-tests-common \
270 make-stage-dir \
271 stage-all \
272 stage-config \
273 stage-mochitest \
274 stage-jstests \
275 stage-android \
276 test-packages-manifest \
277 check \
278 $(NULL)