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