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