2014-08-13 10:39:27 +01:00
# -*- makefile -*-
#
# Rules for building unit tests.
#
# Includers of this file must define the following values:
#
# ASSEMBLY
# ASSEMBLY_EXT
# the_assembly
tests_CLEAN_FILES :=
ifndef TEST_COMPILE
TEST_COMPILE = $(subst $(test_remove),,$(CSCOMPILE))
endif
TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
## Unit test support
ifndef NO_TEST
2016-08-03 10:59:49 +00:00
2018-10-09 08:20:59 +00:00
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
2016-08-03 10:59:49 +00:00
test_nunit_lib = nunitlite.dll
2018-10-09 08:20:59 +00:00
xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions
2018-10-18 08:28:44 +00:00
xunit_deps := System.Runtime
2018-01-24 17:04:36 +00:00
xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs
2018-04-24 09:31:23 +00:00
ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES)
2018-10-09 08:20:59 +00:00
XTEST_REMOTE_EXECUTOR = $(test_lib_dir)/RemoteExecutorConsoleApp.exe
ifeq ($(BUILD_PLATFORM), win32)
XTEST_REMOTE_EXECUTOR_ABSPATH = $(shell cygpath -w $(abspath $(XTEST_REMOTE_EXECUTOR)))
else
XTEST_REMOTE_EXECUTOR_ABSPATH = $(abspath $(XTEST_REMOTE_EXECUTOR))
endif
2018-05-10 08:37:03 +00:00
xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \
2018-08-07 15:19:03 +00:00
$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs \
$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.Unix.cs
2018-06-30 08:22:57 +00:00
ifeq ($(PROFILE),monodroid)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
2019-02-04 20:11:37 +00:00
ifeq ($(PROFILE),monotouch_tv)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
ifeq ($(PROFILE),monotouch_watch)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs
endif
endif
2018-06-30 08:22:57 +00:00
endif
2018-04-24 09:31:23 +00:00
endif
2017-08-21 15:34:15 +00:00
xunit_class_deps :=
2017-06-07 13:16:24 +00:00
xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core))
xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$(xunit_deps))
xunit_libs_dep = $(xunit_class_deps:%=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)%.dll)
xunit_libs_ref += $(xunit_libs_dep:%=-r:%)
2016-08-03 10:59:49 +00:00
2018-05-10 08:37:03 +00:00
TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(TEST_LIB_REFS) $(DEFAULT_REFERENCES))
XTEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(XTEST_LIB_REFS) $(DEFAULT_REFERENCES))
2016-08-03 10:59:49 +00:00
test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)%)
2014-08-13 10:39:27 +01:00
test_nunit_ref = $(test_nunit_dep:%=-r:%)
tests_CLEAN_FILES += TestResult*.xml
2016-08-03 10:59:49 +00:00
test_sourcefile = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
ifeq ($(wildcard $(test_sourcefile)),)
2014-08-13 10:39:27 +01:00
test_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
2016-08-03 10:59:49 +00:00
endif
test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
2018-10-09 08:20:59 +00:00
test_lib_output = $(test_lib_dir)/$(test_lib)
2017-06-07 13:16:24 +00:00
2016-08-03 10:59:49 +00:00
test_sourcefile_excludes = $(test_lib).exclude.sources
2014-08-13 10:39:27 +01:00
test_pdb = $(test_lib:.dll=.pdb)
test_response = $(depsdir)/$(test_lib).response
test_makefrag = $(depsdir)/$(test_lib).makefrag
2018-01-24 17:04:36 +00:00
test_flags = $(test_nunit_ref) $(TEST_MCS_FLAGS) $(TEST_LIB_MCS_FLAGS)
ifndef NO_BUILD
test_flags += -r:$(the_assembly)
2018-04-24 09:31:23 +00:00
test_assembly_dep = $(the_assembly)
2018-01-24 17:04:36 +00:00
endif
2018-10-09 08:20:59 +00:00
tests_CLEAN_FILES += $(test_lib_output) $(test_lib_output:$(ASSEMBLY_EXT)=.pdb) $(test_response) $(test_makefrag)
2014-08-13 10:39:27 +01:00
2019-02-04 20:11:37 +00:00
xtest_sourcefile = $(PROFILE_PLATFORM)_$(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
2018-01-24 17:04:36 +00:00
xtest_sourcefile_excludes = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.exclude.sources)
2017-06-07 13:16:24 +00:00
xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll)
2018-10-09 08:20:59 +00:00
xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib)
2017-06-07 13:16:24 +00:00
2017-08-21 15:34:15 +00:00
xtest_response = $(depsdir)/$(xunit_test_lib).response
xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag
2018-04-24 09:31:23 +00:00
xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe
2017-06-07 13:16:24 +00:00
2017-08-21 15:34:15 +00:00
ifeq ($(wildcard $(xtest_sourcefile)),)
xtest_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
2018-10-09 08:20:59 +00:00
tests_CLEAN_FILES += $(xtest_lib_output) $(xtest_response) $(xtest_makefrag)
2017-08-21 15:34:15 +00:00
endif
2014-08-13 10:39:27 +01:00
ifndef HAVE_CS_TESTS
HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
endif
2017-06-07 13:16:24 +00:00
HAVE_CS_XTESTS := $(wildcard $(xtest_sourcefile))
2016-08-03 10:59:49 +00:00
endif # !NO_TEST
2014-08-13 10:39:27 +01:00
ifndef NO_TEST
$(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
@if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
2016-08-03 10:59:49 +00:00
$(topdir)/build/deps/nunit-$(PROFILE).stamp:
ifndef PARENT_PROFILE
cd ${topdir}/tools/nunit-lite && $(MAKE)
endif
echo "stamp" >$@
2014-08-13 10:39:27 +01:00
tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
2017-06-07 13:16:24 +00:00
2014-08-13 10:39:27 +01:00
endif
test_assemblies :=
ifdef HAVE_CS_TESTS
2018-01-24 17:04:36 +00:00
test_assemblies += $(test_lib_output)
2014-08-13 10:39:27 +01:00
check: run-test
test-local: $(test_assemblies)
run-test-local: run-test-lib
run-test-ondotnet-local: run-test-ondotnet-lib
2018-01-24 17:04:36 +00:00
ifdef TEST_WITH_INTERPRETER
2018-04-24 09:31:23 +00:00
TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,NotWorkingRuntimeInterpreter,CAS
2018-01-24 17:04:36 +00:00
else
2017-10-19 20:04:20 +00:00
TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,CAS
2018-01-24 17:04:36 +00:00
endif
2016-08-03 10:59:49 +00:00
TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
NOSHADOW_FLAG =
2014-08-13 10:39:27 +01:00
ifdef FIXTURE
2016-11-10 13:04:39 +00:00
FIXTURE_ARG = -test=MonoTests.$(FIXTURE)
endif
2014-08-13 10:39:27 +01:00
ifdef TESTNAME
2016-11-10 13:04:39 +00:00
TESTNAME_ARG = -test=MonoTests.$(TESTNAME)
2014-08-13 10:39:27 +01:00
endif
2017-04-10 11:41:01 +00:00
ifdef TEST_HARNESS_VERBOSE
LABELS_ARG = -labels
2016-11-10 13:04:39 +00:00
endif
2014-08-13 10:39:27 +01:00
2016-08-03 10:59:49 +00:00
ifdef ALWAYS_AOT
2018-01-24 17:04:36 +00:00
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
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)
2016-08-03 10:59:49 +00:00
else
2018-01-24 17:04:36 +00:00
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
2016-08-03 10:59:49 +00:00
endif # ALWAYS_AOT
2018-01-24 17:04:36 +00:00
ifdef COVERAGE
TEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/coverage_nunit_$(ASSEMBLY).xml
endif
2017-04-10 11:41:01 +00:00
NUNITLITE_CONFIG_FILE=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe.config
2019-02-04 20:11:37 +00:00
$(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)
cp -f $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(test_lib_output).nunitlite.config
2017-04-10 11:41:01 +00:00
ifdef TEST_NUNITLITE_APP_CONFIG_GLOBAL
2019-02-04 20:11:37 +00:00
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_GLOBAL__/r $(TEST_NUNITLITE_APP_CONFIG_GLOBAL)" $(test_lib_output).nunitlite.config
2017-04-10 11:41:01 +00:00
endif
ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
2019-02-04 20:11:37 +00:00
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(test_lib_output).nunitlite.config
2017-04-10 11:41:01 +00:00
endif
2019-02-04 20:11:37 +00:00
ifdef TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL
cp -f $(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL) $(test_lib_output).nunitlite.config.$(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL)
endif
copy-nunitlite-appconfig: $(test_lib_output).nunitlite.config
cp -f $(test_lib_output).nunitlite.config $(NUNITLITE_CONFIG_FILE)
2017-04-10 11:41:01 +00:00
2018-01-24 17:04:36 +00:00
ifdef PLATFORM_AOT_SUFFIX
DEDUP_DUMMY_CS=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.cs
DEDUP_DUMMY=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.dll
$(DEDUP_DUMMY):
echo " // Empty Assembly \n\n" > $(DEDUP_DUMMY_CS)
$(CSCOMPILE) -t:library -out:$(DEDUP_DUMMY) $(DEDUP_DUMMY_CS)
rm $(DEDUP_DUMMY_CS)
MKBUNDLE_TEST_BIN = $(TEST_HARNESS).static
MKBUNDLE_EXE = $(topdir)/class/lib/$(PROFILE)/mkbundle.exe
# Pattern based on the one in AOT_PROFILE_ASSEMBLIES
# It's easier if you read it backwards.
# What we do here is get the files in the profile directory that end in "test.dll" or are prefixed with nunit (filter)
# and then strip out everything that we expect to live outside the top level (filter-out)
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/*)))))
$(MKBUNDLE_EXE): $(topdir)/tools/mkbundle/mkbundle.cs
make -C $(topdir)/tools/mkbundle
mkbundle-all-tests:
$(Q_AOT) $(MAKE) -C $(topdir)/class do-test
$(Q_AOT) $(MAKE) -C $(topdir)/tools/mkbundle
$(Q_AOT) $(MAKE) $(MKBUNDLE_TEST_BIN) # recursive make re-computes variables for TEST_ASSEMBLIES
ifdef MKBUNDLE_DEDUP
MKBUNDLE_DEDUP_COND := $(DEDUP_DUMMY)
DEDUP_ARGS=--aot-dedup $(DEDUP_DUMMY)
endif
$(MKBUNDLE_TEST_BIN): $(TEST_ASSEMBLIES) $(TEST_HARNESS) $(MKBUNDLE_EXE) $(MKBUNDLE_DEDUP_COND)
$(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
endif # PLATFORM_AOT_SUFFIX
ifneq ($(wildcard $(MKBUNDLE_TEST_BIN)),)
TEST_HARNESS_EXEC=$(MKBUNDLE_TEST_BIN)
TEST_HARNESS_EXCLUDES:=$(TEST_HARNESS_EXCLUDES),StaticLinkedAotNotWorking
else
2018-05-10 08:37:03 +00:00
TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS)
2018-01-24 17:04:36 +00:00
endif
2014-08-13 10:39:27 +01:00
## FIXME: i18n problem in the 'sed' command below
2019-02-04 20:11:37 +00:00
run-test-lib: test-local test-local-aot-compile copy-nunitlite-appconfig
2014-08-13 10:39:27 +01:00
ok=:; \
2018-08-07 15:19:03 +00:00
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) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
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; \
2017-04-10 11:41:01 +00:00
$$ok
2014-08-13 10:39:27 +01:00
## Instructs compiler to compile to target .net execution, it can be usefull in rare cases when runtime detection is not possible
run-test-ondotnet-lib: LOCAL_TEST_COMPILER_ONDOTNET_FLAGS:=-d:RUN_ONDOTNET
run-test-ondotnet-lib: test-local
ok=:; \
2017-04-10 11:41:01 +00:00
$(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) $(TEST_HARNESS_EXCLUDES_ONDOTNET) $(LABELS_ARG) -format:nunit2 -result:TestResult-ondotnet-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG) || ok=false; \
$$ok
2014-08-13 10:39:27 +01:00
2018-01-24 17:04:36 +00:00
endif
2014-08-13 10:39:27 +01:00
TEST_FILES =
ifdef HAVE_CS_TESTS
2018-01-24 17:04:36 +00:00
TEST_FILES += `sed -e '/^$$/d' -e 's,^../,,' -e '/^\#.*$$/d' -et -e 's,^,Test/,' $(test_sourcefile)`
2014-08-13 10:39:27 +01:00
endif
ifdef HAVE_CS_TESTS
2018-01-24 17:04:36 +00:00
$(test_lib_dir):
mkdir -p $@
2019-02-04 20:11:37 +00:00
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_output).nunitlite.config | $(test_lib_dir)
2014-08-13 10:39:27 +01:00
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
2016-08-03 10:59:49 +00:00
test_response_preprocessed = $(test_response)_preprocessed
2018-10-09 08:20:59 +00:00
ifneq "x" "x$(PROFILE_RUNTIME)"
GENSOURCES_RUNTIME=$(PROFILE_RUNTIME)
else
ifneq "x" "x$(TEST_RUNTIME)"
GENSOURCES_RUNTIME=$(TEST_RUNTIME)
else
GENSOURCES_RUNTIME=MONO_PATH="$(GENSOURCES_LIBDIR)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME)
endif
endif
2016-08-03 10:59:49 +00:00
# This handles .excludes/.sources pairs, as well as resolving the
# includes that occur in .sources files
2018-10-09 08:20:59 +00:00
$(test_response_preprocessed): $(test_sourcefile) $(wildcard $(test_sourcefile_excludes)) $(GENSOURCES_CS)
$(GENSOURCES_RUNTIME) --debug $(GENSOURCES_EXE) --basedir:./Test --strict "$@" "$(test_sourcefile)" "$(test_sourcefile_excludes)"
2016-08-03 10:59:49 +00:00
$(test_response): $(test_response_preprocessed)
2014-08-13 10:39:27 +01:00
# @echo Creating $@ ...
2016-08-03 10:59:49 +00:00
@sed -e '/^$$/d' -e 's,^,Test/,' $(test_response_preprocessed) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
2014-08-13 10:39:27 +01:00
$(test_makefrag): $(test_response)
# @echo Creating $@ ...
2018-01-24 17:04:36 +00:00
@sed 's,^,$(test_lib_output): ,' $< >$@
2014-08-13 10:39:27 +01:00
-include $(test_makefrag)
2018-01-24 17:04:36 +00:00
build-test-lib: $(test_lib_output)
2017-06-07 13:16:24 +00:00
@echo Building testing lib
endif
ifdef HAVE_CS_XTESTS
2018-05-10 08:37:03 +00:00
XTEST_HARNESS_PATH := $(topdir)/../external/xunit-binaries
2017-06-07 13:16:24 +00:00
XTEST_HARNESS = $(XTEST_HARNESS_PATH)/xunit.console.exe
2018-10-09 08:20:59 +00:00
XTEST_RESULT_FILE := TestResult-$(PROFILE)-xunit.xml
XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit $(XTEST_RESULT_FILE)
2018-01-24 17:04:36 +00:00
XTEST_TRAIT := -notrait category=failing -notrait category=nonmonotests -notrait Benchmark=true -notrait category=outerloop
2018-08-07 15:19:03 +00:00
# The logic is double inverted so this actually excludes tests not intented for current platform
# best to search for `property name="category"` in the xml output to see what's going on
# https://github.com/dotnet/buildtools/blob/master/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs
XTEST_TRAIT_PLATFORM := -notrait category=non$(XTEST_PLATFORM)tests
2018-05-10 08:37:03 +00:00
TEST_MONO_PATH := $(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(XTEST_HARNESS_PATH)
2017-06-07 13:16:24 +00:00
ifdef FIXTURE
XTEST_HARNESS_FLAGS += -class $(FIXTURE)
2014-08-13 10:39:27 +01:00
endif
2017-06-07 13:16:24 +00:00
ifdef TESTNAME
XTEST_HARNESS_FLAGS += -method $(TESTNAME)
endif
2018-01-24 17:04:36 +00:00
ifdef COVERAGE
XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/coverage_xunit_$(ASSEMBLY).xml
endif
2017-06-07 13:16:24 +00:00
check: run-xunit-test-local
2018-10-09 08:20:59 +00:00
xunit-test-local: $(xtest_lib_output)
2017-06-07 13:16:24 +00:00
run-xunit-test-local: run-xunit-test-lib
2018-10-09 08:20:59 +00:00
# cp -rf is a HACK for xunit runner to require xunit.execution.dOTNET.dll file in local folder on .net only
run-xunit-test-lib: xunit-test-local
@cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.dotnet.dll $(test_lib_dir)/xunit.execution.dotnet.dll
2017-06-07 13:16:24 +00:00
ok=:; \
2018-10-09 08:20:59 +00:00
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) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \
if [ -n "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE" ]; then echo "$(abspath $(XTEST_RESULT_FILE))" >> "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE"; fi; \
2017-06-07 13:16:24 +00:00
$$ok
2018-10-09 08:20:59 +00:00
@rm -f $(test_lib_dir)/xunit.execution.dotnet.dll
2017-06-07 13:16:24 +00:00
2018-04-24 09:31:23 +00:00
# Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase)
2018-10-18 08:28:44 +00:00
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | $(test_lib_dir)
2018-05-10 08:37:03 +00:00
$(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@
2018-04-24 09:31:23 +00:00
2018-10-18 08:28:44 +00:00
$(xtest_lib_output): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
2017-08-21 15:34:15 +00:00
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
2017-06-07 13:16:24 +00:00
xtest_response_preprocessed = $(xtest_response)_preprocessed
# This handles .excludes/.sources pairs, as well as resolving the
# includes that occur in .sources files
2019-02-04 20:11:37 +00:00
$(xtest_response): $(xtest_sourcefile) $(wildcard *xtest.dll.sources) $(wildcard $(xtest_sourcefile_excludes)) $(GENSOURCES_CS)
2018-10-09 08:20:59 +00:00
$(GENSOURCES_RUNTIME) --debug $(GENSOURCES_EXE) --strict "$@" "$(xtest_sourcefile)" "$(xtest_sourcefile_excludes)"
2017-06-07 13:16:24 +00:00
$(xtest_makefrag): $(xtest_response)
@echo Creating $@ ...
2018-10-09 08:20:59 +00:00
@sed 's,^,$(xtest_lib_output): ,' $< >$@
2017-06-07 13:16:24 +00:00
-include $(xtest_makefrag)
endif
2017-04-10 11:41:01 +00:00
.PHONY: patch-nunitlite-appconfig