コード例 #1
0
ファイル: MockHost.cs プロジェクト: zhuweijia/msbuild
 /// <summary>
 /// Waits for the engine status requested. If a status is not changed within a certain amout of time then fail.
 /// </summary>
 public void WaitForEngineStatus(BuildRequestEngineStatus status)
 {
     while (this.LastEngineStatus != status)
     {
         if (this.engineStatusChangedEvent.WaitOne(QAMockHost.globalTimeOut, false) == false)
         {
             Assert.Fail("Requested engine status was not received within - " + QAMockHost.globalTimeOut.ToString() + " seconds.");
         }
     }
 }
コード例 #2
0
ファイル: MockHost.cs プロジェクト: zhuweijia/msbuild
 /// <summary>
 /// Constructor
 /// </summary>
 internal QAMockHost(GetComponentDelegate getComponentCallback)
 {
     this.buildParameters          = new BuildParameters();
     this.getComponentCallback     = getComponentCallback;
     this.engineStatusChangedEvent = new AutoResetEvent(false);
     this.lastEngineStatus         = BuildRequestEngineStatus.Shutdown;
     this.loggingService           = this;
     this.requestEngine            = null;
     this.testDataProvider         = null;
     this.buildComponents          = new Queue <IBuildComponent>();
     this.legacyThreadingData      = new LegacyThreadingData();
 }
コード例 #3
0
        private void VerifyEngineStatus(BuildRequestEngineStatus expectedStatus)
        {
            IBuildRequestEngine engine = (IBuildRequestEngine)_host.GetComponent(BuildComponentType.RequestEngine);

            if (engine.Status == expectedStatus)
            {
                return;
            }

            WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged");
            BuildRequestEngineStatus engineStatus = engine.Status;

            Assert.Equal(expectedStatus, engineStatus);
        }
コード例 #4
0
        private void WaitForEngineStatus(BuildRequestEngineStatus expectedStatus)
        {
            DateTime time = DateTime.Now;

            while (DateTime.Now - time > new TimeSpan(0, 0, 5))
            {
                WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged");
                if (expectedStatus == _engineStatusChanged_Status)
                {
                    return;
                }
            }
            Assert.Fail("Engine failed to change to status " + expectedStatus);
        }
コード例 #5
0
 /// <summary>
 /// Callback for event raised when the build request engine's status changes.
 /// </summary>
 /// <param name="newStatus">The new status for the engine</param>
 private void Engine_EngineStatusChanged(BuildRequestEngineStatus newStatus)
 {
     _engineStatusChanged_Status = newStatus;
     _engineStatusChangedEvent.Set();
 }
コード例 #6
0
ファイル: MockHost.cs プロジェクト: zhuweijia/msbuild
 /// <summary>
 /// Gets called by the build request engine when the build request engine state changes.
 /// Special handeling when a shutdown has been sent so that only shutdown status set the event
 /// </summary>
 private void RequestEngine_OnStatusChanged(BuildRequestEngineStatus newStatus)
 {
     this.LastEngineStatus = newStatus;
     this.engineStatusChangedEvent.Set();
 }
コード例 #7
0
ファイル: BuildRequestEngine.cs プロジェクト: nikson/msbuild
 /// <summary>
 /// Raises the OnStatusChanged event.
 /// </summary>
 /// <param name="newStatus">The new engine status.</param>
 private void RaiseEngineStatusChanged(BuildRequestEngineStatus newStatus)
 {
     EngineStatusChangedDelegate statusChanged = OnStatusChanged;
     if (null != statusChanged)
     {
         statusChanged(newStatus);
     }
 }
コード例 #8
0
ファイル: BuildRequestEngine.cs プロジェクト: nikson/msbuild
 /// <summary>
 /// Changes the engine's status and raises the OnStatsChanged event.
 /// </summary>
 /// <param name="newStatus">The new engine status.</param>
 private void ChangeStatus(BuildRequestEngineStatus newStatus)
 {
     if (_status != newStatus)
     {
         _status = newStatus;
         RaiseEngineStatusChanged(newStatus);
     }
 }
コード例 #9
0
ファイル: MockHost.cs プロジェクト: JamesLinus/msbuild
 /// <summary>
 /// Gets called by the build request engine when the build request engine state changes.
 /// Special handeling when a shutdown has been sent so that only shutdown status set the event
 /// </summary>
 private void RequestEngine_OnStatusChanged(BuildRequestEngineStatus newStatus)
 {
     this.LastEngineStatus = newStatus;
     this.engineStatusChangedEvent.Set();
 }
コード例 #10
0
ファイル: BuildRequestEngine.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Constructor
        /// </summary>
        internal BuildRequestEngine()
        {
            _debugDumpState = Environment.GetEnvironmentVariable("MSBUILDDEBUGSCHEDULER") == "1";
            _debugDumpPath = Environment.GetEnvironmentVariable("MSBUILDDEBUGPATH");
            _debugForceCaching = Environment.GetEnvironmentVariable("MSBUILDDEBUGFORCECACHING") == "1";

            if (String.IsNullOrEmpty(_debugDumpPath))
            {
                _debugDumpPath = Path.GetTempPath();
            }

            _status = BuildRequestEngineStatus.Uninitialized;
            _nextUnresolvedConfigurationId = -1;
            _nextBuildRequestId = 0;
            _requests = new List<BuildRequestEntry>();
            _unsubmittedRequests = new Queue<PendingUnsubmittedBuildRequests>();
            _requestsByGlobalRequestId = new Dictionary<int, BuildRequestEntry>();
        }
コード例 #11
0
ファイル: MockHost.cs プロジェクト: JamesLinus/msbuild
 /// <summary>
 /// Waits for the engine status requested. If a status is not changed within a certain amout of time then fail.
 /// </summary>
 public void WaitForEngineStatus(BuildRequestEngineStatus status)
 {
     while (this.LastEngineStatus != status)
     {
         if (this.engineStatusChangedEvent.WaitOne(QAMockHost.globalTimeOut, false) == false)
         {
             Assert.Fail("Requested engine status was not received within - " + QAMockHost.globalTimeOut.ToString() + " seconds.");
         }
     }
 }
コード例 #12
0
ファイル: MockHost.cs プロジェクト: JamesLinus/msbuild
 /// <summary>
 /// Constructor 
 /// </summary>
 internal QAMockHost(GetComponentDelegate getComponentCallback)
 {
     this.buildParameters = new BuildParameters();
     this.getComponentCallback = getComponentCallback;
     this.engineStatusChangedEvent = new AutoResetEvent(false);
     this.lastEngineStatus = BuildRequestEngineStatus.Shutdown;
     this.loggingService = this;
     this.requestEngine = null;
     this.testDataProvider = null;
     this.buildComponents = new Queue<IBuildComponent>();
     this.legacyThreadingData = new LegacyThreadingData();
 }
コード例 #13
0
 /// <summary>
 /// Callback for event raised when the build request engine's status changes.
 /// </summary>
 /// <param name="newStatus">The new status for the engine</param>
 private void Engine_EngineStatusChanged(BuildRequestEngineStatus newStatus)
 {
     _engineStatusChanged_Status = newStatus;
     _engineStatusChangedEvent.Set();
 }
コード例 #14
0
        private void VerifyEngineStatus(BuildRequestEngineStatus expectedStatus)
        {
            IBuildRequestEngine engine = (IBuildRequestEngine)_host.GetComponent(BuildComponentType.RequestEngine);

            if (engine.Status == expectedStatus)
            {
                return;
            }

            WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged");
            BuildRequestEngineStatus engineStatus = engine.Status;
            Assert.Equal(expectedStatus, engineStatus);
        }
コード例 #15
0
 private void WaitForEngineStatus(BuildRequestEngineStatus expectedStatus)
 {
     DateTime time = DateTime.Now;
     while (DateTime.Now - time > new TimeSpan(0, 0, 5))
     {
         WaitForEvent(_engineStatusChangedEvent, "EngineStatusChanged");
         if (expectedStatus == _engineStatusChanged_Status)
         {
             return;
         }
     }
     Assert.True(false, "Engine failed to change to status " + expectedStatus);
 }