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