Merge pull request #3290 from BrzVlad/fix-finalizer-tests
[mono.git] / mono / tests / Makefile.am
index cc95243bbb6f30cfa30d42ef25f1b666479f29a5..3f225f93cde330f8ed3b73251abc83a08e55b3be 100644 (file)
@@ -19,6 +19,13 @@ test-wrench: check-parallel
 
 aotcheck: testaot gshared-aot
 
+# Whenever running under CI
+# Can't use make conditionals since
+# automake doesn't support them
+# CI - Wrench
+# BUILD_URL = Jenkins
+RUNNING_ON_CI = $(CI)$(BUILD_URL)
+
 TEST_PROG = ../interpreter/mint
 
 JITTEST_PROG = $(if $(VALGRIND), valgrind $(VALGRIND_ARGS),) $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/mono/mini/mono)
@@ -34,6 +41,9 @@ else
 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
 endif
 
+TEST_RUNNER_ARGS += $(if $(RUNNING_ON_CI), --verbose,)
+TEST_RUNNER_ARGS += $(if $(V), --verbose,)
+
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
@@ -59,9 +69,9 @@ MCS = $(MCS_NO_LIB) -lib:$(CLASS)
 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 
 if INSTALL_MOBILE_STATIC
-TEST_RUNNER = ./test-runner.exe --runtime $(RUNTIME) --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
+TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
 else
-TEST_RUNNER = ./test-runner.exe --runtime $(RUNTIME) --mono-path "$(CLASS)"
+TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)"
 endif
 
 
@@ -83,46 +93,67 @@ STRESS_TESTS_SRC=   \
        assembly-load-stress.cs
 
 BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED= \
-       bug-47295.cs            \
-       thread6.cs              \
-       loader.cs       \
-       pinvoke2.cs             \
-       generic-type-builder.2.cs       \
-       assemblyresolve_event2.2.cs     \
-       dynamic-generic-size.cs \
-       cominterop.cs   \
-       dynamic-method-access.2.cs      \
-       dynamic-method-finalize.2.cs    \
-       dynamic-method-stack-traces.cs  \
-       generic_type_definition.2.cs    \
-       bug-333798-tb.2.cs      \
-       bug-335131.2.cs \
-       bug-322722_patch_bx.2.cs        \
-       bug-322722_dyn_method_throw.2.cs        \
-       bug-389886-2.cs \
-       bug-349190.2.cs \
-       bug-389886-sre-generic-interface-instances.cs   \
-       bug-462592.cs   \
-       appdomain-thread-abort.cs       \
-       bug-575941.cs   \
-       bug-389886-3.cs \
-       dynamic-method-resurrection.cs  \
-       bug-80307.cs    \
-       assembly_append_ordering.cs
-
-
-if INSTALL_MOBILE_STATIC
-BASE_TEST_CS_SRC= \
-       $(BASE_TEST_CS_SRC_UNIVERSAL)
-else
-BASE_TEST_CS_SRC= \
-       $(BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED) \
-       $(BASE_TEST_CS_SRC_UNIVERSAL)
-endif
+       remoting4.cs            # Needs remoting support \
+       remoting1.cs            # Needs remoting support \
+       remoting2.cs            # Needs remoting support \
+       remoting3.cs            # Needs remoting support \
+       remoting5.cs            # Needs remoting support \
+       appdomain.cs        # Needs appdomain support \
+       appdomain-client.cs     # Needs appdomain support \
+       appdomain-unload.cs # Needs appdomain support \
+       appdomain-async-invoke.cs       # Needs appdomain support \
+       appdomain-thread-abort.cs       # Needs appdomain support \
+       appdomain1.cs           # Needs appdomain support \
+       appdomain2.cs           # Needs appdomain support \
+       appdomain-exit.cs       # Needs appdomain support \
+       assemblyresolve_event2.2.cs     # Needs appdomain support \
+       appdomain-unload-callback.cs    # Needs appdomain support \
+       appdomain-unload-doesnot-raise-pending-events.cs        # Needs appdomain support \
+       unload-appdomain-on-shutdown.cs # Needs appdomain support \
+       bug-47295.cs # Needs SRE \
+       loader.cs # Needs SRE \
+       pinvoke2.cs # Needs SRE \
+       generic-type-builder.2.cs       # Needs SRE \
+       dynamic-generic-size.cs # Needs SRE \
+       cominterop.cs   # Needs COM \
+       dynamic-method-access.2.cs      # Need SRE \
+       dynamic-method-finalize.2.cs    # Need SRE \
+       dynamic-method-stack-traces.cs # Need SRE\
+       generic_type_definition.2.cs    # Need SRE \
+       bug-333798-tb.2.cs      # Need SRE \
+       bug-335131.2.cs # Need SRE \
+       bug-322722_patch_bx.2.cs        # Need SRE\
+       bug-322722_dyn_method_throw.2.cs        # Need SRE \
+       bug-389886-2.cs # Need SRE \
+       bug-349190.2.cs # Need SRE \
+       bug-389886-sre-generic-interface-instances.cs   # Need SRE \
+       bug-462592.cs   # Need SRE \
+       bug-575941.cs   # Need SRE \
+       bug-389886-3.cs # Need SRE \
+       dynamic-method-resurrection.cs  # Need SRE \
+       bug-80307.cs    # Need System.Web \
+       assembly_append_ordering.cs # Need SRE \
+       bug-544446.cs   # Needs AppDomains / TranparentProxy \
+       bug-36848.cs   # Needs AppDomains / TranparentProxy \
+       generic-marshalbyref.2.cs # Needs AppDomains \
+       stackframes-async.2.cs # Needs AppDomains \
+       transparentproxy.cs # Needs AppDomains / TranparentProxy \
+       bug-48015.cs # Needs AppDomains / TranparentProxy \
+       delegate9.cs # Needs AppDomains \
+       marshal-valuetypes.cs   # Needs AppDomains \
+       xdomain-threads.cs      # Needs AppDomains \
+       monitor.cs # Needs AppDomains \
+       generic-xdomain.2.cs # Needs AppDomains \
+       threadpool-exceptions7.cs # Needs AppDomains \
+       cross-domain.cs # Needs AppDomains \
+       generic-unloading.2.cs # Needs AppDomains \
+       thread6.cs # On MOBILE, ThreadAbortException doesn't have necessary field for this test
 
 # Disabled until ?mcs is fixed
 #      bug-331958.cs
 BASE_TEST_CS_SRC_UNIVERSAL=            \
+       generic-unloading-sub.2.cs      \
+       create-instance.cs      \
        bug-2907.cs             \
        array-init.cs           \
        arraylist.cs            \
@@ -132,7 +163,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        assemblyresolve_event4.cs       \
        checked.cs              \
        char-isnumber.cs        \
-       create-instance.cs      \
        field-layout.cs         \
        pack-layout.cs          \
        pack-bug.cs             \
@@ -234,12 +264,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=                \
        jit-float.cs            \
        pop.cs                  \
        time.cs                 \
-       appdomain.cs        \
-       appdomain1.cs           \
-       appdomain2.cs           \
-       appdomain-client.cs     \
-       appdomain-unload.cs \
-       appdomain-async-invoke.cs       \
        pointer.cs              \
        hashcode.cs             \
        delegate1.cs            \
@@ -249,16 +273,10 @@ BASE_TEST_CS_SRC_UNIVERSAL=               \
        delegate6.cs            \
        delegate7.cs            \
        delegate8.cs            \
-       delegate9.cs            \
        delegate10.cs           \
        delegate11.cs           \
        delegate12.cs           \
        delegate13.cs           \
-       remoting1.cs            \
-       remoting2.cs            \
-       remoting3.cs            \
-       remoting4.cs            \
-       remoting5.cs            \
        largeexp.cs             \
        largeexp2.cs            \
        marshalbyref1.cs        \
@@ -279,7 +297,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        marshal8.cs             \
        marshal9.cs             \
        marshalbool.cs          \
-       marshal-valuetypes.cs   \
        test-byval-in-struct.cs \
        thread.cs               \
        thread5.cs              \
@@ -302,11 +319,9 @@ BASE_TEST_CS_SRC_UNIVERSAL=                \
        threadpool-exceptions4.cs \
        threadpool-exceptions5.cs \
        threadpool-exceptions6.cs \
-       threadpool-exceptions7.cs \
        base-definition.cs      \
        bug-27420.cs            \
        bug-46781.cs            \
-       bug-48015.cs            \
        bug-42136.cs            \
        bug-59286.cs            \
        bug-70561.cs            \
@@ -317,8 +332,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        bug-323114.cs           \
        bug-Xamarin-5278.cs     \
        interlocked.cs          \
-       cross-domain.cs         \
-       appdomain-exit.cs       \
        delegate-async-exit.cs  \
        delegate-delegate-exit.cs       \
        delegate-exit.cs        \
@@ -337,7 +350,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        desweak.cs              \
        exists.cs               \
        handleref.cs    \
-       transparentproxy.cs \
        dbnull-missing.cs       \
        test-type-ctor.cs       \
        soft-float-tests.cs     \
@@ -350,7 +362,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        catch-generics.2.cs     \
        event-get.2.cs          \
        safehandle.2.cs         \
-       stackframes-async.2.cs          \
        module-cctor-loader.2.cs        \
        generics-invoke-byref.2.cs      \
        generic-signature-compare.2.cs  \
@@ -376,8 +387,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        generic-delegate-ctor.2.cs      \
        generic-array-iface-set.2.cs    \
        generic-typedef.2.cs    \
-       generic-marshalbyref.2.cs       \
-       generic-xdomain.2.cs    \
        bug-431413.2.cs \
        bug-459285.2.cs \
        generic-virtual-invoke.2.cs     \
@@ -412,7 +421,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        bug-324535.cs   \
        modules.cs      \
        bug-81673.cs    \
-       bug-36848.cs    \
        bug-81691.cs    \
        bug-415577.cs   \
        filter-stack.cs \
@@ -422,24 +430,18 @@ BASE_TEST_CS_SRC_UNIVERSAL=               \
        bug-461261.cs   \
        bug-400716.cs   \
        bug-459094.cs   \
-       generic-unloading.2.cs  \
-       generic-unloading-sub.2.cs      \
        bug-467456.cs   \
-       appdomain-unload-callback.cs    \
        bug-508538.cs   \
        bug-472692.2.cs         \
        gchandles.cs    \
        interlocked-3.cs        \
        interlocked-4.2.cs      \
-       xdomain-threads.cs      \
        w32message.cs   \
-       bug-544446.cs   \
        gc-altstack.cs  \
        large-gc-bitmap.cs      \
        bug-561239.cs   \
        bug-562150.cs   \
        bug-599469.cs   \
-       monitor.cs      \
        monitor-resurrection.cs \
        monitor-wait-abort.cs   \
        monitor-abort.cs        \
@@ -454,12 +456,10 @@ BASE_TEST_CS_SRC_UNIVERSAL=               \
        bug-bxc-795.cs  \
        bug-3903.cs     \
        async-with-cb-throws.cs \
-       appdomain-unload-doesnot-raise-pending-events.cs        \
        bug-6148.cs     \
        bug-10127.cs    \
        bug-18026.cs    \
        allow-synchronous-major.cs      \
-       unload-appdomain-on-shutdown.cs \
        block_guard_restore_aligment_on_exit.cs \
        thread_static_gc_layout.cs \
        sleep.cs \
@@ -474,6 +474,15 @@ BASE_TEST_CS_SRC_UNIVERSAL=                \
        bug-29585.cs    \
        priority.cs
 
+if INSTALL_MOBILE_STATIC
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+else
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+endif
+
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
        async-exc-compilation.cs \
@@ -627,6 +636,52 @@ else
 COOP_DISABLED_TESTS= 
 endif
 
+if INSTALL_MOBILE_STATIC
+# Tests which rely on TypeLoadExceptions
+# In full-aot mode, these cause the relevant methods to be not AOTed.
+PROFILE_DISABLED_TESTS = \
+       typeload-unaligned.exe \
+       field-access.exe \
+       invalid_generic_instantiation.exe \
+       bug-481403.exe \
+       array_ldelema.exe \
+       array_load_exception.exe \
+       bug445361.exe \
+       generic-type-load-exception.2.exe \
+       invalid-token.exe \
+       call_missing_method.exe \
+       call_missing_class.exe \
+       ldfld_missing_field.exe \
+       ldfld_missing_class.exe \
+       vt-sync-method.exe
+
+# Tests which rely on remoting
+PROFILE_DISABLED_TESTS += \
+       context-static.exe \
+       bug-415577.exe \
+       generic-marshalbyref.2.exe \
+       unhandled-exception-7.exe
+
+# Tests which use unsupported pinvoke+full aot
+# functionality
+PROFILE_DISABLED_TESTS += \
+       marshal.exe \
+       marshal2.exe \
+       marshal6.exe \
+       marshal7.exe \
+       marshal8.exe \
+       pinvoke-2.2.exe \
+       pinvoke3.exe \
+       thunks.exe
+
+# Tests which load assemblies which are not
+# in the mobile_static profile
+PROFILE_DISABLED_TESTS += \
+       assembly-load-remap.exe
+else
+PROFILE_DISABLED_TESTS=
+endif
+
 # The two finalizer tests only work under sgen
 # gc-altstack.exe fails under boehm because it has no support for altstack
 # bug-459094.exe creates an extremely deep directory tree
@@ -641,7 +696,8 @@ DISABLED_TESTS=                     \
        bug-Xamarin-5278.exe \
        $(PLATFORM_DISABLED_TESTS) \
        $(EXTRA_DISABLED_TESTS) \
-       $(COOP_DISABLED_TESTS)
+       $(COOP_DISABLED_TESTS) \
+       $(PROFILE_DISABLED_TESTS)
 
 DISABLED_TESTS_WRENCH= \
        $(DISABLED_TESTS)       \
@@ -661,7 +717,14 @@ AOT_DISABLED_TESTS=constraints-load.exe
 TEST_CSC_SRC=                  \
        vararg.cs
 
-TEST_IL_SRC=                   \
+# constraints-load.il: 
+# Failed to load method 0x6000007 from '..../mono/tests/constraints-load.exe' due to 
+# Could not resolve type with token 01000002 assembly:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.BrokenIComparable`1 member:<none>.
+IL_SRC_MOBILE_STATIC_NOT_SUPPORTED=    \
+       constraints-load.il \
+       bug-515884.il
+
+TEST_IL_SRC_UNIVERSAL=                 \
        field-access.il         \
        method-access.il        \
        ldftn-access.il         \
@@ -720,17 +783,23 @@ TEST_IL_SRC=                      \
        bug-463303.il   \
        bug469742.2.il  \
        bug-528055.il   \
-       constraints-load.il     \
        array_load_exception.il \
        bug-481403.il   \
        interface-with-static-method.il \
-       bug-515884.il   \
        bug-633291.il   \
        delegate-with-null-target.il    \
        bug-318677.il   \
        gsharing-valuetype-layout.il    \
        invalid_generic_instantiation.il
 
+if INSTALL_MOBILE_STATIC
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_UNIVERSAL)
+else
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(TEST_IL_SRC_UNIVERSAL)
+endif
 
 # pre-requisite test sources: files that are not test themselves
 # but that need to be compiled
@@ -746,6 +815,9 @@ TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
 TESTBS=$(BENCHSRC:.cs=.exe)
 STRESS_TESTS=$(STRESS_TESTS_SRC:.cs=.exe)
 
+PREREQSI_IL_AOT=$(PREREQ_IL_SRC:.il=.exe$(PLATFORM_AOT_SUFFIX))
+PREREQSI_CS_AOT=$(PREREQ_CS_SRC:.cs=.exe$(PLATFORM_AOT_SUFFIX))
+
 EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
        $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl $(PREREQ_IL_SRC) $(PREREQ_CS_SRC)
 
@@ -756,9 +828,21 @@ if !INSTALL_MOBILE_STATIC
 TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
 endif
 
-%.exe: %.cs TestDriver.dll
+if INSTALL_MOBILE_STATIC
+TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
+else
+TEST_DRIVER_DEPEND=TestDriver.dll
+endif
+
+%.exe: %.cs $(TEST_DRIVER_DEPEND)
        $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
 
+%.exe$(PLATFORM_AOT_SUFFIX): %.exe 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
+
+%.dll$(PLATFORM_AOT_SUFFIX): %.dll 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
+
 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
 if POWERPC
 test_platform:
@@ -781,8 +865,22 @@ test_platform: test-eglib-remap
 endif
 endif
 
+AOT_EXTRA_LIBS =       \
+bug-382986-lib.dll$(PLATFORM_AOT_SUFFIX)       \
+bug-324535-il.dll$(PLATFORM_AOT_SUFFIX)        \
+bug-36848-a.dll$(PLATFORM_AOT_SUFFIX)  \
+bug-81691-b.dll$(PLATFORM_AOT_SUFFIX)  \
+bug-327438.2.exe$(PLATFORM_AOT_SUFFIX) \
+bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
+
+if INSTALL_MOBILE_STATIC
+prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+else
+prereqs: $(PREREQSI_IL) $(PREREQSI_CS)
+endif
+
 # Target to precompile the test executables
-tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) $(GSHARED_TESTS)
+tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la prereqs $(GSHARED_TESTS)
 
 #
 # Test that no symbols are missed in eglib-remap.h
@@ -820,6 +918,9 @@ test-sgen : sgen-tests
 # Precompile the test assemblies in parallel
 compile-tests:
        $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
+if INSTALL_MOBILE_STATIC
+       $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+endif
 
 # Remove empty .stdout and .stderr files for wrench
 rm-empty-logs:
@@ -829,15 +930,8 @@ rm-empty-logs:
 assemblyresolve/test/asm.dll:
        $(MAKE) -C assemblyresolve prereq
 
-
-if INSTALL_MOBILE_STATIC
 TestDriver.dll:
-       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
-       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
-else
-TestDriver.dll:
-       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
-endif
+       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs $(srcdir)/../mini/TestHelpers.cs
 
 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
@@ -968,7 +1062,7 @@ testbundle: console.exe
        @- rm -rf a.out
 
 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
-test-type-load: TestDriver.dll
+test-type-load: $(TEST_DRIVER_DEPEND)
        @$(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il > /dev/null
        @$(MCS) -t:library -out:t.dll -d:FOUND $(srcdir)/t-missing.cs
        @$(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:load-exceptions.exe $(srcdir)/load-exceptions.cs
@@ -977,7 +1071,7 @@ test-type-load: TestDriver.dll
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
 
 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
-test-cattr-type-load: TestDriver.dll custom-attr-errors.cs custom-attr-errors-lib.cs
+test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs
        $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
        $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll  $(srcdir)/custom-attr-errors.cs
        $(MCS) /t:library $(srcdir)/custom-attr-errors-lib.cs
@@ -1227,19 +1321,23 @@ test-aot:
 
 # Generated tests for runtime invoke
 EXTRA_DIST += gen-runtime-invoke.cs
-runtime-invoke.gen.exe: TestDriver.dll gen-runtime-invoke.exe
+runtime-invoke.gen.exe: $(TEST_DRIVER_DEPEND) gen-runtime-invoke.exe
        $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
        $(MCS) -out:runtime-invoke.gen.exe -r:TestDriver.dll runtime-invoke.gen.cs
 
 EXTRA_DIST += make-imt-test.cs
-imt_big_iface_test.exe: TestDriver.dll make-imt-test.exe
+imt_big_iface_test.exe: $(TEST_DRIVER_DEPEND) make-imt-test.exe
        $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
        $(MCS) -out:imt_big_iface_test.exe -r:TestDriver.dll imt_big_iface_test.cs
 
 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
-test-inline-call-stack-library.dll: TestDriver.dll $(srcdir)/test-inline-call-stack-library.cs
+test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-call-stack-library.cs
        $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs
-test-inline-call-stack.exe: TestDriver.dll test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
+
+test-inline-call-stack.exe: $(TEST_DRIVER_DEPEND) test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
        $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:test-inline-call-stack.exe $(srcdir)/test-inline-call-stack.cs
 
 EXTRA_DIST += unhandled-exception-base-configuration.config
@@ -1282,12 +1380,18 @@ bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-8167
        $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
        $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs
        $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-36848-a.cs
 bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
        $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs /define:WITH_STOP
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
 bug-81691.exe bug-81691-b.dll: $(srcdir)/bug-81691.cs $(srcdir)/bug-81691-a.cs $(srcdir)/bug-81691-b.cs
@@ -1300,24 +1404,37 @@ bug-81691.exe: bug-81691-b.dll
 EXTRA_DIST += bug-81466-lib.il
 bug-81466-lib.dll: bug-81466-lib.il
        $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-81466.exe: bug-81466.il bug-81466-lib.dll
        $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
 
 EXTRA_DIST += bug-324535-il.il
 bug-324535-il.dll : bug-324535-il.il
        $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-324535.exe : bug-324535.cs bug-324535-il.dll
        $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
 
 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
 custom-modifiers-lib.dll: custom-modifiers-lib.il
        $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll
        $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
 
 EXTRA_DIST += bug-382986-lib.cs
 bug-382986-lib.dll: bug-382986-lib.cs
        $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
+
 bug-382986.exe: bug-382986.cs bug-382986-lib.dll
        $(MCS) -out:$@ -r:bug-382986-lib.dll $(srcdir)/bug-382986.cs
 
@@ -1341,10 +1458,16 @@ test-coreclr-security : coreclr-security.exe
 EXTRA_DIST += generic-unboxing.2.il
 generic-unboxing.2.dll : generic-unboxing.2.il
        $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-boxing.2.il
 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
        $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-unbox.2.cs
 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
@@ -1357,6 +1480,9 @@ generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
 generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
        $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 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
 
@@ -1419,7 +1545,7 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
        done
 
 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
-       @$(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+       @$(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
 
 if NACL_CODEGEN
 test-generic-sharing:
@@ -1438,7 +1564,7 @@ test-async-exceptions : async-exceptions.exe
 EXTRA_DIST += modules.cs modules-m1.cs
 modules-m1.netmodule: modules-m1.cs
        $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
-modules.exe: modules.cs modules-m1.netmodule TestDriver.dll
+modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) 
        $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
 
 # Useful if mono is compiled with --enable-shared=no
@@ -1496,13 +1622,13 @@ test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION
        $(MAKE) test-unhandled-exception-2-255-without-managed-handler
 
 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 
 endif