2005-06-03 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / tests / Makefile
1 #
2 # use `run-test-local'
3 #
4 # *** make sure you add multi-file tests to TEST_ORDERING if necessary
5
6 thisdir = tests
7 SUBDIRS =
8 include ../build/rules.make
9
10 DISTFILES = README.tests harness.mk $(wildcard *.cs) $(wildcard *.il) $(wildcard *.xml) $(wildcard *.inc) \
11         test-353-2.cs test-361-2.cs
12
13 with_mono_path = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
14
15 ifeq (default, $(PROFILE))
16 # force this, we don't case if CSC is broken. This also
17 # means we can use --options, yay.
18 MCS = $(with_mono_path) $(INTERNAL_MCS)
19 endif
20 ilasm = $(topdir)/class/lib/net_1_1_bootstrap/ilasm.exe
21 ILASM = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(ilasm)
22
23 ifeq (net_2_0, $(PROFILE))
24 BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_2_0_bootstrap/mcs.exe
25 endif
26
27 # We don't want debugging info :-)
28
29 USE_MCS_FLAGS :=
30
31 # All new tests for 'mcs' go in here
32 # These tests are not run by GMCS since the corresponding code is not yet in there.-
33 # Martin Baulig will manually move them into TEST_SOURCES_common after merging the code into GMCS.
34 # He may also move some to TEST_EXCLUDE_net_2_0 if some of the merges are inappropriate for GMCS.
35 #
36 NEW_TEST_SOURCES_common = test-386 test-387
37
38 #
39 # Please do _not_ add any tests here - all new tests should go into NEW_TEST_SOURCES_common
40 # Martin Baulig is the only one who may add tests here - after merging the latest MCS patches
41 # into GMCS
42 #
43
44 TEST_SOURCES_common = \
45         test-1   test-2   test-3   test-4   test-5   test-6   test-7   test-8   test-9   test-10  \
46         test-11  test-12  test-13  test-14  test-15  test-16  test-17  test-18  test-19  test-20  \
47         test-21  test-22  test-23  test-24  test-25  test-26  test-27  test-28  test-29  test-30  \
48         test-31  test-32  test-33  test-34  test-35  test-36  test-37  test-38  test-39  test-40  \
49         test-41  test-42  test-43  test-44  test-45  test-46  test-47  test-48  test-49  test-50  \
50         test-51  test-52  test-53  test-54  test-55  test-56  test-57  test-58  test-59  test-60  \
51         test-61  test-62  test-63  test-64  test-65  test-66           test-68  test-69  test-70  \
52         test-71  test-72  test-73  test-74  test-75  test-76  test-77  test-78  test-79  test-80  \
53         test-81  test-82  test-83  test-84  test-85  test-86  test-87  test-88  test-89  test-90  \
54         test-91  test-92  test-93  test-94  test-95  test-96  test-97  test-98  test-99  test-100 \
55         test-101 test-102 test-103 test-104          test-106 test-107 test-108 test-109 test-110 \
56         test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119 test-120 \
57         test-121 test-122 test-123          test-125 test-126 test-127 test-128 test-129 test-130 \
58         test-131 test-132 test-133 test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
59         test-141 test-142 test-143 test-144 test-145 test-146 test-147 test-148 test-149 test-150 \
60         test-151 test-152 test-153 test-154 test-155 test-156 test-157 test-158 test-159 test-160 \
61         test-161 test-162 test-163 test-164 test-165 test-166 test-167 test-168 test-169 test-170 \
62         test-171 test-172 test-173 test-174 test-175 test-176 test-177 test-178 test-179 test-180 \
63         test-181 test-182 test-183 test-184 test-185 test-186 test-187 test-188 test-189 test-190 \
64         test-191 test-192 test-193 test-194 test-195 test-196 test-197 test-198 test-199 test-200 \
65         test-201 test-202 test-203 test-204 test-205 test-206 test-207 test-208 test-209 test-210 \
66         test-211 test-212 test-213 test-214 test-215 test-216 test-217 test-218 test-219 test-220 \
67         test-221 test-222 test-223 test-224 test-225 test-226 test-227          test-229 test-230 \
68         test-231 test-232 test-233 test-234 test-235 test-236 test-237 test-238 test-239 test-240 \
69         test-241 test-242 test-243 test-244 test-245 test-246 test-247 test-248 test-249 test-250 \
70         test-251 test-252 test-253 test-254 test-255 test-256 test-257 test-258 test-259 test-260 \
71         test-261 test-262 test-263 test-264 test-265 test-266 test-267 test-268 test-269 test-270 \
72         test-271 test-272 test-273 test-274 test-275 test-276 test-277 test-278 test-279 test-280 \
73         test-281 test-282 test-283 test-284 test-285 test-286 test-287 test-288 test-289 test-290 \
74         test-291 test-292 test-293 test-294 test-295 test-296 test-297 test-298 test-299 test-300 \
75         test-301 test-302 test-303 test-304 test-305 test-306 test-307          test-309 test-310 \
76         test-311 test-312 test-313 test-314 test-315 test-316 test-317 test-318          test-320 \
77         test-321          test-323 test-324 test-325 test-326 test-327 test-328 test-329 test-330 \
78         test-331 test-332 test-333 test-334 test-335 test-336 test-337 test-338 test-339 test-340 \
79         test-341 test-342 test-343 test-344 test-345 test-346 test-347 test-348 test-349 test-350 \
80         test-351 test-352 test-353 test-354 test-355 test-356 test-357 test-358 test-359 test-360 \
81         test-361 test-362 test-363 test-364 test-365 test-366 test-367 test-368 test-369 test-370 \
82         test-371 test-372 test-373 test-374 test-375 test-376 test-377 test-378 test-379 test-380 \
83         test-381 test-382 test-383 test-384 test-385                                              \
84         cls-test-0 cls-test-1 cls-test-2 cls-test-3 cls-test-5 cls-test-6 cls-test-7 cls-test-10  \
85         cls-test-11 cls-test-12 cls-test-14 cls-test-15 cls-test-16 \
86         2test-1  2test-2  2test-3  2test-4  2test-5  2test-6  2test-7  2test-8  2test-9  2test-10 \
87         2test-11 2test-12 2test-13 2test-14          2test-16 2test-17 2test-18 \
88         unsafe-1 unsafe-2 unsafe-3 unsafe-5 unsafe-6 unsafe-7 unsafe-8 unsafe-9 unsafe-10 \
89         mtest-1-dll mtest-1-exe \
90         mtest-2-dll mtest-2-exe \
91         mtest-3-dll mtest-3-exe \
92         mtest-4-dll mtest-4-exe \
93         mtest-5-dll mtest-5-exe \
94         mtest-6-dll mtest-6-exe \
95         mtest-7-dll mtest-7-exe \
96         mtest-8-dll mtest-8-exe \
97         test-319-dll test-319-exe \
98         covariance-1 covariance-2 covariance-3 \
99         conv-dll conv-exe \
100         vararg-dll vararg-exe \
101         module-1 module-2 module-3 \
102         pi pp pu-ip pu-pi \
103         a-call          a-capture5    a-instance        a-parameter2                    \
104         a-capture10     a-capture6    a-nested-anon2    a-parameter4                    \
105         a-capture1      a-capture7    a-nested-anon3    a-parameter5                    \
106         a-capture2      a-capture8    a-nested-anon4                                    \
107         a-capture3      a-capture9    a-nested-anon     a-simple2                       \
108         a-capture4      a-event       a-nested          a-simple                        \
109         a-foreach                                                                       \
110         acc-modifiers   acc-modifiers2                                                  \
111         $(TEST_SOURCES_XML)                                                             \
112         $(NEW_TEST_SOURCES_common)
113
114 TEST_EXCLUDES_common = test-50 test-120 a-parameter4
115
116 TEST_SOURCES_net_2_0 = \
117         gen-13-dll gen-13-exe gen-17-dll gen-17-exe gen-31-dll gen-31-exe               \
118         gen-47-dll gen-47-exe gen-98-dll gen-98-exe                                     \
119         gen-156-dll gen-156-exe                                                         \
120         gen-1   gen-2   gen-3   gen-4   gen-5   gen-6   gen-7   gen-8   gen-9   gen-10  \
121         gen-11  gen-12          gen-14  gen-15  gen-16          gen-18  gen-19  gen-20  \
122         gen-21  gen-22  gen-23  gen-24  gen-25  gen-26  gen-27  gen-28  gen-29  gen-30  \
123                 gen-32  gen-33  gen-34  gen-35  gen-36  gen-37  gen-38  gen-39  gen-40  \
124         gen-41  gen-42  gen-43  gen-44  gen-45  gen-46          gen-48  gen-49  gen-50  \
125         gen-51  gen-52  gen-53  gen-54  gen-55  gen-56          gen-58  gen-59  gen-60  \
126         gen-61  gen-62  gen-63  gen-64          gen-66  gen-67  gen-68  gen-69  gen-70  \
127         gen-71  gen-72  gen-73  gen-74  gen-75  gen-76  gen-77  gen-78  gen-79  gen-80  \
128         gen-81  gen-82  gen-83  gen-84  gen-85  gen-86  gen-87  gen-88  gen-89  gen-90  \
129         gen-91  gen-92  gen-93  gen-94  gen-95  gen-96  gen-97                  gen-100 \
130         gen-101 gen-102 gen-103 gen-104 gen-105 gen-106 gen-107 gen-108 gen-109 gen-110 \
131         gen-111 gen-112 gen-113 gen-114 gen-115 gen-116 gen-117 gen-118 gen-119 gen-120 \
132         gen-121 gen-122 gen-123 gen-124 gen-125         gen-127 gen-128 gen-129 gen-130 \
133         gen-131 gen-132 gen-133 gen-134 gen-135 gen-136 gen-137 gen-138 gen-139 gen-140 \
134         gen-141 gen-142 gen-143 gen-144 gen-145 gen-146 gen-147 gen-148 gen-149 gen-150 \
135         gen-151 gen-152 gen-153 gen-154 gen-155         gen-157 gen-158                 \
136         cond-attr fixed-buffer-dll fixed-buffer-exe
137
138 TEST_EXCLUDES_net_2_0 = $(NEW_TEST_SOURCES_common)
139
140 # These tests load User32.dll and/or Kernel32.dll
141 TEST_SOURCES_win32 = test-67
142
143 # This test fails on Win32 (even with CSC).  This is #71200.
144 TEST_EXCLUDES_win32 = test-74
145
146 TEST_SOURCES = $(filter-out $(TEST_EXCLUDES_common) $(TEST_EXCLUDES_$(PROFILE)) $(TEST_EXCLUDES_$(PLATFORM)), \
147         $(TEST_SOURCES_common) $(TEST_SOURCES_$(PROFILE)) $(TEST_SOURCES_$(PLATFORM)))
148
149 # The test harness supports running the testcases in parallel.  However, we still need to
150 # provide test-ordering rules to support multi-file testcases.  By default, any test named
151 # 'foo-exe' requires that a test named 'foo-dll' be present, and they're run in the order: foo-dll, foo-exe
152 # Additional test-orderings can be listed below.  Note that x:y says that 'x' should be run _after_ y
153 TEST_ORDERING = \
154         module-2:module-1 \
155         module-3:module-2 \
156         pu-pi:pi pu-pi:pp \
157         pu-ip:pi pu-ip:pp
158
159 # Some tests may require additional files to be available in the current directory.
160 # To promote interoperability, we prefer that those files not be referred to with ../ or ..\\
161 # To that end, we will copy those files to the test-harness directory, so that we can refer to simple filenames.
162 TEST_HARNESS_EXTRAS = $(wildcard *.inc) test-74.cs test-353-2.cs test-361-2.cs test-377-$(PROFILE)-il.dll
163
164 all-local install-local uninstall-local:
165
166 # casts
167
168 bootstrap-cast.exe: gen-cast-test.cs
169         $(BOOT_COMPILE) -target:exe /out:$@ $<
170
171 casts.cs: bootstrap-cast.exe
172         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
173
174 casts-mcs.exe: casts.cs
175         $(CSCOMPILE) -target:exe /out:$@ $<
176
177 casts-boot.exe: casts.cs
178         $(BOOT_COMPILE) -target:exe /out:$@ $<
179
180 boot-casts.out: casts-boot.exe
181         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
182
183 mcs-casts.out: casts-mcs.exe
184         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
185
186 test-casts: boot-casts.out mcs-casts.out
187         cmp $^
188
189 test-local: xmldocdiff.exe casts-boot.exe
190
191 run-test-local: ilasm test-harness test-casts
192
193 # do nothing for this target
194 run-test-ondotnet-local:
195
196 test-everything:
197         $(MAKE) PROFILE=default run-test
198         $(MAKE) PROFILE=net_2_0 run-test
199
200 test-generics:
201         $(MAKE) PROFILE=net_2_0 run-test
202
203 test-generics-2:
204         $(MAKE) PROFILE=net_2_0 TEST_SOURCES="$(TEST_SOURCES_net_2_0)" test-harness
205
206 clean-local:
207         -rm -fr dir-*
208         -rm -f *.exe *.dll *.netmodule *.out *.pdb casts.cs
209
210 dist-local: dist-default
211         rm -f $(distdir)/casts.cs
212
213 ifeq (net_2_0, $(PROFILE))
214 TEST_TAG = gmcs
215 else
216 TEST_TAG = mcs
217 endif
218
219 .PHONY: test-harness test-harness-run
220 test-harness: xmldocdiff.exe
221         @$(MAKE) -s test-harness-run
222
223 exe_tests := $(filter %-exe, $(TEST_SOURCES))
224
225 test-harness-run: $(TEST_HARNESS_EXTRAS)
226         @-rm -f $(TEST_TAG).log
227         @-rm -fr dir-$(TEST_TAG)
228         @mkdir dir-$(TEST_TAG)
229         @sed 's,@thisdir@,$(thisdir)/dir-$(TEST_TAG),' harness.mk > dir-$(TEST_TAG)/Makefile
230         @test -z '$(exe_tests)' || for i in ''$(exe_tests); do echo $$i | sed 's,\(.*\)-exe$$,\1-exe.res: \1-dll.res,' >> dir-$(TEST_TAG)/Makefile; done
231         @test -z '$(TEST_ORDERING)' || for i in ''$(TEST_ORDERING); do echo $$i.res | sed 's,:,.res: ,' >> dir-$(TEST_TAG)/Makefile; done
232         @test -z '$(TEST_HARNESS_EXTRAS)' || cp -p $(TEST_HARNESS_EXTRAS) dir-$(TEST_TAG)/
233         @echo 'Running $(TEST_TAG) tests with flags "$(TEST_RUNTIME)" ... '
234         @if test -z '$(TEST_SOURCES)'; then :; else \
235           cd dir-$(TEST_TAG) ; \
236           $(MAKE) -s $(TEST_SOURCES:=.res) || failed="make " ; \
237           for i in ''$(TEST_SOURCES:=.res); do if test -f $$i; then res="$$res $$i"; else failed="$$failed $$i"; fi; done; \
238           test -z '$$res' || cat $$res < /dev/null > ../$(TEST_TAG).log 2>/dev/null ; \
239           failed=$$failed`sed -n 's,^FAIL: ,,p' ../$(TEST_TAG).log` ; \
240           if test -z "$$failed"; then :; else echo "Failing tests: $$failed"; exit 1; fi; fi
241
242 ilasm:
243 ifeq (default, $(PROFILE))
244         $(ILASM) /dll property-il.il
245         $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
246         $(TEST_RUNTIME) property-main.exe
247 endif
248
249 #
250 # Test for /doc option; need to compare result documentation files.
251 #
252
253 TEST_SOURCES_XML = \
254         xml-001 xml-002 xml-003 xml-004 xml-005 xml-006 xml-007 xml-008 xml-009 xml-010 \
255         xml-011 xml-012 xml-013 xml-014 xml-015 xml-016 xml-017 xml-018 xml-019 xml-020 \
256         xml-021         xml-023 xml-024 xml-025 xml-026         xml-029 xml-030 \
257         xml-031 xml-032 xml-033 xml-034 xml-035 xml-036 xml-037 xml-038
258
259 # currently no formalization on 'cref' attribute was found, so there are some
260 # differences between MS.NET and mono.
261 TEST_SOURCES_XML_PENDING = xml-027
262
263 xml-doc-tests := $(filter xml-%, $(TEST_SOURCES))
264
265 xmldocdiff.exe:
266         $(CSCOMPILE) xmldocdiff.cs
267
268 %-il.dll: %-il.il
269         $(ILASM) /dll $<