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