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