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