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