Added test for bug#72494.
[mono.git] / mono / tests / Makefile.am
1 check-local: test
2
3 TEST_PROG = ../interpreter/mint
4 JITTEST_PROG = ../mini/mono
5
6 TEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default MONO_SHARED_DIR=$(mono_build_root)/runtime $(LIBTOOL) --mode=execute $(TEST_PROG)
7 JITTEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default MONO_SHARED_DIR=$(mono_build_root)/runtime $(LIBTOOL) --mode=execute $(JITTEST_PROG)
8
9 RUNTIME_ARGS=--config tests-config --optimize=all
10
11 RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/default $(top_builddir)/runtime/mono-wrapper
12
13 CSC = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe --unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219
14 ILASM = $(RUNTIME) $(mcs_topdir)/ilasm/ilasm.exe
15
16 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
17
18 TEST_CS_SRC=                    \
19         array-init.cs           \
20         arraylist.cs            \
21         checked.cs              \
22         char-isnumber.cs        \
23         create-instance.cs      \
24         field-layout.cs         \
25         pack-layout.cs          \
26         hash-table.cs           \
27         test-ops.cs             \
28         obj.cs                  \
29         string.cs               \
30         stringbuilder.cs        \
31         switch.cs               \
32         outparm.cs              \
33         delegate.cs             \
34         bitconverter.cs         \
35         exception.cs            \
36         exception2.cs           \
37         exception3.cs           \
38         exception4.cs           \
39         exception5.cs           \
40         exception6.cs           \
41         exception7.cs           \
42         exception8.cs           \
43         exception10.cs          \
44         exception11.cs          \
45         exception12.cs          \
46         exception13.cs          \
47         exception14.cs          \
48         exception15.cs          \
49         exception16.cs          \
50         struct.cs               \
51         valuetype-gettype.cs    \
52         typeof-ptr.cs           \
53         static-constructor.cs   \
54         pinvoke.cs              \
55         pinvoke1.cs             \
56         pinvoke2.cs             \
57         pinvoke3.cs             \
58         pinvoke10.cs            \
59         pinvoke11.cs            \
60         pinvoke13.cs            \
61         pinvoke15.cs            \
62         pinvoke17.cs            \
63         pinvoke18.cs            \
64         invoke.cs               \
65         invoke2.cs              \
66         runtime-invoke.cs               \
67         invoke-string-ctors.cs          \
68         reinit.cs               \
69         box.cs                  \
70         array.cs                \
71         enum.cs                 \
72         enum2.cs                \
73         property.cs             \
74         enumcast.cs             \
75         assignable-tests.cs     \
76         array-cast.cs           \
77         cattr-compile.cs        \
78         cattr-field.cs          \
79         cattr-object.cs         \
80         custom-attr.cs          \
81         double-cast.cs          \
82         newobj-valuetype.cs     \
83         arraylist-clone.cs      \
84         setenv.cs               \
85         vtype.cs                \
86         isvaluetype.cs          \
87         iface6.cs               \
88         ipaddress.cs            \
89         array-vt.cs             \
90         interface1.cs           \
91         reflection-enum.cs      \
92         reflection-prop.cs      \
93         reflection4.cs          \
94         reflection5.cs          \
95         reflection-const-field.cs \
96         many-locals.cs          \
97         string-compare.cs       \
98         test-prime.cs           \
99         params.cs               \
100         reflection.cs           \
101         interface.cs            \
102         iface.cs                \
103         iface2.cs               \
104         iface3.cs               \
105         iface4.cs               \
106         virtual-method.cs       \
107         intptrcast.cs           \
108         indexer.cs              \
109         stream.cs               \
110         console.cs              \
111         shift.cs                \
112         jit-int.cs              \
113         jit-uint.cs             \
114         jit-long.cs             \
115         long.cs                 \
116         jit-ulong.cs            \
117         jit-float.cs            \
118         pop.cs                  \
119         time.cs                 \
120         appdomain.cs        \
121         appdomain1.cs           \
122         appdomain2.cs           \
123         appdomain3.cs           \
124         appdomain-client.cs     \
125         appdomain-unload.cs \
126         loader.cs       \
127         pointer.cs              \
128         rounding.cs             \
129         hashcode.cs             \
130         delegate1.cs            \
131         delegate2.cs            \
132         delegate3.cs            \
133         delegate4.cs            \
134         delegate5.cs            \
135         delegate6.cs            \
136         delegate7.cs            \
137         delegate8.cs            \
138         remoting1.cs            \
139         remoting2.cs            \
140         remoting3.cs            \
141         remoting4.cs            \
142         remoting5.cs            \
143         nonvirt.cs              \
144         largeexp.cs             \
145         largeexp2.cs            \
146         marshalbyref1.cs        \
147         static-ctor.cs          \
148         inctest.cs              \
149         bound.cs                \
150         array-invoke.cs         \
151         decimal.cs              \
152         decimal-array.cs        \
153         marshal.cs              \
154         marshal1.cs             \
155         marshal2.cs             \
156         marshal3.cs             \
157         marshal5.cs             \
158         marshal6.cs             \
159         marshal7.cs             \
160         marshal8.cs             \
161         marshal9.cs             \
162         test-byval-in-struct.cs \
163         thread.cs               \
164         thread5.cs              \
165         thread6.cs              \
166         thread-static.cs        \
167         thread-static-init.cs   \
168         context-static.cs       \
169         float-pop.cs            \
170         interfacecast.cs        \
171         array3.cs               \
172         classinit.cs            \
173         classinit2.cs           \
174         synchronized.cs         \
175         async_read.cs           \
176         threadpool.cs           \
177         threadpool1.cs          \
178         base-definition.cs      \
179         bug-27420.cs            \
180         bug-47295.cs            \
181         bug-46781.cs            \
182         bug-48015.cs            \
183         bug-42136.cs            \
184         interlocked.cs          \
185         cross-domain.cs         \
186         appdomain-exit.cs       \
187         delegate-async-exit.cs  \
188         delegate-delegate-exit.cs       \
189         delegate-exit.cs        \
190         finalizer-abort.cs      \
191         finalizer-exception.cs  \
192         finalizer-exit.cs       \
193         main-exit.cs    \
194         main-returns-abort-resetabort.cs        \
195         main-returns-background-abort-resetabort.cs     \
196         main-returns-background-resetabort.cs   \
197         main-returns-background.cs      \
198         main-returns.cs \
199         subthread-exit.cs       \
200         desweak.cs
201
202 if X86
203 # bug #71274
204 PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
205 endif
206
207 if AMD64
208 # bug #71273
209 PLATFORM_DISABLED_TESTS=appdomain-unload.exe
210 endif
211
212 DISABLED_TESTS=                 \
213         delegate-async-exception.cs     \
214         delegate-delegate-exception.cs  \
215         $(PLATFORM_DISABLED_TESTS)
216
217 # These only compile with MS CSC
218 TEST_CSC_SRC=                   \
219         vararg.cs
220
221 TEST_IL_SRC=                    \
222         cpblkTest.il            \
223         jmpTest.il                      \
224         calliTest.il            \
225         ckfiniteTest.il         \
226         locallocTest.il         \
227         initblkTest.il          \
228         qt-instance.il          \
229         vararg.il                       \
230         bug-29859.il            \
231         static-fields-nonconst.il       \
232         even-odd.il
233
234
235 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
236 TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
237 TESTBS=$(BENCHSRC:.cs=.exe)
238
239 EXTRA_DIST=test-driver $(TEST_CS_SRC) $(TEST_IL_SRC) $(BENCHSRC)
240
241 %.exe: %.il
242         $(ILASM) -out:$@ $<
243
244 %.exe: %.cs TestDriver.dll
245         $(CSC) -r:TestDriver.dll -out:$@ $<
246
247 test:   testjit
248
249 TestDriver.dll:
250         $(CSC) -target:library -o $@ $(srcdir)/../mini/TestDriver.cs
251
252 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
253         @failed=0; \
254         passed=0; \
255         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
256         for i in $(TESTSI_CS); do       \
257                 if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
258                 then \
259                         passed=`expr $${passed} + 1`; \
260                 else \
261                         if [ $$? = 2 ]; then break; fi; \
262                         failed=`expr $${failed} + 1`; \
263                 fi \
264         done; \
265         echo; echo ".cs: $${passed} test(s) passed. $${failed} test(s) failed."; echo
266
267 test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
268         @failed=0; \
269         passed=0; \
270         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
271         for i in $(TESTSI_IL); do       \
272                 if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
273                 then \
274                         passed=`expr $${passed} + 1`; \
275                 else \
276                         if [ $$? = 2 ]; then break; fi; \
277                         failed=`expr $${failed} + 1`; \
278                 fi \
279         done; \
280         echo; echo ".il: $${passed} test(s) passed. $${failed} test(s) failed."; echo
281
282 testb: $(TEST_PROG) $(TESTBS)
283         for i in $(TESTBS); do  \
284                 $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS);       \
285         done
286
287 testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la
288         @failed=0; \
289         passed=0; \
290         failed_tests="";\
291         for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do        \
292                 rm -f $${i}.so; \
293                 if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
294                 then \
295                         passed=`expr $${passed} + 1`; \
296                 else \
297                         if [ $$? = 2 ]; then break; fi; \
298                         failed=`expr $${failed} + 1`; \
299                         failed_tests="$${failed_tests} $$i"; \
300                 fi \
301         done; \
302         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
303         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
304           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
305
306 testaot: $(TESTSI_CS) $(TESTBS) libtest.la
307         @failed=0; \
308         passed=0; \
309         failed_tests="";\
310         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
311         for i in $(TESTSI_CS) $(TESTBS); do     \
312                 rm -f $${i}.so; \
313                 $(JITTEST_PROG) --aot $${i} > /dev/null; \
314                 if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
315                 then \
316                         passed=`expr $${passed} + 1`; \
317                 else \
318                         if [ $$? = 2 ]; then break; fi; \
319                         failed=`expr $${failed} + 1`; \
320                         failed_tests="$${failed_tests} $$i"; \
321                 fi \
322         done; \
323         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
324         if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
325           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
326
327 testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
328         @failed=0; \
329         passed=0; \
330         failed_tests="";\
331         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
332         for i in $(TESTSI_CS) $(TESTSI_IL); do \
333                 if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
334                 then \
335                         passed=`expr $${passed} + 1`; \
336                 else \
337                         if [ $$? = 2 ]; then break; fi; \
338                         failed=`expr $${failed} + 1`; \
339                         failed_tests="$${failed_tests} $$i"; \
340                 fi \
341         done; \
342         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
343         if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
344           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
345
346 testjitspeed: $(JITTEST_PROG) $(TESTBS)
347         for i in $(TESTBS); do  \
348                 echo $$i;       \
349                 time $(JITTEST_PROG) $$i;       \
350         done
351
352 noinst_LTLIBRARIES = libtest.la
353
354 INCLUDES = $(GLIB_CFLAGS)
355
356 if PLATFORM_WIN32
357 libtest_la_LDFLAGS=-no-undefined -rpath `pwd`
358 else
359 libtest_la_LDFLAGS = -rpath `pwd`
360 endif
361 libtest_la_SOURCES = libtest.c
362 libtest_la_LIBADD = $(GLIB_LIBS)
363
364 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) *.dll *.stdout *.exe stest.dat