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