Merge pull request #505 from roji/shutdown_flow
[mono.git] / mono / tests / Makefile.am
index 29a58d6f299d7bb4511f6132af3ab69a5d95b81d..455a4b159409ec7d342845a5cc1b01e7fb533627 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = cas assemblyresolve
+SUBDIRS = cas assemblyresolve gc-descriptors
 
 check-local: test
 
@@ -13,7 +13,7 @@ JITTEST_PROG_RUN = MONO_SHARED_DIR=$(mono_build_root)/runtime MONO_CFG_DIR=$(mon
 
 RUNTIME_ARGS=--config tests-config --optimize=all --debug
 
-with_mono_path = MONO_PATH=$(mcs_topdir)/class/lib/net_2_0
+with_mono_path = MONO_PATH=$(mcs_topdir)/class/lib/net_4_5
 with_mono_path_moonlight = MONO_PATH=$(mcs_topdir)/class/lib/moonlight_raw
 
 RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper
@@ -21,11 +21,10 @@ RUNTIME_MOONLIGHT = $(with_mono_path_moonlight) $(top_builddir)/runtime/mono-wra
 
 MKBUNDLE = \
        PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \
-       $(RUNTIME) $(mcs_topdir)/class/lib/net_2_0/mkbundle.exe
+       $(RUNTIME) $(mcs_topdir)/class/lib/net_4_5/mkbundle.exe
 
-MCS = $(RUNTIME) $(mcs_topdir)/class/lib/basic/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug
-SMCS = $(RUNTIME_MOONLIGHT) --runtime=moonlight --security=temporary-smcs-hack $(mcs_topdir)/class/lib/moonlight_raw/smcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219
-ILASM = $(RUNTIME) $(mcs_topdir)/class/lib/net_2_0/ilasm.exe
+MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -debug
+ILASM = $(RUNTIME) $(mcs_topdir)/class/lib/net_4_5/ilasm.exe
 
 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
 
@@ -45,6 +44,7 @@ STRESS_TESTS_SRC=     \
 # Disabled until ?mcs is fixed
 #      bug-331958.cs
 BASE_TEST_CS_SRC=              \
+       bug-2907.cs             \
        array-init.cs           \
        arraylist.cs            \
        assemblyresolve_event.cs        \
@@ -230,6 +230,7 @@ BASE_TEST_CS_SRC=           \
        bug-78656.cs            \
        bug-77127.cs            \
        bug-323114.cs           \
+       bug-Xamarin-5278.cs     \
        interlocked.cs          \
        cross-domain.cs         \
        appdomain-exit.cs       \
@@ -239,6 +240,7 @@ BASE_TEST_CS_SRC=           \
        finalizer-abort.cs      \
        finalizer-exception.cs  \
        finalizer-exit.cs       \
+       finalizer-thread.cs     \
        main-exit.cs    \
        main-returns-abort-resetabort.cs        \
        main-returns-background-abort-resetabort.cs     \
@@ -358,8 +360,6 @@ BASE_TEST_CS_SRC=           \
        gchandles.cs    \
        interlocked-3.cs        \
        interlocked-4.2.cs      \
-       finalizer-wait.cs       \
-       critical-finalizers.cs  \
        appdomain-thread-abort.cs \
        xdomain-threads.cs      \
        w32message.cs   \
@@ -371,7 +371,24 @@ BASE_TEST_CS_SRC=          \
        bug-575941.cs   \
        bug-599469.cs   \
        bug-389886-3.cs \
-       monitor.cs
+       monitor.cs      \
+       dynamic-method-resurrection.cs  \
+       bug-666008.cs   \
+       bug-685908.cs   \
+       sgen-long-vtype.cs      \
+       delegate-invoke.cs      \
+       bug-696593.cs   \
+       bug-705140.cs   \
+       bug-1147.cs     \
+       mono-path.cs    \
+       bug-bxc-795.cs  \
+       bug-3903.cs     \
+       async-with-cb-throws.cs \
+       appdomain-unload-doesnot-raise-pending-events.cs        \
+       bug-6148.cs     \
+       assembly_append_ordering.cs     \
+       bug-10127.cs    \
+       allow-synchronous-major.cs
 
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
@@ -405,7 +422,7 @@ endif
 if X86
 
 if HOST_WIN32
-PLATFORM_DISABLED_TESTS=async-exc-compilation.exe
+PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe
 endif
 
 endif
@@ -419,18 +436,41 @@ if ARM
 PLATFORM_DISABLED_TESTS=filter-stack.exe
 endif
 
-# The two finalizer tests only work under sgen
-# gc-altstack.exe fails under boehm because it has no support for altstack
+if MIPS
+# monitor.exe is racy
+PLATFORM_DISABLED_TESTS=filter-stack.exe monitor.exe
+endif
+
+if S390x
+PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
+#PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
+endif
+
 # bug-459094.exe creates an extremely deep directory tree
+# delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
+# reverted.
 DISABLED_TESTS=                        \
        delegate-async-exception.exe    \
        bug-348522.2.exe        \
-       finalizer-wait.exe      \
-       critical-finalizers.exe \
-       gc-altstack.exe \
        bug-459094.exe \
+       delegate-invoke.exe \
        $(PLATFORM_DISABLED_TESTS)
 
+DISABLED_TESTS_WRENCH= \
+       $(DISABLED_TESTS)       \
+       $(PLATFORM_DISABLED_TESTS_WRENCH)       \
+       main-returns-background-resetabort.exe \
+       main-returns-background-abort-resetabort.exe    \
+       main-returns-background.exe     \
+       thread6.exe     \
+       assemblyresolve_event3.exe \
+       delegate2.exe   \
+       finally_guard.exe       \
+       finalizer-abort.exe     \
+       finalizer-exit.exe      \
+       finalizer-thread.exe \
+       appdomain-async-invoke.exe
+
 AOT_DISABLED_TESTS=constraints-load.exe
 
 # These only compile with MS CSC
@@ -502,7 +542,10 @@ TEST_IL_SRC=                       \
        bug-515884.il   \
        bug-633291.il   \
        delegate-with-null-target.il    \
-       bug-318677.il
+       bug-318677.il   \
+       gsharing-valuetype-layout.il    \
+       invalid_generic_instantiation.il
+
 
 # pre-requisite test sources: files that are not test themselves
 # but that need to be compiled
@@ -529,7 +572,7 @@ EXTRA_DIST=test-driver $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
 
 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
 if POWERPC
-test_platform: testbundle
+test_platform:
 else
 # Can't use mkbundle on win32 since there is no static build there
 # Can't run test-unhandled-exception on Windows because of all the debug popups...
@@ -549,6 +592,9 @@ test_platform: test-eglib-remap
 endif
 endif
 
+# Target to precompile the test executables
+tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) $(GSHARED_TESTS)
+
 #
 # Test that no symbols are missed in eglib-remap.h
 #
@@ -561,9 +607,9 @@ test-eglib-remap:
 # Tests that the internals in mono/io-layer/messages.c are ok by triggering the 
 # code that checks that the table is properly sorted
 #
-test_messages: w32message.exe
+test-messages: w32message.exe
        > test_messages.zero
-       $(JITTEST_PROG_RUN) w32message.exe >& w32message.allout && cmp test_messages.zero w32message.allout
+       $(with_mono_path) $(JITTEST_PROG_RUN) w32message.exe >& w32message.allout && cmp test_messages.zero w32message.allout
 
 if MOONLIGHT
 test_2_1 : test-coreclr-security
@@ -571,9 +617,29 @@ else
 test_2_1 :
 endif
 
-# test_messages fails on the buildbots
-#test: assemblyresolve/test/asm.dll testjit test-type-load test-generic-sharing test_platform test_2_1 test_messages
-test: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test_platform test_2_1 test-process-exit
+if AMD64
+test-sgen : sgen-tests
+else
+if X86
+test-sgen : sgen-tests
+else
+if ARM
+test-sgen : sgen-tests
+else
+if S390x
+test-sgen : sgen-regular-tests
+endif
+endif
+endif
+endif
+
+test: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test_platform test_2_1 test-process-exit test-sgen test-messages rm-empty-logs
+test-wrench: assemblyresolve/test/asm.dll testjit-wrench test-generic-sharing test-type-load test_platform test_2_1 test-process-exit test-sgen test-messages rm-empty-logs
+
+# Remove empty .stdout and .stderr files for wrench
+rm-empty-logs:
+       @echo "Removing empty logs..."
+       @find . '(' -name "*.stdout" -o -name "*.stderr" ')' -empty -exec rm {} \;
 
 assemblyresolve/test/asm.dll:
        $(MAKE) -C assemblyresolve prereq
@@ -585,7 +651,7 @@ test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
        passed=0; \
        for i in $(TESTSI_CS); do       \
-               if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' 'no-dump' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -599,7 +665,7 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
        @failed=0; \
        passed=0; \
        for i in $(TESTSI_IL); do       \
-               if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" 'no-dump' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -611,9 +677,35 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
 
 testb: $(TEST_PROG) $(TESTBS)
        for i in $(TESTBS); do  \
-               $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS);     \
+               $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' 'no-dump' $(RUNTIME_ARGS);   \
        done
 
+runtest-wrench: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
+       @failed=0; \
+       passed=0; \
+       failed_tests="";\
+       for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do        \
+               rm -f $${i}.so; \
+               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; \
+               if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS_WRENCH)' 'dump-output' $(RUNTIME_ARGS); \
+               then \
+                       passed=`expr $${passed} + 1`; \
+               else \
+                       if [ $$? = 2 ]; then break; fi; \
+                       failed=`expr $${failed} + 1`; \
+                       failed_tests="$${failed_tests} $$i"; \
+               fi \
+       done; \
+       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
+       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
+
+runtest-managed-wrench: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
+       @$(RUNTIME) ./test-runner.exe -j a --disabled '$(DISABLED_TESTS_WRENCH)' $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+
+testjit-wrench:
+       @if test x$(M) != x; then $(MAKE) runtest-managed-wrench; else $(MAKE) runtest-wrench; fi
+
 runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
        @failed=0; \
        passed=0; \
@@ -621,7 +713,7 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
        for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do        \
                rm -f $${i}.so; \
                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; \
-               if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' 'no-dump' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -693,6 +785,88 @@ test-type-load: TestDriver.dll
        @echo "Testing load-exception.exe..."
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
 
+
+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
+
+
+#those are actually configurations, eg plain_sgen-descriptors.exe
+#DISABLE_SGEN_TESTS =
+
+SGEN_TESTS =   \
+       finalizer-wait.exe      \
+       critical-finalizers.exe \
+       sgen-descriptors.exe    \
+       sgen-gshared-vtype.exe  \
+       sgen-domain-unload.exe  \
+       sgen-weakref-stress.exe \
+       sgen-cementing-stress.exe       \
+       sgen-case-23400.exe
+
+SGEN_CONFIGURATIONS =  \
+       "|plain"        \
+       "major=marksweep-par|ms-par"    \
+       "major=marksweep-conc|ms-conc"  \
+       "major=marksweep-conc,minor=split|ms-conc-split"        \
+       "minor=split|ms-split"  \
+       "minor=split,alloc-ratio=95|ms-split-95"
+
+#FIXME We should move to use SGEN_CONFIGURATIONS once sgen supports trailling commas or its argument list.
+SGEN_BRIDGE_CONFIGURATIONS =   \
+       "|plain"        \
+       ",major=marksweep-conc|ms-conc" \
+       ",minor=split|ms-split"
+
+sgen-regular-tests: $(SGEN_TESTS)
+       @failed=0; \
+       passed=0; \
+       failed_tests="";\
+       for test in $+; do      \
+               echo "...$$test";       \
+               for conf in $(SGEN_CONFIGURATIONS); do  \
+                       name=`echo $$conf | cut -d\| -f 2`;     \
+                       params=`echo $$conf | cut -d\| -f 1`;   \
+                       test_name="$${test}|$${name}";  \
+                       if MONO_GC_PARAMS="$$params" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" 'dump-output' $(RUNTIME_ARGS);     \
+                       then \
+                               passed=`expr $${passed} + 1`; \
+                       else \
+                               if [ $$? = 2 ]; then break; fi; \
+                               failed=`expr $${failed} + 1`; \
+                               failed_tests="$${failed_tests} $$test_name"; \
+                       fi \
+               done    \
+       done;   \
+       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
+       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
+
+sgen-bridge-tests: sgen-bridge.exe sgen-bridge-major-fragmentation.exe
+       @failed=0; \
+       passed=0; \
+       failed_tests="";\
+       for test in $+; do      \
+               echo "...$$test";       \
+               for conf in $(SGEN_BRIDGE_CONFIGURATIONS); do   \
+                       name=`echo $$conf | cut -d\| -f 2`;     \
+                       params=`echo $$conf | cut -d\| -f 1`;   \
+                       test_name="$${test}|$${name}";  \
+                       if MONO_GC_PARAMS="bridge=Bridge$${params}" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" 'dump-output' $(RUNTIME_ARGS);      \
+                       then \
+                               passed=`expr $${passed} + 1`; \
+                       else \
+                               if [ $$? = 2 ]; then break; fi; \
+                               failed=`expr $${failed} + 1`; \
+                               failed_tests="$${failed_tests} $$test_name"; \
+                       fi \
+               done    \
+       done;   \
+       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
+       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
+
+sgen-tests: sgen-regular-tests sgen-bridge-tests
+
+
 # Generated tests for runtime invoke
 EXTRA_DIST += gen-runtime-invoke.cs
 runtime-invoke.gen.exe: TestDriver.dll gen-runtime-invoke.exe
@@ -816,6 +990,9 @@ generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
 generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
        $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
 
+bug-3903.exe: bug-3903.cs
+       $(MCS) -sdk:2 $(srcdir)/bug-3903.cs -out:$@
+
 gshared: test-generic-sharing
 
 gshared-aot:
@@ -846,7 +1023,8 @@ GSHARED_TESTS = \
                generic-stack-traces.2.exe generic-stack-traces2.2.exe          \
                bug-472600.2.exe bug-473482.2.exe bug-473999.2.exe              \
                bug-479763.2.exe generic-xdomain.2.exe                          \
-               generic-type-load-exception.2.exe bug-616463.exe
+               generic-type-load-exception.2.exe bug-616463.exe        \
+               bug-1147.exe
 
 test-generic-sharing-normal: $(GSHARED_TESTS)
        @for fn in $+ ; do      \
@@ -884,12 +1062,16 @@ patch-libtool:
        sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile
        touch libtest.c
 
-EXTRA_DIST += bug-438454.cs bug-438454.exe.stdout.expected
+EXTRA_DIST += bug-438454.cs bug-438454.exe.stdout.expected threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
 test-process-exit:
        @$(MCS) $(srcdir)/bug-438454.cs -out:bug-438454.exe
        @echo "Testing bug-438454.exe..."
        @$(RUNTIME) bug-438454.exe > bug-438454.exe.stdout
-       @diff bug-438454.exe.stdout $(srcdir)/bug-438454.exe.stdout.expected
+       @diff -w bug-438454.exe.stdout $(srcdir)/bug-438454.exe.stdout.expected
+       @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
+       @echo "Testing threadpool-in-processexit.exe..."
+       @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
+       @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
 
 OOM_TESTS =    \
        gc-oom-handling.exe     \
@@ -907,7 +1089,7 @@ test-oom: $(OOM_TESTS)
 
 noinst_LTLIBRARIES = libtest.la
 
-INCLUDES = $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
+AM_CPPFLAGS = $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
 
 if HOST_WIN32
 # gcc-3.4.4 emits incorrect code when making indirect calls to stdcall functions using a tail call
@@ -920,6 +1102,6 @@ else
 libtest_la_LDFLAGS = -rpath `pwd`
 endif
 libtest_la_SOURCES = libtest.c
-libtest_la_LIBADD = $(GLIB_LIBS)
+libtest_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
 
 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.aotlog *.exe stest.dat