2005-04-12 Dick Porter <dick@ximian.com>
[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         pinvoke10.cs            \
68         pinvoke11.cs            \
69         pinvoke13.cs            \
70         pinvoke15.cs            \
71         pinvoke17.cs            \
72         pinvoke18.cs            \
73         invoke.cs               \
74         invoke2.cs              \
75         runtime-invoke.cs               \
76         invoke-string-ctors.cs          \
77         reinit.cs               \
78         box.cs                  \
79         array.cs                \
80         enum.cs                 \
81         enum2.cs                \
82         property.cs             \
83         enumcast.cs             \
84         assignable-tests.cs     \
85         array-cast.cs           \
86         cattr-compile.cs        \
87         cattr-field.cs          \
88         cattr-object.cs         \
89         custom-attr.cs          \
90         double-cast.cs          \
91         newobj-valuetype.cs     \
92         arraylist-clone.cs      \
93         setenv.cs               \
94         vtype.cs                \
95         isvaluetype.cs          \
96         iface6.cs               \
97         ipaddress.cs            \
98         array-vt.cs             \
99         interface1.cs           \
100         reflection-enum.cs      \
101         reflection-prop.cs      \
102         reflection4.cs          \
103         reflection5.cs          \
104         reflection-const-field.cs \
105         many-locals.cs          \
106         string-compare.cs       \
107         test-prime.cs           \
108         params.cs               \
109         reflection.cs           \
110         interface.cs            \
111         iface.cs                \
112         iface2.cs               \
113         iface3.cs               \
114         iface4.cs               \
115         virtual-method.cs       \
116         intptrcast.cs           \
117         indexer.cs              \
118         stream.cs               \
119         console.cs              \
120         shift.cs                \
121         jit-int.cs              \
122         jit-uint.cs             \
123         jit-long.cs             \
124         long.cs                 \
125         jit-ulong.cs            \
126         jit-float.cs            \
127         pop.cs                  \
128         time.cs                 \
129         appdomain.cs        \
130         appdomain1.cs           \
131         appdomain2.cs           \
132         appdomain3.cs           \
133         appdomain-client.cs     \
134         appdomain-unload.cs \
135         loader.cs       \
136         pointer.cs              \
137         hashcode.cs             \
138         delegate1.cs            \
139         delegate2.cs            \
140         delegate3.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 testtrace:
336         $(MAKE) RUNTIME_ARGS="$${RUNTIME_ARGS} --trace" testjit
337
338 testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
339         @failed=0; \
340         passed=0; \
341         failed_tests="";\
342         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
343         for i in $(TESTSI_CS) $(TESTSI_IL); do \
344                 if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
345                 then \
346                         passed=`expr $${passed} + 1`; \
347                 else \
348                         if [ $$? = 2 ]; then break; fi; \
349                         failed=`expr $${failed} + 1`; \
350                         failed_tests="$${failed_tests} $$i"; \
351                 fi \
352         done; \
353         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
354         if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
355           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
356
357 testjitspeed: $(JITTEST_PROG) $(TESTBS)
358         for i in $(TESTBS); do  \
359                 echo $$i;       \
360                 time $(JITTEST_PROG) $$i;       \
361         done
362
363 stresstest: $(STRESS_TESTS)
364         @failed=0; \
365         passed=0; \
366         failed_tests="";\
367         for i in $(STRESS_TESTS); do    \
368                 if $(srcdir)/stress-runner.pl $$i ../mini/mono $(RUNTIME_ARGS); \
369                 then \
370                         passed=`expr $${passed} + 1`; \
371                 else \
372                         if [ $$? = 2 ]; then break; fi; \
373                         failed=`expr $${failed} + 1`; \
374                         failed_tests="$${failed_tests} $$i"; \
375                 fi \
376         done; \
377         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
378         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
379           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
380
381 noinst_LTLIBRARIES = libtest.la
382
383 INCLUDES = $(GLIB_CFLAGS)
384
385 if PLATFORM_WIN32
386 # the exported names created by gcc for stdcall functions are missing the leading _, so MS.NET
387 # can't find them. So we use --kill-at to remove the @ suffix as well.
388 libtest_la_LDFLAGS=-no-undefined -rpath `pwd` -Wl,--kill-at
389 else
390 libtest_la_LDFLAGS = -rpath `pwd`
391 endif
392 libtest_la_SOURCES = libtest.c
393 libtest_la_LIBADD = $(GLIB_LIBS)
394
395 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.exe stest.dat