Esempio n. 1
0
        /// <summary>
        /// Called by the test executor to start our test running. After this
        /// Test.Status should return InProgress or greater
        /// </summary>
        /// <returns></returns>
        public override bool StartTest(int Pass, int InNumPasses)
        {
            if (UnrealApp == null)
            {
                throw new AutomationException("Node already has a null UnrealApp, was PrepareUnrealSession or IsReadyToStart called?");
            }

            TConfigClass Config = GetConfiguration();

            CurrentPass = Pass;
            NumPasses   = InNumPasses;

            // Launch the test
            TestInstance = UnrealApp.LaunchSession();

            // track the overall session time
            if (SessionStartTime == DateTime.MinValue)
            {
                SessionStartTime = DateTime.Now;
            }

            if (TestInstance != null)
            {
                // Update these for the executor
                MaxDuration      = Config.MaxDuration;
                UnrealTestResult = TestResult.Invalid;
                MarkTestStarted();
            }

            return(TestInstance != null);
        }
Esempio n. 2
0
        /// <summary>
        /// Called by the test executor to start our test running. After this
        /// Test.Status should return InProgress or greater
        /// </summary>
        /// <returns></returns>
        public override bool StartTest(int Pass, int InNumPasses)
        {
            if (UnrealApp == null)
            {
                throw new AutomationException("Node already has a null UnrealApp, was PrepareUnrealSession or IsReadyToStart called?");
            }

            TConfigClass Config = GetCachedConfiguration();

            CurrentPass = Pass;
            NumPasses   = InNumPasses;

            // Either use the ArtifactName param or name of this test
            string TestFolder = string.IsNullOrEmpty(Context.Options.ArtifactName) ? this.ToString() : Context.Options.ArtifactName;

            if (string.IsNullOrEmpty(Context.Options.ArtifactPostfix) == false)
            {
                TestFolder += "_" + Context.Options.ArtifactPostfix;
            }

            TestFolder = TestFolder.Replace(" ", "_");
            TestFolder = TestFolder.Replace(":", "_");
            TestFolder = TestFolder.Replace("|", "_");
            TestFolder = TestFolder.Replace(",", "");

            ArtifactPath = Path.Combine(Context.Options.LogDir, TestFolder);

            // if doing multiple passes, put each in a subdir
            if (NumPasses > 1)
            {
                ArtifactPath = Path.Combine(ArtifactPath, string.Format("Pass_{0}_of_{1}", CurrentPass, NumPasses));
            }

            // When running with -parallel we could have several identical tests (same test, configurations) in flight so
            // we need unique artifact paths. We also don't overwrite dest directories from the build machine for the same
            // reason of multiple tests for a build. Really though these should use ArtifactPrefix to save to
            // SmokeTest_HighQuality etc
            int  ArtifactNumericPostfix = 0;
            bool ArtifactPathIsTaken    = false;

            do
            {
                string PotentialPath = ArtifactPath;

                if (ArtifactNumericPostfix > 0)
                {
                    PotentialPath = string.Format("{0}_{1}", ArtifactPath, ArtifactNumericPostfix);
                }

                ArtifactPathIsTaken = ReservedArtifcactPaths.Contains(PotentialPath) || (CommandUtils.IsBuildMachine && Directory.Exists(PotentialPath));

                if (ArtifactPathIsTaken)
                {
                    Log.Info("Directory already exists at {0}", PotentialPath);
                    ArtifactNumericPostfix++;
                }
                else
                {
                    ArtifactPath = PotentialPath;
                }
            } while (ArtifactPathIsTaken);

            ReservedArtifcactPaths.Add(ArtifactPath);

            // Launch the test
            TestInstance = UnrealApp.LaunchSession();

            // track the overall session time
            if (SessionStartTime == DateTime.MinValue)
            {
                SessionStartTime = DateTime.Now;
            }

            if (TestInstance != null)
            {
                // Update these for the executor
                MaxDuration      = Config.MaxDuration;
                UnrealTestResult = TestResult.Invalid;
                MarkTestStarted();
            }

            return(TestInstance != null);
        }