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