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