Beispiel #1
0
        public bool Execute()
        {
            if (OutputHandler == null)
            {
                throw new InvalidOperationException("No OutputHandler set!");
            }

            if (RunTargets.Count == 0)
            {
                RunTargets.AddRange((RunTargetEnum[])Enum.GetValues(typeof(RunTargetEnum)));
            }

            OutputHandler.ExecutionStart();
            try
            {
                var xResult = true;
                foreach (var xConfig in GetRunConfigurations())
                {
                    OutputHandler.RunConfigurationStart(xConfig);
                    try
                    {
                        foreach (var xAssemblyFile in mKernelsToRun)
                        {
                            mBaseWorkingDirectory = Path.Combine(Path.GetDirectoryName(typeof(Engine).Assembly.Location), "WorkingDirectory");
                            if (Directory.Exists(mBaseWorkingDirectory))
                            {
                                Directory.Delete(mBaseWorkingDirectory, true);
                            }
                            Directory.CreateDirectory(mBaseWorkingDirectory);

                            xResult &= ExecuteKernel(xAssemblyFile, xConfig);
                        }
                    }
                    catch (Exception e)
                    {
                        OutputHandler.UnhandledException(e);
                    }
                    finally
                    {
                        OutputHandler.RunConfigurationEnd(xConfig);
                    }
                }
                return(xResult);
            }
            catch (Exception E)
            {
                OutputHandler.UnhandledException(E);
                return(false);
            }
            finally
            {
                OutputHandler.ExecutionEnd();
            }

            // todo: now report summary
            //DoLog("NotImplemented, summary?");
        }
Beispiel #2
0
        public bool Execute()
        {
            if (OutputHandler == null)
            {
                throw new InvalidOperationException("No OutputHandler set!");
            }

            if (!RunTargets.Any())
            {
                throw new InvalidOperationException("No run targets were specified!");
            }

            OutputHandler.ExecutionStart();
            try
            {
                var xResult = true;
                foreach (var xConfig in GetRunConfigurations())
                {
                    OutputHandler.RunConfigurationStart(xConfig);
                    try
                    {
                        foreach (var xKernelType in KernelsToRun)
                        {
                            var xAssemblyPath     = xKernelType.Assembly.Location;
                            var xWorkingDirectory = Path.Combine(
                                WorkingDirectoryBase, Path.GetFileNameWithoutExtension(xAssemblyPath));

                            if (Directory.Exists(xWorkingDirectory))
                            {
                                Directory.Delete(xWorkingDirectory, true);
                            }

                            Directory.CreateDirectory(xWorkingDirectory);

                            xResult &= ExecuteKernel(xAssemblyPath, xWorkingDirectory, xConfig);
                        }
                    }
                    catch (Exception e)
                    {
                        if (!mKernelResultSet)
                        {
                            OutputHandler.SetKernelTestResult(false, e.ToString());
                            mKernelResult = false;
                            xResult       = false;
                        }
                        OutputHandler.UnhandledException(e);
                    }
                    finally
                    {
                        OutputHandler.RunConfigurationEnd(xConfig);
                    }
                }
                return(xResult);
            }
            catch (Exception E)
            {
                OutputHandler.UnhandledException(E);
                return(false);
            }
            finally
            {
                OutputHandler.ExecutionEnd();
            }

            // todo: now report summary
            //DoLog("NotImplemented, summary?");
        }