Example #1
0
        public override ExitCode Execute()
        {
            AutoParam.ApplyParamsAndDefaults(this, Environment.GetCommandLineArgs());

            if (Verbose)
            {
                Gauntlet.Log.Level = Gauntlet.LogLevel.Verbose;
            }

            IEnumerable <string> TestList = new string[0];

            // If a group was specified...
            if (Group.Length > 0)
            {
                // if a group was specified, find those tests
                TestList = Utils.TestConstructor.GetTestNamesByGroup <ITestNode>(Group, new[] { "Gauntlet.SelfTest" });
            }
            else if (Tests.Length > 0)
            {
                // list of tests?
                TestList = Tests.Split(',').Select(S => S.Trim());
            }
            else
            {
                // Ok, run everything!
                TestList = Utils.TestConstructor.GetTestNamesByGroup <ITestNode>(null, new[] { "Gauntlet.SelfTest" });
            }

            // Create the list of tests
            IEnumerable <ITestNode> Nodes = Utils.TestConstructor.ConstructTests <ITestNode, string[]>(TestList, null, new[] { "Gauntlet.SelfTest" });

            // Create the test executor
            var Executor = new TextExecutor();

            TestExecutorOptions Options = new TestExecutorOptions();

            AutoParam.ApplyParamsAndDefaults(Options, this.Params);

            bool AllTestsPassed = Executor.ExecuteTests(Options, Nodes);

            return(AllTestsPassed ? ExitCode.Success : ExitCode.Error_TestFailure);
        }
Example #2
0
        bool ExecuteTests(UnrealTestOptions Options, IEnumerable <ITestNode> TestList)
        {
            // Create the test executor
            var Executor = new TextExecutor();

            try
            {
                bool Result = Executor.ExecuteTests(Options, TestList);

                return(Result);
            }
            catch (System.Exception ex)
            {
                Gauntlet.Log.Info("");
                Gauntlet.Log.Error("{0}.\r\n\r\n{1}", ex.Message, ex.StackTrace);

                return(false);
            }
            finally
            {
                Executor.Dispose();

                DevicePool.Instance.Dispose();

                if (ParseParam("clean"))
                {
                    LogInformation("Deleting temp dir {0}", Options.TempDir);
                    DirectoryInfo Di = new DirectoryInfo(Options.TempDir);
                    if (Di.Exists)
                    {
                        Di.Delete(true);
                    }
                }

                GC.Collect();
            }
        }