private void StartExecution(JSTestSettings settings, IEnumerable <string> sources) { this.PrintHeader(); var processInfo = RuntimeProviderFactory.Instance.GetRuntimeProcessInfo(settings, sources); this.runtimeManager = new TestRuntimeManager(settings, this.testRunEvents); Task <bool> launchTask = null; JSTestException exception = null; try { var launchStopWatch = Stopwatch.StartNew(); launchTask = Task.Run(() => this.runtimeManager.LaunchProcessAsync(processInfo, new CancellationToken())); int launchTimeoutInMilliseconds = GetProcessLaunchTimeout(); if (!launchTask.Wait(launchTimeoutInMilliseconds)) { throw new TimeoutException($"Process launch timeout after {launchTimeoutInMilliseconds} ms"); } else { launchStopWatch.Stop(); Console.WriteLine($"JSTest: Process Launched with id {this.runtimeManager.GetProcessId()} in {launchStopWatch.ElapsedMilliseconds} ms"); } } catch (Exception ex) { this.testRunEvents.DisableInvoke = true; EqtTrace.Error(ex); exception = new JSTestException($"JSTest.TestRunner.StartExecution: Could not start javascript runtime : {ex}"); } finally { if (exception == null && launchTask.Exception != null) { EqtTrace.Error(launchTask.Exception); exception = new JSTestException($"JSTest.TestRunner.StartExecution: Could not start javascript runtime. {launchTask.Exception}"); } } if (exception != null) { throw exception; } }
private void StartRuntimeManager(JSTestSettings settings, IEnumerable <string> sources) { var processInfo = RuntimeProviderFactory.Instance.GetRuntimeProcessInfo(settings, sources); this.runtimeManager = new TestRuntimeManager(settings, this.testRunEvents); Task <bool> launchTask = null; JSTestException exception = null; try { launchTask = Task.Run(() => this.runtimeManager.LaunchProcessAsync(processInfo, new CancellationToken())); if (!launchTask.Wait(RuntimeProviderFactory.Instance.IsRuntimeDebuggingEnabled ? Constants.InfiniteTimout : Constants.StandardWaitTimout)) { throw new TimeoutException("Process launch timeout."); } } catch (Exception ex) { this.testRunEvents.DisableInvoke = true; EqtTrace.Error(ex); exception = new JSTestException($"JSTest.TestRunner.StartExecution: Could not start javascript runtime : {ex}"); } finally { if (exception == null && launchTask.Exception != null) { EqtTrace.Error(launchTask.Exception); exception = new JSTestException($"JSTest.TestRunner.StartExecution: Could not start javascript runtime. {launchTask.Exception}"); } } if (exception != null) { throw exception; } }