public void TestEngineShutdownWhileActive() { BuildRequestData data = new BuildRequestData("TestFile", new Dictionary <string, string>(), "TestToolsVersion", new string[0], null); BuildRequestConfiguration config = new BuildRequestConfiguration(1, data, "2.0"); _cache.AddConfiguration(config); string[] targets = new string[3] { "target1", "target2", "target3" }; BuildRequest request = CreateNewBuildRequest(1, targets); VerifyEngineStatus(BuildRequestEngineStatus.Uninitialized); _engine.InitializeForBuild(new NodeLoggingContext(_host.LoggingService, 0, false)); _engine.SubmitBuildRequest(request); Thread.Sleep(250); VerifyEngineStatus(BuildRequestEngineStatus.Active); _engine.CleanupForBuild(); WaitForEvent(_requestCompleteEvent, "RequestComplete"); Assert.Equal(request, _requestComplete_Request); Assert.Equal(BuildResultCode.Failure, _requestComplete_Result.OverallResult); VerifyEngineStatus(BuildRequestEngineStatus.Uninitialized); }
/// <summary> /// Cache the configuration for this build definition and then submit the build request to the request engine. If the request being submitted does not have /// a GlobalRequestId than assign one. /// Since we want to make all requests rooted - it the passed in request is null then we will use the dummy root request and make that the parent. This is usually /// the case when tests submit build requets. When a request is submitted by the RequestBuilder the request is always populated and likely rooted. /// </summary> public void Build(BuildRequest request) { if (request == null) { _configuration = _testDataProvider.CreateConfiguration(this); _buildRequest = new BuildRequest(1 /* submissionId */, 1, _configuration.ConfigurationId, _targetsToBuild, null, BuildEventContext.Invalid, null); _buildRequest.GlobalRequestId = RequestDefinition.s_globalRequestId++; } else { _buildRequest = request; // Assign a new Global Request id if one is not already there bool assignNewId = false; if (_buildRequest.GlobalRequestId == BuildRequest.InvalidGlobalRequestId) { foreach (KeyValuePair <int, RequestDefinition> idRequestPair in _testDataProvider.RequestDefinitions) { if ( idRequestPair.Value._buildRequest != null && idRequestPair.Value._buildRequest.ConfigurationId == _buildRequest.ConfigurationId && idRequestPair.Value._buildRequest.Targets.Count == _buildRequest.Targets.Count ) { List <string> leftTargets = new List <string>(idRequestPair.Value._buildRequest.Targets); List <string> rightTargets = new List <string>(_buildRequest.Targets); leftTargets.Sort(StringComparer.OrdinalIgnoreCase); rightTargets.Sort(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < leftTargets.Count; i++) { if (!leftTargets[i].Equals(rightTargets[i], StringComparison.OrdinalIgnoreCase)) { assignNewId = true; break; } } if (!assignNewId) { _buildRequest.GlobalRequestId = idRequestPair.Value._buildRequest.GlobalRequestId; break; } } } } if (assignNewId) { _buildRequest.GlobalRequestId = RequestDefinition.s_globalRequestId++; } } _requestEngine.SubmitBuildRequest(_buildRequest); }
private void HandleBuildRequest(BuildRequest request) { _buildRequestEngine.SubmitBuildRequest(request); }