예제 #1
0
        public void TestBuildWithChildren()
        {
            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);

            // Configure the builder to spawn build requests
            MockRequestBuilder builder = (MockRequestBuilder)_host.GetComponent(BuildComponentType.RequestBuilder);

            builder.NewRequests.Add(new FullyQualifiedBuildRequest[1] {
                new FullyQualifiedBuildRequest(config, new string[1] {
                    "requiredTarget1"
                }, true)
            });

            // Create the initial build request
            string[] targets = new string[3] {
                "target1", "target2", "target3"
            };
            BuildRequest request = CreateNewBuildRequest(1, targets);

            // Kick it off
            VerifyEngineStatus(BuildRequestEngineStatus.Uninitialized);
            _engine.InitializeForBuild(new NodeLoggingContext(_host.LoggingService, 0, false));
            _engine.SubmitBuildRequest(request);
            Thread.Sleep(250);
            VerifyEngineStatus(BuildRequestEngineStatus.Active);

            // Wait for the new requests to be spawned by the builder
            WaitForEvent(_newRequestEvent, "NewRequestEvent");
            Assert.Equal(1, _newRequest_Request.BuildRequests[0].ConfigurationId);
            Assert.Single(_newRequest_Request.BuildRequests[0].Targets);
            Assert.Equal("requiredTarget1", _newRequest_Request.BuildRequests[0].Targets[0]);

            // Wait for a moment, because the build request engine thread may not have gotten around
            // to going to the waiting state.
            Thread.Sleep(250);
            VerifyEngineStatus(BuildRequestEngineStatus.Waiting);

            // Report a result to satisfy the build request
            BuildResult result = new BuildResult(_newRequest_Request.BuildRequests[0]);

            result.AddResultsForTarget("requiredTarget1", BuildResultUtilities.GetEmptySucceedingTargetResult());
            _engine.UnblockBuildRequest(new BuildRequestUnblocker(result));

            // Continue the request.
            _engine.UnblockBuildRequest(new BuildRequestUnblocker(request.GlobalRequestId));

            // Wait for the original request to complete
            WaitForEvent(_requestCompleteEvent, "RequestComplete");
            Assert.Equal(request, _requestComplete_Request);
            Assert.Equal(BuildResultCode.Success, _requestComplete_Result.OverallResult);

            VerifyEngineStatus(BuildRequestEngineStatus.Idle);
        }
예제 #2
0
        /// <summary>
        /// Request for this definition is completed. This call is in the ProcessorThread of the TestDataProvider
        /// </summary>
        public void RaiseOnBuildRequestCompleted(BuildRequest request, BuildResult result)
        {
            if (!result.ResultBelongsToRootRequest)
            {
                // Don't report root requests to the request engine, as it doesn't wait on them.
                _requestEngine.UnblockBuildRequest(new BuildRequestUnblocker(result));
            }

            _buildResult = result;
            _testProjectCompletedEvent.Set();
        }
예제 #3
0
 private void HandleBuildRequestUnblocker(BuildRequestUnblocker unblocker)
 {
     _buildRequestEngine.UnblockBuildRequest(unblocker);
 }