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