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