[runtime] Use mkbundle in BCL tests
authorAlexander Kyte <alexmkyte@gmail.com>
Wed, 7 Jun 2017 18:43:58 +0000 (14:43 -0400)
committerAlexander Kyte <alexmkyte@gmail.com>
Wed, 30 Aug 2017 16:52:51 +0000 (12:52 -0400)
mcs/build/tests.make
mcs/tools/mkbundle/mkbundle.cs

index 8ffa784a23aeff1661c912461451be8e75a5445e..3936085129185dd930c942d03c24ba14bc749d03 100644 (file)
@@ -141,10 +141,27 @@ ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
        sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(NUNITLITE_CONFIG_FILE)
 endif
 
+ifdef STATIC_AOT_BUNDLE
+
+TEST_HARNESS_EXEC = $(TEST_HARNESS).static
+TEST_HARNESS_BIN = $(TEST_HARNESS_EXEC)
+MKBUNDLE_EXE = $(topdir)/class/lib/$(PROFILE)/mkbundle.exe
+BUNDLED_ASSEMBLIES := $(sort $(patsubst .//%,%,$(filter-out %.exe.static %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll %.exe,$(wildcard $(topdir)/class/lib/$(PROFILE)/*)))))
+
+$(MKBUNDLE_EXE):
+       make -C $(topdir)/tools/mkbundle
+
+$(TEST_HARNESS_BIN): $(MKBUNDLE_EXE)
+       $(TEST_RUNTIME) $(MKBUNDLE_EXE) -L $(topdir)/class/lib/$(PROFILE) -v --deps $(TEST_HARNESS) $(BUNDLED_ASSEMBLIES) -o $(TEST_HARNESS_BIN) --aot-mode $(STATIC_AOT_BUNDLE) --aot-runtime $(RUNTIME)
+
+else 
+TEST_HARNESS_EXEC = $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) 
+endif
+
 ## FIXME: i18n problem in the 'sed' command below
-run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig
+run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig $(TEST_HARNESS_BIN)
        ok=:; \
-       PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
+       PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_HARNESS_EXEC) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
        if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
        $$ok
 
index dd19a7b2b216f290fd299c2aa53539485c756527..a929ed237e6cf82d96b0a6c33a0393565bcf873d 100755 (executable)
@@ -369,6 +369,7 @@ class MakeBundle {
                                var dedup_file = args [++i];
                                sources.Add (dedup_file);
                                aot_dedup_assembly = sources.Count () - 1;
+                               aot_compile = true;
                                break;
                        case "--aot-mode":
                                if (i+1 == top) {
@@ -377,7 +378,6 @@ class MakeBundle {
                                }
 
                                aot_mode = args [++i];
-
                                if (aot_mode != "full" && aot_mode != "llvmonly") {
                                        Console.WriteLine ("Need string of aot mode (full, llvmonly). Omit for normal AOT.");
                                        return 1;
@@ -1439,6 +1439,15 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                if (aot_runtime == null)
                        aot_runtime = runtime;
 
+               if (aot_runtime == null || aot_runtime.Length == 0){
+                       if (IsUnix)
+                               aot_runtime = Process.GetCurrentProcess().MainModule.FileName;
+                       else {
+                               Error ("You must specify at least one aot runtime with --runtime or --cross or --aot_runtime when AOT compiling");
+                               Environment.Exit (1);
+                       }
+               }
+
                var aot_mode_string = "";
                if (aot_mode != null)
                        aot_mode_string = "," + aot_mode;
@@ -1463,6 +1472,9 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                all_assemblies.Append (" ");
                                Execute (String.Format ("{0} --aot={1},outfile={2}{3}{4} {5}",
                                        aot_runtime, aot_args, outPath, aot_mode_string, dedup_mode_string, path));
+                       } else {
+                               Execute (String.Format ("{0} --aot={1},outfile={2}{3} {4}",
+                                       aot_runtime, aot_args, outPath, aot_mode_string, path));
                        }
                }
                if (aot_dedup_assembly != null) {