output_width = Math.Min (120, ti.test.Length);
}
- List<Thread> threads = new List<Thread> (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<String> (tests);
- if (aot_build_flags != null) {
- var allTests = new StringBuilder();
- foreach (string test in tests) {
- allTests.Append(test);
- allTests.Append(" ");
- }
+ List<Thread> build_threads = new List<Thread> (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<Thread> threads = new List<Thread> (concurrency);
+
+ DateTime test_start_time = DateTime.UtcNow;
for (int j = 0; j < concurrency; ++j) {
Thread thread = new Thread (() => {