Esempio n. 1
0
        protected void TestInstallThenRun(UnrealBuildSource Build, UnrealTargetRole ProcessType, ITargetDevice Device, UnrealTargetConfiguration Config, UnrealOptions InOptions = null)
        {
            // create a config based on the passed in params

            UnrealSessionRole Role = new UnrealSessionRole(ProcessType, Device.Platform, Config, InOptions);

            Log.Info("Testing {0}", Role);

            UnrealAppConfig AppConfig = Build.CreateConfiguration(Role);

            if (!CheckResult(AppConfig != null, "Could not create config for {0} {1} with platform {2} from build.", Config, ProcessType, Device))
            {
                MarkComplete();
                return;
            }

            // Install the app on this device
            IAppInstall AppInstall = Device.InstallApplication(AppConfig);

            CheckResult(AppConfig != null, "Could not create AppInstall for {0} {1} with platform {2} from build.", Config, ProcessType, Device);


            DateTime StartTime = DateTime.Now;

            // Run the app and wait for either a timeout or it to exit
            IAppInstance AppProcess = AppInstall.Run();

            while (AppProcess.HasExited == false)
            {
                if ((DateTime.Now - StartTime).TotalSeconds > 60)
                {
                    break;
                }

                Thread.Sleep(1000);
            }

            // Check it didn't exit unexpectedly
            CheckResult(AppProcess.HasExited == false, "Failed to run {0} {1} with platform {2}", Config, ProcessType, Device);

            // but kill it
            AppProcess.Kill();

            // Check that it left behind some artifacts (minimum should be a log)
            int ArtifactCount = new DirectoryInfo(AppProcess.ArtifactPath).GetFiles("*", SearchOption.AllDirectories).Length;

            CheckResult(ArtifactCount > 0, "No artifacts on device!");
        }
        void TestClientPlatform(UnrealTargetPlatform Platform)
        {
            string GameName  = this.ProjectFile.FullName;
            string BuildPath = this.BuildPath;
            string DevKit    = this.DevkitName;

            if (GameName.Equals("OrionGame", StringComparison.OrdinalIgnoreCase) == false)
            {
                Log.Info("Skipping test {0} due to non-Orion project!", this);
                MarkComplete();
                return;
            }

            // create a new build
            UnrealBuildSource Build = new UnrealBuildSource(ProjectFile, this.UnrealPath, UsesSharedBuildType, BuildPath);

            // check it's valid
            if (!CheckResult(Build.BuildCount > 0, "staged build was invalid"))
            {
                MarkComplete();
                return;
            }

            // Create devices to run the client and server
            ITargetDevice ServerDevice = new TargetDeviceWindows("PC Server", Gauntlet.Globals.TempDir);
            ITargetDevice ClientDevice = null;

            if (Platform == UnrealTargetPlatform.PS4)
            {
                //ClientDevice = new TargetDevicePS4(this.PS4Name);
            }
            else
            {
                ClientDevice = new TargetDeviceWindows("PC Client", Gauntlet.Globals.TempDir);
            }

            UnrealAppConfig ServerConfig = Build.CreateConfiguration(new UnrealSessionRole(UnrealTargetRole.Server, ServerDevice.Platform, UnrealTargetConfiguration.Development));
            UnrealAppConfig ClientConfig = Build.CreateConfiguration(new UnrealSessionRole(UnrealTargetRole.Client, ClientDevice.Platform, UnrealTargetConfiguration.Development));

            if (!CheckResult(ServerConfig != null && ServerConfig != null, "Could not create configs!"))
            {
                MarkComplete();
                return;
            }

            ShortSoloOptions Options = new ShortSoloOptions();

            Options.ApplyToConfig(ClientConfig);
            Options.ApplyToConfig(ServerConfig);

            IAppInstall ClientInstall = ClientDevice.InstallApplication(ClientConfig);
            IAppInstall ServerInstall = ServerDevice.InstallApplication(ServerConfig);

            if (!CheckResult(ServerConfig != null && ServerConfig != null, "Could not create configs!"))
            {
                MarkComplete();
                return;
            }

            IAppInstance ClientInstance = ClientInstall.Run();
            IAppInstance ServerInstance = ServerInstall.Run();

            DateTime StartTime        = DateTime.Now;
            bool     RunWasSuccessful = true;

            while (ClientInstance.HasExited == false)
            {
                if ((DateTime.Now - StartTime).TotalSeconds > 800)
                {
                    RunWasSuccessful = false;
                    break;
                }
            }

            ClientInstance.Kill();
            ServerInstance.Kill();

            UnrealLogParser LogParser = new UnrealLogParser(ClientInstance.StdOut);

            UnrealLogParser.CallstackMessage ErrorInfo = LogParser.GetFatalError();
            if (ErrorInfo != null)
            {
                CheckResult(false, "FatalError - {0}", ErrorInfo.Message);
            }

            RunWasSuccessful = LogParser.HasRequestExit();

            CheckResult(RunWasSuccessful, "Failed to run for platform {0}", Platform);
        }