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