From: Alexander Kyte Date: Thu, 16 Jun 2016 21:38:55 +0000 (-0400) Subject: [mobile_static] Make test runner aot each assembly individually X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=09e89205e50d8c2b087b72662184088cb9eb2aa9 [mobile_static] Make test runner aot each assembly individually --- diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index cc95243bbb6..627252457c3 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -59,9 +59,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 diff --git a/mono/tests/test-runner.cs b/mono/tests/test-runner.cs index 4e2827424c8..8b456247222 100644 --- a/mono/tests/test-runner.cs +++ b/mono/tests/test-runner.cs @@ -218,39 +218,66 @@ public class TestRunner output_width = Math.Min (120, ti.test.Length); } - List threads = new List (concurrency); + if (aot_build_flags != null) { + Console.WriteLine("AOT compiling tests"); - DateTime test_start_time = DateTime.UtcNow; + object aot_monitor = new object (); + var aot_queue = new Queue (tests); - if (aot_build_flags != null) { - var allTests = new StringBuilder(); - foreach (string test in tests) { - allTests.Append(test); - allTests.Append(" "); - } + List build_threads = new List (concurrency); - string aot_args = aot_build_flags + " " + allTests.ToString(); + for (int j = 0; j < concurrency; ++j) { + Thread thread = new Thread (() => { + while (true) { + String test_name; - ProcessStartInfo job = new ProcessStartInfo (runtime, aot_args); - job.UseShellExecute = false; - job.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString(); - job.EnvironmentVariables[MONO_PATH] = mono_path; - Process compiler = new Process (); - compiler.StartInfo = job; + lock (aot_monitor) { + if (aot_queue.Count == 0) + break; + test_name = aot_queue.Dequeue (); + } - compiler.Start (); + string test_bitcode_output = test_name + "_bitcode_tmp"; + string test_bitcode_arg = ",temp-path=" + test_bitcode_output; + string aot_args = aot_build_flags + test_bitcode_arg + " " + test_name; + + ProcessStartInfo job = new ProcessStartInfo (runtime, aot_args); + job.UseShellExecute = false; + job.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString(); + job.EnvironmentVariables[MONO_PATH] = mono_path; + Process compiler = new Process (); + compiler.StartInfo = job; + + compiler.Start (); + + if (!compiler.WaitForExit (timeout * 1000)) { + try { + compiler.Kill (); + } catch { + } + throw new Exception(String.Format("Timeout AOT compiling tests")); + } else if (compiler.ExitCode != 0) { + throw new Exception(String.Format("Error AOT compiling tests")); + } else { + File.Delete (test_bitcode_output); + } + } + }); - if (!compiler.WaitForExit (timeout * 1000)) { - try { - compiler.Kill (); - } catch { - } - throw new Exception(String.Format("Timeout AOT compiling tests")); - } else if (compiler.ExitCode != 0) { - throw new Exception(String.Format("Error AOT compiling tests")); + thread.Start (); + + build_threads.Add (thread); } + + for (int j = 0; j < build_threads.Count; ++j) + build_threads [j].Join (); + + Console.WriteLine("Done compiling"); } + List threads = new List (concurrency); + + DateTime test_start_time = DateTime.UtcNow; for (int j = 0; j < concurrency; ++j) { Thread thread = new Thread (() => {