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