[runtime] Fixed typo in previous commit, added sleep
[mono.git] / mono / tests / Makefile.am
1 SUBDIRS = assemblyresolve gc-descriptors
2
3 check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform test-process-exit test-messages rm-empty-logs
4 check-full: test-sgen check-local
5 check-parallel: compile-tests check-full
6
7 # for backwards compatibility on Wrench
8 test-wrench: check-parallel
9
10 aotcheck: testaot gshared-aot
11
12 TEST_PROG = ../interpreter/mint
13
14 JITTEST_PROG = $(if $(VALGRIND), valgrind $(VALGRIND_ARGS),) $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/mono/mini/mono)
15
16 TEST_PROG_RUN = MONO_CFG_DIR=$(mono_build_root)/runtime/etc $(LIBTOOL) --mode=execute $(TEST_PROG)
17 JITTEST_PROG_RUN = MONO_CFG_DIR=$(mono_build_root)/runtime/etc $(LIBTOOL) --mode=execute $(JITTEST_PROG)
18
19 RUNTIME_ARGS=--config tests-config --optimize=all --debug
20
21 with_mono_path = MONO_PATH=$(mcs_topdir)/class/lib/net_4_5
22
23 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
24
25 MKBUNDLE = \
26         PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \
27         $(RUNTIME) $(mcs_topdir)/class/lib/net_4_5/mkbundle.exe
28
29 MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -debug \
30         -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \
31         -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
32         -nowarn:0197
33 ILASM = $(RUNTIME) $(mcs_topdir)/class/lib/net_4_5/ilasm.exe
34
35 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
36
37 STRESS_TESTS_SRC=       \
38         abort-stress-1.cs       \
39         abort-stress-2.cs       \
40         abort-stress-3.cs       \
41         domain-stress.cs        \
42         gchandle-stress.cs      \
43         monitor-stress.cs       \
44         thread-stress.cs        \
45         gc-stress.cs            \
46         gc-copy-stress.cs       \
47         gc-graystack-stress.cs          \
48         exit-stress.cs          \
49         process-stress.cs       \
50         assembly-load-stress.cs
51
52 # Disabled until ?mcs is fixed
53 #       bug-331958.cs
54 BASE_TEST_CS_SRC=               \
55         bug-2907.cs             \
56         array-init.cs           \
57         arraylist.cs            \
58         assemblyresolve_event.cs        \
59         assemblyresolve_event3.cs       \
60         assemblyresolve_event4.cs       \
61         checked.cs              \
62         char-isnumber.cs        \
63         create-instance.cs      \
64         field-layout.cs         \
65         pack-layout.cs          \
66         pack-bug.cs             \
67         hash-table.cs           \
68         test-ops.cs             \
69         obj.cs                  \
70         test-dup-mp.cs          \
71         string.cs               \
72         stringbuilder.cs        \
73         switch.cs               \
74         outparm.cs              \
75         delegate.cs             \
76         bitconverter.cs         \
77         exception.cs            \
78         exception2.cs           \
79         exception3.cs           \
80         exception4.cs           \
81         exception5.cs           \
82         exception6.cs           \
83         exception7.cs           \
84         exception8.cs           \
85         exception10.cs          \
86         exception11.cs          \
87         exception12.cs          \
88         exception13.cs          \
89         exception14.cs          \
90         exception15.cs          \
91         exception16.cs          \
92         exception17.cs          \
93         typeload-unaligned.cs   \
94         struct.cs               \
95         valuetype-gettype.cs    \
96         typeof-ptr.cs           \
97         static-constructor.cs   \
98         pinvoke.cs              \
99         pinvoke2.cs             \
100         pinvoke3.cs             \
101         pinvoke11.cs            \
102         pinvoke13.cs            \
103         pinvoke17.cs            \
104         invoke.cs               \
105         invoke2.cs              \
106         runtime-invoke.cs               \
107         invoke-string-ctors.cs          \
108         reinit.cs               \
109         box.cs                  \
110         array.cs                \
111         enum.cs                 \
112         enum2.cs                \
113         enum-intrins.cs         \
114         property.cs             \
115         enumcast.cs             \
116         assignable-tests.cs     \
117         array-cast.cs           \
118         array-subtype-attr.cs   \
119         cattr-compile.cs        \
120         cattr-field.cs          \
121         cattr-object.cs         \
122         custom-attr.cs          \
123         double-cast.cs          \
124         newobj-valuetype.cs     \
125         arraylist-clone.cs      \
126         setenv.cs               \
127         vtype.cs                \
128         isvaluetype.cs          \
129         iface6.cs               \
130         iface7.cs               \
131         ipaddress.cs            \
132         array-vt.cs             \
133         interface1.cs           \
134         reflection-enum.cs      \
135         reflection-prop.cs      \
136         reflection4.cs          \
137         reflection5.cs          \
138         reflection-const-field.cs \
139         many-locals.cs          \
140         string-compare.cs       \
141         test-prime.cs           \
142         params.cs               \
143         reflection.cs           \
144         interface.cs            \
145         iface.cs                \
146         iface2.cs               \
147         iface3.cs               \
148         iface4.cs               \
149         iface-large.cs          \
150         virtual-method.cs       \
151         intptrcast.cs           \
152         indexer.cs              \
153         stream.cs               \
154         console.cs              \
155         shift.cs                \
156         jit-int.cs              \
157         jit-uint.cs             \
158         jit-long.cs             \
159         long.cs                 \
160         jit-ulong.cs            \
161         jit-float.cs            \
162         pop.cs                  \
163         time.cs                 \
164         appdomain.cs        \
165         appdomain1.cs           \
166         appdomain2.cs           \
167         appdomain-client.cs     \
168         appdomain-unload.cs \
169         appdomain-async-invoke.cs       \
170         loader.cs       \
171         pointer.cs              \
172         hashcode.cs             \
173         delegate1.cs            \
174         delegate2.cs            \
175         delegate3.cs            \
176         delegate5.cs            \
177         delegate6.cs            \
178         delegate7.cs            \
179         delegate8.cs            \
180         delegate9.cs            \
181         delegate10.cs           \
182         delegate11.cs           \
183         remoting1.cs            \
184         remoting2.cs            \
185         remoting3.cs            \
186         remoting4.cs            \
187         remoting5.cs            \
188         largeexp.cs             \
189         largeexp2.cs            \
190         marshalbyref1.cs        \
191         static-ctor.cs          \
192         inctest.cs              \
193         bound.cs                \
194         array-invoke.cs         \
195         test-arr.cs             \
196         decimal.cs              \
197         decimal-array.cs        \
198         marshal.cs              \
199         marshal1.cs             \
200         marshal2.cs             \
201         marshal3.cs             \
202         marshal5.cs             \
203         marshal6.cs             \
204         marshal7.cs             \
205         marshal8.cs             \
206         marshal9.cs             \
207         marshalbool.cs          \
208         marshal-valuetypes.cs   \
209         test-byval-in-struct.cs \
210         thread.cs               \
211         thread5.cs              \
212         thread6.cs              \
213         thread-static.cs        \
214         thread-static-init.cs   \
215         context-static.cs       \
216         float-pop.cs            \
217         interfacecast.cs        \
218         array3.cs               \
219         classinit.cs            \
220         classinit2.cs           \
221         classinit3.cs           \
222         synchronized.cs         \
223         async_read.cs           \
224         threadpool.cs           \
225         threadpool1.cs          \
226         threadpool-exceptions1.cs \
227         threadpool-exceptions2.cs \
228         threadpool-exceptions3.cs \
229         threadpool-exceptions4.cs \
230         threadpool-exceptions5.cs \
231         threadpool-exceptions6.cs \
232         threadpool-exceptions7.cs \
233         base-definition.cs      \
234         bug-27420.cs            \
235         bug-47295.cs            \
236         bug-46781.cs            \
237         bug-48015.cs            \
238         bug-42136.cs            \
239         bug-59286.cs            \
240         bug-70561.cs            \
241         bug-78311.cs            \
242         bug-78653.cs            \
243         bug-78656.cs            \
244         bug-77127.cs            \
245         bug-323114.cs           \
246         bug-Xamarin-5278.cs     \
247         interlocked.cs          \
248         cross-domain.cs         \
249         appdomain-exit.cs       \
250         delegate-async-exit.cs  \
251         delegate-delegate-exit.cs       \
252         delegate-exit.cs        \
253         finalizer-abort.cs      \
254         finalizer-exception.cs  \
255         finalizer-exit.cs       \
256         finalizer-thread.cs     \
257         main-exit.cs    \
258         main-returns-abort-resetabort.cs        \
259         main-returns-background-abort-resetabort.cs     \
260         main-returns-background-resetabort.cs   \
261         main-returns-background.cs      \
262         main-returns-background-change.cs       \
263         main-returns.cs         \
264         subthread-exit.cs       \
265         desweak.cs              \
266         cominterop.cs           \
267         exists.cs               \
268         handleref.cs    \
269         transparentproxy.cs \
270         dbnull-missing.cs       \
271         test-type-ctor.cs       \
272         soft-float-tests.cs     \
273         thread-exit.cs          \
274         finalize-parent.cs      \
275         assemblyresolve_event2.2.cs     \
276         interlocked-2.2.cs      \
277         pinvoke-2.2.cs          \
278         bug-78431.2.cs          \
279         bug-79684.2.cs          \
280         catch-generics.2.cs     \
281         event-get.2.cs          \
282         safehandle.2.cs         \
283         stackframes-async.2.cs          \
284         module-cctor-loader.2.cs        \
285         generics-invoke-byref.2.cs      \
286         generic-signature-compare.2.cs  \
287         generics-sharing.2.cs   \
288         shared-generic-methods.2.cs     \
289         shared-generic-synchronized.2.cs        \
290         generic-inlining.2.cs   \
291         generic-initobj.2.cs    \
292         generic-delegate.2.cs   \
293         generic-sizeof.2.cs     \
294         generic-virtual.2.cs    \
295         generic-interface-methods.2.cs  \
296         generic-array-type.2.cs \
297         generic-method-patching.2.cs    \
298         generic-static-methods.2.cs     \
299         generic-null-call.2.cs  \
300         generic-special.2.cs    \
301         generic-exceptions.2.cs \
302         generic-virtual2.2.cs   \
303         generic-valuetype-interface.2.cs        \
304         generic-getgenericarguments.2.cs        \
305         generic-type-builder.2.cs       \
306         generic-synchronized.2.cs       \
307         generic-delegate-ctor.2.cs      \
308         generic-array-iface-set.2.cs    \
309         generic-typedef.2.cs    \
310         generic-marshalbyref.2.cs       \
311         generic-xdomain.2.cs    \
312         dynamic-generic-size.cs \
313         bug-431413.2.cs \
314         bug-459285.2.cs \
315         generic-virtual-invoke.2.cs     \
316         bug-461198.2.cs \
317         generic-sealed-virtual.2.cs     \
318         generic-system-arrays.2.cs      \
319         generic-stack-traces.2.cs       \
320         generic-stack-traces2.2.cs      \
321         bug-472600.2.cs \
322         recursive-generics.2.cs \
323         bug-473482.2.cs \
324         bug-473999.2.cs \
325         bug-479763.2.cs \
326         bug-616463.cs   \
327         bug-80392.2.cs          \
328         dynamic-method-access.2.cs      \
329         dynamic-method-finalize.2.cs    \
330         bug-82194.2.cs  \
331         anonarray.2.cs  \
332         ienumerator-interfaces.2.cs     \
333         array-enumerator-ifaces.2.cs    \
334         generic_type_definition_encoding.2.cs \
335         generic_type_definition.2.cs    \
336         bug-333798.2.cs         \
337         bug-333798-tb.2.cs              \
338         bug-335131.2.cs         \
339         bug-322722_patch_bx.2.cs                \
340         bug-348522.2.cs         \
341         bug-340662_bug.cs       \
342         bug-322722_dyn_method_throw.2.cs        \
343         bug-389886-2.cs \
344         bug-325283.2.cs \
345         thunks.cs \
346         winx64structs.cs \
347         bug-349190.2.cs \
348         nullable_boxing.2.cs    \
349         valuetype-equals.cs     \
350         custom-modifiers.2.cs   \
351         bug-382986.cs   \
352         test-inline-call-stack.cs       \
353         bug-324535.cs   \
354         modules.cs      \
355         bug-81673.cs    \
356         bug-81691.cs    \
357         bug-80307.cs    \
358         bug-415577.cs   \
359         filter-stack.cs \
360         vararg2.cs      \
361         bug-389886-sre-generic-interface-instances.cs   \
362         bug-461867.cs   \
363         bug-461941.cs   \
364         bug-461261.cs   \
365         bug-400716.cs   \
366         bug-462592.cs   \
367         bug-459094.cs   \
368         generic-unloading.2.cs  \
369         generic-unloading-sub.2.cs      \
370         bug-467456.cs   \
371         appdomain-unload-callback.cs    \
372         bug-508538.cs   \
373         bug-472692.2.cs         \
374         gchandles.cs    \
375         interlocked-3.cs        \
376         interlocked-4.2.cs      \
377         appdomain-thread-abort.cs \
378         xdomain-threads.cs      \
379         w32message.cs   \
380         bug-544446.cs   \
381         gc-altstack.cs  \
382         large-gc-bitmap.cs      \
383         bug-561239.cs   \
384         bug-562150.cs   \
385         bug-575941.cs   \
386         bug-599469.cs   \
387         bug-389886-3.cs \
388         monitor.cs      \
389         monitor-resurrection.cs \
390         dynamic-method-resurrection.cs  \
391         bug-666008.cs   \
392         bug-685908.cs   \
393         sgen-long-vtype.cs      \
394         delegate-invoke.cs      \
395         bug-696593.cs   \
396         bug-705140.cs   \
397         bug-1147.cs     \
398         mono-path.cs    \
399         bug-bxc-795.cs  \
400         bug-3903.cs     \
401         async-with-cb-throws.cs \
402         appdomain-unload-doesnot-raise-pending-events.cs        \
403         bug-6148.cs     \
404         assembly_append_ordering.cs     \
405         bug-10127.cs    \
406         bug-18026.cs    \
407         allow-synchronous-major.cs      \
408         unload-appdomain-on-shutdown.cs \
409         block_guard_restore_aligment_on_exit.cs \
410         thread_static_gc_layout.cs \
411         sleep.cs \
412         bug-27147.cs    \
413         bug-17537.cs
414
415 TEST_CS_SRC_DIST=       \
416         $(BASE_TEST_CS_SRC)     \
417         async-exc-compilation.cs \
418         filter-stack.cs \
419         finally_guard.cs \
420         finally_block_ending_in_dead_bb.cs
421
422 TEST_CS_SRC_GEN = \
423         runtime-invoke.gen.cs \
424         imt_big_iface_test.cs
425
426 if AMD64
427 TEST_CS_SRC = $(BASE_TEST_CS_SRC) $(TEST_CS_SRC_GEN) async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
428 # #651684
429 PLATFORM_DISABLED_TESTS = finally_guard.exe
430 else
431 if X86
432 TEST_CS_SRC = $(BASE_TEST_CS_SRC) $(TEST_CS_SRC_GEN) async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
433 else
434 TEST_CS_SRC = $(BASE_TEST_CS_SRC) $(TEST_CS_SRC_GEN)
435 endif
436 endif
437
438 if IA64
439 TEST_CS_SRC+=async-exc-compilation.cs filter-stack.cs
440 # bug #319249
441 PLATFORM_DISABLED_TESTS=exception17.exe
442 PLATFORM_DISABLED_TESTS+=winx64structs.exe
443 endif
444
445 if X86
446
447 if HOST_WIN32
448 PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
449         bug-18026.exe monitor.exe threadpool-exceptions5.exe
450 endif
451
452 endif
453
454 if POWERPC
455 # bug #71274
456 PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
457 endif
458
459 if ARM
460 PLATFORM_DISABLED_TESTS=filter-stack.exe
461 endif
462
463 if MIPS
464 # monitor.exe is racy
465 PLATFORM_DISABLED_TESTS=filter-stack.exe monitor.exe
466 endif
467
468 if S390X
469 PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
470 #PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
471 endif
472
473 if NACL_CODEGEN
474 # Tests that use Thread.Abort()
475 PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
476                          abort-stress-2.exe \
477                          abort-stress-3.exe \
478                          appdomain-thread-abort.exe \
479                          async-exc-compilation.exe \
480                          bug-561239.exe \
481                          bug-70561.exe \
482                          finalizer-abort.exe \
483                          finally_guard.exe \
484                          finally_block_ending_in_dead_bb.exe \
485                          main-returns-abort-resetabort.exe \
486                          main-returns-background-abort-resetabort.exe \
487                          thread6.exe \
488                          threadpool-exceptions5.exe \
489                          threadpool-exceptions6.exe
490
491 # Tests that rely on AppDomain.Unload
492 PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
493                           appdomain-exit.exe \
494                           appdomain-unload-callback.exe \
495                           appdomain-unload.exe \
496                           domain-stress.exe \
497                           generic-unloading.2.exe \
498                           monitor.exe \
499                           remoting4.exe \
500                           threadpool-exceptions7.exe \
501                           xdomain-threads.exe
502
503 # pinvoke2 attaches a thread to the runtime, but
504 # doesn't 'unattach' it and it hangs in GC on exit
505 PLATFORM_DISABLED_TESTS+= pinvoke2.exe
506
507 # Tests that currently hang waiting for non-main threads
508 # to exit in NaCl, need to investigate.  Most are AppDomain
509 # creation and Delegate tests.
510 PLATFORM_DISABLED_TESTS+= appdomain1.exe \
511                           delegate9.exe \
512                           marshal-valuetypes.exe \
513                           cross-domain.exe \
514                           stackframes-async.2.exe \
515                           generic-marshalbyref.2.exe \
516                           generic-xdomain.2.exe \
517                           bug-415577.exe
518
519 # Tests that fail trying to write files (appdomain create mostly)
520 PLATFORM_DISABLED_TESTS+= bug-335131.2.exe \
521                           bug-349190.2.exe \
522                           bug-80307.exe \
523                           bug-462592.exe
524
525 # FIXME: don't know why delegate2.exe fails, it shouldn't
526 PLATFORM_DISABLED_TESTS+= delegate2.exe
527
528 # These tests newly fail with the latest revision. pinvoke3 fails because
529 # of a thread attach, the others have not been investigated.  TODO revisit.
530 PLATFORM_DISABLED_TESTS+= pinvoke3.exe \
531                           async_read.exe \
532                           async-with-cb-throws.exe \
533                           appdomain-unload-doesnot-raise-pending-events.exe \
534                           gsharing-valuetype-layout.exe
535
536 if X86
537 # FIXME: There are problems with async callbacks and results on NaCl 32-bit
538 PLATFORM_DISABLED_TESTS+= delegate1.exe \
539                           delegate3.exe \
540                           delegate5.exe \
541                           delegate8.exe \
542                           threadpool.exe \
543                           threadpool1.exe \
544                           threadpool-exceptions3.exe \
545                           bug-323114.exe \
546                           delegate-exit.exe \
547                           bug-80392.2.exe
548
549 # FIXME: These tests hang/fail for unknown reasons, deal with exiting
550 PLATFORM_DISABLED_TESTS+= main-returns-background-resetabort.exe \
551                           main-returns-background.exe \
552                           main-returns-background-change.exe
553 endif
554
555 endif
556
557 # The two finalizer tests only work under sgen
558 # gc-altstack.exe fails under boehm because it has no support for altstack
559 # bug-459094.exe creates an extremely deep directory tree
560 # delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
561 # reverted.
562 # bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
563 DISABLED_TESTS=                 \
564         delegate-async-exception.exe    \
565         bug-348522.2.exe        \
566         bug-459094.exe \
567         delegate-invoke.exe \
568         bug-Xamarin-5278.exe \
569         $(PLATFORM_DISABLED_TESTS) \
570         $(EXTRA_DISABLED_TESTS)
571
572 DISABLED_TESTS_WRENCH=  \
573         $(DISABLED_TESTS)       \
574         $(PLATFORM_DISABLED_TESTS_WRENCH)       \
575         main-returns-background-resetabort.exe \
576         main-returns-background-abort-resetabort.exe    \
577         thread6.exe     \
578         assemblyresolve_event3.exe \
579         delegate2.exe   \
580         finally_guard.exe \
581         gc-altstack.exe \
582         generic-xdomain.2.exe
583
584 AOT_DISABLED_TESTS=constraints-load.exe
585
586 # These only compile with MS CSC
587 TEST_CSC_SRC=                   \
588         vararg.cs
589
590 TEST_IL_SRC=                    \
591         field-access.il         \
592         method-access.il        \
593         ldftn-access.il         \
594         cpblkTest.il            \
595         vbinterface.il          \
596         calliTest.il            \
597         ckfiniteTest.il         \
598         fault-handler.il                \
599         locallocTest.il         \
600         initblkTest.il          \
601         qt-instance.il          \
602         vararg.il               \
603         bug-29859.il            \
604         bug-78549.il            \
605         static-fields-nonconst.il       \
606         reload-at-bb-end.il     \
607         test-enum-indstoreil.il \
608         filter-bug.il           \
609         even-odd.il             \
610         bug-82022.il    \
611         vt-sync-method.il       \
612         enum_types.il   \
613         invalid-token.il        \
614         call_missing_method.il  \
615         call_missing_class.il   \
616         ldfld_missing_field.il  \
617         ldfld_missing_class.il  \
618         find-method.2.il        \
619         bug-79215.2.il  \
620         bug-79956.2.il  \
621         bug-327438.2.il \
622         bug-387274.2.il \
623         bug-426309.2.il \
624         ldtoken_with_byref_typespec.2.il \
625         resolve_method_bug.2.il \
626         resolve_field_bug.2.il \
627         resolve_type_bug.2.il   \
628         generics-sharing-other-exc.2.il \
629         generic-ldobj.2.il      \
630         generic-mkrefany.2.il   \
631         generic-refanyval.2.il  \
632         generic-ldtoken.2.il    \
633         generic-ldtoken-method.2.il     \
634         generic-ldtoken-field.2.il      \
635         generic-tailcall.2.il   \
636         generic-tailcall2.2.il  \
637         generic-array-exc.2.il  \
638         generic-valuetype-newobj2.2.il  \
639         generic-valuetype-newobj.2.il   \
640         generic-constrained.2.il        \
641         generic-type-load-exception.2.il        \
642         bug-81466.il    \
643         bug457574.il    \
644         bug445361.il    \
645         bug-463303.il   \
646         bug469742.2.il  \
647         bug-528055.il   \
648         constraints-load.il     \
649         array_load_exception.il \
650         bug-481403.il   \
651         interface-with-static-method.il \
652         bug-515884.il   \
653         bug-633291.il   \
654         delegate-with-null-target.il    \
655         bug-318677.il   \
656         gsharing-valuetype-layout.il    \
657         invalid_generic_instantiation.il
658
659
660 # pre-requisite test sources: files that are not test themselves
661 # but that need to be compiled
662 PREREQ_IL_SRC=event-il.il module-cctor.il
663 PREREQ_CS_SRC=
664 PREREQ_IL_DLL_SRC=event-il.il module-cctor.il
665 PREREQ_CS_DLL_SRC=
666
667 PREREQSI_IL=$(PREREQ_IL_SRC:.il=.exe)
668 PREREQSI_CS=$(PREREQ_CS_SRC:.cs=.exe)
669 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
670 TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
671 TESTBS=$(BENCHSRC:.cs=.exe)
672 STRESS_TESTS=$(STRESS_TESTS_SRC:.cs=.exe)
673
674 EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
675         $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl $(PREREQ_IL_SRC) $(PREREQ_CS_SRC)
676
677 %.exe: %.il
678         $(ILASM) -out:$@ $<
679
680 %.exe: %.cs TestDriver.dll
681         $(MCS) -r:TestDriver.dll -out:$@ $<
682
683 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
684 if POWERPC
685 test_platform:
686 else
687 # Can't use mkbundle on win32 since there is no static build there
688 # Can't run test-unhandled-exception on Windows because of all the debug popups...
689 if HOST_WIN32
690 test_platform:
691 else
692 # mkbundle uses the installed mono-2.pc so it won't work if there is no system mono
693 #test_platform: testbundle test-iomap-regression
694 test_platform:  test-iomap-regression
695 endif
696 endif
697
698 if X86
699 if HOST_WIN32
700 else
701 test_platform: test-eglib-remap
702 endif
703 endif
704
705 # Target to precompile the test executables
706 tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) $(GSHARED_TESTS)
707
708 #
709 # Test that no symbols are missed in eglib-remap.h
710 #
711 OK_G_SYMBOLS='g_list\|g_slist\|g_concat_dir_and_file\|g_Ctoc\'
712 if NACL_CODEGEN
713 test-eglib-remap:
714 else
715 test-eglib-remap:
716         @echo "Testing eglib remap..."
717         @if which nm > /dev/null; then if nm $(top_builddir)/mono/mini/mono | grep -v $(OK_G_SYMBOLS) | grep 't g_'; then exit 1; else exit 0; fi; fi
718 endif
719
720 #
721 # Tests that the internals in mono/io-layer/messages.c are ok by triggering the 
722 # code that checks that the table is properly sorted
723 #
724 if NACL_CODEGEN
725 test-messages:
726 else
727 if HOST_WIN32
728 test-messages:
729 else
730 test-messages: w32message.exe
731         > test_messages.zero
732         $(with_mono_path) $(JITTEST_PROG_RUN) w32message.exe >& w32message.allout && cmp test_messages.zero w32message.allout
733 endif
734 endif
735
736 if AMD64
737 test-sgen : sgen-tests
738 else
739 if X86
740 if HOST_WIN32
741 test-sgen :
742 else
743 test-sgen : sgen-tests
744 endif
745 else
746 if ARM
747 test-sgen : sgen-tests
748 else
749 if S390X
750 test-sgen : sgen-regular-tests
751 endif
752 endif
753 endif
754 endif
755
756 # Precompile the test assemblies in parallel
757 compile-tests:
758         $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
759
760 # Remove empty .stdout and .stderr files for wrench
761 rm-empty-logs:
762         @echo "Removing empty logs..."
763         @find . '(' -name "*.stdout" -o -name "*.stderr" ')' -empty -exec rm {} \;
764
765 assemblyresolve/test/asm.dll:
766         $(MAKE) -C assemblyresolve prereq
767
768 TestDriver.dll:
769         $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
770
771 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
772         @failed=0; \
773         passed=0; \
774         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
775         if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
776         for i in $(TESTSI_CS); do       \
777                 if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
778                 then \
779                         passed=`expr $${passed} + 1`; \
780                 else \
781                         if [ $$? = 2 ]; then break; fi; \
782                         failed=`expr $${failed} + 1`; \
783                 fi \
784         done; \
785         echo; echo ".cs: $${passed} test(s) passed. $${failed} test(s) did not pass."; echo
786
787 test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
788         @failed=0; \
789         passed=0; \
790         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
791         if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
792         for i in $(TESTSI_IL); do       \
793                 if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
794                 then \
795                         passed=`expr $${passed} + 1`; \
796                 else \
797                         if [ $$? = 2 ]; then break; fi; \
798                         failed=`expr $${failed} + 1`; \
799                 fi \
800         done; \
801         echo; echo ".il: $${passed} test(s) passed. $${failed} test(s) did not pass."; echo
802
803 testb: $(TEST_PROG) $(TESTBS)
804         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
805         if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
806         for i in $(TESTBS); do  \
807                 $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS);  \
808         done
809
810 runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
811         @failed=0; \
812         passed=0; \
813         failed_tests="";\
814         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
815         if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
816         rm -f testlist testlist.sorted; \
817         for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do echo $${i} >> testlist; sort testlist > testlist.sorted; done; \
818         for i in `cat testlist.sorted`; do \
819                 rm -f $${i}.so; \
820                 if [ x$(AOT) = x1 ]; then if echo $(AOT_DISABLED_TESTS) | grep -v -q $${i}; then $(with_mono_path) $(JITTEST_PROG_RUN) --aot --debug $${i} > $${i}.aotlog 2>&1 || exit 1; fi; fi; \
821                 if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
822                 then \
823                         passed=`expr $${passed} + 1`; \
824                 else \
825                         if [ $$? = 2 ]; then break; fi; \
826                         failed=`expr $${failed} + 1`; \
827                         failed_tests="$${failed_tests} $$i"; \
828                 fi \
829         done; \
830         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
831         rm -f testlist testlist.sorted; \
832         if [ $${failed} != 0 ]; then \
833           echo -e "\nFailed tests:\n"; \
834           for i in $${failed_tests}; do \
835             echo $${i}; \
836             if [ "x$$V" = "x1" ]; then \
837               cat $${i}.stdout; \
838               cat $${i}.stderr; \
839             fi; \
840           done; \
841           exit 1; \
842         fi
843
844 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
845         @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
846         $(RUNTIME) ./test-runner.exe -j a --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
847
848 testjit:
849         @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
850
851 testaot:
852         @$(MAKE) AOT=1 runtest
853
854 testtrace:
855         @$(MAKE) RUNTIME_ARGS="$${RUNTIME_ARGS} --trace" runtest
856
857 testinterp:
858         @$(MAKE) JITTEST_PROG_RUN="$(TEST_PROG_RUN)" runtest
859
860 testjitspeed: $(JITTEST_PROG) $(TESTBS)
861         for i in $(TESTBS); do  \
862                 echo $$i;       \
863                 time $(JITTEST_PROG) $$i;       \
864         done
865
866 test-iomap-regression: exists.cs
867         @$(MCS) $(srcdir)/exists.cs -out:exists.exe
868         @echo "Testing exists.exe..."
869         @MONO_IOMAP=all $(RUNTIME) exists.exe
870
871 stresstest: $(STRESS_TESTS)
872         @failed=0; \
873         passed=0; \
874         failed_tests="";\
875         for i in $(STRESS_TESTS); do    \
876                 if $(srcdir)/stress-runner.pl $$i ../mini/mono $(RUNTIME_ARGS); \
877                 then \
878                         passed=`expr $${passed} + 1`; \
879                 else \
880                         if [ $$? = 2 ]; then break; fi; \
881                         failed=`expr $${failed} + 1`; \
882                         failed_tests="$${failed_tests} $$i"; \
883                 fi \
884         done; \
885         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
886         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
887           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
888
889 testbundle: console.exe
890         @echo "Testing mkbundle..."
891         @$(MKBUNDLE) --static console.exe > mkbundle.stdout
892         @$(with_mono_path) MONO_CFG_DIR=$(mono_cfg_dir) ./a.out >> mkbundle.stdout
893         @- rm -rf a.out
894
895 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
896 test-type-load: TestDriver.dll
897         @$(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il > /dev/null
898         @$(MCS) -t:library -out:t.dll -d:FOUND $(srcdir)/t-missing.cs
899         @$(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:load-exceptions.exe $(srcdir)/load-exceptions.cs
900         @$(MCS) -t:library -out:t.dll $(srcdir)/t-missing.cs
901         @echo "Testing load-exception.exe..."
902         @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
903
904 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
905 test-cattr-type-load: TestDriver.dll custom-attr-errors.cs custom-attr-errors-lib.cs
906         $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
907         $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll  $(srcdir)/custom-attr-errors.cs
908         $(MCS) /t:library $(srcdir)/custom-attr-errors-lib.cs
909         @echo "Testing custom-attribute-load-exceptions.exe..."
910         @$(RUNTIME) custom-attr-errors.exe > custom-attr-errors.exe.stdout 2> custom-attr-errors.exe.stderr
911
912 EXTRA_DIST += reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.cs reflection-load-with-context.cs
913 test-reflection-load-with-context: reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.cs reflection-load-with-context.exe
914         rm -rf reflection-load-dir
915         mkdir reflection-load-dir
916         $(MCS) /t:library $(srcdir)/reflection-load-with-context-second-lib.cs -out:reflection-load-dir/reflection-load-with-context-second-lib.dll
917         $(MCS) /t:library -r:reflection-load-dir/reflection-load-with-context-second-lib.dll $(srcdir)/reflection-load-with-context-lib.cs -out:reflection-load-dir/reflection-load-with-context-lib.dll
918         @echo "Testing reflection-load-with-context.cs.exe..."
919         @$(RUNTIME) reflection-load-with-context.exe > reflection-load-with-context.exe.stdout 2> reflection-load-with-context.exe.stderr
920
921
922 EXTRA_DIST += debug-casts.cs
923 # This depends on TLS, so its not ran by default
924 debug-casts:
925         @$(MCS) -r:TestDriver.dll $(srcdir)/debug-casts.cs
926         @$(RUNTIME) --debug=casts debug-casts.exe
927
928 EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs sgen-weakref-stress.cs sgen-cementing-stress.cs sgen-case-23400.cs      finalizer-wait.cs critical-finalizers.cs sgen-domain-unload-2.cs sgen-suspend.cs sgen-new-threads-dont-join-stw.cs sgen-bridge-xref.cs bug-17590.cs sgen-toggleref.cs
929
930
931 #those are actually configurations, eg plain_sgen-descriptors.exe
932 #DISABLE_SGEN_TESTS =
933
934 SGEN_TESTS =    \
935         finalizer-wait.exe      \
936         critical-finalizers.exe \
937         sgen-descriptors.exe    \
938         sgen-gshared-vtype.exe  \
939         sgen-domain-unload.exe  \
940         sgen-weakref-stress.exe \
941         sgen-cementing-stress.exe       \
942         sgen-case-23400.exe     \
943         sgen-new-threads-dont-join-stw.exe      \
944         gc-graystack-stress.exe \
945         bug-17590.exe
946
947 SGEN_CONFIGURATIONS =   \
948         "|plain"        \
949         "major=marksweep-conc|ms-conc"  \
950         "major=marksweep-conc,minor=split|ms-conc-split"        \
951         "minor=split|ms-split"  \
952         "minor=split,alloc-ratio=95|ms-split-95"        \
953         "|plain-clear-at-gc|clear-at-gc"        \
954         "major=marksweep-conc|ms-conc-clear-at-gc|clear-at-gc"  \
955         "minor=split|ms-split-clear-at-gc|clear-at-gc"
956
957
958 #FIXME We should move to use SGEN_CONFIGURATIONS once sgen supports trailling commas or its argument list.
959 SGEN_BRIDGE_CONFIGURATIONS =    \
960         "|plain"        \
961         ",major=marksweep-conc|ms-conc" \
962         "minor=split|ms-split"  \
963         "bridge-implementation=new|plain-new-bridge"    \
964         "bridge-implementation=new,major=marksweep-conc|ms-conc-new-bridge"     \
965         "bridge-implementation=new,minor=split|ms-split-new-bridge"     \
966         "bridge-implementation=tarjan|plain-tarjan-bridge"      \
967         "bridge-implementation=tarjan,minor=split|ms-split-tarjan-bridge"
968
969 sgen-regular-tests: $(SGEN_TESTS)
970         @failed=0; \
971         passed=0; \
972         failed_tests="";\
973         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
974         for test in $+; do      \
975                 echo "...$$test";       \
976                 for conf in $(SGEN_CONFIGURATIONS); do  \
977                         name=`echo $$conf | cut -d\| -f 2`;     \
978                         params=`echo $$conf | cut -d\| -f 1`;   \
979                         debug_opt=`echo $$conf | cut -d\| -f 3`;        \
980                         test_name="$${test}|$${name}";  \
981                         if MONO_GC_PARAMS="$$params" MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="$$debug_opt" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);     \
982                         then \
983                                 passed=`expr $${passed} + 1`; \
984                         else \
985                                 if [ $$? = 2 ]; then break; fi; \
986                                 failed=`expr $${failed} + 1`; \
987                                 failed_tests="$${failed_tests} $$test_name"; \
988                         fi \
989                 done    \
990         done;   \
991         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
992         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
993           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
994
995 sgen-bridge-tests1: sgen-bridge.exe sgen-bridge-major-fragmentation.exe
996         @failed=0; \
997         passed=0; \
998         failed_tests="";\
999         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1000         for test in $+; do      \
1001                 echo "...$$test";       \
1002                 for conf in $(SGEN_BRIDGE_CONFIGURATIONS); do   \
1003                         name=`echo $$conf | cut -d\| -f 2`;     \
1004                         params=`echo $$conf | cut -d\| -f 1`;   \
1005                         test_name="$${test}|$${name}";  \
1006                         if MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="$${params}" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS); \
1007                         then \
1008                                 passed=`expr $${passed} + 1`; \
1009                         else \
1010                                 if [ $$? = 2 ]; then break; fi; \
1011                                 failed=`expr $${failed} + 1`; \
1012                                 failed_tests="$${failed_tests} $$test_name"; \
1013                         fi \
1014                 done    \
1015         done;   \
1016         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1017         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1018           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1019
1020 sgen-bridge-tests2: sgen-bridge-xref.exe
1021         @failed=0; \
1022         passed=0; \
1023         failed_tests="";\
1024         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1025         for test in $+; do      \
1026                 echo "...$$test";       \
1027                 for conf in $(SGEN_BRIDGE_CONFIGURATIONS); do   \
1028                         name=`echo $$conf | cut -d\| -f 2`;     \
1029                         params=`echo $$conf | cut -d\| -f 1`;   \
1030                         test_name="$${test}|$${name}";  \
1031                         if MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="$${params}" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);        \
1032                         then \
1033                                 passed=`expr $${passed} + 1`; \
1034                         else \
1035                                 if [ $$? = 2 ]; then break; fi; \
1036                                 failed=`expr $${failed} + 1`; \
1037                                 failed_tests="$${failed_tests} $$test_name"; \
1038                         fi \
1039                 done    \
1040         done;   \
1041         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1042         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1043           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1044
1045 sgen-toggleref-tests: sgen-toggleref.exe
1046         @failed=0; \
1047         passed=0; \
1048         failed_tests="";\
1049         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1050         for test in $+; do      \
1051                 echo "...$$test";       \
1052                 for conf in $(SGEN_CONFIGURATIONS); do  \
1053                         name=`echo $$conf | cut -d\| -f 2`;     \
1054                         params=`echo $$conf | cut -d\| -f 1`;   \
1055                         test_name="$${test}|$${name}";  \
1056                         if MONO_GC_PARAMS="toggleref-test,$$params" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);  \
1057                         then \
1058                                 passed=`expr $${passed} + 1`; \
1059                         else \
1060                                 if [ $$? = 2 ]; then break; fi; \
1061                                 failed=`expr $${failed} + 1`; \
1062                                 failed_tests="$${failed_tests} $$test_name"; \
1063                         fi \
1064                 done    \
1065         done;   \
1066         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1067         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1068           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1069
1070 sgen-bridge-tests: sgen-bridge-tests1 sgen-bridge-tests2
1071
1072 sgen-tests: sgen-regular-tests sgen-bridge-tests sgen-toggleref-tests
1073
1074 AOT_CONFIGURATIONS=     \
1075         "|regular"      \
1076         "--gc=boehm|boehm"
1077
1078 #LLVM crashes, got to fix it first.
1079 #       "--llvm|llvm"   \
1080 #       "--llvm --gc=boehm|llvm+boehm"
1081
1082
1083 test-aot:
1084         @failed=0; \
1085         passed=0; \
1086         failed_tests="";\
1087         profile=net_4_5;        \
1088         tmpfile=`mktemp -t mono_aot_output` || exit 1;  \
1089         rm -f test-aot-$${name}.stdout test-aot-$${name}.stderr; \
1090         for assembly in $(mcs_topdir)/class/lib/$$profile/*.dll ; do    \
1091                 asm_name=`basename $$assembly`; \
1092                 echo "... $$asm_name";  \
1093                 for conf in $(AOT_CONFIGURATIONS); do   \
1094                         name=`echo $$conf | cut -d\| -f 2`;     \
1095                         params=`echo $$conf | cut -d\| -f 1`;   \
1096                         test_name="$${asm_name}|$${name}";      \
1097                         echo "  $$test_name";   \
1098                         if MONO_PATH=$(mcs_topdir)/class/lib/$$profile $(JITTEST_PROG_RUN) $$params --aot=outfile=$$tmpfile $$assembly >> test-aot-$${name}.stdout 2>> test-aot-$${name}.stderr;        \
1099                         then \
1100                                 passed=`expr $${passed} + 1`; \
1101                         else \
1102                                 failed=`expr $${failed} + 1`; \
1103                                 failed_tests="$${failed_tests} $$test_name"; \
1104                         fi \
1105                 done;   \
1106         done;   \
1107         rm      $$tmpfile;      \
1108         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1109         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1110         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1111
1112
1113 # Generated tests for runtime invoke
1114 EXTRA_DIST += gen-runtime-invoke.cs
1115 runtime-invoke.gen.exe: TestDriver.dll gen-runtime-invoke.exe
1116         $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
1117         $(MCS) -out:runtime-invoke.gen.exe -r:TestDriver.dll runtime-invoke.gen.cs
1118
1119 EXTRA_DIST += make-imt-test.cs
1120 imt_big_iface_test.exe: TestDriver.dll make-imt-test.exe
1121         $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
1122         $(MCS) -out:imt_big_iface_test.exe -r:TestDriver.dll imt_big_iface_test.cs
1123
1124 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
1125 test-inline-call-stack-library.dll: TestDriver.dll $(srcdir)/test-inline-call-stack-library.cs
1126         $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs
1127 test-inline-call-stack.exe: TestDriver.dll test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
1128         $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:test-inline-call-stack.exe $(srcdir)/test-inline-call-stack.cs
1129
1130 EXTRA_DIST += unhandled-exception-base-configuration.config
1131 EXTRA_DIST += unhandled-exception-legacy-configuration.config
1132 EXTRA_DIST += appdomain-unload.exe.config
1133 EXTRA_DIST += unhandled-exception-test-case.2.cs
1134 EXTRA_DIST += unhandled-exception-test-runner.2.cs
1135 unhandled-exception-test-case.1.cs: unhandled-exception-test-case.2.cs
1136         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case.1.cs
1137 unhandled-exception-test-case-legacy.1.cs: unhandled-exception-test-case.1.cs
1138         cp unhandled-exception-test-case.1.cs unhandled-exception-test-case-legacy.1.cs
1139 unhandled-exception-test-case-legacy.2.cs: unhandled-exception-test-case.2.cs
1140         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case-legacy.2.cs
1141 unhandled-exception-config_files: unhandled-exception-base-configuration.config unhandled-exception-legacy-configuration.config
1142         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.1.exe.config
1143         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.2.exe.config
1144         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.1.exe.config
1145         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.2.exe.config
1146 unhandled-exception-test-case.1.exe: unhandled-exception-test-case.1.cs
1147         $(MCS) /debug unhandled-exception-test-case.1.cs
1148 unhandled-exception-test-case-legacy.1.exe: unhandled-exception-test-case-legacy.1.cs
1149         $(MCS) /debug unhandled-exception-test-case-legacy.1.cs
1150 unhandled-exception-test-case.2.exe: unhandled-exception-test-case.2.cs
1151         $(MCS) /debug unhandled-exception-test-case.2.cs
1152 unhandled-exception-test-case-legacy.2.exe: unhandled-exception-test-case-legacy.2.cs
1153         $(MCS) /debug unhandled-exception-test-case-legacy.2.cs
1154 unhandled-exception-test-runner.2.exe: unhandled-exception-test-runner.2.cs
1155         $(MCS) /debug unhandled-exception-test-runner.2.cs
1156
1157 test-unhandled-exception: unhandled-exception-test-runner.2.exe unhandled-exception-config_files unhandled-exception-test-case.1.exe unhandled-exception-test-case-legacy.1.exe  unhandled-exception-test-case.2.exe unhandled-exception-test-case-legacy.2.exe
1158         $(RUNTIME) unhandled-exception-test-runner.2.exe RUNTIME:../mini/mono,GTC:F
1159
1160 # We use 'test-support-files' to handle an ordering issue between the 'mono/' and 'runtime/' directories
1161 bug-80307.exe: $(srcdir)/bug-80307.cs
1162         $(MCS) -r:System.Web -out:$@ $(srcdir)/bug-80307.cs
1163         cd $(top_builddir)/runtime && $(MAKE) test-support-files
1164
1165 EXTRA_DIST += bug-81673-interface.cs
1166 bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-81673-interface.cs
1167         $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1168         $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs
1169         $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1170
1171 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
1172 bug-81691.exe bug-81691-b.dll: $(srcdir)/bug-81691.cs $(srcdir)/bug-81691-a.cs $(srcdir)/bug-81691-b.cs
1173         $(MCS) -target:library -out:bug-81691-a.dll $(srcdir)/bug-81691-a.cs
1174         $(MCS) -target:library -out:bug-81691-b.dll -r:bug-81691-a.dll $(srcdir)/bug-81691-b.cs
1175         $(MCS) -r:bug-81691-b.dll -out:bug-81691.exe $(srcdir)/bug-81691.cs
1176         rm -f bug-81691-a.dll
1177 bug-81691.exe: bug-81691-b.dll
1178
1179 EXTRA_DIST += bug-81466-lib.il
1180 bug-81466-lib.dll: bug-81466-lib.il
1181         $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
1182 bug-81466.exe: bug-81466.il bug-81466-lib.dll
1183         $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
1184
1185 EXTRA_DIST += bug-324535-il.il
1186 bug-324535-il.dll : bug-324535-il.il
1187         $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
1188 bug-324535.exe : bug-324535.cs bug-324535-il.dll
1189         $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
1190
1191 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
1192 custom-modifiers-lib.dll: custom-modifiers-lib.il
1193         $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
1194 custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll
1195         $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
1196
1197 EXTRA_DIST += bug-382986-lib.cs
1198 bug-382986-lib.dll: bug-382986-lib.cs
1199         $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs
1200 bug-382986.exe: bug-382986.cs bug-382986-lib.dll
1201         $(MCS) -out:$@ -r:bug-382986-lib.dll $(srcdir)/bug-382986.cs
1202
1203 EXTRA_DIST += bug-17537-helper.cs
1204 bug-17537-helper.exe: bug-17537-helper.cs
1205         $(MCS) -out:$@ $(srcdir)/bug-17537-helper.cs
1206         chmod -x $@
1207
1208 bug-17537.exe: bug-17537.cs bug-17537-helper.exe
1209         $(MCS) -out:$@ $(srcdir)/bug-17537.cs
1210
1211 EXTRA_DIST += coreclr-security.cs
1212
1213 coreclr-security.exe : coreclr-security.cs
1214         $(SMCS) -out:coreclr-security.exe $(srcdir)/coreclr-security.cs
1215
1216 test-coreclr-security : coreclr-security.exe
1217         @echo "Testing coreclr-security.exe..."
1218         @$(RUNTIME_MOONLIGHT) --security=core-clr-test coreclr-security.exe
1219
1220 EXTRA_DIST += generic-unboxing.2.il
1221 generic-unboxing.2.dll : generic-unboxing.2.il
1222         $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
1223
1224 EXTRA_DIST += generic-boxing.2.il
1225 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
1226         $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
1227
1228 EXTRA_DIST += generic-unbox.2.cs
1229 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
1230         $(MCS) -r:generic-unboxing.2.dll -out:$@ $(srcdir)/generic-unbox.2.cs
1231
1232 EXTRA_DIST += generic-box.2.cs
1233 generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
1234         $(MCS) -r:generic-unboxing.2.dll,generic-boxing.2.dll -out:$@ $(srcdir)/generic-box.2.cs
1235
1236 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
1237 generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
1238         $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il
1239 generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
1240         $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
1241
1242 bug-3903.exe: bug-3903.cs
1243         $(MCS) -sdk:2 $(srcdir)/bug-3903.cs -out:$@
1244
1245 gshared: test-generic-sharing
1246
1247 gshared-aot:
1248         @$(MAKE) AOT=1 gshared
1249
1250 GSHARED_TESTS = \
1251                 generics-sharing.2.exe shared-generic-methods.2.exe     \
1252                 shared-generic-synchronized.2.exe generic-initobj.2.exe         \
1253                 generics-sharing-other-exc.2.exe generic-box.2.exe              \
1254                 generic-unbox.2.exe generic-delegate.2.exe generic-sizeof.2.exe \
1255                 generic-ldobj.2.exe generic-mkrefany.2.exe                      \
1256                 generic-refanyval.2.exe generic-ldtoken.2.exe                   \
1257                 generic-ldtoken-method.2.exe  generic-ldtoken-field.2.exe       \
1258                 generic-virtual.2.exe generic-tailcall.2.exe                    \
1259                 generic-interface-methods.2.exe generic-array-type.2.exe        \
1260                 generic-method-patching.2.exe generic-static-methods.2.exe      \
1261                 generic-null-call.2.exe generic-tailcall2.2.exe                 \
1262                 generic-array-exc.2.exe generic-special.2.exe                   \
1263                 generic-exceptions.2.exe generic-delegate2.2.exe                \
1264                 generic-virtual2.2.exe generic-valuetype-interface.2.exe        \
1265                 generic-valuetype-newobj.2.exe generic-valuetype-newobj2.2.exe  \
1266                 generic-getgenericarguments.2.exe generic-type-builder.2.exe    \
1267                 generic-synchronized.2.exe generic-delegate-ctor.2.exe          \
1268                 generic-constrained.2.exe bug-431413.2.exe                      \
1269                 generic-virtual-invoke.2.exe generic-typedef.2.exe              \
1270                 generic-marshalbyref.2.exe bug-459285.2.exe bug-461198.2.exe    \
1271                 generic-sealed-virtual.2.exe generic-system-arrays.2.exe        \
1272                 generic-stack-traces.2.exe generic-stack-traces2.2.exe          \
1273                 bug-472600.2.exe bug-473482.2.exe bug-473999.2.exe              \
1274                 bug-479763.2.exe                                \
1275                 generic-type-load-exception.2.exe bug-616463.exe        \
1276                 bug-1147.exe
1277
1278 test-generic-sharing-normal: $(GSHARED_TESTS)
1279         @for fn in $+ ; do      \
1280                 echo "Testing $$fn ...";        \
1281                 MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared                $$fn > $$fn.stdout || exit 1;     \
1282                 MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared,shared         $$fn > $$fn.stdout || exit 1;     \
1283                 MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared,-inline        $$fn > $$fn.stdout || exit 1;     \
1284                 MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared,-inline,shared $$fn > $fn.stdout || exit 1;      \
1285                 if [ x$(AOT) = x1 ]; then MONO_GENERIC_SHARING=all $(with_mono_path) $(JITTEST_PROG_RUN) --aot --debug $$fn > /dev/null || exit 1; MONO_GENERIC_SHARING=all $(RUNTIME) $$fn > $$fn.stdout || exit 1; fi; \
1286         done
1287
1288 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
1289         @$(RUNTIME) ./test-runner.exe -j a --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
1290
1291 if NACL_CODEGEN
1292 test-generic-sharing:
1293 else
1294 test-generic-sharing:
1295         @if test x$(M) != x0; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
1296 endif
1297
1298 EXTRA_DIST += async-exceptions.cs
1299 async-exceptions.exe : async-exceptions.cs
1300         $(MCS) -out:async-exceptions.exe $(srcdir)/async-exceptions.cs
1301 test-async-exceptions : async-exceptions.exe
1302         for i in `echo 0 1 2 3 4 5 6 7 8 9 10`; do $(RUNTIME) --inject-async-exc Tests:foo $$i async-exceptions.exe || exit 1; done
1303         for i in `echo 0 1 2 3 4 5 6 7 8 9 10`; do $(RUNTIME) --inject-async-exc Tests:bar $$i async-exceptions.exe || exit 1; done
1304
1305 EXTRA_DIST += modules.cs modules-m1.cs
1306 modules-m1.netmodule: modules-m1.cs
1307         $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
1308 modules.exe: modules.cs modules-m1.netmodule TestDriver.dll
1309         $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
1310
1311 # Useful if mono is compiled with --enable-shared=no
1312 patch-libtool:
1313         cp "../../libtool" .
1314         sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool
1315         sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
1316         touch libtest.c
1317
1318
1319 if NACL_CODEGEN
1320 test-process-exit:
1321 else
1322 EXTRA_DIST += threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
1323 test-process-exit:
1324         @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
1325         @echo "Testing threadpool-in-processexit.exe..."
1326         @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
1327         @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
1328 endif
1329
1330 OOM_TESTS =     \
1331         gc-oom-handling.exe     \
1332         gc-oom-handling2.exe
1333
1334
1335 test-oom: $(OOM_TESTS)
1336         @for fn in $+ ; do      \
1337                 echo "Testing $$fn ...";        \
1338                 MONO_GC_PARAMS=max-heap-size=16m MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.stdout || exit 1;      \
1339                 MONO_GC_PARAMS=max-heap-size=16m                                                  $(RUNTIME) $$fn > $$fn.stdout || exit 1;      \
1340         done
1341
1342
1343 noinst_LTLIBRARIES = libtest.la
1344
1345 AM_CPPFLAGS = $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
1346
1347 if HOST_WIN32
1348 # gcc-3.4.4 emits incorrect code when making indirect calls to stdcall functions using a tail call
1349 # This shows up when compiling mono_test_marshal_delegate ()
1350 libtest_la_CFLAGS=-fno-optimize-sibling-calls
1351 # the exported names created by gcc for stdcall functions are missing the leading _, so MS.NET
1352 # can't find them. So we use --kill-at to remove the @ suffix as well.
1353 libtest_la_LDFLAGS=-no-undefined -rpath `pwd` -Wl,--kill-at
1354 else
1355 libtest_la_LDFLAGS = -rpath `pwd`
1356 endif
1357 libtest_la_SOURCES = libtest.c
1358 libtest_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
1359
1360 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.aotlog *.exe stest.dat