* Makefile (MCS) [PROFILE=default]: Force testing of 'mcs'.
[mono.git] / mcs / tests / Makefile
1 #
2 # use `run-test-local'
3 #
4 thisdir = tests
5 SUBDIRS = 
6 include ../build/rules.make
7
8 DISTFILES = README.tests $(wildcard *.cs)
9
10 ifeq (default, $(PROFILE))
11 # force this, we don't case if CSC is broken. This also
12 # means we can use --options, yay.
13
14 MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
15 endif
16
17 # We don't want debugging info :-)
18
19 USE_MCS_FLAGS :=
20
21 #
22 # If you add any tests here, please do also add them to README.Tests !
23 #
24
25 TEST_SOURCES_all = \
26         test-1   test-2   test-3   test-4   test-5   test-6   test-7   test-8   test-9   test-10  \
27         test-11  test-12  test-13  test-14  test-15  test-16  test-17  test-18  test-19  test-20  \
28         test-21  test-22  test-23  test-24  test-25  test-26  test-27  test-28  test-29  test-30  \
29         test-31  test-32  test-33  test-34  test-35  test-36  test-37  test-38  test-39  test-40  \
30         test-41  test-42  test-43  test-44  test-45  test-46  test-47  test-48  test-49           \
31         test-51  test-52  test-53  test-54  test-55  test-56  test-57           test-59  test-60  \
32         test-61  test-62  test-63  test-64  test-65  test-66           test-68  test-69  test-70  \
33         test-71  test-72  test-73  test-74  test-75  test-76  test-77  test-78  test-79  test-80  \
34         test-81  test-82  test-83  test-84  test-85  test-86  test-87  test-88  test-89  test-90  \
35         test-91  test-92  test-93  test-94  test-95  test-96  test-97  test-98  test-99  test-100 \
36         test-101 test-102 test-103 test-104          test-106 test-107 test-108 test-109 test-110 \
37         test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119          \
38         test-121 test-122 test-123          test-125 test-126 test-127 test-128 test-129 test-130 \
39         test-131                   test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
40         test-141 test-142 test-143 test-144 test-145 test-146 test-147 test-148 test-149 test-150 \
41         test-151 test-152 test-153 test-154 test-155 test-156 test-157 test-158 test-159 test-160 \
42         test-161 test-162 test-163 test-164 test-165 test-166 test-167 test-168 test-169 test-170 \
43                  test-172 test-173 test-174 test-175 test-176 test-177 test-178 test-179 test-180 \
44         test-181 test-182 test-183 test-184 test-185 test-186 test-187 test-188 test-189 test-190 \
45         test-191 test-192 test-193 test-194 test-195 test-196 test-197 test-198 test-199 test-200 \
46         test-201 test-202 test-203 test-204 test-205 test-206 test-207 test-208 test-209 test-210 \
47         test-211 test-212 test-213 test-214 test-215 test-216 test-217 test-218 test-219 test-220 \
48         test-221 test-222 test-223 test-224 test-225 test-226 test-227          test-229 test-230 \
49         test-231 test-232 test-233 test-234 test-235 test-236 test-237 test-238 test-239 test-240 \
50         test-241 test-242 test-243 test-244 test-245 test-246 test-247 test-248 test-249 test-250 \
51         test-251 test-252 test-253 test-254 test-255 test-256 test-257 test-258 test-259 test-260 \
52         test-261 test-262 test-263 test-264 test-265 test-266 test-267 test-268 test-269 test-270 \
53         test-271 test-272 test-273 test-274 test-275 test-276 test-277 test-278 test-279 test-280 \
54         test-281 test-282 test-283 test-284 test-285 test-286 test-287 test-288 test-289 test-290 \
55         test-291 test-292 test-293 \
56         cls-test-0 cls-test-1 cls-test-2 cls-test-3 cls-test-5 cls-test-6 cls-test-7 cls-test-10  \
57         cls-test-11 cls-test-14 cls-test-15 cls-test-16 \
58         mtest-1-dll mtest-1-exe \
59         dll-1 prog-1 \
60         dll-2 prog-2 \
61         conv-lib conv-main \
62         vararg-lib vararg-exe \
63         module-1 module-2 module-3 \
64         ns0 ns
65
66 net_2_0_KNOWN_FAILURES = test-55 test-290 test-292
67
68 TEST_SOURCES = $(filter-out $($(PROFILE)_KNOWN_FAILURES), $(TEST_SOURCES_all))
69
70 GENERIC_SOURCES = \
71         gen-1   gen-2   gen-3   gen-4   gen-5   gen-6   gen-7   gen-8   gen-9   gen-10 \
72         gen-11  gen-12          gen-14  gen-15  gen-16          gen-18  gen-19  gen-20 \
73         gen-21  gen-22  gen-23  gen-24  gen-25  gen-26  gen-27  gen-28  gen-29  gen-30 \
74                 gen-32  gen-33  gen-34  gen-35  gen-36  gen-37  gen-38  gen-39  gen-40 \
75         gen-41  gen-42  gen-43  gen-44  gen-45  gen-46          gen-48  gen-49  gen-50 \
76         gen-51  gen-52  gen-53  gen-54  gen-55  gen-56          gen-58  gen-59  gen-60 \
77                 gen-62  gen-63  gen-64  gen-65  gen-66  gen-67  gen-68  gen-69  gen-70 \
78         gen-71  gen-72  gen-73  gen-74  gen-75  gen-76
79
80 GENERIC_MULTI_SOURCES = \
81         gen-13  gen-17  gen-47
82
83 #
84 # C# 2.0 tests 
85 #
86 TEST2_SOURCES = \
87         2test-1 2test-2 2test-3 2test-4 2test-5 2test-6 2test-7 2test-8 2test-9 2test-10 \
88         2test-11 2test-12 2test-13 2test-14
89
90 UNSAFE_SOURCES = \
91         unsafe-1 unsafe-2 unsafe-3 test-58 test-171 unsafe-5 unsafe-6 unsafe-7 unsafe-8 unsafe-9 unsafe-10
92
93 WINDOWS_SOURCES = \
94         test-50 test-67
95
96 # A test is a 'no pass' if it fails on either windows or linux
97 # Test 120 does not pass because the MS.NET runtime is buggy.
98
99 TEST_NOPASS = \
100         test-28  test-45  test-53  test-91  test-102 test-106 test-107 test-120 test-122 test-132 test-133 test-66 test-177
101
102 all-local install-local uninstall-local:
103
104 # casts
105
106 bootstrap-cast.exe: gen-cast-test.cs
107         $(BOOT_COMPILE) -target:exe /out:$@ $<
108
109 casts.cs: bootstrap-cast.exe
110         $(RUNTIME) $< >$@
111
112 casts-mcs.exe: casts.cs
113         $(CSCOMPILE) -target:exe /out:$@ $<
114
115 casts-boot.exe: casts.cs
116         $(BOOT_COMPILE) -target:exe /out:$@ $<
117
118 boot-casts.out: casts-boot.exe
119         $(RUNTIME) $< >$@
120
121 mcs-casts.out: casts-mcs.exe
122         $(RUNTIME) $< >$@
123
124 test-casts: boot-casts.out mcs-casts.out
125         cmp $^
126
127 # compilation is part of the testing too, so we don't actually 
128 # do anything in test-local.
129
130 test-local: 
131
132 run-test-local: test-compiler-jit test-unsafe-compiler-jit test-casts test-2
133
134 ifeq (net_2_0, $(PROFILE))
135 run-test-local: test-generic-3 test-generic-4
136 endif
137
138 clean-local:
139         rm -f *.exe *.netmodule *.out *.pdb casts.cs
140
141 dist-local: dist-default
142         rm -f $(distdir)/casts.cs
143
144 test-compiler-jit: multi test-compiler-jit-real
145
146 TEST_TAG = $(PROFILE)
147
148 test-compiler-jit-real:
149         @rm -f *.exe *.dll *.netmodule $(TEST_TAG).log $(TEST_TAG)-*.log ; \
150         logfile="$(TEST_TAG).log" ; \
151         echo 'Running $(TEST_TAG) tests with flags "$(TEST_RUNTIME)" ... ' ; \
152         for i in $(TEST_SOURCES) ; do \
153             options=`sed -n 's,^// Compiler options:,,p' $$i.cs`; \
154             testlogfile="$(TEST_TAG)-$$i.log" ; \
155             echo -n "$$i: "; \
156             echo "*** $(CSCOMPILE) $$options $$i.cs" > $$testlogfile ; \
157             if $(CSCOMPILE) $$options $$i.cs >> $$testlogfile 2>&1 ; then \
158                 if test -f $$i.exe; then \
159                     echo "*** $(TEST_RUNTIME) ./$$i.exe" >> $$testlogfile ; \
160                     if $(TEST_RUNTIME) ./$$i.exe >> $$testlogfile 2>&1 ; then \
161                         echo "PASS: $$i" >> $$logfile ; \
162                         echo OK ; rm -f $$testlogfile ; \
163                     else \
164                         echo "Exit code: $$?" >> $$testlogfile ; \
165                         failed="$$failed $$i" ; \
166                         echo "FAIL: $$i" >> $$logfile ; \
167                         echo FAILED ; cat $$testlogfile ; \
168                     fi ; \
169                 else \
170                     echo "PASS: $$i: compilation" >> $$logfile ; \
171                     echo OK ; rm -f $$testlogfile ; \
172                 fi ; \
173             else \
174                 echo "Exit code: $$?" >> $$testlogfile ; \
175                 failed="$$failed $$i" ; \
176                 echo "FAIL: $$i: compilation" >> $$logfile ; \
177                 echo FAILED COMPILATION ; cat $$testlogfile ; \
178             fi ; \
179         done ; \
180         if test -z "$$failed"; then :; else echo "Failing tests: $$failed"; exit 1; fi
181
182 #
183 # Tests the 2.0 features
184 #
185 test-2:
186         make CSCOMPILE="$(CSCOMPILE) /langversion:default" test-compiler-jit-real TEST_SOURCES="$(TEST2_SOURCES)" TEST_TAG=$(PROFILE)-v2
187
188 test-unsafe-compiler-jit:
189         make CSCOMPILE="$(CSCOMPILE) /unsafe" test-compiler-jit-real TEST_SOURCES="$(UNSAFE_SOURCES)" TEST_TAG=$(PROFILE)-unsafe
190
191 test-generic-3:
192         make test-compiler-jit-real TEST_SOURCES="$(GENERIC_SOURCES)" TEST_TAG=$(PROFILE)-v3
193
194 test-generic-4:
195         make test-compiler-jit-real TEST_SOURCES="$(GENERIC_MULTI_SOURCES:=-dll) $(GENERIC_MULTI_SOURCES:=-exe)" TEST_TAG=$(PROFILE)-v4
196
197 #
198 # Tests that require separate compilation
199 #
200 multi: multi-2 ilasm
201         echo Multi-assembly test passes
202
203 #
204 # Tests that the order for internal/public in external 
205 # assemblies does not affect the outcome of a build.
206 # also checks that multiple `entry points' can be declared
207 # in a library. (eg, that it is not confused by two Main methods)
208 #
209 multi-2:
210         $(CSCOMPILE) -target:library pi.cs
211         $(CSCOMPILE) -target:library pp.cs
212         $(CSCOMPILE) pu.cs -r:pi.dll -r:pp.dll
213         $(CSCOMPILE) pu.cs -r:pp.dll -r:pi.dll
214
215 ilasm:
216         $(INTERNAL_ILASM) /dll property-il.il
217         $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
218         $(TEST_RUNTIME) property-main.exe