[threadpool] Do not swallow exception in RegisterWaitForSingleObject callback (#4408)
[mono.git] / mono / tests / Makefile.am
1 SUBDIRS = assemblyresolve gc-descriptors
2
3 if FULL_AOT_TESTS
4 FEATUREFUL_RUNTIME_TEST =  
5 else
6 FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
7 endif
8
9 check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform \
10                  test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs
11 check-full: test-sgen check-local
12 check-parallel: compile-tests check-full
13
14 check-coreclr:
15         $(MAKE) -C $(mono_build_root)/acceptance-tests check-coreclr
16
17 # for backwards compatibility on Wrench
18 test-wrench: check-parallel
19
20 aotcheck: testaot gshared-aot
21
22 TEST_PROG = ../interpreter/mint
23
24 JITTEST_PROG = $(if $(VALGRIND), valgrind $(VALGRIND_ARGS),) $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/mono/mini/mono)
25
26 TEST_PROG_RUN = MONO_CFG_DIR=$(mono_build_root)/runtime/etc $(LIBTOOL) --mode=execute $(TEST_PROG)
27 JITTEST_PROG_RUN = MONO_CFG_DIR=$(mono_build_root)/runtime/etc $(LIBTOOL) --mode=execute $(JITTEST_PROG)
28
29 RUNTIME_ARGS=--config tests-config --optimize=all --debug
30
31 if HOST_WIN32
32 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(shell cygpath -w -a $(MONO_EXECUTABLE) | sed 's/\\/\\\\/g'),mono)
33 else
34 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
35 endif
36
37 TEST_RUNNER_ARGS += $(if $(V), --verbose,)
38
39 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
40
41 with_mono_path = MONO_PATH=$(CLASS)
42
43 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
44 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper --aot-path=$(mcs_topdir)/class/lib/build
45
46 MKBUNDLE = \
47         PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \
48         $(RUNTIME) $(CLASS)/mkbundle.exe
49
50 if FULL_AOT_TESTS
51 PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_LEGACY,FULL_AOT_DESKTOP 
52 endif
53
54 if HYBRID_AOT_TESTS
55 PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_LEGACY 
56 endif
57
58 MCS_NO_LIB = $(TOOLS_RUNTIME) $(CSC) -unsafe -debug:portable \
59         -noconfig -nologo \
60         -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \
61         -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
62         -nowarn:0197 $(PROFILE_MCS_FLAGS)
63
64 MCS = $(MCS_NO_LIB) -lib:$(CLASS)
65
66 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
67
68 if FULL_AOT_TESTS
69 TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
70 else
71 TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)"
72 endif
73
74
75 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
76
77 STRESS_TESTS_SRC=       \
78         abort-stress-1.cs       \
79         abort-stress-2.cs       \
80         abort-stress-3.cs       \
81         domain-stress.cs        \
82         gchandle-stress.cs      \
83         monitor-stress.cs       \
84         thread-stress.cs        \
85         gc-stress.cs            \
86         gc-copy-stress.cs       \
87         gc-graystack-stress.cs          \
88         exit-stress.cs          \
89         process-stress.cs       \
90         assembly-load-stress.cs
91
92 # Disabled until ?mcs is fixed
93 #       bug-331958.cs
94 BASE_TEST_CS_SRC=               \
95         generic-unloading-sub.2.cs      \
96         create-instance.cs      \
97         bug-2907.cs             \
98         array-init.cs           \
99         arraylist.cs            \
100         assembly-load-remap.cs  \
101         assemblyresolve_event.cs        \
102         assemblyresolve_event3.cs       \
103         assemblyresolve_event4.cs       \
104         checked.cs              \
105         char-isnumber.cs        \
106         field-layout.cs         \
107         pack-layout.cs          \
108         pack-bug.cs             \
109         hash-table.cs           \
110         test-ops.cs             \
111         obj.cs                  \
112         test-dup-mp.cs          \
113         string.cs               \
114         stringbuilder.cs        \
115         switch.cs               \
116         outparm.cs              \
117         delegate.cs             \
118         bitconverter.cs         \
119         exception.cs            \
120         exception2.cs           \
121         exception3.cs           \
122         exception4.cs           \
123         exception5.cs           \
124         exception6.cs           \
125         exception7.cs           \
126         exception8.cs           \
127         exception10.cs          \
128         exception11.cs          \
129         exception12.cs          \
130         exception13.cs          \
131         exception14.cs          \
132         exception15.cs          \
133         exception16.cs          \
134         exception17.cs          \
135         exception18.cs          \
136         typeload-unaligned.cs   \
137         struct.cs               \
138         valuetype-gettype.cs    \
139         typeof-ptr.cs           \
140         static-constructor.cs   \
141         pinvoke.cs              \
142         pinvoke-utf8.cs         \
143         pinvoke3.cs             \
144         pinvoke11.cs            \
145         pinvoke13.cs            \
146         pinvoke17.cs            \
147         invoke.cs               \
148         invoke2.cs              \
149         runtime-invoke.cs               \
150         invoke-string-ctors.cs          \
151         reinit.cs               \
152         box.cs                  \
153         array.cs                \
154         enum.cs                 \
155         enum2.cs                \
156         enum-intrins.cs         \
157         property.cs             \
158         enumcast.cs             \
159         assignable-tests.cs     \
160         array-cast.cs           \
161         array-subtype-attr.cs   \
162         cattr-compile.cs        \
163         cattr-field.cs          \
164         cattr-object.cs         \
165         custom-attr.cs          \
166         double-cast.cs          \
167         newobj-valuetype.cs     \
168         arraylist-clone.cs      \
169         setenv.cs               \
170         vtype.cs                \
171         isvaluetype.cs          \
172         iface6.cs               \
173         iface7.cs               \
174         ipaddress.cs            \
175         array-vt.cs             \
176         interface1.cs           \
177         reflection-enum.cs      \
178         reflection-prop.cs      \
179         reflection4.cs          \
180         reflection5.cs          \
181         reflection-const-field.cs \
182         many-locals.cs          \
183         string-compare.cs       \
184         test-prime.cs           \
185         test-tls.cs             \
186         params.cs               \
187         reflection.cs           \
188         interface.cs            \
189         iface.cs                \
190         iface2.cs               \
191         iface3.cs               \
192         iface4.cs               \
193         iface-large.cs          \
194         virtual-method.cs       \
195         intptrcast.cs           \
196         indexer.cs              \
197         stream.cs               \
198         console.cs              \
199         shift.cs                \
200         jit-int.cs              \
201         jit-uint.cs             \
202         jit-long.cs             \
203         long.cs                 \
204         jit-ulong.cs            \
205         jit-float.cs            \
206         pop.cs                  \
207         time.cs                 \
208         pointer.cs              \
209         hashcode.cs             \
210         delegate1.cs            \
211         delegate2.cs            \
212         delegate3.cs            \
213         delegate5.cs            \
214         delegate6.cs            \
215         delegate7.cs            \
216         delegate8.cs            \
217         delegate10.cs           \
218         delegate11.cs           \
219         delegate12.cs           \
220         delegate13.cs           \
221         largeexp.cs             \
222         largeexp2.cs            \
223         marshalbyref1.cs        \
224         static-ctor.cs          \
225         inctest.cs              \
226         bound.cs                \
227         array-invoke.cs         \
228         test-arr.cs             \
229         decimal.cs              \
230         decimal-array.cs        \
231         marshal.cs              \
232         marshal1.cs             \
233         marshal2.cs             \
234         marshal3.cs             \
235         marshal5.cs             \
236         marshal6.cs             \
237         marshal7.cs             \
238         marshal8.cs             \
239         marshal9.cs             \
240         marshalbool.cs          \
241         test-byval-in-struct.cs \
242         thread.cs               \
243         thread5.cs              \
244         thread-static.cs        \
245         thread-static-init.cs   \
246         context-static.cs       \
247         float-pop.cs            \
248         interfacecast.cs        \
249         array3.cs               \
250         classinit.cs            \
251         classinit2.cs           \
252         classinit3.cs           \
253         synchronized.cs         \
254         async_read.cs           \
255         threadpool.cs           \
256         threadpool1.cs          \
257         threadpool-exceptions1.cs \
258         threadpool-exceptions2.cs \
259         threadpool-exceptions3.cs \
260         threadpool-exceptions4.cs \
261         threadpool-exceptions5.cs \
262         threadpool-exceptions6.cs \
263         base-definition.cs      \
264         bug-27420.cs            \
265         bug-46781.cs            \
266         bug-42136.cs            \
267         bug-59286.cs            \
268         bug-70561.cs            \
269         bug-78311.cs            \
270         bug-78653.cs            \
271         bug-78656.cs            \
272         bug-77127.cs            \
273         bug-323114.cs           \
274         bug-Xamarin-5278.cs     \
275         interlocked.cs          \
276         delegate-async-exit.cs  \
277         delegate-delegate-exit.cs       \
278         delegate-exit.cs        \
279         finalizer-abort.cs      \
280         finalizer-exception.cs  \
281         finalizer-exit.cs       \
282         finalizer-thread.cs     \
283         main-exit.cs    \
284         main-returns-abort-resetabort.cs        \
285         main-returns-background-abort-resetabort.cs     \
286         main-returns-background-resetabort.cs   \
287         main-returns-background.cs      \
288         main-returns-background-change.cs       \
289         main-returns.cs         \
290         subthread-exit.cs       \
291         desweak.cs              \
292         exists.cs               \
293         handleref.cs    \
294         dbnull-missing.cs       \
295         test-type-ctor.cs       \
296         soft-float-tests.cs     \
297         thread-exit.cs          \
298         finalize-parent.cs      \
299         interlocked-2.2.cs      \
300         pinvoke-2.2.cs          \
301         bug-78431.2.cs          \
302         bug-79684.2.cs          \
303         catch-generics.2.cs     \
304         event-get.2.cs          \
305         safehandle.2.cs         \
306         module-cctor-loader.2.cs        \
307         generics-invoke-byref.2.cs      \
308         generic-signature-compare.2.cs  \
309         generics-sharing.2.cs   \
310         shared-generic-methods.2.cs     \
311         shared-generic-synchronized.2.cs        \
312         generic-inlining.2.cs   \
313         generic-initobj.2.cs    \
314         generic-delegate.2.cs   \
315         generic-sizeof.2.cs     \
316         generic-virtual.2.cs    \
317         generic-interface-methods.2.cs  \
318         generic-array-type.2.cs \
319         generic-method-patching.2.cs    \
320         generic-static-methods.2.cs     \
321         generic-null-call.2.cs  \
322         generic-special.2.cs    \
323         generic-exceptions.2.cs \
324         generic-virtual2.2.cs   \
325         generic-valuetype-interface.2.cs        \
326         generic-getgenericarguments.2.cs        \
327         generic-synchronized.2.cs       \
328         generic-delegate-ctor.2.cs      \
329         generic-array-iface-set.2.cs    \
330         generic-typedef.2.cs    \
331         bug-431413.2.cs \
332         bug-459285.2.cs \
333         generic-virtual-invoke.2.cs     \
334         bug-461198.2.cs \
335         generic-sealed-virtual.2.cs     \
336         generic-system-arrays.2.cs      \
337         generic-stack-traces.2.cs       \
338         generic-stack-traces2.2.cs      \
339         bug-472600.2.cs \
340         recursive-generics.2.cs \
341         bug-473482.2.cs \
342         bug-473999.2.cs \
343         bug-479763.2.cs \
344         bug-616463.cs   \
345         bug-80392.2.cs          \
346         bug-82194.2.cs  \
347         anonarray.2.cs  \
348         ienumerator-interfaces.2.cs     \
349         array-enumerator-ifaces.2.cs    \
350         generic_type_definition_encoding.2.cs \
351         bug-333798.2.cs         \
352         bug-348522.2.cs         \
353         bug-340662_bug.cs       \
354         bug-325283.2.cs \
355         thunks.cs \
356         winx64structs.cs \
357         nullable_boxing.2.cs    \
358         valuetype-equals.cs     \
359         custom-modifiers.2.cs   \
360         bug-382986.cs   \
361         test-inline-call-stack.cs       \
362         bug-324535.cs   \
363         modules.cs      \
364         bug-81673.cs    \
365         bug-81691.cs    \
366         bug-415577.cs   \
367         filter-stack.cs \
368         vararg.cs       \
369         vararg2.cs      \
370         bug-461867.cs   \
371         bug-461941.cs   \
372         bug-461261.cs   \
373         bug-400716.cs   \
374         bug-459094.cs   \
375         bug-467456.cs   \
376         bug-508538.cs   \
377         bug-472692.2.cs         \
378         gchandles.cs    \
379         interlocked-3.cs        \
380         interlocked-4.2.cs      \
381         w32message.cs   \
382         gc-altstack.cs  \
383         large-gc-bitmap.cs      \
384         bug-561239.cs   \
385         bug-562150.cs   \
386         bug-599469.cs   \
387         monitor-resurrection.cs \
388         monitor-wait-abort.cs   \
389         monitor-abort.cs        \
390         bug-666008.cs   \
391         bug-685908.cs   \
392         sgen-long-vtype.cs      \
393         delegate-invoke.cs      \
394         bug-696593.cs   \
395         bug-705140.cs   \
396         bug-1147.cs     \
397         mono-path.cs    \
398         bug-bxc-795.cs  \
399         bug-3903.cs     \
400         async-with-cb-throws.cs \
401         bug-6148.cs     \
402         bug-10127.cs    \
403         bug-18026.cs    \
404         allow-synchronous-major.cs      \
405         block_guard_restore_aligment_on_exit.cs \
406         thread_static_gc_layout.cs \
407         sleep.cs \
408         bug-27147.cs    \
409         bug-30085.cs    \
410         bug-17537.cs    \
411         pinvoke_ppcc.cs \
412         pinvoke_ppcs.cs \
413         pinvoke_ppci.cs \
414         pinvoke_ppcf.cs \
415         pinvoke_ppcd.cs \
416         bug-29585.cs    \
417         priority.cs     \
418         abort-cctor.cs  \
419         thread-native-exit.cs \
420         reference-loader.cs \
421         thread-suspend-suspended.cs \
422         thread-suspend-selfsuspended.cs \
423         remoting4.cs    \
424         remoting1.cs    \
425         remoting2.cs    \
426         remoting3.cs    \
427         remoting5.cs    \
428         appdomain.cs    \
429         appdomain-client.cs     \
430         appdomain-unload.cs     \
431         appdomain-async-invoke.cs       \
432         appdomain-thread-abort.cs       \
433         appdomain1.cs   \
434         appdomain2.cs   \
435         appdomain-exit.cs       \
436         assemblyresolve_event2.2.cs     \
437         appdomain-unload-callback.cs    \
438         appdomain-unload-doesnot-raise-pending-events.cs        \
439         unload-appdomain-on-shutdown.cs \
440         bug-47295.cs    \
441         loader.cs       \
442         pinvoke2.cs     \
443         generic-type-builder.2.cs       \
444         dynamic-generic-size.cs \
445         cominterop.cs   \
446         dynamic-method-access.2.cs      \
447         dynamic-method-finalize.2.cs    \
448         dynamic-method-stack-traces.cs  \
449         generic_type_definition.2.cs    \
450         bug-333798-tb.2.cs      \
451         bug-335131.2.cs \
452         bug-322722_patch_bx.2.cs        \
453         bug-322722_dyn_method_throw.2.cs        \
454         bug-389886-2.cs \
455         bug-349190.2.cs \
456         bug-389886-sre-generic-interface-instances.cs   \
457         bug-462592.cs   \
458         bug-575941.cs   \
459         bug-389886-3.cs \
460         constant-division.cs    \
461         dynamic-method-resurrection.cs  \
462         bug-80307.cs    \
463         assembly_append_ordering.cs     \
464         bug-544446.cs   \
465         bug-36848.cs    \
466         generic-marshalbyref.2.cs       \
467         stackframes-async.2.cs  \
468         transparentproxy.cs     \
469         bug-48015.cs    \
470         delegate9.cs    \
471         marshal-valuetypes.cs   \
472         xdomain-threads.cs      \
473         monitor.cs      \
474         generic-xdomain.2.cs    \
475         threadpool-exceptions7.cs       \
476         cross-domain.cs \
477         generic-unloading.2.cs  \
478         namedmutex-destroy-race.cs      \
479         thread6.cs      \
480         appdomain-threadpool-unload.cs  \
481         process-unref-race.cs   \
482         bug-46661.cs
483
484 TEST_CS_SRC_DIST=       \
485         $(BASE_TEST_CS_SRC)     \
486         async-exc-compilation.cs \
487         filter-stack.cs \
488         finally_guard.cs \
489         finally_block_ending_in_dead_bb.cs
490
491 TEST_CS_SRC_GEN = \
492         runtime-invoke.gen.cs \
493         imt_big_iface_test.cs
494
495 if AMD64
496 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
497 else
498 if X86
499 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
500 else
501 TEST_CS_SRC = $(BASE_TEST_CS_SRC) $(TEST_CS_SRC_GEN)
502 endif
503 endif
504
505 if IA64
506 TEST_CS_SRC+=async-exc-compilation.cs filter-stack.cs
507 endif
508
509 TEST_IL_SRC=                    \
510         field-access.il         \
511         method-access.il        \
512         ldftn-access.il         \
513         cpblkTest.il            \
514         vbinterface.il          \
515         calliTest.il            \
516         calliGenericTest.il             \
517         ckfiniteTest.il         \
518         fault-handler.il                \
519         locallocTest.il         \
520         initblkTest.il          \
521         qt-instance.il          \
522         vararg.il               \
523         bug-29859.il            \
524         bug-78549.il            \
525         static-fields-nonconst.il       \
526         reload-at-bb-end.il     \
527         test-enum-indstoreil.il \
528         filter-bug.il           \
529         even-odd.il             \
530         bug-82022.il    \
531         vt-sync-method.il       \
532         enum_types.il   \
533         invalid-token.il        \
534         call_missing_method.il  \
535         call_missing_class.il   \
536         ldfld_missing_field.il  \
537         ldfld_missing_class.il  \
538         find-method.2.il        \
539         bug-79215.2.il  \
540         bug-79956.2.il  \
541         bug-327438.2.il \
542         bug-387274.2.il \
543         bug-426309.2.il \
544         ldtoken_with_byref_typespec.2.il \
545         resolve_method_bug.2.il \
546         resolve_field_bug.2.il \
547         resolve_type_bug.2.il   \
548         generics-sharing-other-exc.2.il \
549         generic-ldobj.2.il      \
550         generic-mkrefany.2.il   \
551         generic-refanyval.2.il  \
552         generic-ldtoken.2.il    \
553         generic-ldtoken-method.2.il     \
554         generic-ldtoken-field.2.il      \
555         generic-tailcall.2.il   \
556         generic-tailcall2.2.il  \
557         generic-array-exc.2.il  \
558         generic-valuetype-newobj2.2.il  \
559         generic-valuetype-newobj.2.il   \
560         generic-constrained.2.il        \
561         generic-type-load-exception.2.il        \
562         bug-81466.il    \
563         bug457574.il    \
564         bug445361.il    \
565         bug-463303.il   \
566         bug469742.2.il  \
567         bug-528055.il   \
568         array_load_exception.il \
569         bug-481403.il   \
570         interface-with-static-method.il \
571         bug-633291.il   \
572         delegate-with-null-target.il    \
573         bug-318677.il   \
574         gsharing-valuetype-layout.il    \
575         invalid_generic_instantiation.il \
576         bug-45841-fpstack-exceptions.il
577
578 if AMD64
579 # #651684
580 PLATFORM_DISABLED_TESTS = finally_guard.exe
581 endif
582
583 if IA64
584 # bug #319249
585 PLATFORM_DISABLED_TESTS=exception17.exe
586 PLATFORM_DISABLED_TESTS+=winx64structs.exe
587 endif
588
589 if X86
590
591 if HOST_WIN32
592 PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
593         bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe
594 endif
595
596 endif
597
598 if POWERPC
599 # bug #71274
600 PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
601 endif
602
603 if POWERPC64
604 # FIXME: These tests hang/fail for unknown reasons
605 PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
606         pinvoke2.exe pinvoke3.exe pinvoke11.exe threadpool-exceptions7.exe winx64structs.exe bug-10127.exe pinvoke_ppcc.exe \
607         pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe abort-cctor.exe \
608         sgen-domain-unload-2.exe sgen-weakref-stress.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw.exe \
609         sgen-new-threads-dont-join-stw-2.exe sgen-new-threads-collect.exe sgen-bridge.exe
610 endif
611
612 if ARM
613 PLATFORM_DISABLED_TESTS=filter-stack.exe
614 endif
615
616 if MIPS
617 # monitor.exe is racy
618 PLATFORM_DISABLED_TESTS=filter-stack.exe monitor.exe
619 endif
620
621 if S390X
622 PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
623 #PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
624 endif
625
626 if NACL_CODEGEN
627 # Tests that use Thread.Abort()
628 PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
629                          abort-stress-2.exe \
630                          abort-stress-3.exe \
631                          appdomain-thread-abort.exe \
632                          async-exc-compilation.exe \
633                          bug-561239.exe \
634                          bug-70561.exe \
635                          finalizer-abort.exe \
636                          finally_guard.exe \
637                          finally_block_ending_in_dead_bb.exe \
638                          main-returns-abort-resetabort.exe \
639                          main-returns-background-abort-resetabort.exe \
640                          thread6.exe \
641                          threadpool-exceptions5.exe \
642                          threadpool-exceptions6.exe
643
644 # Tests that rely on AppDomain.Unload
645 PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
646                           appdomain-exit.exe \
647                           appdomain-unload-callback.exe \
648                           appdomain-unload.exe \
649                           domain-stress.exe \
650                           generic-unloading.2.exe \
651                           monitor.exe \
652                           remoting4.exe \
653                           threadpool-exceptions7.exe \
654                           xdomain-threads.exe
655
656 # pinvoke2 attaches a thread to the runtime, but
657 # doesn't 'unattach' it and it hangs in GC on exit
658 PLATFORM_DISABLED_TESTS+= pinvoke2.exe
659
660 # Tests that currently hang waiting for non-main threads
661 # to exit in NaCl, need to investigate.  Most are AppDomain
662 # creation and Delegate tests.
663 PLATFORM_DISABLED_TESTS+= appdomain1.exe \
664                           delegate9.exe \
665                           marshal-valuetypes.exe \
666                           cross-domain.exe \
667                           stackframes-async.2.exe \
668                           generic-marshalbyref.2.exe \
669                           generic-xdomain.2.exe \
670                           bug-415577.exe
671
672 # Tests that fail trying to write files (appdomain create mostly)
673 PLATFORM_DISABLED_TESTS+= bug-335131.2.exe \
674                           bug-349190.2.exe \
675                           bug-80307.exe \
676                           bug-462592.exe
677
678 # FIXME: don't know why delegate2.exe fails, it shouldn't
679 PLATFORM_DISABLED_TESTS+= delegate2.exe
680
681 # These tests newly fail with the latest revision. pinvoke3 fails because
682 # of a thread attach, the others have not been investigated.  TODO revisit.
683 PLATFORM_DISABLED_TESTS+= pinvoke3.exe \
684                           async_read.exe \
685                           async-with-cb-throws.exe \
686                           appdomain-unload-doesnot-raise-pending-events.exe \
687                           gsharing-valuetype-layout.exe
688
689 if X86
690 # FIXME: There are problems with async callbacks and results on NaCl 32-bit
691 PLATFORM_DISABLED_TESTS+= delegate1.exe \
692                           delegate3.exe \
693                           delegate5.exe \
694                           delegate8.exe \
695                           threadpool.exe \
696                           threadpool1.exe \
697                           threadpool-exceptions3.exe \
698                           bug-323114.exe \
699                           delegate-exit.exe \
700                           bug-80392.2.exe
701
702 # FIXME: These tests hang/fail for unknown reasons, deal with exiting
703 PLATFORM_DISABLED_TESTS+= main-returns-background-resetabort.exe \
704                           main-returns-background.exe \
705                           main-returns-background-change.exe
706 endif
707
708 endif
709
710 if ENABLE_COOP
711 COOP_DISABLED_TESTS= thunks.exe
712 else
713 COOP_DISABLED_TESTS= 
714 endif
715
716 PROFILE_DISABLED_TESTS=
717
718 if FULL_AOT_TESTS
719 # Tests which rely on TypeLoadExceptions
720 # In full-aot mode, these cause the relevant methods to be not AOTed.
721 PROFILE_DISABLED_TESTS += \
722         typeload-unaligned.exe \
723         field-access.exe \
724         invalid_generic_instantiation.exe \
725         bug-481403.exe \
726         array_ldelema.exe \
727         array_load_exception.exe \
728         bug445361.exe \
729         generic-type-load-exception.2.exe \
730         invalid-token.exe \
731         call_missing_method.exe \
732         call_missing_class.exe \
733         ldfld_missing_field.exe \
734         ldfld_missing_class.exe \
735         vt-sync-method.exe
736
737 # Tests which rely on remoting
738 PROFILE_DISABLED_TESTS += \
739         context-static.exe \
740         bug-415577.exe \
741         generic-marshalbyref.2.exe \
742         unhandled-exception-7.exe
743
744 # Tests which use unsupported pinvoke+full aot
745 # functionality
746 PROFILE_DISABLED_TESTS += \
747         marshal.exe \
748         marshal2.exe \
749         marshal6.exe \
750         marshal7.exe \
751         marshal8.exe \
752         pinvoke-2.2.exe \
753         pinvoke3.exe \
754         thunks.exe
755
756 # Tests which load assemblies which are not
757 # in the testing_aot_full profile
758 PROFILE_DISABLED_TESTS += \
759         assembly-load-remap.exe
760
761 # Test which needs remoting support
762 PROFILE_DISABLED_TESTS += \
763         remoting4.exe   \
764         remoting1.exe   \
765         remoting2.exe   \
766         remoting3.exe   \
767         remoting5.exe
768
769 # Tests which needs AppDomain support
770 PROFILE_DISABLED_TESTS += \
771         appdomain.exe   \
772         appdomain-client.exe    \
773         appdomain-unload.exe    \
774         appdomain-async-invoke.exe      \
775         appdomain-thread-abort.exe      \
776         appdomain1.exe  \
777         appdomain2.exe  \
778         appdomain-exit.exe      \
779         appdomain-unload-callback.exe   \
780         appdomain-unload-doesnot-raise-pending-events.exe       \
781         unload-appdomain-on-shutdown.exe        \
782         assemblyresolve_event2.2.exe    \
783         bug-544446.exe  \
784         bug-36848.exe   \
785         generic-marshalbyref.2.exe      \
786         stackframes-async.2.exe \
787         transparentproxy.exe    \
788         bug-48015.exe   \
789         delegate9.exe   \
790         marshal-valuetypes.exe  \
791         xdomain-threads.exe     \
792         monitor.exe     \
793         generic-xdomain.2.exe   \
794         threadpool-exceptions7.exe      \
795         cross-domain.exe        \
796         generic-unloading.2.exe \
797         appdomain-threadpool-unload.exe
798
799 # Tests which needs System.Reflection.Emit support
800 PROFILE_DISABLED_TESTS += \
801         bug-47295.exe   \
802         loader.exe      \
803         pinvoke2.exe    \
804         generic-type-builder.2.exe      \
805         dynamic-generic-size.exe        \
806         cominterop.exe  \
807         dynamic-method-access.2.exe     \
808         dynamic-method-finalize.2.exe   \
809         dynamic-method-stack-traces.exe \
810         generic_type_definition.2.exe   \
811         bug-333798-tb.2.exe     \
812         bug-335131.2.exe        \
813         bug-322722_patch_bx.2.exe       \
814         bug-322722_dyn_method_throw.2.exe       \
815         bug-389886-2.exe        \
816         bug-349190.2.exe        \
817         bug-389886-sre-generic-interface-instances.exe  \
818         bug-462592.exe  \
819         bug-575941.exe  \
820         bug-389886-3.exe        \
821         constant-division.exe   \
822         dynamic-method-resurrection.exe \
823         assembly_append_ordering.exe
824
825 # Test which needs System.Web support
826 PROFILE_DISABLED_TESTS += \
827         bug-80307.exe
828
829 # Tests which needs named Mutex support
830 PROFILE_DISABLED_TESTS += \
831         namedmutex-destroy-race.exe
832
833 # ThreadAbortException doesn't have necessary field for this test
834 PROFILE_DISABLED_TESTS += \
835         thread6.exe
836
837 # can't AOT the TestingReferenceAssembly.dll which is a dependency
838 # of reference-loader.exe because it contains the [ReferenceAssemblyAttribute]
839 # and the runtime errors out with "File does not contain a valid CIL image."
840 PROFILE_DISABLED_TESTS += \
841         reference-loader.exe
842
843 # constraints-load.il: 
844 # Failed to load method 0x6000007 from '..../mono/tests/constraints-load.exe' due to 
845 # Could not resolve type with token 01000002 assembly:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.BrokenIComparable`1 member:<none>.
846 PROFILE_DISABLED_TESTS += \
847         constraints-load.exe \
848         bug-515884.exe
849 endif
850
851 if HYBRID_AOT_TESTS
852 PROFILE_DISABLED_TESTS += \
853         bug-80307.exe \
854         namedmutex-destroy-race.exe
855 endif
856
857 AOT_DISABLED_TESTS= \
858         constraints-load.exe
859
860 CI_DISABLED_TESTS = \
861         main-returns-background-resetabort.exe \
862         main-returns-background-abort-resetabort.exe    \
863         assemblyresolve_event3.exe \
864         delegate2.exe   \
865         finally_guard.exe \
866         generic-xdomain.2.exe
867
868 # failing tests which we temporarily disable for PRs
869 # so they don't interfere with other people's work
870 CI_PR_DISABLED_TESTS = \
871         appdomain-threadpool-unload.exe \
872         appdomain-thread-abort.exe
873
874 # appdomain-threadpool-unload.exe creates 100 appdomains, takes too long with llvm
875 LLVM_DISABLED_TESTS = \
876         appdomain-threadpool-unload.exe
877
878 LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS))
879
880 # The two finalizer tests only work under sgen
881 # gc-altstack.exe fails under boehm because it has no support for altstack
882 # bug-459094.exe creates an extremely deep directory tree
883 # delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
884 # reverted.
885 # bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
886 # bug-45841-fpstack-exceptions.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47053
887 # appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054
888 DISABLED_TESTS=                 \
889         delegate-async-exception.exe    \
890         bug-348522.2.exe        \
891         bug-459094.exe \
892         delegate-invoke.exe \
893         bug-Xamarin-5278.exe \
894         bug-45841-fpstack-exceptions.exe \
895         appdomain-thread-abort.exe \
896         $(PLATFORM_DISABLED_TESTS) \
897         $(EXTRA_DISABLED_TESTS) \
898         $(COOP_DISABLED_TESTS) \
899         $(PROFILE_DISABLED_TESTS) \
900         $(if $(AOT),$(AOT_DISABLED_TESTS)) \
901         $(if $(CI),$(CI_DISABLED_TESTS)) \
902         $(if $(CI_PR),$CI_PR_DISABLED_TESTS) \
903         $(if $(LLVM),$(LLVM_DISABLED_TESTS))
904
905 # pre-requisite test sources: files that are not test themselves
906 # but that need to be compiled
907 PREREQ_IL_SRC=event-il.il module-cctor.il
908 PREREQ_CS_SRC=
909 PREREQ_IL_DLL_SRC=
910 PREREQ_CS_DLL_SRC=
911
912 PREREQSI_IL=$(PREREQ_IL_SRC:.il=.exe) \
913         $(PREREQ_IL_DLL_SRC:.il=.dll)
914 PREREQSI_CS=$(PREREQ_CS_SRC:.cs=.exe) \
915         $(PREREQ_CS_DLL_SRC:.cs=.dll)
916 TESTSI_CS=$(filter-out $(DISABLED_TESTS),$(TEST_CS_SRC:.cs=.exe))
917 TESTSI_IL=$(filter-out $(DISABLED_TESTS),$(TEST_IL_SRC:.il=.exe))
918 TESTBS=$(filter-out $(DISABLED_TESTS),$(BENCHSRC:.cs=.exe))
919 STRESS_TESTS=$(filter-out $(DISABLED_TESTS),$(STRESS_TESTS_SRC:.cs=.exe))
920
921 PREREQSI_IL_AOT=$(PREREQ_IL_SRC:.il=.exe$(PLATFORM_AOT_SUFFIX)) \
922                 $(PREREQ_IL_DLL_SRC:.il=.dll$(PLATFORM_AOT_SUFFIX))
923 PREREQSI_CS_AOT=$(PREREQ_CS_SRC:.cs=.exe$(PLATFORM_AOT_SUFFIX)) \
924                 $(PREREQ_CS_DLL_SRC:.cs=.dll$(PLATFORM_AOT_SUFFIX))
925
926 EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
927         $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl $(PREREQ_IL_SRC) $(PREREQ_CS_SRC)
928
929 %.exe: %.il
930         $(ILASM) -out:$@ $<
931
932 if !FULL_AOT_TESTS
933 if !HYBRID_AOT_TESTS
934 TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
935 endif
936 endif
937
938 if FULL_AOT_TESTS
939 TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
940 else
941 TEST_DRIVER_DEPEND=TestDriver.dll
942 endif
943
944 %.exe: %.cs $(TEST_DRIVER_DEPEND)
945         $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
946
947 %.dll: %.cs
948         $(MCS) -r:System.dll -target:library -out:$@ $<
949
950 reference-loader.exe: reference-loader.cs TestingReferenceAssembly.dll TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_DEPEND)
951         $(MCS) -r:System.dll -r:TestDriver.dll -r:TestingReferenceAssembly.dll -r:TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $(srcdir)/reference-loader.cs
952
953 TestingReferenceAssembly.dll: TestingReferenceAssembly.cs
954         $(MCS) -target:library -out:$@ $<
955
956 TestingReferenceReferenceAssembly.dll: TestingReferenceReferenceAssembly.cs TestingReferenceAssembly.dll
957         $(MCS) -r:TestingReferenceAssembly.dll -target:library -out:$@ $<
958
959 %.exe$(PLATFORM_AOT_SUFFIX): %.exe 
960         $(RUNTIME) $(AOT_BUILD_FLAGS) $<
961
962 %.dll$(PLATFORM_AOT_SUFFIX): %.dll 
963         $(RUNTIME) $(AOT_BUILD_FLAGS) $<
964
965 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
966 if POWERPC
967 test_platform:
968 else
969 # Can't use mkbundle on win32 since there is no static build there
970 # Can't run test-unhandled-exception on Windows because of all the debug popups...
971 if HOST_WIN32
972 test_platform:
973 else
974 # mkbundle uses the installed mono-2.pc so it won't work if there is no system mono
975 #test_platform: testbundle test-iomap-regression
976 test_platform:  test-iomap-regression
977 endif
978 endif
979
980 if X86
981 if HOST_WIN32
982 else
983 test_platform: test-eglib-remap
984 endif
985 endif
986
987 AOT_EXTRA_LIBS =        \
988 bug-382986-lib.dll$(PLATFORM_AOT_SUFFIX)        \
989 bug-324535-il.dll$(PLATFORM_AOT_SUFFIX) \
990 bug-36848-a.dll$(PLATFORM_AOT_SUFFIX)   \
991 bug-81691-b.dll$(PLATFORM_AOT_SUFFIX)   \
992 bug-327438.2.exe$(PLATFORM_AOT_SUFFIX)  \
993 bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
994
995 if FULL_AOT_TESTS
996 prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
997 else
998 prereqs: $(PREREQSI_IL) $(PREREQSI_CS)
999 endif
1000
1001 # Target to precompile the test executables
1002 tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la prereqs $(GSHARED_TESTS)
1003
1004 #
1005 # Test that no symbols are missed in eglib-remap.h
1006 #
1007 OK_G_SYMBOLS='g_list\|g_slist\|g_concat_dir_and_file\|g_Ctoc\'
1008 if NACL_CODEGEN
1009 test-eglib-remap:
1010 else
1011 test-eglib-remap:
1012         @echo "Testing eglib remap..."
1013         @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
1014 endif
1015
1016 #
1017 # Tests that the internals in mono/io-layer/messages.c are ok by triggering the 
1018 # code that checks that the table is properly sorted
1019 #
1020 if NACL_CODEGEN
1021 test-messages:
1022 else
1023 if HOST_WIN32
1024 test-messages:
1025 else
1026 test-messages: w32message.exe
1027         > test_messages.zero
1028         $(with_mono_path) $(JITTEST_PROG_RUN) w32message.exe > w32message.allout 2>&1 && cmp test_messages.zero w32message.allout
1029 endif
1030 endif
1031
1032 test-env-options:
1033         MONO_ENV_OPTIONS="--version" $(RUNTIME) array-init.exe | grep -q Architecture:
1034
1035 test-sgen : sgen-tests
1036
1037 # Precompile the test assemblies in parallel
1038 compile-tests:
1039         $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
1040 if FULL_AOT_TESTS
1041         $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
1042 endif
1043
1044 # Remove empty .stdout and .stderr files for wrench
1045 rm-empty-logs:
1046         @echo "Removing empty logs..."
1047         find . '(' -name "*.stdout" -o -name "*.stderr" ')' -size 0 -exec rm {} \;
1048
1049 assemblyresolve/test/asm.dll:
1050         $(MAKE) -C assemblyresolve prereq
1051
1052 TestDriver.dll:
1053         $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs $(srcdir)/../mini/TestHelpers.cs
1054
1055 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
1056         @failed=0; \
1057         passed=0; \
1058         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1059         for i in $(TESTSI_CS); do       \
1060                 if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" "$${dump_action}" $(RUNTIME_ARGS); \
1061                 then \
1062                         passed=`expr $${passed} + 1`; \
1063                 else \
1064                         if [ $$? = 2 ]; then break; fi; \
1065                         failed=`expr $${failed} + 1`; \
1066                 fi \
1067         done; \
1068         echo; echo ".cs: $${passed} test(s) passed. $${failed} test(s) did not pass."; echo
1069
1070 test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
1071         @failed=0; \
1072         passed=0; \
1073         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1074         for i in $(TESTSI_IL); do       \
1075                 if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" "$${dump_action}" $(RUNTIME_ARGS); \
1076                 then \
1077                         passed=`expr $${passed} + 1`; \
1078                 else \
1079                         if [ $$? = 2 ]; then break; fi; \
1080                         failed=`expr $${failed} + 1`; \
1081                 fi \
1082         done; \
1083         echo; echo ".il: $${passed} test(s) passed. $${failed} test(s) did not pass."; echo
1084
1085 testb: $(TEST_PROG) $(TESTBS)
1086         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1087         for i in $(TESTBS); do  \
1088                 $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" "$${dump_action}" $(RUNTIME_ARGS);   \
1089         done
1090
1091 runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
1092         @failed=0; \
1093         passed=0; \
1094         failed_tests="";\
1095         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1096         rm -f testlist testlist.sorted; \
1097         for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do echo $${i} >> testlist; sort testlist > testlist.sorted; done; \
1098         for i in `cat testlist.sorted`; do \
1099                 rm -f $${i}.so; \
1100                 $(with_mono_path) $(JITTEST_PROG_RUN) --aot --debug $${i} > $${i}.aotlog 2>&1 || exit 1; \
1101                 if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" "$${dump_action}" $(RUNTIME_ARGS); \
1102                 then \
1103                         passed=`expr $${passed} + 1`; \
1104                 else \
1105                         if [ $$? = 2 ]; then break; fi; \
1106                         failed=`expr $${failed} + 1`; \
1107                         failed_tests="$${failed_tests} $$i"; \
1108                 fi \
1109         done; \
1110         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1111         rm -f testlist testlist.sorted; \
1112         if [ $${failed} != 0 ]; then \
1113           echo -e "\nFailed tests:\n"; \
1114           for i in $${failed_tests}; do \
1115             echo $${i}; \
1116             if [ "x$$V" = "x1" ]; then \
1117               cat $${i}.stdout; \
1118               cat $${i}.stderr; \
1119             fi; \
1120           done; \
1121           exit 1; \
1122         fi
1123
1124 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
1125         $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
1126
1127 runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
1128         $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
1129
1130 testjit:
1131         @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
1132
1133 testaot:
1134         @$(MAKE) AOT=1 runtest
1135
1136 testtrace:
1137         @$(MAKE) RUNTIME_ARGS="$${RUNTIME_ARGS} --trace" runtest
1138
1139 testinterp:
1140         @$(MAKE) JITTEST_PROG_RUN="$(TEST_PROG_RUN)" runtest
1141
1142 testjitspeed: $(JITTEST_PROG) $(TESTBS)
1143         for i in $(TESTBS); do  \
1144                 echo $$i;       \
1145                 time $(JITTEST_PROG) $$i;       \
1146         done
1147
1148 test-iomap-regression: exists.cs
1149         @$(MCS) $(srcdir)/exists.cs -out:exists.exe
1150         @echo "Testing exists.exe..."
1151         @MONO_IOMAP=all $(RUNTIME) exists.exe
1152
1153 stresstest: $(STRESS_TESTS)
1154         @failed=0; \
1155         passed=0; \
1156         failed_tests="";\
1157         for i in $(STRESS_TESTS); do    \
1158                 if $(srcdir)/stress-runner.pl $$i ../mini/mono $(RUNTIME_ARGS); \
1159                 then \
1160                         passed=`expr $${passed} + 1`; \
1161                 else \
1162                         if [ $$? = 2 ]; then break; fi; \
1163                         failed=`expr $${failed} + 1`; \
1164                         failed_tests="$${failed_tests} $$i"; \
1165                 fi \
1166         done; \
1167         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1168         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1169           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1170
1171 testbundle: console.exe
1172         @echo "Testing mkbundle..."
1173         @$(MKBUNDLE) --static console.exe > mkbundle.stdout
1174         @$(with_mono_path) MONO_CFG_DIR=$(mono_cfg_dir) ./a.out >> mkbundle.stdout
1175         @- rm -rf a.out
1176
1177 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
1178 test-type-load: $(TEST_DRIVER_DEPEND)
1179 if !POWERPC64
1180         @$(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il > /dev/null
1181         @$(MCS) -t:library -out:t.dll -d:FOUND $(srcdir)/t-missing.cs
1182         @$(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:load-exceptions.exe $(srcdir)/load-exceptions.cs
1183         @$(MCS) -t:library -out:t.dll $(srcdir)/t-missing.cs
1184         @echo "Testing load-exception.exe..."
1185         @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
1186 endif
1187
1188 EXTRA_DIST += test-multi-netmodule-1-netmodule.cs test-multi-netmodule-2-dll1.cs test-multi-netmodule-3-dll2.cs test-multi-netmodule-4-exe.cs
1189 test-multi-netmodule:
1190         @$(MCS) -t:module test-multi-netmodule-1-netmodule.cs
1191         @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-2-dll1.cs
1192         @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-3-dll2.cs
1193         @$(MCS) -r:test-multi-netmodule-2-dll1.dll test-multi-netmodule-4-exe.cs
1194         $(RUNTIME) test-multi-netmodule-4-exe.exe > test-multi-netmodule-4-exe.exe.stdout 2> test-multi-netmodule-4-exe.exe.stderr
1195
1196 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
1197 test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs
1198         $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
1199         $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll  $(srcdir)/custom-attr-errors.cs
1200         $(MCS) /t:library $(srcdir)/custom-attr-errors-lib.cs
1201         @echo "Testing custom-attribute-load-exceptions.exe..."
1202         @$(RUNTIME) custom-attr-errors.exe > custom-attr-errors.exe.stdout 2> custom-attr-errors.exe.stderr
1203
1204 EXTRA_DIST += reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.cs reflection-load-with-context.cs
1205 test-reflection-load-with-context: reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.cs reflection-load-with-context.exe
1206         rm -rf reflection-load-dir
1207         mkdir reflection-load-dir
1208         $(MCS) /t:library $(srcdir)/reflection-load-with-context-second-lib.cs -out:reflection-load-dir/reflection-load-with-context-second-lib.dll
1209         $(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
1210         @echo "Testing reflection-load-with-context.cs.exe..."
1211         @$(RUNTIME) reflection-load-with-context.exe > reflection-load-with-context.exe.stdout 2> reflection-load-with-context.exe.stderr
1212
1213
1214 EXTRA_DIST += debug-casts.cs
1215 # This depends on TLS, so its not ran by default
1216 debug-casts:
1217         @$(MCS) -r:TestDriver.dll $(srcdir)/debug-casts.cs
1218         @$(RUNTIME) --debug=casts debug-casts.exe
1219
1220 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-new-threads-dont-join-stw-2.cs sgen-new-threads-collect.cs sgen-bridge-xref.cs bug-17590.cs sgen-toggleref.cs sgen-bridge-gchandle.cs
1221
1222
1223 sgen-tests:
1224         $(MAKE) sgen-regular-tests
1225 if !S390X
1226         $(MAKE) sgen-toggleref-tests
1227         $(MAKE) sgen-bridge-tests
1228         $(MAKE) sgen-bridge2-tests
1229 endif
1230
1231 SGEN_REGULAR_TESTS_SRC =        \
1232         finalizer-wait.cs       \
1233         critical-finalizers.cs  \
1234         sgen-descriptors.cs     \
1235         sgen-gshared-vtype.cs   \
1236         sgen-weakref-stress.cs  \
1237         sgen-cementing-stress.cs        \
1238         sgen-case-23400.cs      \
1239         sgen-new-threads-dont-join-stw.cs       \
1240         sgen-new-threads-dont-join-stw-2.cs     \
1241         sgen-new-threads-collect.cs     \
1242         gc-graystack-stress.cs  \
1243         bug-17590.cs    \
1244         sgen-domain-unload.cs   \
1245         sgen-domain-unload-2.cs
1246
1247 SGEN_REGULAR_DISABLED_TESTS=
1248
1249 if FULL_AOT_TESTS
1250 SGEN_REGULAR_DISABLED_TESTS += \
1251         sgen-domain-unload.exe  \
1252         sgen-domain-unload-2.exe
1253 endif
1254
1255 SGEN_REGULAR_TESTS=$(filter-out $(SGEN_REGULAR_DISABLED_TESTS),$(SGEN_REGULAR_TESTS_SRC:.cs=.exe))
1256
1257 sgen-regular-tests: $(SGEN_REGULAR_TESTS)
1258         $(MAKE) sgen-regular-tests-ms
1259         $(MAKE) sgen-regular-tests-ms-conc
1260         $(MAKE) sgen-regular-tests-ms-conc-par
1261         $(MAKE) sgen-regular-tests-ms-conc-split
1262         $(MAKE) sgen-regular-tests-ms-split
1263         $(MAKE) sgen-regular-tests-ms-conc-split-95
1264         $(MAKE) sgen-regular-tests-ms-clear-at-gc
1265         $(MAKE) sgen-regular-tests-ms-conc-clear-at-gc
1266         $(MAKE) sgen-regular-tests-ms-conc-split-clear-at-gc
1267
1268 sgen-regular-tests-ms: $(SGEN_REGULAR_TESTS) test-runner.exe
1269         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1270 sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
1271         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1272 sgen-regular-tests-ms-conc-par: $(SGEN_REGULAR_TESTS) test-runner.exe
1273         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc-par" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1274 sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
1275         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1276 sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
1277         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1278 sgen-regular-tests-ms-conc-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
1279         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1280 sgen-regular-tests-ms-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
1281         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1282 sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
1283         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1284 sgen-regular-tests-ms-conc-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
1285         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
1286
1287 SGEN_TOGGLEREF_TESTS=   \
1288         sgen-toggleref.exe
1289
1290 sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
1291         $(MAKE) sgen-toggleref-tests-plain
1292         $(MAKE) sgen-toggleref-tests-ms-conc
1293         $(MAKE) sgen-toggleref-tests-ms-conc-split
1294         $(MAKE) sgen-toggleref-tests-ms-split
1295         $(MAKE) sgen-toggleref-tests-ms-split-95
1296         $(MAKE) sgen-toggleref-tests-plain-clear-at-gc
1297         $(MAKE) sgen-toggleref-tests-ms-conc-clear-at-gc
1298         $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
1299
1300 sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1301         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1302 sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1303         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1304 sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1305         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1306 sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1307         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1308 sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1309         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1310 sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1311         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1312 sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1313         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1314 sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
1315         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
1316
1317 SGEN_BRIDGE_TESTS=      \
1318         sgen-bridge.exe \
1319         sgen-bridge-major-fragmentation.exe
1320
1321 sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
1322         $(MAKE) sgen-bridge-tests-plain
1323         $(MAKE) sgen-bridge-tests-ms-conc
1324         $(MAKE) sgen-bridge-tests-ms-split
1325         $(MAKE) sgen-bridge-tests-plain-new-bridge
1326         $(MAKE) sgen-bridge-tests-ms-conc-new-bridge
1327         $(MAKE) sgen-bridge-tests-ms-split-new-bridge
1328         $(MAKE) sgen-bridge-tests-plain-tarjan-bridge
1329         $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
1330
1331 sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
1332         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1333 sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
1334         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1335 sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
1336         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1337 sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
1338         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1339 sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
1340         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1341 sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
1342         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1343 sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
1344         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1345 sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
1346         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
1347
1348 SGEN_BRIDGE2_TESTS=     \
1349         sgen-bridge-xref.exe
1350
1351 sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
1352         $(MAKE) sgen-bridge2-tests-plain
1353         $(MAKE) sgen-bridge2-tests-ms-conc
1354         $(MAKE) sgen-bridge2-tests-ms-split
1355         $(MAKE) sgen-bridge2-tests-plain-new-bridge
1356         $(MAKE) sgen-bridge2-tests-ms-conc-new-bridge
1357         $(MAKE) sgen-bridge2-tests-ms-split-new-bridge
1358         $(MAKE) sgen-bridge2-tests-plain-tarjan-bridge
1359         $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
1360
1361 sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1362         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1363 sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1364         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1365 sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1366         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1367 sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1368         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1369 sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1370         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1371 sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1372         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1373 sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1374         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1375 sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
1376         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
1377
1378 SGEN_BRIDGE3_TESTS=     \
1379         sgen-bridge-gchandle.exe
1380
1381 sgen-bridge3-tests: $(SGEN_BRIDGE3_TESTS)
1382         $(MAKE) sgen-bridge3-tests-plain
1383         $(MAKE) sgen-bridge3-tests-ms-conc
1384         $(MAKE) sgen-bridge3-tests-ms-split
1385         $(MAKE) sgen-bridge3-tests-plain-new-bridge
1386         $(MAKE) sgen-bridge3-tests-ms-conc-new-bridge
1387         $(MAKE) sgen-bridge3-tests-ms-split-new-bridge
1388         $(MAKE) sgen-bridge3-tests-plain-tarjan-bridge
1389         $(MAKE) sgen-bridge3-tests-ms-split-tarjan-bridge
1390
1391 sgen-bridge3-tests-plain: $(SGEN_bridge3_TESTS) test-runner.exe
1392         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1393 sgen-bridge3-tests-ms-conc: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1394         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1395 sgen-bridge3-tests-ms-split: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1396         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1397 sgen-bridge3-tests-plain-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1398         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1399 sgen-bridge3-tests-ms-conc-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1400         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1401 sgen-bridge3-tests-ms-split-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1402         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1403 sgen-bridge3-tests-plain-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1404         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1405 sgen-bridge3-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
1406         MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
1407
1408
1409 AOT_CONFIGURATIONS=     \
1410         "|regular"      \
1411         "--gc=boehm|boehm"
1412
1413 #LLVM crashes, got to fix it first.
1414 #       "--llvm|llvm"   \
1415 #       "--llvm --gc=boehm|llvm+boehm"
1416
1417
1418 test-aot:
1419         @failed=0; \
1420         passed=0; \
1421         failed_tests="";\
1422         profile=$(DEFAULT_PROFILE);     \
1423         tmpfile=`mktemp -t mono_aot_outputXXXXXX` || exit 1;    \
1424         rm -f test-aot-$${name}.stdout test-aot-$${name}.stderr; \
1425         for assembly in $(mcs_topdir)/class/lib/$$profile/*.dll ; do    \
1426                 asm_name=`basename $$assembly`; \
1427                 echo "... $$asm_name";  \
1428                 for conf in $(AOT_CONFIGURATIONS); do   \
1429                         name=`echo $$conf | cut -d\| -f 2`;     \
1430                         params=`echo $$conf | cut -d\| -f 1`;   \
1431                         test_name="$${asm_name}|$${name}";      \
1432                         echo "  $$test_name";   \
1433                         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;        \
1434                         then \
1435                                 passed=`expr $${passed} + 1`; \
1436                         else \
1437                                 failed=`expr $${failed} + 1`; \
1438                                 failed_tests="$${failed_tests} $$test_name"; \
1439                         fi \
1440                 done;   \
1441         done;   \
1442         rm      $$tmpfile;      \
1443         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1444         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1445         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1446
1447
1448 # Generated tests for runtime invoke
1449 EXTRA_DIST += gen-runtime-invoke.cs
1450 runtime-invoke.gen.exe: $(TEST_DRIVER_DEPEND) gen-runtime-invoke.exe
1451         $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
1452         $(MCS) -out:runtime-invoke.gen.exe -r:TestDriver.dll runtime-invoke.gen.cs
1453
1454 EXTRA_DIST += make-imt-test.cs
1455 imt_big_iface_test.exe: $(TEST_DRIVER_DEPEND) make-imt-test.exe
1456         $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
1457         $(MCS) -out:imt_big_iface_test.exe -r:TestDriver.dll imt_big_iface_test.cs
1458
1459 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
1460 test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-call-stack-library.cs
1461         $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs
1462 if FULL_AOT_TESTS
1463         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1464 endif
1465
1466 test-inline-call-stack.exe: $(TEST_DRIVER_DEPEND) test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
1467         $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:test-inline-call-stack.exe $(srcdir)/test-inline-call-stack.cs
1468
1469 EXTRA_DIST += unhandled-exception-base-configuration.config
1470 EXTRA_DIST += unhandled-exception-legacy-configuration.config
1471 EXTRA_DIST += appdomain-unload.exe.config
1472 EXTRA_DIST += unhandled-exception-test-case.2.cs
1473 EXTRA_DIST += unhandled-exception-test-runner.2.cs
1474 unhandled-exception-test-case.1.cs: unhandled-exception-test-case.2.cs
1475         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case.1.cs
1476 unhandled-exception-test-case-legacy.1.cs: unhandled-exception-test-case.1.cs
1477         cp unhandled-exception-test-case.1.cs unhandled-exception-test-case-legacy.1.cs
1478 unhandled-exception-test-case-legacy.2.cs: unhandled-exception-test-case.2.cs
1479         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case-legacy.2.cs
1480 unhandled-exception-config_files: unhandled-exception-base-configuration.config unhandled-exception-legacy-configuration.config
1481         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.1.exe.config
1482         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.2.exe.config
1483         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.1.exe.config
1484         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.2.exe.config
1485 unhandled-exception-test-case.1.exe: unhandled-exception-test-case.1.cs
1486         $(MCS) /debug unhandled-exception-test-case.1.cs
1487 unhandled-exception-test-case-legacy.1.exe: unhandled-exception-test-case-legacy.1.cs
1488         $(MCS) /debug unhandled-exception-test-case-legacy.1.cs
1489 unhandled-exception-test-case.2.exe: unhandled-exception-test-case.2.cs
1490         $(MCS) /debug unhandled-exception-test-case.2.cs
1491 unhandled-exception-test-case-legacy.2.exe: unhandled-exception-test-case-legacy.2.cs
1492         $(MCS) /debug unhandled-exception-test-case-legacy.2.cs
1493 unhandled-exception-test-runner.2.exe: unhandled-exception-test-runner.2.cs
1494         $(MCS) /debug unhandled-exception-test-runner.2.cs
1495
1496 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
1497         $(RUNTIME) unhandled-exception-test-runner.2.exe RUNTIME:../mini/mono,GTC:F
1498
1499 # We use 'test-support-files' to handle an ordering issue between the 'mono/' and 'runtime/' directories
1500 bug-80307.exe: $(srcdir)/bug-80307.cs
1501         $(MCS) -r:System.Web.dll -out:$@ $(srcdir)/bug-80307.cs
1502         cd $(top_builddir)/runtime && $(MAKE) test-support-files
1503
1504 EXTRA_DIST += bug-81673-interface.cs
1505 bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-81673-interface.cs
1506         $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1507         $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs
1508         $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1509 if FULL_AOT_TESTS
1510         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1511 endif
1512
1513 EXTRA_DIST += bug-36848-a.cs
1514 bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
1515         $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
1516         $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs
1517         $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs /define:WITH_STOP
1518 if FULL_AOT_TESTS
1519         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1520 endif
1521
1522 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
1523 bug-81691.exe bug-81691-b.dll: $(srcdir)/bug-81691.cs $(srcdir)/bug-81691-a.cs $(srcdir)/bug-81691-b.cs
1524         $(MCS) -target:library -out:bug-81691-a.dll $(srcdir)/bug-81691-a.cs
1525         $(MCS) -target:library -out:bug-81691-b.dll -r:bug-81691-a.dll $(srcdir)/bug-81691-b.cs
1526         $(MCS) -r:bug-81691-b.dll -out:bug-81691.exe $(srcdir)/bug-81691.cs
1527         rm -f bug-81691-a.dll
1528 bug-81691.exe: bug-81691-b.dll
1529
1530 EXTRA_DIST += bug-81466-lib.il
1531 bug-81466-lib.dll: bug-81466-lib.il
1532         $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
1533 if FULL_AOT_TESTS
1534         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1535 endif
1536 bug-81466.exe: bug-81466.il bug-81466-lib.dll
1537         $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
1538
1539 EXTRA_DIST += bug-324535-il.il
1540 bug-324535-il.dll : bug-324535-il.il
1541         $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
1542 if FULL_AOT_TESTS
1543         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1544 endif
1545 bug-324535.exe : bug-324535.cs bug-324535-il.dll
1546         $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
1547
1548 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
1549 custom-modifiers-lib.dll: custom-modifiers-lib.il
1550         $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
1551 if FULL_AOT_TESTS
1552         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1553 endif
1554 custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll
1555         $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
1556
1557 EXTRA_DIST += bug-382986-lib.cs
1558 bug-382986-lib.dll: bug-382986-lib.cs
1559         $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs
1560 if FULL_AOT_TESTS
1561         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1562 endif
1563
1564 bug-382986.exe: bug-382986.cs bug-382986-lib.dll
1565         $(MCS) -out:$@ -r:bug-382986-lib.dll $(srcdir)/bug-382986.cs
1566
1567 EXTRA_DIST += bug-17537-helper.cs
1568 bug-17537-helper.exe: bug-17537-helper.cs
1569         $(MCS) -out:$@ $(srcdir)/bug-17537-helper.cs
1570         chmod -x $@
1571
1572 bug-17537.exe: bug-17537.cs bug-17537-helper.exe
1573         $(MCS) -r:System.dll -out:$@ $(srcdir)/bug-17537.cs
1574
1575 EXTRA_DIST += coreclr-security.cs
1576
1577 coreclr-security.exe : coreclr-security.cs
1578         $(SMCS) -out:coreclr-security.exe $(srcdir)/coreclr-security.cs
1579
1580 test-coreclr-security : coreclr-security.exe
1581         @echo "Testing coreclr-security.exe..."
1582         @$(RUNTIME_MOONLIGHT) --security=core-clr-test coreclr-security.exe
1583
1584 EXTRA_DIST += generic-unboxing.2.il
1585 generic-unboxing.2.dll : generic-unboxing.2.il
1586         $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
1587 if FULL_AOT_TESTS
1588         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1589 endif
1590
1591 EXTRA_DIST += generic-boxing.2.il
1592 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
1593         $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
1594 if FULL_AOT_TESTS
1595         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1596 endif
1597
1598 EXTRA_DIST += generic-unbox.2.cs
1599 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
1600         $(MCS) -r:generic-unboxing.2.dll -out:$@ $(srcdir)/generic-unbox.2.cs
1601
1602 EXTRA_DIST += generic-box.2.cs
1603 generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
1604         $(MCS) -r:generic-unboxing.2.dll,generic-boxing.2.dll -out:$@ $(srcdir)/generic-box.2.cs
1605
1606 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
1607 generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
1608         $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il
1609 if FULL_AOT_TESTS
1610         $(RUNTIME) $(AOT_BUILD_FLAGS) $@
1611 endif
1612 generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
1613         $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
1614
1615 bug-3903.exe: bug-3903.cs
1616         $(MCS_NO_LIB) -lib:$(srcdir)/../../external/binary-reference-assemblies/v2.0/ $(srcdir)/bug-3903.cs -r:System.Core.dll -out:$@
1617
1618 gshared: test-generic-sharing
1619
1620 gshared-aot:
1621         @$(MAKE) AOT=1 gshared
1622
1623 GSHARED_TESTS_SRC = \
1624         generics-sharing.2.cs   \
1625         shared-generic-methods.2.cs     \
1626         shared-generic-synchronized.2.cs        \
1627         generic-initobj.2.cs            \
1628         generics-sharing-other-exc.2.cs \
1629         generic-box.2.cs                \
1630         generic-unbox.2.cs      \
1631         generic-delegate.2.cs   \
1632         generic-sizeof.2.cs     \
1633         generic-ldobj.2.cs      \
1634         generic-mkrefany.2.cs                   \
1635         generic-refanyval.2.cs  \
1636         generic-ldtoken.2.cs                    \
1637         generic-ldtoken-method.2.cs     \
1638         generic-ldtoken-field.2.cs      \
1639         generic-virtual.2.cs    \
1640         generic-tailcall.2.cs                   \
1641         generic-interface-methods.2.cs  \
1642         generic-array-type.2.cs \
1643         generic-method-patching.2.cs    \
1644         generic-static-methods.2.cs     \
1645         generic-null-call.2.cs  \
1646         generic-tailcall2.2.cs                  \
1647         generic-array-exc.2.cs  \
1648         generic-special.2.cs                    \
1649         generic-exceptions.2.cs \
1650         generic-delegate2.2.cs          \
1651         generic-virtual2.2.cs   \
1652         generic-valuetype-interface.2.cs        \
1653         generic-valuetype-newobj.2.cs   \
1654         generic-valuetype-newobj2.2.cs  \
1655         generic-getgenericarguments.2.cs        \
1656         generic-synchronized.2.cs       \
1657         generic-delegate-ctor.2.cs              \
1658         generic-constrained.2.cs        \
1659         bug-431413.2.cs                 \
1660         generic-virtual-invoke.2.cs     \
1661         generic-typedef.2.cs            \
1662         generic-marshalbyref.2.cs       \
1663         bug-459285.2.cs \
1664         bug-461198.2.cs \
1665         generic-sealed-virtual.2.cs     \
1666         generic-system-arrays.2.cs      \
1667         generic-stack-traces.2.cs       \
1668         generic-stack-traces2.2.cs              \
1669         bug-472600.2.cs \
1670         bug-473482.2.cs \
1671         bug-473999.2.cs         \
1672         bug-479763.2.cs                         \
1673         generic-type-load-exception.2.cs        \
1674         bug-616463.cs   \
1675         bug-1147.cs     \
1676         generic-type-builder.2.cs
1677
1678 GSHARED_DISABLED_TESTS=
1679
1680 if FULL_AOT_TESTS
1681 GSHARED_DISABLED_TESTS += \
1682         generic-type-builder.2.exe
1683 endif
1684
1685 GSHARED_TESTS=$(filter-out $(GSHARED_DISABLED_TESTS),$(GSHARED_TESTS_SRC:.cs=.exe))
1686
1687 test-generic-sharing-normal: $(GSHARED_TESTS)
1688         @for fn in $+ ; do      \
1689                 echo "Testing $$fn ...";        \
1690                 $(RUNTIME) -O=gshared                $$fn > $$fn.stdout || exit 1;      \
1691                 $(RUNTIME) -O=gshared,shared         $$fn > $$fn.stdout || exit 1;      \
1692                 $(RUNTIME) -O=gshared,-inline        $$fn > $$fn.stdout || exit 1;      \
1693                 $(RUNTIME) -O=gshared,-inline,shared $$fn > $fn.stdout || exit 1;       \
1694                 if [ x$(AOT) = x1 ]; then $(with_mono_path) $(JITTEST_PROG_RUN) --aot --debug $$fn > /dev/null || exit 1; $(RUNTIME) $$fn > $$fn.stdout || exit 1; fi; \
1695         done
1696
1697 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
1698         $(Q) $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
1699
1700 if NACL_CODEGEN
1701 test-generic-sharing:
1702 else
1703 test-generic-sharing:
1704         @if test x$(M) != x0; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
1705 endif
1706
1707 EXTRA_DIST += async-exceptions.cs
1708 async-exceptions.exe : async-exceptions.cs
1709         $(MCS) -out:async-exceptions.exe $(srcdir)/async-exceptions.cs
1710 test-async-exceptions : async-exceptions.exe
1711         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
1712         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
1713
1714 EXTRA_DIST += modules.cs modules-m1.cs
1715 modules-m1.netmodule: modules-m1.cs
1716         $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
1717 modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) 
1718         $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
1719
1720 # Useful if mono is compiled with --enable-shared=no
1721 patch-libtool:
1722         cp "../../libtool" .
1723         sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool
1724         sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
1725         touch libtest.c
1726
1727
1728 if NACL_CODEGEN
1729 test-process-exit:
1730 else
1731 EXTRA_DIST += threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
1732 test-process-exit:
1733         @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
1734         @echo "Testing threadpool-in-processexit.exe..."
1735         @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
1736         @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
1737 endif
1738
1739 OOM_TESTS =     \
1740         gc-oom-handling.exe     \
1741         gc-oom-handling2.exe
1742
1743
1744 test-oom: $(OOM_TESTS)
1745         @for fn in $+ ; do      \
1746                 echo "Testing $$fn ...";        \
1747                 MONO_GC_PARAMS=max-heap-size=16m MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.stdout || exit 1;      \
1748                 MONO_GC_PARAMS=max-heap-size=16m                                                  $(RUNTIME) $$fn > $$fn.stdout || exit 1;      \
1749         done
1750
1751 if HOST_WIN32
1752 test-unhandled-exception-2:
1753 else
1754
1755 # tests that expect a 1 exit code
1756 UNHANDLED_EXCEPTION_1_TESTS =   \
1757         unhandled-exception-1.exe
1758
1759 # tests that expect a 255 exit code
1760 UNHANDLED_EXCEPTION_255_TESTS = \
1761         unhandled-exception-2.exe       \
1762         unhandled-exception-3.exe       \
1763         unhandled-exception-4.exe       \
1764         unhandled-exception-5.exe       \
1765         unhandled-exception-6.exe       \
1766         unhandled-exception-7.exe       \
1767         unhandled-exception-8.exe
1768
1769 test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION_255_TESTS)
1770         $(MAKE) test-unhandled-exception-2-1-with-managed-handler
1771         $(MAKE) test-unhandled-exception-2-1-without-managed-handler
1772         $(MAKE) test-unhandled-exception-2-255-with-managed-handler
1773         $(MAKE) test-unhandled-exception-2-255-without-managed-handler
1774
1775 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
1776         $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
1777 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
1778         TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
1779 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
1780         $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
1781 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
1782         TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
1783
1784 endif
1785
1786 EXTRA_DIST += appdomain-loader.cs appdomain-tester.cs
1787 test-appdomain-unload: appdomain-loader.exe appdomain-tester.exe
1788         $(RUNTIME) -O=gshared appdomain-loader.exe > appdomain-loader.exe.1.stdout || exit 1;
1789         $(RUNTIME) appdomain-loader.exe > appdomain-loader.exe.2.stdout || exit 1;
1790         MONO_DEBUG_ASSEMBLY_UNLOAD=1 $(RUNTIME) -O=gshared appdomain-loader.exe > appdomain-loader.exe.3.stdout || exit 1;
1791         MONO_DEBUG_ASSEMBLY_UNLOAD=1 $(RUNTIME) appdomain-loader.exe > appdomain-loader.exe.4.stdout || exit 1;
1792
1793 EXTRA_DIST += console-output.cs console-output.exe.stderr.expected console-output.exe.stdout.expected
1794 test-console-output: console-output.exe
1795         @$(RUNTIME) console-output.exe 1>console-output.exe.stdout
1796         @$(RUNTIME) console-output.exe 2>console-output.exe.stderr
1797         @diff -w console-output.exe.stdout $(srcdir)/console-output.exe.stdout.expected \
1798                 && diff -w console-output.exe.stderr $(srcdir)/console-output.exe.stderr.expected
1799
1800 PROCESS_STRESS_TESTS=   \
1801                 process-stress-1.exe    \
1802                 process-stress-2.exe    \
1803                 process-stress-3.exe    \
1804                 process-leak.exe
1805
1806 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
1807         $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(PROCESS_STRESS_TESTS)
1808
1809 coreclr-gcstress:
1810         $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
1811
1812 # Tests for the Mono lldb plugin
1813 EXTRA_DIST += test_lldb.py test-lldb.cs
1814 test-lldb: test-lldb.exe
1815         python test_lldb.py $(JITTEST_PROG)
1816
1817 noinst_LTLIBRARIES = libtest.la
1818
1819 AM_CPPFLAGS = $(GLIB_CFLAGS)
1820
1821 if HOST_WIN32
1822 # gcc-3.4.4 emits incorrect code when making indirect calls to stdcall functions using a tail call
1823 # This shows up when compiling mono_test_marshal_delegate ()
1824 libtest_la_CFLAGS=-fno-optimize-sibling-calls
1825 # the exported names created by gcc for stdcall functions are missing the leading _, so MS.NET
1826 # can't find them. So we use --kill-at to remove the @ suffix as well.
1827 libtest_la_LDFLAGS=-no-undefined -rpath `pwd` -Wl,--kill-at
1828 else
1829 libtest_la_LDFLAGS = -rpath `pwd`
1830 endif
1831 libtest_la_SOURCES = libtest.c
1832 libtest_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
1833
1834 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.aotlog *.exe stest.dat