using System.Collections.Generic;
using System.Globalization;
using System.Xml;
+using System.Text;
using System.Text.RegularExpressions;
#if !MOBILE_STATIC
{
const string TEST_TIME_FORMAT = "mm\\:ss\\.fff";
const string ENV_TIMEOUT = "TEST_DRIVER_TIMEOUT_SEC";
+ const string MONO_PATH = "MONO_PATH";
class ProcessData {
public string test;
string testsuiteName = null;
string inputFile = null;
- // FIXME: Add support for runtime arguments + env variables
-
string disabled_tests = null;
string runtime = "mono";
string config = null;
+ string mono_path = null;
var opt_sets = new List<string> ();
+ string aot_run_flags = null;
+ string aot_build_flags = null;
+
// Process options
int i = 0;
while (i < args.Length) {
}
inputFile = args [i + 1];
i += 2;
+ } else if (args [i] == "--runtime") {
+ if (i + 1 >= args.Length) {
+ Console.WriteLine ("Missing argument to --runtime command line option.");
+ return 1;
+ }
+ runtime = args [i + 1];
+ i += 2;
+ } else if (args [i] == "--mono-path") {
+ if (i + 1 >= args.Length) {
+ Console.WriteLine ("Missing argument to --mono-path command line option.");
+ return 1;
+ }
+ mono_path = args [i + 1].Substring(0, args [i + 1].Length);
+
+ i += 2;
+ } else if (args [i] == "--aot-run-flags") {
+ if (i + 1 >= args.Length) {
+ Console.WriteLine ("Missing argument to --aot-run-flags command line option.");
+ return 1;
+ }
+ aot_run_flags = args [i + 1].Substring(0, args [i + 1].Length);
+ i += 2;
+ } else if (args [i] == "--aot-build-flags") {
+ if (i + 1 >= args.Length) {
+ Console.WriteLine ("Missing argument to --aot-build-flags command line option.");
+ return 1;
+ }
+ aot_build_flags = args [i + 1].Substring(0, args [i + 1].Length);
+ i += 2;
} else {
Console.WriteLine ("Unknown command line option: '" + args [i] + "'.");
return 1;
DateTime test_start_time = DateTime.UtcNow;
+ if (aot_build_flags != null) {
+ var allTests = new StringBuilder();
+ foreach (string test in tests) {
+ allTests.Append(test);
+ allTests.Append(" ");
+ }
+
+ string aot_args = aot_build_flags + " " + allTests.ToString();
+
+ 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"));
+ }
+ }
+
+
for (int j = 0; j < concurrency; ++j) {
Thread thread = new Thread (() => {
while (true) {
output.Write (String.Format ("{{0,-{0}}} ", output_width), test);
+ string test_invoke;
+
+ if (aot_run_flags != null)
+ test_invoke = aot_run_flags + " " + test;
+ else
+ test_invoke = test;
+
/* Spawn a new process */
string process_args;
if (opt_set == null)
- process_args = test;
+ process_args = test_invoke;
else
- process_args = "-O=" + opt_set + " " + test;
+ process_args = "-O=" + opt_set + " " + test_invoke;
+
ProcessStartInfo info = new ProcessStartInfo (runtime, process_args);
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
if (config != null)
info.EnvironmentVariables["MONO_CONFIG"] = config;
+ if (mono_path != null)
+ info.EnvironmentVariables[MONO_PATH] = mono_path;
Process p = new Process ();
p.StartInfo = info;