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