Exemple #1
0
        /// <summary>
        /// Encapsulates logic for cleaning up any infrastructure state.
        /// </summary>
        public override void Execute()
        {
            Console.WriteLine("Cleaning up.");
            DebuggingEngineCommand.Rollback();

            //HACK - We need to know the location of the ES.exe so we can shut it down. This is likely to fail when run from a share.
            string testBinRoot = @".\";

            ElevationServiceCommand.RemoveInstallation(testBinRoot);
        }
Exemple #2
0
        internal void StartService(DebuggingEngineCommand debuggingEngine, int testCount)
        {
            ExecutionEventLog.RecordStatus("Starting up LoggingMediator.");
            server = new LoggingServer(debuggingEngine, debugTests);
            server.Start();
            consoleLogger        = new ConsoleLogger();
            recordingLogger      = new RecordingLogger();
            windowProgressLogger = new ProgressWindowLogger(testCount);

            server.RegisterLogger(recordingLogger);
            server.RegisterLogger(consoleLogger);
            server.RegisterLogger(windowProgressLogger);
        }
Exemple #3
0
        /// <summary>
        /// Executes Tests
        /// </summary>
        public static void Execute(ExecutionSettings settings)
        {
            Stack <ICleanableCommand> cleanupCommands = new Stack <ICleanableCommand>();

            try
            {
                //Elevation Service is hitting Error #5 "Access Denied" in XP - We don't have run time dependencies on it right now, so disabling.
                //cleanupCommands.Push(ElevationServiceCommand.Apply(infraBinariesDirectory));

                cleanupCommands.Push(LogDirectoryCommand.Apply(settings.LogFilesPath, settings.SkipDxDiag));

                ExecutionComponents executionComponents = new ExecutionComponents();
                executionComponents.DebuggingEngine = DebuggingEngineCommand.Apply(settings.InfraBinariesDirectory, settings.JitDebuggerCommand);
                cleanupCommands.Push(executionComponents.DebuggingEngine);
                ExecutionEventLog.RecordStatus("Creating LoggingMediator.");
                executionComponents.LoggingMediator = new LoggingMediator(settings.DebugTests); //Consider using dispose pattern.
                executionComponents.LoggingMediator.StartService(executionComponents.DebuggingEngine, settings.Tests.TestCollection.Count(record => record.ExecutionEnabled));

                //

                cleanupCommands.Push(ExecutionGroupLogCommand.Apply("InfraExecution", settings.LogFilesPath, executionComponents.LoggingMediator));
                if (settings.CodeCoverageEnabled)
                {
                    cleanupCommands.Push(MergeCodeCoverageDataCommand.Apply(settings.LogFilesPath));
                }
                cleanupCommands.Push(TemporaryDirectoryCommand.Apply(settings.ExecutionRootDirectory));
                cleanupCommands.Push(MoveWindowCommand.Apply());
                cleanupCommands.Push(ExecutionEventLog.Apply(settings.LogFilesPath, !settings.ContinueExecution));

                try
                {
                    ExecuteTestStateGroups(settings, executionComponents);
                }
                catch (Exception e)
                {
                    ExecutionEventLog.RecordException(e);
                }
                finally
                {
                    ExecutionEventLog.RecordStatus("Ending Test Sequence.");
                    ExecutionEventLog.RecordStatus("Shutting down test logging system.");
                    executionComponents.LoggingMediator.StopService();
                }
            }
            finally
            {
                Cleanup(cleanupCommands);
                Console.WriteLine("Test Execution has finished.\n");
            }
        }
Exemple #4
0
        /// <summary>
        /// Runs Test process. Returns duration of execution.
        /// </summary>
        internal static TimeSpan Launch(ExecutionSettings settings, List <TestRecord> tests, DirectoryInfo executionDirectory, DebuggingEngineCommand debuggingEngine)
        {
            //Small hack to lessen the chance that Mosh UI on Win8 will interfere with tests.
            //This can be removed once all tests play nice and don't bring up Mosh in the middle of the runs.
            if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2)
            {
                if (ModernShellUtilities.IsImmersiveWindowOpen())
                {
                    ModernShellUtilities.EnsureDesktop();
                }
            }
            PrepareDriverPayload(tests, executionDirectory);
            //Hmm. Need to check for overflow, or be less Linq-ish...
            int timeout = AddUpTimeout(settings, tests);

            DriverLaunchSettings.StoreSettings(executionDirectory.FullName, settings.TestBinariesDirectory.FullName);
            ProcessStartInfo startInfo = PrepareProcessStartInfo(tests.First().TestInfo.Driver.Executable, executionDirectory, settings);

            ExecutionEventLog.RecordStatus("Running Driver sandbox.");
            Process p = Process.Start(startInfo);

            debuggingEngine.TestStarted(p.Id, executionDirectory);

            int millisecondsTimeout = timeout;

            if (!p.WaitForExit(millisecondsTimeout))
            {
                TerminateLaggard(p, millisecondsTimeout);
            }

            debuggingEngine.TestEnded(p.StartTime);

            return(p.ExitTime - p.StartTime);
        }
Exemple #5
0
 public LoggingNormalizer(DebuggingEngineCommand debuggingEngine, bool debugTests)
 {
     this.isDebugging     = debugTests;
     this.debuggingEngine = debuggingEngine;
     Loggers = new LoggerCollection();
 }
Exemple #6
0
 /// <summary/>
 public LoggingServer(DebuggingEngineCommand debuggingEngine, bool debugTests)
 {
     LoggingNormalizer = new LoggingNormalizer(debuggingEngine, debugTests);
     Instance          = this;
 }