3 # Rules for building unit tests.
5 # Includers of this file must define the following values:
14 TEST_COMPILE
= $(CSCOMPILE
)
17 TEST_RUNTIME_WRAPPERS_PATH
= $(shell dirname
$(RUNTIME
))/_tmpinst
/bin
21 test_nunit_lib
= nunit.framework.dll nunit.core.dll nunit.util.dll nunit.mocks.dll
22 test_nunit_dep
= $(test_nunit_lib
:%=$(topdir
)/class
/lib
/$(PROFILE
)/%)
23 test_nunit_ref
= $(test_nunit_dep
:%=-r
:%)
24 tests_CLEAN_FILES
+= TestResult
*.xml
26 test_lib
= $(ASSEMBLY
:$(ASSEMBLY_EXT
)=_test_
$(PROFILE
).dll
)
27 test_sourcefile
= $(ASSEMBLY
:$(ASSEMBLY_EXT
)=_test.dll.sources
)
28 test_pdb
= $(test_lib
:.dll
=.pdb
)
29 test_response
= $(depsdir
)/$(test_lib
).response
30 test_makefrag
= $(depsdir
)/$(test_lib
).makefrag
31 test_flags
= -r
:$(the_assembly
) $(test_nunit_ref
) $(TEST_MCS_FLAGS
)
32 tests_CLEAN_FILES
+= $(ASSEMBLY
:$(ASSEMBLY_EXT
)=_test
*.dll
) $(ASSEMBLY
:$(ASSEMBLY_EXT
)=_test
*.pdb
) $(test_response
) $(test_makefrag
)
35 HAVE_CS_TESTS
:= $(wildcard $(test_sourcefile
))
41 $(test_nunit_dep
): $(topdir
)/build
/deps
/nunit-
$(PROFILE
).stamp
42 @if
test -f
$@
; then
:; else rm -f
$<; $(MAKE
) $<; fi
43 $(topdir
)/build
/deps
/nunit-
$(PROFILE
).stamp
:
44 cd
${topdir}/nunit24
&& $(MAKE
)
46 tests_CLEAN_FILES
+= $(topdir
)/build
/deps
/nunit-
$(PROFILE
).stamp
52 test_assemblies
+= $(test_lib
)
57 test-local
: $(test_assemblies
)
58 run-test-local
: run-test-lib
59 run-test-ondotnet-local
: run-test-ondotnet-lib
61 TEST_HARNESS_EXCLUDES
= -exclude
=$(PLATFORM_TEST_HARNESS_EXCLUDES
)NotWorking
,ValueAdd
,CAS
,InetAccess
62 TEST_HARNESS_EXCLUDES_ONDOTNET
= /exclude
:$(PLATFORM_TEST_HARNESS_EXCLUDES
)NotDotNet
,CAS
64 ifdef TEST_HARNESS_VERBOSE
65 TEST_HARNESS_OUTPUT
= -labels
66 TEST_HARNESS_OUTPUT_ONDOTNET
= -labels
67 TEST_HARNESS_POSTPROC
= :
68 TEST_HARNESS_POSTPROC_ONDOTNET
= :
70 TEST_HARNESS_OUTPUT
= -output
=TestResult-
$(PROFILE
).log
71 TEST_HARNESS_OUTPUT_ONDOTNET
= -output
=TestResult-ondotnet-
$(PROFILE
).log
72 TEST_HARNESS_POSTPROC
= (echo
''; cat TestResult-
$(PROFILE
).log
) | sed
'1,/^Tests run: /d'; xsltproc
$(topdir
)/build
/nunit-summary.xsl TestResult-
$(PROFILE
).xml
>> TestResult-
$(PROFILE
).log
73 TEST_HARNESS_POSTPROC_ONDOTNET
= (echo
''; cat TestResult-ondotnet-
$(PROFILE
).log
) | sed
'1,/^Tests run: /d'; xsltproc
$(topdir
)/build
/nunit-summary.xsl TestResult-ondotnet-
$(PROFILE
).xml
>> TestResult-ondotnet-
$(PROFILE
).log
77 FIXTURE_ARG
= -fixture
=MonoTests.
$(FIXTURE
)
81 TESTNAME_ARG
= -run
=MonoTests.
$(TESTNAME
)
84 ## FIXME: i18n problem in the 'sed' command below
85 run-test-lib
: test-local
87 PATH
="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH
="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS
="yes" $(TEST_RUNTIME
) $(RUNTIME_FLAGS
) $(TEST_HARNESS
) $(test_assemblies
) -noshadow
$(TEST_HARNESS_FLAGS
) $(LOCAL_TEST_HARNESS_FLAGS
) $(TEST_HARNESS_EXCLUDES
) $(TEST_HARNESS_OUTPUT
) -xml
=TestResult-
$(PROFILE
).xml
$(FIXTURE_ARG
) $(TESTNAME_ARG
)|| ok
=false
; \
88 $(TEST_HARNESS_POSTPROC
) ; $$ok
90 ## Instructs compiler to compile to target .net execution, it can be usefull in rare cases when runtime detection is not possible
91 run-test-ondotnet-lib
: LOCAL_TEST_COMPILER_ONDOTNET_FLAGS
:=-d
:RUN_ONDOTNET
92 run-test-ondotnet-lib
: test-local
94 $(TEST_HARNESS
) $(test_assemblies
) -noshadow
$(TEST_HARNESS_FLAGS
) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS
) $(TEST_HARNESS_EXCLUDES_ONDOTNET
) $(TEST_HARNESS_OUTPUT_ONDOTNET
) -xml
=TestResult-ondotnet-
$(PROFILE
).xml
$(FIXTURE_ARG
) $(TESTNAME_ARG
) || ok
=false
; \
95 $(TEST_HARNESS_POSTPROC_ONDOTNET
) ; $$ok
98 endif # test_assemblies
103 TEST_FILES
+= `sed -e '/^$$/d' -e 's,^../,,' -et -e 's,^,Test/,' $(test_sourcefile)`
108 $(test_lib
): $(the_assembly
) $(test_response
) $(test_nunit_dep
)
109 $(TEST_COMPILE
) -target
:library
-out
:$@
$(test_flags
) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS
) @
$(test_response
)
111 $(test_response
): $(test_sourcefile
)
112 # @echo Creating $@ ...
113 @sed
-e
'/^$$/d' -e
's,^,Test/,' $(test_sourcefile
) |
$(PLATFORM_CHANGE_SEPARATOR_CMD
) >$@
115 $(test_makefrag
): $(test_response
)
116 # @echo Creating $@ ...
117 @sed
's,^,$(test_lib): ,' $< >$@
119 -include $(test_makefrag
)