[merp] Add tests for crashing via POSIX signal (#19977)
[mono-project.git] / mcs / build / tests.make
blob47b7f76320bca3803d81405e3d5e4fcced083071
1 # -*- makefile -*-
3 # Rules for building unit tests.
4 #
5 # Includers of this file must define the following values:
7 # ASSEMBLY
8 # ASSEMBLY_EXT
9 # the_assembly
11 tests_CLEAN_FILES :=
13 ifndef TEST_COMPILE
14 TEST_COMPILE = $(subst $(test_remove),,$(CSCOMPILE))
15 endif
17 TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
19 ## Unit test support
20 ifndef NO_TEST
22 test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
24 test_nunit_lib = nunitlite.dll
25 xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions
26 xunit_deps := netstandard System.Runtime
27 xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs
29 ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES)
30 XTEST_REMOTE_EXECUTOR = $(test_lib_dir)/RemoteExecutorConsoleApp.exe
32 ifeq ($(BUILD_PLATFORM), win32)
33 XTEST_REMOTE_EXECUTOR_ABSPATH = $(shell cygpath -w $(abspath $(XTEST_REMOTE_EXECUTOR)))
34 else
35 XTEST_REMOTE_EXECUTOR_ABSPATH = $(abspath $(XTEST_REMOTE_EXECUTOR))
36 endif
38 xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \
39 $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \
40 $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \
41 $(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs \
42 $(topdir)/../external/corefx/src/Common/src/System/PasteArguments.Unix.cs
44 ifdef MOBILE_PROFILE
45 xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
46 else
47 ifeq ($(PROFILE), xammac_net_4_5)
48 xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
49 else
50 xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs
51 endif
52 endif
54 endif # ($(USE_XTEST_REMOTE_EXECUTOR), YES)
56 xunit_class_deps :=
58 xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core))
59 xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$(xunit_deps))
61 xunit_libs_dep = $(xunit_class_deps:%=$(topdir)/class/lib/$(PROFILE)/%.dll)
62 xunit_libs_ref += $(xunit_libs_dep:%=-r:%)
64 TEST_LIB_REFS_ALL = $(TEST_LIB_REFS) $(DEFAULT_REFERENCES)
66 ifdef TARGET_NET_REFERENCE
67 # System*, mscorlib references come from the TARGET_NET_REFERENCE dir, others from the profile dir
68 TEST_LIB_REFS_MONO = $(call _FILTER_OUT,System,$(call _FILTER_OUT,mscorlib,$(TEST_LIB_REFS_ALL)))
69 TEST_LIB_REFS_SYSTEM = $(filter-out $(TEST_LIB_REFS_MONO),$(TEST_LIB_REFS_ALL))
71 TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(TEST_LIB_REFS_SYSTEM))
72 TEST_LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(TEST_LIB_REFS_MONO))
73 else
74 TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(TEST_LIB_REFS_ALL))
75 endif
77 XTEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(XTEST_LIB_REFS) $(DEFAULT_REFERENCES))
79 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
80 test_nunit_ref = $(test_nunit_dep:%=-r:%)
81 tests_CLEAN_FILES += TestResult*.xml
83 test_sourcefile_base = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
85 ifeq ($(wildcard $(test_sourcefile_base)),)
86 test_sourcefile_base = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
87 endif
89 test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
90 test_lib_output = $(test_lib_dir)/$(test_lib)
92 test_library = $(ASSEMBLY:$(ASSEMBLY_EXT)=)_test$(ASSEMBLY_EXT)
93 test_response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).response
94 test_makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).makefrag
96 test_flags = $(test_nunit_ref) $(TEST_MCS_FLAGS) $(TEST_LIB_MCS_FLAGS)
97 ifndef NO_BUILD
98 test_flags += -r:$(the_assembly)
99 test_assembly_dep = $(the_assembly)
100 endif
102 tests_CLEAN_FILES += $(test_lib_output) $(test_response) $(test_makefrag)
104 xtest_sourcefile_base = $(PROFILE_PLATFORM)_$(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
106 xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll)
107 xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib)
109 xtest_library = $(ASSEMBLY:$(ASSEMBLY_EXT)=)_xtest$(ASSEMBLY_EXT)
110 xtest_response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(xtest_library).response
111 xtest_makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(xtest_library).makefrag
112 xtest_flags = $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe
114 ifndef NO_BUILD
115 xtest_flags += -r:$(the_assembly)
116 xtest_assembly_dep = $(the_assembly)
117 endif
119 ifeq ($(wildcard $(xtest_sourcefile_base)),)
120 xtest_sourcefile_base = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
121 tests_CLEAN_FILES += $(xtest_lib_output) $(xtest_response) $(xtest_makefrag)
122 endif
124 ifndef HAVE_CS_TESTS
125 HAVE_CS_TESTS := $(wildcard $(test_sourcefile_base))
126 endif
128 HAVE_CS_XTESTS := $(wildcard $(xtest_sourcefile_base))
130 endif # !NO_TEST
132 ifndef NO_TEST
133 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
134 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
136 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
137 $(MAKE) -C ${topdir}/tools/nunit-lite
138 echo "stamp" >$@
140 tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
142 endif
144 test_assemblies :=
146 ifdef HAVE_CS_TESTS
147 test_assemblies += $(test_lib_output)
149 ifdef TEST_SPLIT_ASSEMBLIES
150 test_assemblies += $(test_lib_output:.dll=.part1.dll) $(test_lib_output:.dll=.part2.dll) $(test_lib_output:.dll=.part3.dll)
151 endif
153 check: run-test
154 test-local: $(test_assemblies) $(test_lib_dir)/nunit-excludes.txt
155 run-test-local: run-test-lib
156 run-test-ondotnet-local: run-test-ondotnet-lib
158 TEST_HARNESS_EXCLUDES = $(PLATFORM_TEST_HARNESS_EXCLUDES) $(PROFILE_TEST_HARNESS_EXCLUDES) NotWorking CAS
160 ifdef TEST_WITH_INTERPRETER
161 TEST_HARNESS_EXCLUDES += NotWorkingRuntimeInterpreter
162 endif
164 NOSHADOW_FLAG =
166 ifdef FIXTURE
167 FIXTURE_ARG = -test=$(FIXTURE)
168 endif
170 ifdef TESTNAME
171 TESTNAME_ARG = -test=$(TESTNAME)
172 endif
174 ifdef TEST_HARNESS_VERBOSE
175 LABELS_ARG = -labels
176 endif
178 ifdef ALWAYS_AOT_TESTS
179 test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
180 PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) $(test_assemblies)
182 else
183 test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
185 endif # ALWAYS_AOT_TESTS
187 ifdef COVERAGE
188 TEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/coverage_nunit_$(ASSEMBLY).xml
189 endif
191 NUNITLITE_CONFIG_FILE=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe.config
193 $(test_lib_output).nunitlite.config: $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(TEST_NUNITLITE_APP_CONFIG_GLOBAL) $(TEST_NUNITLITE_APP_CONFIG_RUNTIME) $(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL) | $(test_lib_dir)
194 cp -f $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(test_lib_output).nunitlite.config
195 ifdef TEST_NUNITLITE_APP_CONFIG_GLOBAL
196 sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_GLOBAL__/r $(TEST_NUNITLITE_APP_CONFIG_GLOBAL)" $(test_lib_output).nunitlite.config
197 endif
198 ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
199 sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(test_lib_output).nunitlite.config
200 endif
201 ifdef TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL
202 cp -f $(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL) $(test_lib_output).nunitlite.config.$(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL)
203 endif
205 copy-nunitlite-appconfig: $(test_lib_output).nunitlite.config
206 cp -f $(test_lib_output).nunitlite.config $(NUNITLITE_CONFIG_FILE)
208 ifdef PLATFORM_AOT_SUFFIX
210 DEDUP_DUMMY_CS=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.cs
211 DEDUP_DUMMY=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.dll
213 $(DEDUP_DUMMY):
214 echo " // Empty Assembly \n\n" > $(DEDUP_DUMMY_CS)
215 $(CSCOMPILE) -t:library -out:$(DEDUP_DUMMY) $(DEDUP_DUMMY_CS)
216 rm $(DEDUP_DUMMY_CS)
218 MKBUNDLE_TEST_BIN = $(TEST_HARNESS).static
219 MKBUNDLE_EXE = $(topdir)/class/lib/$(PROFILE)/mkbundle.exe
220 # Pattern based on the one in AOT_PROFILE_ASSEMBLIES
221 # It's easier if you read it backwards.
222 # What we do here is get the files in the profile directory that end in "test.dll" or are prefixed with nunit (filter)
223 # and then strip out everything that we expect to live outside the top level (filter-out)
224 TEST_ASSEMBLIES:=$(sort $(patsubst .//%,%,$(filter-out %.exe.static %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll,$(wildcard $(topdir)/class/lib/$(PROFILE)/tests/*)))))
226 $(MKBUNDLE_EXE): $(topdir)/tools/mkbundle/mkbundle.cs
227 $(MAKE) -C $(topdir)/tools/mkbundle
229 mkbundle-all-tests:
230 $(Q_AOT) $(MAKE) -C $(topdir)/class do-test
231 $(Q_AOT) $(MAKE) -C $(topdir)/tools/mkbundle
232 $(Q_AOT) $(MAKE) $(MKBUNDLE_TEST_BIN) # recursive make re-computes variables for TEST_ASSEMBLIES
234 ifdef MKBUNDLE_DEDUP
235 MKBUNDLE_DEDUP_COND := $(DEDUP_DUMMY)
236 DEDUP_ARGS=--aot-dedup $(DEDUP_DUMMY)
237 endif
239 $(MKBUNDLE_TEST_BIN): $(TEST_ASSEMBLIES) $(TEST_HARNESS) $(MKBUNDLE_EXE) $(MKBUNDLE_DEDUP_COND)
240 $(Q_AOT) MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)" PKG_CONFIG_PATH="$(topdir)/../data" $(RUNTIME) $(RUNTIME_FLAGS) $(MKBUNDLE_EXE) -L $(topdir)/class/lib/$(PROFILE) -v --deps $(TEST_HARNESS) $(TEST_ASSEMBLIES) -o $(MKBUNDLE_TEST_BIN) --aot-mode $(AOT_MODE) --aot-runtime $(RUNTIME) --aot-args $(AOT_BUILD_ATTRS) --in-tree $(topdir)/.. --managed-linker $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe --config $(topdir)/../data/config --i18n all $(DEDUP_ARGS) --keeptemp
242 endif # PLATFORM_AOT_SUFFIX
244 ifneq ($(wildcard $(MKBUNDLE_TEST_BIN)),)
245 TEST_HARNESS_EXEC=$(MKBUNDLE_TEST_BIN)
246 TEST_HARNESS_EXCLUDES:=$(TEST_HARNESS_EXCLUDES) StaticLinkedAotNotWorking
247 else
248 TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS)
249 endif
251 $(test_lib_dir)/nunit-excludes.txt: $(topdir)/build/tests.make | $(test_lib_dir)
252 @rm -f $@
253 @$(foreach entry,$(TEST_HARNESS_EXCLUDES),echo "$(entry)" >> $@;)
255 ## FIXME: i18n problem in the 'sed' command below
256 run-test-lib: test-local test-local-aot-compile copy-nunitlite-appconfig
257 ok=:; \
258 PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="$(TEST_RUNTIME_FLAGS)" $(TEST_HARNESS_EXEC) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) -exclude=$(subst $(space),$(comma),$(TEST_HARNESS_EXCLUDES)) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
259 if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='$(notdir $(strip $(test_assemblies))).crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
260 $$ok
262 ## Instructs compiler to compile to target .net execution, it can be usefull in rare cases when runtime detection is not possible
263 run-test-ondotnet-lib: LOCAL_TEST_COMPILER_ONDOTNET_FLAGS:=-d:RUN_ONDOTNET
264 run-test-ondotnet-lib: test-local
265 ok=:; \
266 $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) /exclude:$(subst $(space),$(comma),$(TEST_HARNESS_EXCLUDES) NotDotNet) $(LABELS_ARG) -format:nunit2 -result:TestResult-ondotnet-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG) || ok=false; \
267 $$ok
270 endif
272 TEST_FILES =
274 ifdef HAVE_CS_TESTS
276 TEST_FILES += `sed -e '/^$$/d' -e 's,^../,,' -e '/^\#.*$$/d' -et -e 's,^,Test/,' $(test_sourcefile_base)`
278 $(test_lib_dir):
279 mkdir -p $@
281 $(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_output).nunitlite.config | $(test_lib_dir)
282 $(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
284 ifdef TEST_SPLIT_ASSEMBLIES
285 $(test_lib_output:.dll=.part1.dll): $(test_lib_output) $(test_response).part1
286 $(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part1
288 $(test_lib_output:.dll=.part2.dll): $(test_lib_output) $(test_response).part2
289 $(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part2
291 $(test_lib_output:.dll=.part3.dll): $(test_lib_output) $(test_response).part3
292 ifneq ($(wildcard $(test_response).part3),)
293 $(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part3
294 endif
296 # part3 is optional so we need this empty target to silence make if it doesn't exist
297 $(test_response).part3: ;
299 tests_CLEAN_FILES += $(test_response).part1 $(test_response).part2 $(test_response).part3
300 endif
302 $(test_response): $(test_sourcefile_base) $(wildcard *_test.dll.sources) $(wildcard *_test.dll.exclude.sources) $(topdir)/build/tests.make $(depsdir)/.stamp
303 $(GENSOURCES) --basedir:./Test --strict --platformsdir:$(topdir)/build "$@" "$(test_library)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
305 $(test_makefrag): $(test_response)
306 @echo Creating $@ ...
307 @sed 's,^,$(test_lib_output) $(test_lib_output:.dll=.part1.dll) $(test_lib_output:.dll=.part2.dll) $(test_lib_output:.dll=.part3.dll): ,' $< >$@
309 -include $(test_makefrag)
312 endif
315 ifdef HAVE_CS_XTESTS
317 XTEST_HARNESS_PATH := $(topdir)/../external/xunit-binaries
318 XTEST_HARNESS = $(XTEST_HARNESS_PATH)/xunit.console.exe
319 XTEST_RESULT_FILE := TestResult-$(PROFILE)-xunit.xml
320 XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit $(XTEST_RESULT_FILE)
322 XTEST_NOTRAITS := category=failing category=nonmonotests Benchmark=true
324 ifndef OUTER_LOOP
325 XTEST_NOTRAITS += category=outerloop
326 endif
328 # The logic is double inverted so this actually excludes tests not intented for current platform
329 # best to search for `property name="category"` in the xml output to see what's going on
330 # https://github.com/dotnet/buildtools/blob/master/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs
331 XTEST_NOTRAITS += category=non$(XTEST_PLATFORM)tests
333 TEST_MONO_PATH := $(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(XTEST_HARNESS_PATH)
335 ifdef FIXTURE
336 XTEST_HARNESS_FLAGS += -class $(FIXTURE)
337 endif
339 ifdef TESTNAME
340 XTEST_HARNESS_FLAGS += -method $(TESTNAME)
341 endif
343 ifdef COVERAGE
344 XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/coverage_xunit_$(ASSEMBLY).xml
345 endif
347 xtest_assemblies += $(xtest_lib_output)
349 ifdef XTEST_SPLIT_ASSEMBLIES
350 xtest_assemblies += $(xtest_lib_output:.dll=.part1.dll) $(xtest_lib_output:.dll=.part2.dll) $(xtest_lib_output:.dll=.part3.dll)
351 endif
354 check: run-xunit-test-local
355 xunit-test-local: $(xtest_assemblies) $(test_lib_dir)/xunit-excludes.txt $(test_lib_dir)/Xunit.NetCore.Extensions.dll $(test_lib_dir)/xunit.execution.dotnet.dll
356 run-xunit-test-local: run-xunit-test-lib
358 $(test_lib_dir)/xunit-excludes.txt: $(topdir)/build/tests.make | $(test_lib_dir)
359 @rm -f $@
360 $(foreach entry,$(XTEST_NOTRAITS),echo "$(entry)" >> $@;)
362 $(test_lib_dir)/Xunit.NetCore.Extensions.dll: $(topdir)/build/tests.make $(topdir)/../external/xunit-binaries/Xunit.NetCore.Extensions.dll | $(test_lib_dir)
363 @cp -f $(topdir)/../external/xunit-binaries/Xunit.NetCore.Extensions.dll $@
365 $(test_lib_dir)/xunit.execution.dotnet.dll: $(topdir)/build/tests.make $(topdir)/../external/xunit-binaries/xunit.execution.dotnet.dll | $(test_lib_dir)
366 @cp -f $(topdir)/../external/xunit-binaries/xunit.execution.dotnet.dll $@
368 run-xunit-test-lib: xunit-test-local
369 ok=:; \
370 PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR="$(XTEST_REMOTE_EXECUTOR_ABSPATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xtest_lib_output) $(XTEST_HARNESS_FLAGS) -notrait $(subst $(space), -notrait ,$(XTEST_NOTRAITS)) || ok=false; \
371 if [ -n "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE" ]; then echo "$(abspath $(XTEST_RESULT_FILE))" >> "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE"; fi; \
372 $$ok
374 # Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase)
375 $(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | $(test_lib_dir)
376 $(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@
378 $(xtest_lib_output): $(xtest_assembly_dep) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
379 $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
381 ifdef XTEST_SPLIT_ASSEMBLIES
382 $(xtest_lib_output:.dll=.part1.dll): $(xtest_lib_output) $(xtest_response).part1
383 $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part1 $(xunit_src)
385 $(xtest_lib_output:.dll=.part2.dll): $(xtest_lib_output) $(xtest_response).part2
386 $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part2 $(xunit_src)
388 $(xtest_lib_output:.dll=.part3.dll): $(xtest_lib_output) $(xtest_response).part3
389 ifneq ($(wildcard $(xtest_response).part3),)
390 $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part3 $(xunit_src)
391 endif
393 # part3 is optional so we need this empty target to silence make if it doesn't exist
394 $(xtest_response).part3: ;
396 xtests_CLEAN_FILES += $(xtest_response).part1 $(xtest_response).part2 $(xtest_response).part3
397 endif
399 # This handles .excludes/.sources pairs, as well as resolving the
400 # includes that occur in .sources files. It also handles splitting test assemblies into multiple parts.
401 $(xtest_response): $(xtest_sourcefile_base) $(wildcard *_xtest.dll.sources) $(wildcard *_xtest.dll.exclude.sources) $(topdir)/build/tests.make $(depsdir)/.stamp
402 $(GENSOURCES) --strict --platformsdir:$(topdir)/build "$@" "$(xtest_library)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
404 $(xtest_makefrag): $(xtest_response)
405 @echo Creating $@ ...
406 @sed 's,^,$(xtest_lib_output) $(xtest_lib_output:.dll=.part1.dll) $(xtest_lib_output:.dll=.part2.dll) $(xtest_lib_output:.dll=.part3.dll): ,' $< >$@
408 -include $(xtest_makefrag)
410 endif