729b663f91ba9cfb66dbdee3e980641d7a843803
[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         appdomain-unload-exception.cs   \
473         unload-appdomain-on-shutdown.cs \
474         bug-47295.cs    \
475         loader.cs       \
476         pinvoke2.cs     \
477         generic-type-builder.2.cs       \
478         dynamic-generic-size.cs \
479         cominterop.cs   \
480         dynamic-method-access.2.cs      \
481         dynamic-method-finalize.2.cs    \
482         dynamic-method-stack-traces.cs  \
483         generic_type_definition.2.cs    \
484         bug-333798-tb.2.cs      \
485         bug-335131.2.cs \
486         bug-322722_patch_bx.2.cs        \
487         bug-322722_dyn_method_throw.2.cs        \
488         bug-389886-2.cs \
489         bug-349190.2.cs \
490         bug-389886-sre-generic-interface-instances.cs   \
491         bug-462592.cs   \
492         bug-575941.cs   \
493         bug-389886-3.cs \
494         constant-division.cs    \
495         dynamic-method-resurrection.cs  \
496         bug-80307.cs    \
497         assembly_append_ordering.cs     \
498         bug-544446.cs   \
499         bug-36848.cs    \
500         generic-marshalbyref.2.cs       \
501         stackframes-async.2.cs  \
502         transparentproxy.cs     \
503         bug-48015.cs    \
504         delegate9.cs    \
505         marshal-valuetypes.cs   \
506         xdomain-threads.cs      \
507         monitor.cs      \
508         generic-xdomain.2.cs    \
509         threadpool-exceptions7.cs       \
510         cross-domain.cs \
511         generic-unloading.2.cs  \
512         namedmutex-destroy-race.cs      \
513         thread6.cs      \
514         appdomain-threadpool-unload.cs  \
515         process-unref-race.cs   \
516         bug-46661.cs    \
517         w32message.cs \
518         runtime-invoke.gen.cs \
519         imt_big_iface_test.cs \
520         bug-58782-plain-throw.cs \
521         bug-58782-capture-and-throw.cs \
522         recursive-struct-arrays.cs
523
524 if AMD64
525 TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
526 endif
527
528 if X86
529 TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
530 endif
531
532 TESTS_IL_SRC=                   \
533         field-access.il         \
534         method-access.il        \
535         ldftn-access.il         \
536         cpblkTest.il            \
537         vbinterface.il          \
538         calliTest.il            \
539         calliGenericTest.il             \
540         ckfiniteTest.il         \
541         fault-handler.il                \
542         locallocTest.il         \
543         initblkTest.il          \
544         qt-instance.il          \
545         vararg.il               \
546         bug-29859.il            \
547         bug-78549.il            \
548         static-fields-nonconst.il       \
549         reload-at-bb-end.il     \
550         test-enum-indstoreil.il \
551         filter-bug.il           \
552         even-odd.il             \
553         bug-82022.il    \
554         vt-sync-method.il       \
555         enum_types.il   \
556         invalid-token.il        \
557         call_missing_method.il  \
558         call_missing_class.il   \
559         ldfld_missing_field.il  \
560         ldfld_missing_class.il  \
561         find-method.2.il        \
562         bug-79215.2.il  \
563         bug-79956.2.il  \
564         bug-327438.2.il \
565         bug-387274.2.il \
566         bug-426309.2.il \
567         ldtoken_with_byref_typespec.2.il \
568         resolve_method_bug.2.il \
569         resolve_field_bug.2.il \
570         resolve_type_bug.2.il   \
571         generics-sharing-other-exc.2.il \
572         generic-ldobj.2.il      \
573         generic-mkrefany.2.il   \
574         generic-refanyval.2.il  \
575         generic-ldtoken.2.il    \
576         generic-ldtoken-method.2.il     \
577         generic-ldtoken-field.2.il      \
578         generic-tailcall.2.il   \
579         generic-tailcall2.2.il  \
580         generic-array-exc.2.il  \
581         generic-valuetype-newobj2.2.il  \
582         generic-valuetype-newobj.2.il   \
583         generic-constrained.2.il        \
584         generic-type-load-exception.2.il        \
585         bug-81466.il    \
586         bug457574.il    \
587         bug445361.il    \
588         bug-463303.il   \
589         bug469742.2.il  \
590         bug-528055.il   \
591         array_load_exception.il \
592         bug-481403.il   \
593         interface-with-static-method.il \
594         bug-633291.il   \
595         delegate-with-null-target.il    \
596         bug-318677.il   \
597         gsharing-valuetype-layout.il    \
598         invalid_generic_instantiation.il \
599         bug-45841-fpstack-exceptions.il \
600         instance_tailrec.il
601
602 TESTS_GSHARED_SRC = \
603         generics-sharing.2.cs   \
604         shared-generic-methods.2.cs     \
605         shared-generic-synchronized.2.cs        \
606         generic-initobj.2.cs            \
607         generics-sharing-other-exc.2.cs \
608         generic-box.2.cs                \
609         generic-unbox.2.cs      \
610         generic-delegate.2.cs   \
611         generic-sizeof.2.cs     \
612         generic-ldobj.2.cs      \
613         generic-mkrefany.2.cs                   \
614         generic-refanyval.2.cs  \
615         generic-ldtoken.2.cs                    \
616         generic-ldtoken-method.2.cs     \
617         generic-ldtoken-field.2.cs      \
618         generic-virtual.2.cs    \
619         generic-tailcall.2.cs                   \
620         generic-interface-methods.2.cs  \
621         generic-array-type.2.cs \
622         generic-method-patching.2.cs    \
623         generic-static-methods.2.cs     \
624         generic-null-call.2.cs  \
625         generic-tailcall2.2.cs                  \
626         generic-array-exc.2.cs  \
627         generic-special.2.cs                    \
628         generic-special2.2.cs   \
629         generic-exceptions.2.cs \
630         generic-delegate2.2.cs          \
631         generic-virtual2.2.cs   \
632         generic-valuetype-interface.2.cs        \
633         generic-valuetype-newobj.2.cs   \
634         generic-valuetype-newobj2.2.cs  \
635         generic-getgenericarguments.2.cs        \
636         generic-synchronized.2.cs       \
637         generic-delegate-ctor.2.cs              \
638         generic-constrained.2.cs        \
639         bug-431413.2.cs                 \
640         generic-virtual-invoke.2.cs     \
641         generic-typedef.2.cs            \
642         generic-marshalbyref.2.cs       \
643         bug-459285.2.cs \
644         bug-461198.2.cs \
645         generic-sealed-virtual.2.cs     \
646         generic-system-arrays.2.cs      \
647         generic-stack-traces.2.cs       \
648         generic-stack-traces2.2.cs              \
649         bug-472600.2.cs \
650         bug-473482.2.cs \
651         bug-473999.2.cs         \
652         bug-479763.2.cs                         \
653         generic-type-load-exception.2.cs        \
654         bug-616463.cs   \
655         bug-1147.cs     \
656         generic-type-builder.2.cs
657
658 PLATFORM_DISABLED_TESTS=
659
660 if HOST_WIN32
661 PLATFORM_DISABLED_TESTS += bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe
662 endif
663
664 if AMD64
665 # #651684
666 PLATFORM_DISABLED_TESTS += finally_guard.exe
667
668 if HOST_WIN32
669 PLATFORM_DISABLED_TESTS += w32message.exe
670 endif
671
672 endif
673
674 if X86
675
676 if HOST_WIN32
677 PLATFORM_DISABLED_TESTS += async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
678         bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe w32message.exe \
679         unhandled-exception-1.exe unhandled-exception-2.exe unhandled-exception-3.exe unhandled-exception-4.exe \
680         unhandled-exception-5.exe unhandled-exception-6.exe unhandled-exception-7.exe unhandled-exception-8.exe
681 endif
682
683 endif
684
685 if POWERPC
686 # bug #71274
687 PLATFORM_DISABLED_TESTS += finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
688 endif
689
690 if POWERPC64
691 # FIXME: These tests hang/fail for unknown reasons
692 PLATFORM_DISABLED_TESTS += monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
693         pinvoke2.exe pinvoke3.exe pinvoke11.exe threadpool-exceptions7.exe winx64structs.exe bug-10127.exe pinvoke_ppcc.exe \
694         pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe abort-cctor.exe load-exceptions.exe \
695         sgen-domain-unload-2.exe sgen-weakref-stress.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw.exe \
696         sgen-new-threads-dont-join-stw-2.exe sgen-new-threads-collect.exe sgen-bridge.exe
697 endif
698
699 if ARM
700 PLATFORM_DISABLED_TESTS += filter-stack.exe
701 INTERP_DISABLED_TESTS_PLATFORM=finalizer-exception.exe main-returns-abort-resetabort.exe block_guard_restore_aligment_on_exit.exe \
702         delegate-exit.exe delegate-exit.exe delegate-delegate-exit.exe delegate-async-exit.exe delegate3.exe delegate1.exe
703 endif
704
705 if ARM64
706 INTERP_DISABLED_TESTS_PLATFORM=finalizer-exception.exe main-returns-abort-resetabort.exe block_guard_restore_aligment_on_exit.exe
707 endif
708
709 if MIPS
710 # monitor.exe is racy
711 PLATFORM_DISABLED_TESTS += filter-stack.exe monitor.exe
712 endif
713
714 if S390X
715 PLATFORM_DISABLED_TESTS += dynamic-method-resurrection.exe
716 #PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
717
718 PLATFORM_DISABLED_TESTS += \
719         sgen-toggleref.exe \
720         sgen-bridge.exe \
721         sgen-bridge-major-fragmentation.exe \
722         sgen-bridge-xref.exe
723 endif
724
725 if ENABLE_COOP
726 COOP_DISABLED_TESTS= thunks.exe
727 else
728 COOP_DISABLED_TESTS= 
729 endif
730
731 PROFILE_DISABLED_TESTS=
732
733 if FULL_AOT_TESTS
734 # Tests which rely on TypeLoadExceptions
735 # In full-aot mode, these cause the relevant methods to be not AOTed.
736 PROFILE_DISABLED_TESTS += \
737         typeload-unaligned.exe \
738         field-access.exe \
739         invalid_generic_instantiation.exe \
740         bug-481403.exe \
741         array_ldelema.exe \
742         array_load_exception.exe \
743         bug445361.exe \
744         generic-type-load-exception.2.exe \
745         invalid-token.exe \
746         call_missing_method.exe \
747         call_missing_class.exe \
748         ldfld_missing_field.exe \
749         ldfld_missing_class.exe \
750         vt-sync-method.exe \
751         resolve_method_bug.2.exe \
752         resolve_field_bug.2.exe \
753         resolve_type_bug.2.exe \
754         bug-81691.exe \
755         bug-327438.2.exe
756
757 # Tests which rely on remoting
758 PROFILE_DISABLED_TESTS += \
759         context-static.exe \
760         bug-415577.exe \
761         generic-marshalbyref.2.exe \
762         unhandled-exception-7.exe
763
764 # Tests which use unsupported pinvoke+full aot
765 # functionality
766 PROFILE_DISABLED_TESTS += \
767         marshal.exe \
768         marshal2.exe \
769         marshal6.exe \
770         marshal7.exe \
771         marshal8.exe \
772         pinvoke-2.2.exe \
773         pinvoke3.exe \
774         thunks.exe \
775         bug-58782-plain-throw.exe \
776         bug-58782-capture-and-throw.exe
777
778 # Tests which load assemblies which are not
779 # in the testing_aot_full profile
780 PROFILE_DISABLED_TESTS += \
781         assembly-load-remap.exe
782
783 # Test which needs remoting support
784 PROFILE_DISABLED_TESTS += \
785         remoting4.exe   \
786         remoting1.exe   \
787         remoting2.exe   \
788         remoting3.exe   \
789         remoting5.exe
790
791 # Tests which needs AppDomain support
792 PROFILE_DISABLED_TESTS += \
793         appdomain.exe   \
794         appdomain-client.exe    \
795         appdomain-unload.exe    \
796         appdomain-async-invoke.exe      \
797         appdomain-thread-abort.exe      \
798         appdomain1.exe  \
799         appdomain2.exe  \
800         appdomain-exit.exe      \
801         appdomain-unload-asmload.exe \
802         appdomain-unload-callback.exe   \
803         appdomain-unload-doesnot-raise-pending-events.exe       \
804         unload-appdomain-on-shutdown.exe        \
805         assemblyresolve_event2.2.exe    \
806         assemblyresolve_event6.exe      \
807         bug-544446.exe  \
808         bug-36848.exe   \
809         generic-marshalbyref.2.exe      \
810         stackframes-async.2.exe \
811         transparentproxy.exe    \
812         bug-48015.exe   \
813         delegate9.exe   \
814         marshal-valuetypes.exe  \
815         xdomain-threads.exe     \
816         monitor.exe     \
817         generic-xdomain.2.exe   \
818         threadpool-exceptions7.exe      \
819         cross-domain.exe        \
820         generic-unloading.2.exe \
821         appdomain-threadpool-unload.exe
822
823 # Tests which needs System.Reflection.Emit support
824 PROFILE_DISABLED_TESTS += \
825         bug-47295.exe   \
826         loader.exe      \
827         pinvoke2.exe    \
828         generic-type-builder.2.exe      \
829         dynamic-generic-size.exe        \
830         cominterop.exe  \
831         dynamic-method-access.2.exe     \
832         dynamic-method-finalize.2.exe   \
833         dynamic-method-stack-traces.exe \
834         generic_type_definition.2.exe   \
835         bug-333798-tb.2.exe     \
836         bug-335131.2.exe        \
837         bug-322722_patch_bx.2.exe       \
838         bug-322722_dyn_method_throw.2.exe       \
839         bug-389886-2.exe        \
840         bug-349190.2.exe        \
841         bug-389886-sre-generic-interface-instances.exe  \
842         bug-462592.exe  \
843         bug-575941.exe  \
844         bug-389886-3.exe        \
845         constant-division.exe   \
846         dynamic-method-resurrection.exe \
847         assembly_append_ordering.exe \
848         assemblyresolve_event5.exe
849
850 # Test which needs System.Web support
851 PROFILE_DISABLED_TESTS += \
852         bug-80307.exe
853
854 # Tests which needs named Mutex support
855 PROFILE_DISABLED_TESTS += \
856         namedmutex-destroy-race.exe
857
858 # ThreadAbortException doesn't have necessary field for this test
859 PROFILE_DISABLED_TESTS += \
860         thread6.exe
861
862 # can't AOT the TestingReferenceAssembly.dll which is a dependency
863 # of reference-loader.exe because it contains the [ReferenceAssemblyAttribute]
864 # and the runtime errors out with "File does not contain a valid CIL image."
865 PROFILE_DISABLED_TESTS += \
866         reference-loader.exe
867
868 # constraints-load.il: 
869 # Failed to load method 0x6000007 from '..../mono/tests/constraints-load.exe' due to 
870 # Could not resolve type with token 01000002 assembly:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.BrokenIComparable`1 member:<none>.
871 PROFILE_DISABLED_TESTS += \
872         constraints-load.exe \
873         bug-515884.exe
874
875 PROFILE_DISABLED_TESTS += \
876         generic-type-builder.2.exe
877
878 PROFILE_DISABLED_TESTS += \
879         sgen-domain-unload.exe  \
880         sgen-domain-unload-2.exe
881
882 PROFILE_DISABLED_TESTS += \
883         appdomain-loader.exe \
884         assemblyresolve_event3.exe \
885         appdomain-serialize-exception.exe
886 endif
887
888 if HYBRID_AOT_TESTS
889 PROFILE_DISABLED_TESTS += \
890         bug-80307.exe \
891         namedmutex-destroy-race.exe
892 endif
893
894 AOT_DISABLED_TESTS= \
895         constraints-load.exe
896
897 CI_DISABLED_TESTS = \
898         main-returns-background-resetabort.exe \
899         main-returns-background-abort-resetabort.exe    \
900         assemblyresolve_event3.exe \
901         delegate2.exe   \
902         finally_guard.exe \
903         generic-xdomain.2.exe
904
905 # failing tests which we temporarily disable for PRs
906 # so they don't interfere with other people's work
907 CI_PR_DISABLED_TESTS = \
908         appdomain-threadpool-unload.exe \
909         appdomain-thread-abort.exe
910
911 # appdomain-threadpool-unload.exe creates 100 appdomains, takes too long with llvm
912 LLVM_DISABLED_TESTS = \
913         finally_block_ending_in_dead_bb.exe \
914         appdomain-threadpool-unload.exe
915
916 LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS))
917
918 # The two finalizer tests only work under sgen
919 # gc-altstack.exe fails under boehm because it has no support for altstack
920 # bug-459094.exe creates an extremely deep directory tree
921 # delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
922 # reverted.
923 # bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
924 # appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054
925 KNOWN_FAILING_TESTS = \
926         delegate-async-exception.exe    \
927         bug-348522.2.exe        \
928         bug-459094.exe \
929         delegate-invoke.exe \
930         bug-Xamarin-5278.exe \
931         appdomain-thread-abort.exe
932
933 DISABLED_TESTS = \
934         $(KNOWN_FAILING_TESTS) \
935         $(PLATFORM_DISABLED_TESTS) \
936         $(EXTRA_DISABLED_TESTS) \
937         $(COOP_DISABLED_TESTS) \
938         $(PROFILE_DISABLED_TESTS) \
939         $(if $(AOT),$(AOT_DISABLED_TESTS)) \
940         $(if $(CI),$(CI_DISABLED_TESTS)) \
941         $(if $(CI_PR),$CI_PR_DISABLED_TESTS) \
942         $(if $(LLVM),$(LLVM_DISABLED_TESTS))
943
944 INTERP_DISABLED_TESTS = \
945         $(CI_PR_DISABLED_TESTS) \
946         $(CI_DISABLED_TESTS) \
947         $(KNOWN_FAILING_TESTS) \
948         $(INTERP_DISABLED_TESTS_PLATFORM) \
949         abort-cctor.exe \
950         appdomain-async-invoke.exe \
951         appdomain-exit.exe \
952         appdomain-serialize-exception.exe \
953         appdomain-unload-asmload.exe \
954         appdomain-unload-callback.exe \
955         appdomain-unload-doesnot-raise-pending-events.exe \
956         appdomain-unload.exe \
957         appdomain.exe \
958         appdomain1.exe \
959         appdomain2.exe \
960         array_load_exception.exe \
961         assembly_append_ordering.exe \
962         assemblyresolve_event4.exe \
963         assemblyresolve_event6.exe \
964         async-exc-compilation.exe \
965         async-with-cb-throws.exe \
966         async_read.exe \
967         bug-18026.exe \
968         bug-2907.exe \
969         bug-323114.exe \
970         bug-327438.2.exe \
971         bug-335131.2.exe \
972         bug-415577.exe \
973         bug-45841-fpstack-exceptions.exe \
974         bug-461867.exe \
975         bug-461941.exe \
976         bug-46661.exe \
977         bug-47295.exe \
978         bug-48015.exe \
979         bug-58782-plain-throw.exe \
980         bug-58782-capture-and-throw.exe \
981         bug-544446.exe \
982         bug-685908.exe \
983         bug-80307.exe \
984         bug-80392.2.exe \
985         bug-81673.exe \
986         bug-82022.exe \
987         bug445361.exe \
988         call_missing_class.exe \
989         call_missing_method.exe \
990         calliGenericTest.exe \
991         cominterop.exe \
992         context-static.exe \
993         cross-domain.exe \
994         delegate-with-null-target.exe \
995         delegate9.exe \
996         dynamic-method-stack-traces.exe \
997         even-odd.exe \
998         exception18.exe \
999         field-access.exe \
1000         finally_block_ending_in_dead_bb.exe \
1001         generic-array-exc.2.exe \
1002         generic-marshalbyref.2.exe \
1003         generic-mkrefany.2.exe \
1004         generic-refanyval.2.exe \
1005         generic-stack-traces2.2.exe \
1006         generic-type-load-exception.2.exe \
1007         generic-unloading.2.exe \
1008         generics-invoke-byref.2.exe \
1009         generics-sharing.2.exe \
1010         handleref.exe \
1011         invalid-token.exe \
1012         invalid_generic_instantiation.exe \
1013         ldfld_missing_class.exe \
1014         ldfld_missing_field.exe \
1015         ldftn-access.exe \
1016         main-returns-background-change.exe \
1017         marshal-valuetypes.exe \
1018         marshal.exe \
1019         marshal2.exe \
1020         marshal8.exe \
1021         marshal9.exe \
1022         marshalbool.exe \
1023         method-access.exe \
1024         monitor.exe \
1025         nullable_boxing.2.exe \
1026         pinvoke-2.2.exe \
1027         pinvoke-utf8.exe \
1028         pinvoke.exe \
1029         pinvoke11.exe \
1030         pinvoke2.exe \
1031         pinvoke3.exe \
1032         pinvoke_ppcc.exe \
1033         pinvoke_ppcd.exe \
1034         pinvoke_ppcf.exe \
1035         pinvoke_ppci.exe \
1036         pinvoke_ppcs.exe \
1037         process-unref-race.exe \
1038         reload-at-bb-end.exe \
1039         remoting1.exe \
1040         remoting2.exe \
1041         remoting3.exe \
1042         remoting4.exe \
1043         remoting5.exe \
1044         safehandle.2.exe \
1045         stackframes-async.2.exe \
1046         static-constructor.exe \
1047         test-inline-call-stack.exe \
1048         test-type-ctor.exe \
1049         thread6.exe \
1050         threadpool-exceptions1.exe \
1051         threadpool-exceptions2.exe \
1052         threadpool-exceptions3.exe \
1053         threadpool-exceptions4.exe \
1054         threadpool-exceptions5.exe \
1055         threadpool-exceptions6.exe \
1056         threadpool-exceptions7.exe \
1057         threadpool.exe \
1058         threadpool1.exe \
1059         thunks.exe \
1060         transparentproxy.exe \
1061         typeload-unaligned.exe \
1062         unload-appdomain-on-shutdown.exe \
1063         vararg.exe \
1064         vararg2.exe \
1065         vt-sync-method.exe \
1066         winx64structs.exe \
1067         xdomain-threads.exe
1068
1069 TESTS_CS=$(filter-out $(DISABLED_TESTS),$(TESTS_CS_SRC:.cs=.exe))
1070 TESTS_IL=$(filter-out $(DISABLED_TESTS),$(TESTS_IL_SRC:.il=.exe))
1071 TESTS_BENCH=$(filter-out $(DISABLED_TESTS),$(TESTS_BENCH_SRC:.cs=.exe))
1072 TESTS_STRESS=$(filter-out $(DISABLED_TESTS),$(TESTS_STRESS_SRC:.cs=.exe))
1073 TESTS_GSHARED=$(filter-out $(DISABLED_TESTS),$(TESTS_GSHARED_SRC:.cs=.exe))
1074
1075 if FULL_AOT_TESTS
1076 TESTSAOT_CS=$(TESTS_CS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1077 TESTSAOT_IL=$(TESTS_IL:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1078 TESTSAOT_BENCH=$(TESTS_BENCH:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1079 TESTSAOT_STRESS=$(TESTS_STRESS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1080 TESTSAOT_GSHARED=$(TESTS_GSHARED:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1081 endif
1082
1083 if HYBRID_AOT_TESTS
1084 TESTSAOT_CS=$(TESTS_CS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1085 TESTSAOT_IL=$(TESTS_IL:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1086 TESTSAOT_BENCH=$(TESTS_BENCH:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1087 TESTSAOT_STRESS=$(TESTS_STRESS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1088 TESTSAOT_GSHARED=$(TESTS_GSHARED:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1089 endif
1090
1091 EXTRA_DIST=test-driver test-runner.cs $(TESTS_CS_SRC) $(TESTS_IL_SRC) \
1092         $(TESTS_BENCH_SRC) $(TESTS_STRESS_SRC) stress-runner.pl
1093
1094 %.exe: %.il
1095         $(ILASM) -out:$@ $<
1096
1097 if !FULL_AOT_TESTS
1098 if !HYBRID_AOT_TESTS
1099 TEST_DRIVER_HARD_KILL_FEATURE=-r:$(CLASS)/Mono.Posix.dll
1100 endif
1101 endif
1102
1103 if FULL_AOT_TESTS
1104 TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
1105 else
1106 if HYBRID_AOT_TESTS
1107 TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
1108 else
1109 TEST_DRIVER_DEPEND=TestDriver.dll
1110 endif
1111 endif
1112
1113 %.exe: %.cs $(TEST_DRIVER_DEPEND)
1114         $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
1115
1116 # N.B. test-runner.exe references the TOOLS_RUNTIME versions of the framework assemblies
1117 test-runner.exe: test-runner.cs $(TEST_DRIVER_DEPEND)
1118         $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
1119
1120 %.dll: %.cs
1121         $(MCS) -r:$(CLASS)/System.dll -target:library -out:$@ $<
1122 %.dll: %.il
1123         $(ILASM) /dll /output:$@ $<
1124
1125 reference-loader.exe: reference-loader.cs TestingReferenceAssembly.dll TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_DEPEND)
1126         $(MCS) -r:$(CLASS)/System.dll -r:TestDriver.dll -r:TestingReferenceAssembly.dll -r:TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $(srcdir)/reference-loader.cs
1127
1128 TestingReferenceAssembly.dll: TestingReferenceAssembly.cs
1129         $(MCS) -target:library -out:$@ $<
1130
1131 TestingReferenceReferenceAssembly.dll: TestingReferenceReferenceAssembly.cs TestingReferenceAssembly.dll
1132         $(MCS) -r:TestingReferenceAssembly.dll -target:library -out:$@ $<
1133
1134 %.exe$(PLATFORM_AOT_SUFFIX): %.exe 
1135         $(RUNTIME) $(AOT_BUILD_FLAGS) $<
1136
1137 %.dll$(PLATFORM_AOT_SUFFIX): %.dll 
1138         $(RUNTIME) $(AOT_BUILD_FLAGS) $<
1139
1140 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
1141 if POWERPC
1142 test-platform:
1143 else
1144 # Can't use mkbundle on win32 since there is no static build there
1145 # Can't run test-unhandled-exception on Windows because of all the debug popups...
1146 if HOST_WIN32
1147 test-platform:
1148 else
1149 # mkbundle uses the installed mono-2.pc so it won't work if there is no system mono
1150 #test-platform: testbundle test-iomap-regression
1151 test-platform:  test-iomap-regression
1152 endif
1153 endif
1154
1155 # Target to precompile the test executables
1156 tests: compile-tests
1157
1158 #
1159 # Test that no symbols are missed in eglib-remap.h
1160 #
1161 if HOST_LINUX
1162 test-platform: test-eglib-remap
1163 else
1164 if HOST_DARWIN
1165 test-platform: test-eglib-remap
1166 endif
1167 endif
1168 # The following regexp describes all symbols that start with "g_" but are not part of eglibc.
1169 # The optional underscore prepending symbol names may or may not appear depending on the
1170 # system and the state of the leading-underscore compiler flag.
1171 OK_G_SYMBOLS='\<_?g_(s?list_(pre|ap)pend_(image|mempool)|concat_dir_and_file|Ctoc)\>'
1172 test-eglib-remap:
1173         @echo "Testing eglib remap..."
1174         @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
1175
1176 test-env-options:
1177         MONO_ENV_OPTIONS="--version" $(RUNTIME) array-init.exe | grep -q Architecture:
1178
1179 # Precompile the test assemblies in parallel
1180 compile-tests:
1181         $(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
1182
1183 # Remove empty .stdout and .stderr files for wrench
1184 rm-empty-logs:
1185         @echo "Removing empty logs..."
1186         find . '(' -name "*.stdout" -o -name "*.stderr" ')' -size 0 -exec rm {} \;
1187
1188 TestDriver.dll:
1189         $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs $(srcdir)/../mini/TestHelpers.cs
1190
1191 runtest: compile-tests
1192         @failed=0; \
1193         passed=0; \
1194         failed_tests="";\
1195         if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
1196         rm -f testlist testlist.sorted; \
1197         for i in $(TESTS_CS) $(TESTS_IL) $(TESTS_BENCH); do echo $${i} >> testlist; sort testlist > testlist.sorted; done; \
1198         for i in `cat testlist.sorted`; do \
1199                 rm -f $${i}.so; \
1200                 $(with_mono_path) $(JITTEST_PROG_RUN) --aot --debug $${i} > $${i}.aotlog 2>&1 || exit 1; \
1201                 if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" "$${dump_action}" $(RUNTIME_ARGS); \
1202                 then \
1203                         passed=`expr $${passed} + 1`; \
1204                 else \
1205                         if [ $$? = 2 ]; then break; fi; \
1206                         failed=`expr $${failed} + 1`; \
1207                         failed_tests="$${failed_tests} $$i"; \
1208                 fi \
1209         done; \
1210         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1211         rm -f testlist testlist.sorted; \
1212         if [ $${failed} != 0 ]; then \
1213           echo -e "\nFailed tests:\n"; \
1214           for i in $${failed_tests}; do \
1215             echo $${i}; \
1216             if [ "x$$V" = "x1" ]; then \
1217               cat $${i}.stdout; \
1218               cat $${i}.stderr; \
1219             fi; \
1220           done; \
1221           exit 1; \
1222         fi
1223
1224 runtest-managed: test-runner.exe compile-tests
1225         $(TOOLS_RUNTIME) --debug $(TEST_RUNNER) -j a --testsuite-name "runtime" --timeout 300 --disabled "$(DISABLED_TESTS)" $(TESTS_CS) $(TESTS_IL) $(TESTS_BENCH)
1226
1227 runtest-managed-serial: test-runner.exe compile-tests
1228         $(TOOLS_RUNTIME) --debug $(TEST_RUNNER) -j 1 --testsuite-name "runtime" --disabled "$(DISABLED_TESTS)" $(TESTS_CS) $(TESTS_IL) $(TESTS_BENCH)
1229
1230 test-jit:
1231         @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
1232
1233 testaot:
1234         @$(MAKE) AOT=1 runtest
1235
1236 testtrace:
1237         @$(MAKE) RUNTIME_ARGS="$${RUNTIME_ARGS} --trace" runtest
1238
1239 testinterp: test-runner.exe compile-tests
1240         $(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)
1241
1242 testjitspeed: $(JITTEST_PROG) compile-tests
1243         for i in $(TESTS_BENCH); do     \
1244                 echo $$i;       \
1245                 time $(JITTEST_PROG) $$i;       \
1246         done
1247
1248 test-iomap-regression: exists.exe
1249         @echo "Testing exists.exe..."
1250         @MONO_IOMAP=all $(RUNTIME) exists.exe
1251
1252 stresstest: compile-tests
1253         @failed=0; \
1254         passed=0; \
1255         failed_tests="";\
1256         for i in $(TESTS_STRESS); do    \
1257                 if $(srcdir)/stress-runner.pl $$i ../mini/mono $(RUNTIME_ARGS); \
1258                 then \
1259                         passed=`expr $${passed} + 1`; \
1260                 else \
1261                         if [ $$? = 2 ]; then break; fi; \
1262                         failed=`expr $${failed} + 1`; \
1263                         failed_tests="$${failed_tests} $$i"; \
1264                 fi \
1265         done; \
1266         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1267         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1268           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1269
1270 testbundle: console.exe
1271         @echo "Testing mkbundle..."
1272         @$(MKBUNDLE) --static console.exe > mkbundle.stdout
1273         @$(with_mono_path) MONO_CFG_DIR=$(mono_cfg_dir) ./a.out >> mkbundle.stdout
1274         @- rm -rf a.out
1275
1276 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
1277
1278 load-missing.dll: load-missing.il
1279         $(Q) $(ILASM) /dll /output:$@ $<
1280
1281 load-exceptions.exe t.dll: load-exceptions.cs t-missing.cs load-missing.dll $(TEST_DRIVER_DEPEND)
1282         $(Q) $(MCS) -t:library -out:t.dll -d:FOUND t-missing.cs
1283         $(Q) $(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:$@ $<
1284         $(Q) $(MCS) -t:library -out:t.dll t-missing.cs
1285
1286 test-type-load: load-exceptions.exe
1287 if !POWERPC64
1288         $(Q) $(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
1289 endif
1290
1291 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
1292
1293 test-multi-netmodule-1-netmodule.netmodule: test-multi-netmodule-1-netmodule.cs
1294         $(Q) $(MCS) -t:module -out:$@ $<
1295 test-multi-netmodule-2-dll1.dll: test-multi-netmodule-2-dll1.cs test-multi-netmodule-1-netmodule.netmodule
1296         $(Q) $(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library  -out:$@ $<
1297 test-multi-netmodule-3-dll2.dll: test-multi-netmodule-3-dll2.cs test-multi-netmodule-1-netmodule.netmodule
1298         $(Q) $(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library -out:$@ $<
1299 test-multi-netmodule-4-exe.exe: test-multi-netmodule-4-exe.cs test-multi-netmodule-2-dll1.dll test-multi-netmodule-3-dll2.dll
1300         $(Q) $(MCS) -r:test-multi-netmodule-2-dll1.dll -out:$@ $<
1301
1302 test-multi-netmodule: test-multi-netmodule-4-exe.exe
1303         $(Q) $(RUNTIME) test-multi-netmodule-4-exe.exe > test-multi-netmodule-4-exe.exe.stdout 2> test-multi-netmodule-4-exe.exe.stderr
1304
1305 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
1306
1307 custom-attr-errors.exe custom-attr-errors-lib.dll: custom-attr-errors.cs custom-attr-errors-lib.cs $(TEST_DRIVER_DEPEND)
1308         $(Q) $(MCS) /t:library -D:WITH_MEMBERS custom-attr-errors-lib.cs
1309         $(Q) $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll custom-attr-errors.cs
1310         $(Q) $(MCS) /t:library custom-attr-errors-lib.cs
1311
1312 test-cattr-type-load: custom-attr-errors.exe
1313         $(Q) $(RUNTIME) custom-attr-errors.exe > custom-attr-errors.exe.stdout 2> custom-attr-errors.exe.stderr
1314
1315 EXTRA_DIST += reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.cs reflection-load-with-context.cs
1316
1317 reflection-load-with-context-second-lib.dll: reflection-load-with-context-second-lib.cs
1318         $(Q) $(MCS) /t:library -out:$@ $<
1319 reflection-load-with-context-lib.dll: reflection-load-with-context-lib.cs reflection-load-with-context-second-lib.dll
1320         $(Q) $(MCS) /t:library -r:reflection-load-with-context-second-lib.dll -out:$@ $<
1321 reflection-load-with-context.exe: reflection-load-with-context-lib.dll
1322
1323 test-reflection-load-with-context: reflection-load-with-context.exe
1324         $(Q) $(RUNTIME) reflection-load-with-context.exe > reflection-load-with-context.exe.stdout 2> reflection-load-with-context.exe.stderr
1325
1326
1327 EXTRA_DIST += debug-casts.cs
1328 # This depends on TLS, so its not ran by default
1329 debug-casts: debug-casts.exe
1330         $(Q) $(RUNTIME) --debug=casts debug-casts.exe
1331
1332 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
1333
1334 test-sgen:
1335         ok=; \
1336         $(MAKE) test-sgen-regular || ok=false; \
1337         $(MAKE) test-sgen-toggleref || ok=false; \
1338         $(MAKE) test-sgen-bridge || ok=false; \
1339         $(MAKE) test-sgen-bridge2 || ok=false; \
1340         $(MAKE) test-sgen-bridge3 || ok=false; \
1341         $$ok
1342
1343 test-stress-sgen:
1344         ok=; \
1345         $(MAKE) test-stress-sgen-regular || ok=false; \
1346         $(MAKE) test-stress-sgen-toggleref || ok=false; \
1347         $(MAKE) test-stress-sgen-bridge || ok=false; \
1348         $(MAKE) test-stress-sgen-bridge2 || ok=false; \
1349         $(MAKE) test-stress-sgen-bridge3 || ok=false; \
1350         $$ok
1351
1352 TESTS_SGEN_REGULAR_SRC =        \
1353         finalizer-wait.cs       \
1354         critical-finalizers.cs  \
1355         sgen-descriptors.cs     \
1356         sgen-gshared-vtype.cs   \
1357         sgen-weakref-stress.cs  \
1358         sgen-cementing-stress.cs        \
1359         sgen-case-23400.cs      \
1360         sgen-new-threads-dont-join-stw.cs       \
1361         sgen-new-threads-dont-join-stw-2.cs     \
1362         sgen-new-threads-collect.cs     \
1363         gc-graystack-stress.cs  \
1364         bug-17590.cs    \
1365         sgen-domain-unload.cs   \
1366         sgen-domain-unload-2.cs
1367
1368 TESTS_SGEN_REGULAR=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_REGULAR_SRC:.cs=.exe))
1369
1370 if FULL_AOT_TESTS
1371 TESTSAOT_SGEN_REGULAR=$(TESTS_SGEN_REGULAR:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1372 endif
1373
1374 if HYBRID_AOT_TESTS
1375 TESTSAOT_SGEN_REGULAR=$(TESTS_SGEN_REGULAR:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1376 endif
1377
1378 test-sgen-regular: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR)
1379         ok=; \
1380         $(MAKE) test-sgen-regular-ms-simple || ok=false; \
1381         $(MAKE) test-sgen-regular-ms-conc-simple || ok=false; \
1382         $$ok
1383
1384 test-stress-sgen-regular: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR)
1385         ok=; \
1386         $(MAKE) test-sgen-regular-ms-simple MONO_TESTS_STRESS=1 || ok=false; \
1387         $(MAKE) test-sgen-regular-ms-conc-simple MONO_TESTS_STRESS=1 || ok=false; \
1388         $(MAKE) test-sgen-regular-ms-conc-par-simple MONO_TESTS_STRESS=1 || ok=false; \
1389         $(MAKE) test-sgen-regular-ms-conc-split MONO_TESTS_STRESS=1 || ok=false; \
1390         $(MAKE) test-sgen-regular-ms-conc-split-95-clear-at-gc MONO_TESTS_STRESS=1 || ok=false; \
1391         $(MAKE) test-sgen-regular-ms-conc-par-simple-par-dyn MONO_TESTS_STRESS=1 || ok=false; \
1392         $(MAKE) test-sgen-regular-ms-conc-par-simple-par-512k MONO_TESTS_STRESS=1 || ok=false; \
1393         $(MAKE) test-sgen-regular-ms-conc-par-simple-par-32m MONO_TESTS_STRESS=1 || ok=false; \
1394         $(MAKE) test-sgen-regular-ms-conc-par-simple-par-dyn-clear-at-gc MONO_TESTS_STRESS=1 || ok=false; \
1395         $$ok
1396
1397 test-sgen-regular-ms-simple: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1398         $(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)
1399 test-sgen-regular-ms-conc-simple: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1400         $(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)
1401 test-sgen-regular-ms-conc-par-simple: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1402         $(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)
1403 test-sgen-regular-ms-conc-split: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1404         $(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)
1405 test-sgen-regular-ms-conc-split-95-clear-at-gc: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1406         $(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)
1407 test-sgen-regular-ms-conc-par-simple-par-dyn: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1408         $(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)
1409 test-sgen-regular-ms-conc-par-simple-par-512k: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1410         $(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)
1411 test-sgen-regular-ms-conc-par-simple-par-32m: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1412         $(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)
1413 test-sgen-regular-ms-conc-par-simple-par-dyn-clear-at-gc: $(TESTS_SGEN_REGULAR) $(TESTSAOT_SGEN_REGULAR) test-runner.exe
1414         $(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)
1415
1416 TESTS_SGEN_TOGGLEREF_SRC=       \
1417         sgen-toggleref.cs
1418
1419 TESTS_SGEN_TOGGLEREF=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_TOGGLEREF_SRC:.cs=.exe))
1420
1421 if FULL_AOT_TESTS
1422 TESTSAOT_SGEN_TOGGLEREF=$(TESTS_SGEN_TOGGLEREF:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1423 endif
1424
1425 if HYBRID_AOT_TESTS
1426 TESTSAOT_SGEN_TOGGLEREF=$(TESTS_SGEN_TOGGLEREF:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1427 endif
1428
1429 test-sgen-toggleref: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF)
1430         ok=; \
1431         $(MAKE) test-sgen-toggleref-ms-simple || ok=false; \
1432         $(MAKE) test-sgen-toggleref-ms-conc-simple || ok=false; \
1433         $$ok
1434
1435 test-stress-sgen-toggleref: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF)
1436         ok=; \
1437         $(MAKE) test-sgen-toggleref-ms-simple MONO_TESTS_STRESS=1 || ok=false; \
1438         $(MAKE) test-sgen-toggleref-ms-conc-simple MONO_TESTS_STRESS=1 || ok=false; \
1439         $(MAKE) test-sgen-toggleref-ms-conc-par-simple MONO_TESTS_STRESS=1 || ok=false; \
1440         $(MAKE) test-sgen-toggleref-ms-conc-split MONO_TESTS_STRESS=1 || ok=false; \
1441         $(MAKE) test-sgen-toggleref-ms-conc-split-95-clear-at-gc MONO_TESTS_STRESS=1 || ok=false; \
1442         $(MAKE) test-sgen-toggleref-ms-conc-par-simple-par-dyn MONO_TESTS_STRESS=1 || ok=false; \
1443         $(MAKE) test-sgen-toggleref-ms-conc-par-simple-par-512k MONO_TESTS_STRESS=1 || ok=false; \
1444         $(MAKE) test-sgen-toggleref-ms-conc-par-simple-par-32m MONO_TESTS_STRESS=1 || ok=false; \
1445         $(MAKE) test-sgen-toggleref-ms-conc-par-simple-par-dyn-clear-at-gc MONO_TESTS_STRESS=1 || ok=false; \
1446         $$ok
1447
1448 test-sgen-toggleref-ms-simple: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1449         $(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)
1450 test-sgen-toggleref-ms-conc-simple: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1451         $(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)
1452 test-sgen-toggleref-ms-conc-par-simple: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1453         $(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)
1454 test-sgen-toggleref-ms-conc-split: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1455         $(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)
1456 test-sgen-toggleref-ms-conc-split-95-clear-at-gc: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1457         $(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)
1458 test-sgen-toggleref-ms-conc-par-simple-par-dyn: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1459         $(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)
1460 test-sgen-toggleref-ms-conc-par-simple-par-512k: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1461         $(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)
1462 test-sgen-toggleref-ms-conc-par-simple-par-32m: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1463         $(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)
1464 test-sgen-toggleref-ms-conc-par-simple-par-dyn-clear-at-gc: $(TESTS_SGEN_TOGGLEREF) $(TESTSAOT_SGEN_TOGGLEREF) test-runner.exe
1465         $(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)
1466
1467 TESTS_SGEN_BRIDGE_SRC=  \
1468         sgen-bridge.cs  \
1469         sgen-bridge-major-fragmentation.cs
1470
1471 TESTS_SGEN_BRIDGE=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_BRIDGE_SRC:.cs=.exe))
1472
1473 if FULL_AOT_TESTS
1474 TESTSAOT_SGEN_BRIDGE=$(TESTS_SGEN_BRIDGE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1475 endif
1476
1477 if HYBRID_AOT_TESTS
1478 TESTSAOT_SGEN_BRIDGE=$(TESTS_SGEN_BRIDGE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1479 endif
1480
1481 test-sgen-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE)
1482         ok=; \
1483         $(MAKE) test-sgen-bridge-ms-simple-tarjan-bridge || ok=false; \
1484         $(MAKE) test-sgen-bridge-ms-conc-simple-tarjan-bridge || ok=false; \
1485         $$ok
1486
1487 test-stress-sgen-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE)
1488         ok=; \
1489         $(MAKE) test-sgen-bridge-ms-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1490         $(MAKE) test-sgen-bridge-ms-conc-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1491         $(MAKE) test-sgen-bridge-ms-conc-split-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1492         $(MAKE) test-sgen-bridge-ms-conc-simple-new-bridge MONO_TESTS_STRESS=1 || ok=false; \
1493         $(MAKE) test-sgen-bridge-ms-conc-simple-old-bridge MONO_TESTS_STRESS=1 || ok=false; \
1494         $(MAKE) test-sgen-bridge-ms-conc-par-simple-par-dyn-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1495         $(MAKE) test-sgen-bridge-ms-conc-par-simple-par-512k-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1496         $(MAKE) test-sgen-bridge-ms-conc-par-simple-par-32m-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1497         $$ok
1498
1499 test-sgen-bridge-ms-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1500         $(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)
1501 test-sgen-bridge-ms-conc-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1502         $(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)
1503 test-sgen-bridge-ms-conc-split-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1504         $(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)
1505 test-sgen-bridge-ms-conc-simple-new-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1506         $(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)
1507 test-sgen-bridge-ms-conc-simple-old-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1508         $(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)
1509 test-sgen-bridge-ms-conc-par-simple-par-dyn-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1510         $(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)
1511 test-sgen-bridge-ms-conc-par-simple-par-512k-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1512         $(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)
1513 test-sgen-bridge-ms-conc-par-simple-par-32m-tarjan-bridge: $(TESTS_SGEN_BRIDGE) $(TESTSAOT_SGEN_BRIDGE) test-runner.exe
1514         $(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)
1515
1516 TESTS_SGEN_BRIDGE2_SRC= \
1517         sgen-bridge-xref.cs
1518
1519 TESTS_SGEN_BRIDGE2=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_BRIDGE2_SRC:.cs=.exe))
1520
1521 if FULL_AOT_TESTS
1522 TESTSAOT_SGEN_BRIDGE2=$(TESTS_SGEN_BRIDGE2:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1523 endif
1524
1525 if HYBRID_AOT_TESTS
1526 TESTSAOT_SGEN_BRIDGE2=$(TESTS_SGEN_BRIDGE2:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1527 endif
1528
1529 test-sgen-bridge2: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2)
1530         ok=; \
1531         $(MAKE) test-sgen-bridge2-ms-simple-tarjan-bridge || ok=false; \
1532         $(MAKE) test-sgen-bridge2-ms-conc-simple-tarjan-bridge || ok=false; \
1533         $$ok
1534
1535 test-stress-sgen-bridge2: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2)
1536         ok=; \
1537         $(MAKE) test-sgen-bridge2-ms-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1538         $(MAKE) test-sgen-bridge2-ms-conc-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1539         $(MAKE) test-sgen-bridge2-ms-conc-split-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1540         $(MAKE) test-sgen-bridge2-ms-conc-simple-new-bridge MONO_TESTS_STRESS=1 || ok=false; \
1541         $(MAKE) test-sgen-bridge2-ms-conc-simple-old-bridge MONO_TESTS_STRESS=1 || ok=false; \
1542         $(MAKE) test-sgen-bridge2-ms-conc-par-simple-par-dyn-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1543         $(MAKE) test-sgen-bridge2-ms-conc-par-simple-par-512k-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1544         $(MAKE) test-sgen-bridge2-ms-conc-par-simple-par-32m-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1545         $$ok
1546
1547 test-sgen-bridge2-ms-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1548         $(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)
1549 test-sgen-bridge2-ms-conc-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1550         $(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)
1551 test-sgen-bridge2-ms-conc-split-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1552         $(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)
1553 test-sgen-bridge2-ms-conc-simple-new-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1554         $(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)
1555 test-sgen-bridge2-ms-conc-simple-old-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1556         $(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)
1557 test-sgen-bridge2-ms-conc-par-simple-par-dyn-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1558         $(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)
1559 test-sgen-bridge2-ms-conc-par-simple-par-512k-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1560         $(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)
1561 test-sgen-bridge2-ms-conc-par-simple-par-32m-tarjan-bridge: $(TESTS_SGEN_BRIDGE2) $(TESTSAOT_SGEN_BRIDGE2) test-runner.exe
1562         $(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)
1563
1564 TESTS_SGEN_BRIDGE3_SRC= \
1565         sgen-bridge-gchandle.cs
1566
1567 TESTS_SGEN_BRIDGE3=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_BRIDGE3_SRC:.cs=.exe))
1568
1569 if FULL_AOT_TESTS
1570 TESTSAOT_SGEN_BRIDGE3=$(TESTS_SGEN_BRIDGE3:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1571 endif
1572
1573 if HYBRID_AOT_TESTS
1574 TESTSAOT_SGEN_BRIDGE3=$(TESTS_SGEN_BRIDGE3:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1575 endif
1576
1577 test-sgen-bridge3: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3)
1578         ok=; \
1579         $(MAKE) test-sgen-bridge3-ms-simple-tarjan-bridge || ok=false; \
1580         $(MAKE) test-sgen-bridge3-ms-conc-simple-tarjan-bridge || ok=false; \
1581         $$ok
1582
1583 test-stress-sgen-bridge3: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3)
1584         ok=; \
1585         $(MAKE) test-sgen-bridge3-ms-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1586         $(MAKE) test-sgen-bridge3-ms-conc-simple-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1587         $(MAKE) test-sgen-bridge3-ms-conc-split-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1588         $(MAKE) test-sgen-bridge3-ms-conc-simple-new-bridge MONO_TESTS_STRESS=1 || ok=false; \
1589         $(MAKE) test-sgen-bridge3-ms-conc-simple-old-bridge MONO_TESTS_STRESS=1 || ok=false; \
1590         $(MAKE) test-sgen-bridge3-ms-conc-par-simple-par-dyn-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1591         $(MAKE) test-sgen-bridge3-ms-conc-par-simple-par-512k-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1592         $(MAKE) test-sgen-bridge3-ms-conc-par-simple-par-32m-tarjan-bridge MONO_TESTS_STRESS=1 || ok=false; \
1593         $$ok
1594
1595 test-sgen-bridge3-ms-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1596         $(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)
1597 test-sgen-bridge3-ms-conc-simple-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1598         $(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)
1599 test-sgen-bridge3-ms-conc-split-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1600         $(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)
1601 test-sgen-bridge3-ms-conc-simple-new-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1602         $(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)
1603 test-sgen-bridge3-ms-conc-simple-old-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1604         $(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)
1605 test-sgen-bridge3-ms-conc-par-simple-par-dyn-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1606         $(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)
1607 test-sgen-bridge3-ms-conc-par-simple-par-512k-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1608         $(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)
1609 test-sgen-bridge3-ms-conc-par-simple-par-32m-tarjan-bridge: $(TESTS_SGEN_BRIDGE3) $(TESTSAOT_SGEN_BRIDGE3) test-runner.exe
1610         $(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)
1611
1612 TESTS_SGEN_OOM_SRC =    \
1613         sgen-oom-cementing-stress.cs    \
1614         sgen-oom-new-threads-dont-join-stw-2.cs \
1615         sgen-oom-bridge-major-fragmentation.cs \
1616         gc-oom-handling.cs      \
1617         gc-oom-handling2.cs
1618
1619 TESTS_SGEN_OOM=$(filter-out $(DISABLED_TESTS),$(TESTS_SGEN_OOM_SRC:.cs=.exe))
1620
1621 if FULL_AOT_TESTS
1622 TESTSAOT_SGEN_OOM=$(TESTS_SGEN_OOM:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1623 endif
1624
1625 if HYBRID_AOT_TESTS
1626 TESTSAOT_SGEN_OOM=$(TESTS_SGEN_OOM:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1627 endif
1628
1629 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
1630         $(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)
1631
1632 AOT_CONFIGURATIONS=     \
1633         "|regular"      \
1634         "--gc=boehm|boehm"
1635
1636 #LLVM crashes, got to fix it first.
1637 #       "--llvm|llvm"   \
1638 #       "--llvm --gc=boehm|llvm+boehm"
1639
1640
1641 test-aot:
1642         @failed=0; \
1643         passed=0; \
1644         failed_tests="";\
1645         profile=$(DEFAULT_PROFILE);     \
1646         tmpfile=`mktemp -t mono_aot_outputXXXXXX` || exit 1;    \
1647         rm -f test-aot-$${name}.stdout test-aot-$${name}.stderr; \
1648         for assembly in $(mcs_topdir)/class/lib/$$profile/*.dll ; do    \
1649                 asm_name=`basename $$assembly`; \
1650                 echo "... $$asm_name";  \
1651                 for conf in $(AOT_CONFIGURATIONS); do   \
1652                         name=`echo $$conf | cut -d\| -f 2`;     \
1653                         params=`echo $$conf | cut -d\| -f 1`;   \
1654                         test_name="$${asm_name}|$${name}";      \
1655                         echo "  $$test_name";   \
1656                         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;        \
1657                         then \
1658                                 passed=`expr $${passed} + 1`; \
1659                         else \
1660                                 failed=`expr $${failed} + 1`; \
1661                                 failed_tests="$${failed_tests} $$test_name"; \
1662                         fi \
1663                 done;   \
1664         done;   \
1665         rm      $$tmpfile;      \
1666         echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
1667         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
1668         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
1669
1670
1671 # Generated tests for runtime invoke
1672 EXTRA_DIST += gen-runtime-invoke.cs
1673
1674 runtime-invoke.gen.cs: gen-runtime-invoke.exe
1675         $(Q) $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
1676
1677 EXTRA_DIST += make-imt-test.cs
1678
1679 imt_big_iface_test.cs: make-imt-test.exe
1680         $(Q) $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
1681
1682 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
1683
1684 test-inline-call-stack-library.dll: $(srcdir)/test-inline-call-stack-library.cs
1685         $(MCS) -t:library -out:$@ $<
1686
1687 test-inline-call-stack.exe$(PLATFORM_AOT_SUFFIX): test-inline-call-stack-library.dll$(PLATFORM_AOT_SUFFIX)
1688 test-inline-call-stack.exe: test-inline-call-stack.cs test-inline-call-stack-library.dll $(TEST_DRIVER_DEPEND)
1689         $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:$@ $<
1690
1691 EXTRA_DIST += unhandled-exception-base-configuration.config
1692 EXTRA_DIST += unhandled-exception-legacy-configuration.config
1693 EXTRA_DIST += appdomain-unload.exe.config
1694 EXTRA_DIST += unhandled-exception-test-case.2.cs
1695 EXTRA_DIST += unhandled-exception-test-runner.2.cs
1696 unhandled-exception-test-case.1.cs: unhandled-exception-test-case.2.cs
1697         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case.1.cs
1698 unhandled-exception-test-case-legacy.1.cs: unhandled-exception-test-case.1.cs
1699         cp unhandled-exception-test-case.1.cs unhandled-exception-test-case-legacy.1.cs
1700 unhandled-exception-test-case-legacy.2.cs: unhandled-exception-test-case.2.cs
1701         cp unhandled-exception-test-case.2.cs unhandled-exception-test-case-legacy.2.cs
1702 unhandled-exception-config_files: unhandled-exception-base-configuration.config unhandled-exception-legacy-configuration.config
1703         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.1.exe.config
1704         cp unhandled-exception-base-configuration.config unhandled-exception-test-case.2.exe.config
1705         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.1.exe.config
1706         cp unhandled-exception-legacy-configuration.config unhandled-exception-test-case-legacy.2.exe.config
1707
1708 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
1709
1710 test-unhandled-exception: unhandled-exception-test-runner.2.exe
1711         $(Q) $(RUNTIME) unhandled-exception-test-runner.2.exe RUNTIME:../mini/mono,GTC:F
1712
1713 safehandle.2.exe winx64structs.exe thunks.exe pinvoke3.exe pinvoke2.exe pinvoke-2.2.exe pinvoke17.exe pinvoke13.exe \
1714         pinvoke11.exe pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe pinvoke_ppcc.exe pinvoke.exe \
1715         marshalbool.exe marshal9.exe marshal5.exe marshal.exe handleref.exe cominterop.exe bug-Xamarin-5278.exe \
1716         bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe: libtest.la
1717
1718 event-get.2.exe$(PLATFORM_AOT_SUFFIX): event-il.exe$(PLATFORM_AOT_SUFFIX)
1719 event-get.2.exe: event-il.exe
1720
1721 module-cctor-loader.2.exe$(PLATFORM_AOT_SUFFIX): module-cctor.exe$(PLATFORM_AOT_SUFFIX)
1722 module-cctor-loader.2.exe: module-cctor.exe
1723
1724 reference-loader.exe$(PLATFORM_AOT_SUFFIX): TestingReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX) TestingReferenceReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX)
1725 reference-loader.exe: TestingReferenceAssembly.dll TestingReferenceReferenceAssembly.dll
1726
1727 assemblyresolve_asm.dll$(PLATFORM_AOT_SUFFIX): assemblyresolve_asm.dll assemblyresolve_deps/Test.dll$(PLATFORM_AOT_SUFFIX)
1728         MONO_PATH="assemblyresolve_deps:$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(AOT_BUILD_FLAGS) assemblyresolve_asm.dll
1729 assemblyresolve_deps/Test.dll$(PLATFORM_AOT_SUFFIX): assemblyresolve_deps/Test.dll assemblyresolve_deps/TestBase.dll$(PLATFORM_AOT_SUFFIX)
1730
1731 EXTRA_DIST += assemblyresolve_TestBase.cs assemblyresolve_Test.cs assemblyresolve_asm.cs 
1732 assemblyresolve_deps:
1733         mkdir -p assemblyresolve_deps
1734 assemblyresolve_deps/TestBase.dll: assemblyresolve_deps $(srcdir)/assemblyresolve_TestBase.cs
1735         $(MCS) -target:library -out:assemblyresolve_deps/TestBase.dll $(srcdir)/assemblyresolve_TestBase.cs
1736 assemblyresolve_deps/Test.dll: assemblyresolve_deps assemblyresolve_deps/TestBase.dll $(srcdir)/assemblyresolve_Test.cs
1737         $(MCS) -target:library -r:assemblyresolve_deps/TestBase.dll -out:assemblyresolve_deps/Test.dll $(srcdir)/assemblyresolve_Test.cs
1738 assemblyresolve_asm.dll: assemblyresolve_deps/Test.dll $(srcdir)/assemblyresolve_asm.cs
1739         $(MCS) -target:library -r:assemblyresolve_deps/TestBase.dll -r:assemblyresolve_deps/Test.dll -out:assemblyresolve_asm.dll $(srcdir)/assemblyresolve_asm.cs
1740
1741 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)
1742 assemblyresolve_event3.exe: assemblyresolve_asm.dll assemblyresolve_deps/Test.dll assemblyresolve_deps/TestBase.dll
1743
1744 assemblyresolve_event4.exe$(PLATFORM_AOT_SUFFIX): assemblyresolve_deps/Test.dll$(PLATFORM_AOT_SUFFIX) assemblyresolve_deps/TestBase.dll$(PLATFORM_AOT_SUFFIX)
1745 assemblyresolve_event4.exe: assemblyresolve_deps/Test.dll assemblyresolve_deps/TestBase.dll
1746
1747 EXTRA_DIST += assemblyresolve_event5_label.cs assemblyresolve_event5_helper.cs
1748 assemblyresolve_deps/assemblyresolve_event5_label.dll: assemblyresolve_event5_label.cs assemblyresolve_deps 
1749         $(MCS) -target:library -out:assemblyresolve_deps/assemblyresolve_event5_label.dll $(srcdir)/assemblyresolve_event5_label.cs
1750 assemblyresolve_event5_helper.dll: assemblyresolve_event5_helper.cs assemblyresolve_deps/assemblyresolve_event5_label.dll
1751         $(MCS) -target:library -out:assemblyresolve_event5_helper.dll -r:assemblyresolve_deps/assemblyresolve_event5_label.dll $(srcdir)/assemblyresolve_event5_helper.cs
1752 assemblyresolve_event5.exe: assemblyresolve_event5_helper.dll
1753
1754 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)
1755 assemblyresolve_event6.exe: assemblyresolve_asm.dll assemblyresolve_deps/Test.dll assemblyresolve_deps/TestBase.dll
1756
1757 # We use 'test-support-files' to handle an ordering issue between the 'mono/' and 'runtime/' directories
1758 bug-80307.exe: $(srcdir)/bug-80307.cs
1759         $(MCS) -r:$(CLASS)/System.Web.dll -out:$@ $(srcdir)/bug-80307.cs
1760         cd $(top_builddir)/runtime && $(MAKE) test-support-files
1761
1762 EXTRA_DIST += bug-81673-interface.cs
1763
1764 bug-81673.exe$(PLATFORM_AOT_SUFFIX): bug-81673-interface.dll$(PLATFORM_AOT_SUFFIX)
1765 bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-81673-interface.cs
1766         $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1767         $(MCS) -r:bug-81673-interface.dll -out:bug-81673.exe $(srcdir)/bug-81673.cs
1768         $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
1769
1770 EXTRA_DIST += bug-36848-a.cs
1771
1772 bug-36848.exe$(PLATFORM_AOT_SUFFIX): bug-36848-a.dll$(PLATFORM_AOT_SUFFIX)
1773 bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
1774         $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
1775         $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs
1776         $(MCS) -define:WITH_STOP -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
1777
1778 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
1779
1780 bug-81691.exe$(PLATFORM_AOT_SUFFIX): bug-81691-b.dll$(PLATFORM_AOT_SUFFIX)
1781 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
1782         $(MCS) -target:library -out:bug-81691-a.dll $(srcdir)/bug-81691-a.cs 
1783         $(MCS) -r:bug-81691-a.dll -target:library -out:bug-81691-b.dll $(srcdir)/bug-81691-b.cs
1784         $(MCS) -r:bug-81691-b.dll -out:bug-81691.exe $(srcdir)/bug-81691.cs
1785         rm -f bug-81691-a.dll
1786
1787 EXTRA_DIST += bug-81466-lib.il
1788
1789 bug-81466.exe$(PLATFORM_AOT_SUFFIX): bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
1790 bug-81466.exe bug-81466-lib.dll: $(srcdir)/bug-81466.il $(srcdir)/bug-81466-lib.il
1791         $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
1792         $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
1793
1794 EXTRA_DIST += bug-324535-il.il
1795
1796 bug-324535.exe$(PLATFORM_AOT_SUFFIX): bug-324535-il.dll$(PLATFORM_AOT_SUFFIX)
1797 bug-324535.exe bug-324535-il.dll: $(srcdir)/bug-324535.cs $(srcdir)/bug-324535-il.il
1798         $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
1799         $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
1800
1801 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
1802
1803 custom-modifiers.2.exe$(PLATFORM_AOT_SUFFIX): custom-modifiers-lib.dll$(PLATFORM_AOT_SUFFIX)
1804 custom-modifiers.2.exe custom-modifiers-lib.dll: $(srcdir)/custom-modifiers.2.cs $(srcdir)/custom-modifiers-lib.il
1805         $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
1806         $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
1807
1808 EXTRA_DIST += bug-382986-lib.cs
1809
1810 bug-382986.exe$(PLATFORM_AOT_SUFFIX): bug-382986-lib.dll$(PLATFORM_AOT_SUFFIX)
1811 bug-382986.exe bug-382986-lib.dll: $(srcdir)/bug-382986.cs $(srcdir)/bug-382986-lib.cs
1812         $(MCS) -target:library -out:bug-382986-lib.dll $(srcdir)/bug-382986-lib.cs
1813         $(MCS) -r:bug-382986-lib.dll -out:bug-382986.exe $(srcdir)/bug-382986.cs
1814
1815 EXTRA_DIST += bug-17537-helper.cs
1816
1817 bug-17537.exe$(PLATFORM_AOT_SUFFIX): bug-17537-helper.exe$(PLATFORM_AOT_SUFFIX)
1818 bug-17537-helper.exe: $(srcdir)/bug-17537-helper.cs
1819         $(MCS) -out:$@ $<
1820         chmod -x $@
1821 bug-17537.exe: bug-17537-helper.exe
1822
1823 EXTRA_DIST += coreclr-security.cs
1824
1825 test-coreclr-security : coreclr-security.exe
1826         @$(RUNTIME_MOONLIGHT) --security=core-clr-test coreclr-security.exe
1827
1828 EXTRA_DIST += generic-unboxing.2.il generic-boxing.2.il
1829
1830 generic-unboxing.2.dll: $(srcdir)/generic-unboxing.2.il
1831         $(ILASM) /dll /output:$@ $<
1832 generic-boxing.2.dll: $(srcdir)/generic-boxing.2.il generic-unboxing.2.dll
1833         $(ILASM) /dll /output:$@ $<
1834
1835 EXTRA_DIST += generic-unbox.2.cs
1836
1837 generic-unbox.2.exe$(PLATFORM_AOT_SUFFIX): generic-unboxing.2.dll$(PLATFORM_AOT_SUFFIX)
1838 generic-unbox.2.exe: $(srcdir)/generic-unbox.2.cs generic-unboxing.2.dll
1839         $(MCS) -r:generic-unboxing.2.dll -out:$@ $<
1840
1841 EXTRA_DIST += generic-box.2.cs
1842
1843 generic-box.2.exe$(PLATFORM_AOT_SUFFIX): generic-unboxing.2.dll$(PLATFORM_AOT_SUFFIX) generic-boxing.2.dll$(PLATFORM_AOT_SUFFIX)
1844 generic-box.2.exe : $(srcdir)/generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
1845         $(MCS) -r:generic-unboxing.2.dll,generic-boxing.2.dll -out:$@ $<
1846
1847 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
1848
1849 generic-delegate2-lib.2.dll: $(srcdir)/generic-delegate2-lib.2.il
1850         $(ILASM) /dll /output:$@ $<
1851
1852 generic-delegate2.2.exe$(PLATFORM_AOT_SUFFIX): generic-delegate2-lib.2.dll$(PLATFORM_AOT_SUFFIX)
1853 generic-delegate2.2.exe: $(srcdir)/generic-delegate2.2.cs generic-delegate2-lib.2.dll
1854         $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $<
1855
1856 bug-3903.exe: bug-3903.cs
1857         $(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:$@
1858
1859 gshared:
1860         $(MAKE) test-generic-sharing
1861
1862 gshared-aot:
1863         @$(MAKE) AOT=1 gshared
1864
1865 test-generic-sharing-normal: $(TESTS_GSHARED) $(TESTSAOT_GSHARED)
1866         @for fn in $+ ; do      \
1867                 echo "Testing $$fn ...";        \
1868                 $(RUNTIME) -O=gshared                $$fn > $$fn.stdout || exit 1;      \
1869                 $(RUNTIME) -O=gshared,shared         $$fn > $$fn.stdout || exit 1;      \
1870                 $(RUNTIME) -O=gshared,-inline        $$fn > $$fn.stdout || exit 1;      \
1871                 $(RUNTIME) -O=gshared,-inline,shared $$fn > $fn.stdout || exit 1;       \
1872                 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; \
1873         done
1874
1875 test-generic-sharing-managed: test-runner.exe $(TESTS_GSHARED) $(TESTSAOT_GSHARED) 
1876         $(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)
1877
1878 test-generic-sharing:
1879         @if test x$(M) != x0; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
1880
1881 EXTRA_DIST += async-exceptions.cs
1882 async-exceptions.exe : async-exceptions.cs
1883         $(MCS) -out:async-exceptions.exe $(srcdir)/async-exceptions.cs
1884 test-async-exceptions : async-exceptions.exe
1885         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
1886         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
1887
1888 EXTRA_DIST += modules.cs modules-m1.cs
1889 modules-m1.netmodule: modules-m1.cs
1890         $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
1891 modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) 
1892         $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
1893
1894 # Useful if mono is compiled with --enable-shared=no
1895 patch-libtool:
1896         cp "../../libtool" .
1897         sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool
1898         sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
1899         touch libtest.c
1900
1901
1902 EXTRA_DIST += threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
1903 test-process-exit:
1904         @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
1905         @echo "Testing threadpool-in-processexit.exe..."
1906         @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
1907         @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
1908
1909 # tests that expect a 1 exit code
1910 TESTS_UNHANDLED_EXCEPTION_1_SRC =       \
1911         unhandled-exception-1.cs        \
1912         unhandled-exception-9.cs
1913
1914 # tests that expect a 255 exit code
1915 TESTS_UNHANDLED_EXCEPTION_255_SRC =     \
1916         unhandled-exception-2.cs        \
1917         unhandled-exception-3.cs        \
1918         unhandled-exception-4.cs        \
1919         unhandled-exception-5.cs        \
1920         unhandled-exception-6.cs        \
1921         unhandled-exception-7.cs        \
1922         unhandled-exception-8.cs
1923
1924 TESTS_UNHANDLED_EXCEPTION_1=$(filter-out $(DISABLED_TESTS),$(TESTS_UNHANDLED_EXCEPTION_1_SRC:.cs=.exe))
1925 TESTS_UNHANDLED_EXCEPTION_255=$(filter-out $(DISABLED_TESTS),$(TESTS_UNHANDLED_EXCEPTION_255_SRC:.cs=.exe))
1926
1927 if FULL_AOT_TESTS
1928 TESTSAOT_UNHANDLED_EXCEPTION_1=$(TESTS_UNHANDLED_EXCEPTION_1:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1929 TESTSAOT_UNHANDLED_EXCEPTION_255=$(TESTS_UNHANDLED_EXCEPTION_255:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1930 endif
1931
1932 if HYBRID_AOT_TESTS
1933 TESTSAOT_UNHANDLED_EXCEPTION_1=$(TESTS_UNHANDLED_EXCEPTION_1:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1934 TESTSAOT_UNHANDLED_EXCEPTION_255=$(TESTS_UNHANDLED_EXCEPTION_255:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1935 endif
1936
1937 test-unhandled-exception-2: $(TESTS_UNHANDLED_EXCEPTION_1) $(TESTS_UNHANDLED_EXCEPTION_255) $(TESTSAOT_UNHANDLED_EXCEPTION_1) $(TESTSAOT_UNHANDLED_EXCEPTION_255)
1938         ok=; \
1939         $(MAKE) test-unhandled-exception-2-1-with-managed-handler || ok=false; \
1940         $(MAKE) test-unhandled-exception-2-1-without-managed-handler || ok=false; \
1941         $(MAKE) test-unhandled-exception-2-255-with-managed-handler || ok=false; \
1942         $(MAKE) test-unhandled-exception-2-255-without-managed-handler || ok=false; \
1943         $$ok
1944
1945 test-unhandled-exception-2-1-with-managed-handler: $(TESTS_UNHANDLED_EXCEPTION_1) $(TESTSAOT_UNHANDLED_EXCEPTION_1) test-runner.exe
1946         $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(TESTS_UNHANDLED_EXCEPTION_1)
1947 test-unhandled-exception-2-1-without-managed-handler: $(TESTS_UNHANDLED_EXCEPTION_1) $(TESTSAOT_UNHANDLED_EXCEPTION_1) test-runner.exe
1948         TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(TESTS_UNHANDLED_EXCEPTION_1)
1949 test-unhandled-exception-2-255-with-managed-handler: $(TESTS_UNHANDLED_EXCEPTION_255) $(TESTSAOT_UNHANDLED_EXCEPTION_255) test-runner.exe
1950         $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(TESTS_UNHANDLED_EXCEPTION_255)
1951 test-unhandled-exception-2-255-without-managed-handler: $(TESTS_UNHANDLED_EXCEPTION_255) $(TESTSAOT_UNHANDLED_EXCEPTION_255) test-runner.exe
1952         TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(TESTS_UNHANDLED_EXCEPTION_255)
1953
1954 EXTRA_DIST += appdomain-loader.cs appdomain-tester.cs
1955
1956 if FULL_AOT_TESTS
1957 test-appdomain-unload:
1958 else
1959 appdomain-loader.exe: appdomain-tester.exe
1960
1961 test-appdomain-unload: appdomain-loader.exe appdomain-tester.exe
1962         $(RUNTIME) -O=gshared appdomain-loader.exe > appdomain-loader.exe.1.stdout || exit 1;
1963         $(RUNTIME) appdomain-loader.exe > appdomain-loader.exe.2.stdout || exit 1;
1964         MONO_DEBUG_ASSEMBLY_UNLOAD=1 $(RUNTIME) -O=gshared appdomain-loader.exe > appdomain-loader.exe.3.stdout || exit 1;
1965         MONO_DEBUG_ASSEMBLY_UNLOAD=1 $(RUNTIME) appdomain-loader.exe > appdomain-loader.exe.4.stdout || exit 1;
1966 endif
1967
1968 EXTRA_DIST += console-output.cs console-output.exe.stderr.expected console-output.exe.stdout.expected
1969 test-console-output: console-output.exe
1970         @$(RUNTIME) console-output.exe 1>console-output.exe.stdout
1971         @$(RUNTIME) console-output.exe 2>console-output.exe.stderr
1972         @diff -w console-output.exe.stdout $(srcdir)/console-output.exe.stdout.expected \
1973                 && diff -w console-output.exe.stderr $(srcdir)/console-output.exe.stderr.expected
1974
1975 test-pedump: test-runner.exe
1976         $(with_mono_path) $(mono_build_root)/tools/pedump/pedump --verify error test-runner.exe
1977
1978 .PHONY: test-gac-loading test-eglib-remap
1979
1980 runtest-gac-loading: test-runner.exe
1981         $(MAKE) -C testing_gac runtest
1982
1983 compile-gac-loading:
1984         $(MAKE) -C testing_gac compile-tests
1985
1986 TESTS_STRESS_PROCESS_SRC=       \
1987                 process-stress-1.cs     \
1988                 process-stress-2.cs     \
1989                 process-stress-3.cs     \
1990                 process-leak.cs
1991
1992 TESTS_STRESS_PROCESS=$(filter-out $(DISABLED_TESTS),$(TESTS_STRESS_PROCESS_SRC:.cs=.exe))
1993
1994 if FULL_AOT_TESTS
1995 TESTSAOT_STRESS_PROCESS=$(TESTS_STRESS_PROCESS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
1996 endif
1997
1998 if HYBRID_AOT_TESTS
1999 TESTSAOT_STRESS_PROCESS=$(TESTS_STRESS_PROCESS:.exe=.exe$(PLATFORM_AOT_SUFFIX))
2000 endif
2001
2002 test-process-stress: $(TESTS_STRESS_PROCESS) $(TESTSAOT_STRESS_PROCESS) test-runner.exe
2003         $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(TESTS_STRESS_PROCESS)
2004
2005 coreclr-gcstress:
2006         $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
2007
2008 # Tests for the Mono lldb plugin
2009 EXTRA_DIST += test_lldb.py test-lldb.cs
2010 test-lldb: test-lldb.exe
2011         python test_lldb.py $(JITTEST_PROG)
2012
2013 noinst_LTLIBRARIES = libtest.la
2014
2015 AM_CPPFLAGS = $(GLIB_CFLAGS)
2016
2017 if HOST_WIN32
2018 # gcc-3.4.4 emits incorrect code when making indirect calls to stdcall functions using a tail call
2019 # This shows up when compiling mono_test_marshal_delegate ()
2020 libtest_la_CFLAGS=-fno-optimize-sibling-calls
2021 # the exported names created by gcc for stdcall functions are missing the leading _, so MS.NET
2022 # can't find them. So we use --kill-at to remove the @ suffix as well.
2023 libtest_la_LDFLAGS=-no-undefined -rpath `pwd` -Wl,--kill-at
2024 else
2025 libtest_la_LDFLAGS = -rpath `pwd`
2026 endif
2027 libtest_la_SOURCES = libtest.c
2028 libtest_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
2029
2030 INTERNALSVISIBLETO_TEST_SRC = \
2031         internalsvisibleto-runtimetest.cs \
2032         internalsvisibleto-compilertest.cs
2033
2034 INTERNALSVISIBLETO_TEST_LIB_SRC = \
2035         internalsvisibleto-library.cs
2036
2037 INTERNALSVISIBLETO_TEST_LIBS = \
2038         internalsvisibleto-correctcase.dll \
2039         internalsvisibleto-wrongcase.dll \
2040         internalsvisibleto-correctcase-2.dll \
2041         internalsvisibleto-wrongcase-2.dll \
2042         internalsvisibleto-correctcase-sign2048.dll \
2043         internalsvisibleto-wrongcase-sign2048.dll \
2044         internalsvisibleto-correctcase-2-sign2048.dll \
2045         internalsvisibleto-wrongcase-2-sign2048.dll
2046
2047
2048 INTERNALSVISIBLETO_TEST = \
2049         $(INTERNALSVISIBLETO_TEST_SRC:.cs=.exe) \
2050         $(INTERNALSVISIBLETO_TEST_SRC:.cs=-sign2048.exe)
2051
2052 if FULL_AOT_TESTS
2053 INTERNALSVISIBLETO_TESTAOT = \
2054         $(INTERNALSVISIBLETO_TEST:.exe=.exe$(PLATFORM_AOT_SUFFIX))
2055 INTERNALSVISIBLETO_TESTAOT_LIBS = \
2056         $(INTERNALSVISIBLETO_TEST_LIBS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
2057 endif
2058
2059 if HYBRID_AOT_TESTS
2060 INTERNALSVISIBLETO_TESTAOT = \
2061         $(INTERNALSVISIBLETO_TEST:.exe=.exe$(PLATFORM_AOT_SUFFIX))
2062 INTERNALSVISIBLETO_TESTAOT_LIBS = \
2063         $(INTERNALSVISIBLETO_TEST_LIBS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
2064 endif
2065
2066 EXTRA_DIST += $(INTERNALSVISIBLETO_TEST_SRC) $(INTERNALSVISIBLETO_TEST_LIB_SRC)
2067
2068 test-internalsvisibleto: test-runner.exe $(INTERNALSVISIBLETO_TEST) $(INTERNALSVISIBLETO_TESTAOT) $(INTERNALSVISIBLETO_TESTAOT_LIBS)
2069         $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ $(INTERNALSVISIBLETO_TEST)
2070
2071 internalsvisibleto-correctcase.dll internalsvisibleto-wrongcase.dll internalsvisibleto-runtimetest.exe: internalsvisibleto-runtimetest.cs internalsvisibleto-library.cs
2072         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE -d:PERMISSIVE internalsvisibleto-library.cs       
2073         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE -d:PERMISSIVE internalsvisibleto-library.cs
2074         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-runtimetest.exe -warn:0 -r:internalsvisibleto-correctcase.dll -r:internalsvisibleto-wrongcase.dll internalsvisibleto-runtimetest.cs
2075         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs     
2076         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
2077
2078 internalsvisibleto-correctcase-2.dll internalsvisibleto-wrongcase-2.dll  internalsvisibleto-compilertest.exe: internalsvisibleto-compilertest.cs internalsvisibleto-library.cs
2079         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-2.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs   
2080         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-2.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
2081         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-compilertest.exe -warn:0 -r:internalsvisibleto-correctcase-2.dll -r:internalsvisibleto-wrongcase-2.dll internalsvisibleto-compilertest.cs
2082
2083 internalsvisibleto-correctcase-sign2048.dll internalsvisibleto-wrongcase-sign2048.dll internalsvisibleto-runtimetest-sign2048.exe: internalsvisibleto-runtimetest.cs internalsvisibleto-library.cs internalsvisibleto-2048.snk
2084         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-sign2048.dll -target:library -d:CORRECT_CASE -d:PERMISSIVE -d:SIGN2048 internalsvisibleto-library.cs
2085         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-sign2048.dll -target:library -d:WRONG_CASE -d:PERMISSIVE -d:SIGN2048 internalsvisibleto-library.cs
2086         $(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
2087         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-sign2048.dll -target:library -d:CORRECT_CASE -d:SIGN2048 internalsvisibleto-library.cs
2088         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-sign2048.dll -target:library -d:WRONG_CASE -d:SIGN2048 internalsvisibleto-library.cs
2089
2090 internalsvisibleto-correctcase-2-sign2048.dll internalsvisibleto-wrongcase-2-sign2048.dll internalsvisibleto-compilertest-sign2048.exe: internalsvisibleto-compilertest.cs internalsvisibleto-library.cs internalsvisibleto-2048.snk
2091         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-2-sign2048.dll -target:library -d:CORRECT_CASE -d:SIGN2048 internalsvisibleto-library.cs      
2092         $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-2-sign2048.dll -target:library -d:WRONG_CASE -d:SIGN2048 internalsvisibleto-library.cs
2093         $(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
2094
2095
2096 CLEANFILES = $(TESTS_CS) $(TESTS_IL) $(TESTS_BENCH) $(TESTS_STRESS) $(TESTSAOT_CS) $(TESTSAOT_IL) $(TESTSAOT_BENCH) $(TESTSAOT_STRESS) *.dll *.stdout *.aotlog *.exe stest.dat