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