You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb None ========================== MAJOR FEATURES + CHANGES ========================== Change 3011102 on 2016/06/13 by Steve.Cano After taking a screenshot using glReadPixels, transfer the data to the target buffer from bottom row up to fix the "upside-down" render that OpenGL does. Confirmed with QA (owen.stupka_volt) that this does not appear to be happening on iOS (non-metal devices, inclusion of iOS in write-up was a mistake), verified on an ipod touch 5. Also confirmed that this does not happen on html5, and that Mobile HDR flag does not make a difference in function. #jira UE-26421 #ue4 #android Change 3015801 on 2016/06/16 by Dmitriy.Dyomin Probbably fix for UE-30878, was not able to repro an actual crash(FFoliageInstanceBaseCache::AddInstanceBaseId). Added even more logging in case fix does not work. #jira UE-30878 Change 3015903 on 2016/06/16 by Dmitriy.Dyomin Fixed: Levels window has Refresh/UI issues when World Composition is active #jira UE-26160 Change 3018352 on 2016/06/17 by Chris.Babcock Handle Android media prepare failure (URL without internet for example) #jira UE-32029 #ue4 #android Change 3026387 on 2016/06/24 by Jack.Porter Remove FFuncTestManager warning about PIE when running on a standalone game binary Change 3026398 on 2016/06/24 by Jack.Porter Prevent FSocketBSD::Recv returning false on SE_EWOULDBLOCK Change 3027553 on 2016/06/25 by Niklas.Smedberg OpenGL: Made some block size calculation work for arbitrary block sizes (e.g. not pow-of-two). Change 3027554 on 2016/06/25 by Niklas.Smedberg Metal: copyFromTexture now gets block-aligned size parameter (e.g. used for texture streaming) Change 3028061 on 2016/06/26 by Jack.Porter Fixed a problem where newly discovered instances were not added to an existing session in the Session Browser. Fixed a problem where selecting an instance in a session with multiple instances didn't deselect the previously selected instance correctly. Change 3029220 on 2016/06/27 by Steve.Cano Change Android Tilt values to use GetRotationMatrix/GetOrientation logic, same as java-side android would use, and adjust slightly to match as closely as possible to iOS values for tilt. There is drift and some differences in the "Y" value but the same sort of inconsistencies are also seen on iOS. #jira UE-6135 #ue4 #android Change3030420on 2016/06/28 by Jack.Porter Fix crash with RenderOutputValidation when running with cooked content Change 3030426 on 2016/06/28 by Jack.Porter Fix to CL 3026398 - make FSocketBSD(IPv6)::Recv(From) return false when recv returns 0. A return value of 0 indicates the connection was shutdown in an orderly manner. Change 3030973 on 2016/06/28 by Steve.Cano Added a landscape downloader background along with the options to change it from within Android settings #ue4 #android #jira UE-32318 Change 3031757 on 2016/06/28 by Chris.Babcock Remove unused methods from AndroidJNI header #ue4 #android Change 3032387 on 2016/06/29 by Allan.Bentham Rename android es31+aep -> glesdeferred. Change 3032711 on 2016/06/29 by Allan.Bentham Rename GLSL_310_ES_EXT shader define: ES31_AEP_PROFILE -> ESDEFERRED_PROFILE bumped UE_SHADER_GLSL_310_ES_EXT_VER version number. Change 3033698 on 2016/06/29 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3034210 on 2016/06/30 by Steve.Cano Added a new AndroidRuntimeSettings variable that allows creation of installers for both Windows and Mac/Linux if set to true. #jira UE-32302 #ue4 #android Change 3034530 on 2016/06/30 by Chris.Babcock Rename FManifestReader to FAndroidFileManifestReader in AndroidFile #jira UE-32679 #ue4 #android Change 3034612 on 2016/06/30 by Steve.Cano Change Alpha from being set to a range of 0-255 to being in a range of 0-1 (which is the correct range of values) #jira UE-25325 #ue4 #android Change 3034679 on 2016/06/30 by Chris.Babcock Fix tooltip (.command for mac, not .sh) #jira UE-32302 #ue4 #android Change 3038881 on 2016/07/05 by Jack.Porter Package and launch on multiple Android devices simultaneously using the -Device=xxxxxxx+yyyyyyyy+zzzzzzzz format generated by a Project Launcher profile when you select multiple devices #jira UEMOB-115 Change 3039240 on 2016/07/06 by Jack.Porter TcpMessageTransport - connection-based message bus transport. #jira UEMOB-112 #jira UEMOB-113 Change 3039252 on 2016/07/06 by Jack.Porter Enable messaging and session services and functional testing on Android when launched with -messaging Android device detection module support for adding port forwarding and connection announcement for TcpMessageTransport #jira UEMOB-112 #jira UEMOB-113 Change 3039264 on 2016/07/06 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3040041 on 2016/07/06 by Chris.Babcock Pass proper value to script generator functions #jira UE-32861 #ue4 #android Change 3040890 on 2016/07/07 by Allan.Bentham Fix shadow crash #jira UE-32884 Change 3041458 on 2016/07/07 by Peter.Sauerbrei fix for IOS launch on failures Change 3041542 on 2016/07/07 by Peter.Sauerbrei better fix for the multi-device deployment issue Change 3041774 on 2016/07/07 by Steve.Cano Fixing crash that occurs when a games app id for Google Play is set before configuring the apk packaging. Also validating the value that is inserted and using it to override any values that have been hand-inserted into the GooglePlayAppID.xml #jira UE-16992 #android #ue4 Change 3042222 on 2016/07/08 by Dmitriy.Dyomin Mobile packaging scenarious Added a wizard for creating launcher profiles (Android & IOS) for scenario: Minimal App + Downloadable content Added Archive step to launcher profiles to be able to store build product into specified directory Changes to a cooker to be able to pack DLC based with a different flavor to a release App Changes to DLC packaging to be able to build streaming data without chunking pak files #jira UEMOB-119 Change3042244on 2016/07/08 by Dmitriy.Dyomin Fixed crash in FTcpMessageTransportConnection::Stop Change 3042270 on 2016/07/08 by Dmitriy.Dyomin GitHub #2320 : [ULevelStreamingKismet] Load Level Instance, Enables UE4 Users to create multiple transformed instances of a .umap without having to include in persistent level's list ? Rama contributed by: EverNewJoy #jira UE-29867 Change 3042449 on 2016/07/08 by Dmitriy.Dyomin Fixing Mac Editor build erros from CL# 3042222 Change 3042480 on 2016/07/08 by Allan.Bentham Add ES3.1 profile & compiler_glsl_es3_1 to shaders. Change 3042481 on 2016/07/08 by Allan.Bentham hlslcc - ES3.1 changes. set ES3.1 version number to 310 Do not use ES2 keywords for ES3.1. Generate Layout Locations for ES3.1 bump version. Change 3042483 on 2016/07/08 by Allan.Bentham Add mobile ES3.1 support. Recreates EGL and ES3.1 context during PlatformInitOpenGL if ES3.1 is required. Change 3042485 on 2016/07/08 by Allan.Bentham Undo android XGE change. Change 3042506 on 2016/07/08 by Dmitriy.Dyomin One more compile fix from CL# 3042222 Change 3044173 on 2016/07/10 by Dmitriy.Dyomin UAT: Added support for building target platforms with multiple cook flavors ex: -targetplatform=Android -cookflavor=ETC1+ETC2 Change 3044213 on 2016/07/11 by Dmitriy.Dyomin Fixed: Can't stream in a level whose name is a substring of another streaming level #jira UE-32999 Change 3044221 on 2016/07/11 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3044815 on 2016/07/11 by Allan.Bentham Corrected NAME_GLSL_ES3_1_ANDROID format string. Change 3046911 on 2016/07/12 by Chris.Babcock Add handling of OnTextChanged for virtual keyboard input on Android #jira UE-32348 #ue4 #android Change 3046958 on 2016/07/12 by Chris.Babcock Rename some functions with Error in the name to prevent false coloring in the logs #jira UE-30541 #ue4 #android Change 3047169 on 2016/07/12 by Chris.Babcock Return player ID and handle auth token for Google Play Games on Android (contributed by gameDNAstudio) #jira UE-30610 #pr #2372 #ue4 #android Change 3047406 on 2016/07/12 by Jack.Porter Add missing import to GameActivity.java Change 3047442 on 2016/07/13 by Dmitriy.Dyomin Added: Mobile custom post-process Limitations: can fetch only from PostProcessInput0 (SceneColor) other scene textures are not supported. Does not support "Replacing the Tonemapper" blendable location. #jira UEMOB-147 Change 3047466 on 2016/07/13 by Dmitriy.Dyomin Disabled engine crash handler on Android, system crash handler works more reliably across different os versions/devices Change 3047746 on 2016/07/13 by Jack.Porter Rename FBasePassFowardDynamicPointLightInfo Change 3047778 on 2016/07/13 by Jack.Porter Missing file for rename FBasePassFowardDynamicPointLightInfo Change 3047788 on 2016/07/13 by Allan.Bentham Fix incorrect TargetPlatformDescriptor string generation. Change 3047790 on 2016/07/13 by Allan.Bentham Fixed half3x3 matrix use with ES3.1 glsl Fixed couple of interpolator precision mismatch. Fixed ES3.1 support detection issues Change 3047816 on 2016/07/13 by Allan.Bentham Remove AndroidGL4 remnants. Change 3048926 on 2016/07/13 by Chris.Babcock Added detection of Amazon Fire TV to disable requiring virtual joysticks #ue4 #android Change 3049335 on 2016/07/14 by Dmitriy.Dyomin Fixing UAT crash when packaging project for iOS Change 3049390 on 2016/07/14 by Jack.Porter Disabled error for warning 4819 "The file contains a character that cannot be represented in the current code page (xxx). Save the file in Unicode format to prevent data loss" This is triggered by European characters and copyright symbols in source saved as latin-1 when compiling on non-US windows. Seen often in 3rd party headers, eg nvapi. #code_review: Ben.Marsh Change 3049391 on 2016/07/14 by Jack.Porter Fixed incorrect comment order in CL 3049390 Change 3049545 on 2016/07/14 by Dmitriy.Dyomin Reworking some code from CL#3047442 to make static analizer happy Change 3049626 on 2016/07/14 by Allan.Bentham Automatic CSM shader toggling #jira UE-27429 Change 3051574 on 2016/07/15 by Jack.Porter Support for lighting channels on Mobile - Multiple directional lights are supported in different channels but primitives are only affected by the directional light in the first channel they have set - CSM shadows from stationary or movable directional lights correctly follow their lighting channels - No channel limitations for dynamic point lights Notes: Removed mobile-specific directional light shadowing fields from View uniform buffer and mobile no longers uses SimpleDirectionalLight. Separate uniform buffers for mobile directional light are generated for each lighting channel. CSM culling information is now stored in FViewInfo and not per FVisibleLightViewInfo as the visibility bits are per view. #code_review Daniel.Wright #jira UEMOB-110 Change 3051699 on 2016/07/15 by Steve.Cano Preserve the original, pre-transformed input vertices for Slate shaders, which is required to properly do anti-aliasing (the ViewProjection-transformed values were causing the lines to not be drawn). #jira UE-20320 #ue4 #android Change 3051744 on 2016/07/15 by Chris.Babcock Fix Android Vulkan include path checks (contributed by kodomastro) #jira UE-33311 #PR #2602 #ue4 #android Change 3052023 on 2016/07/15 by Chris.Babcock Fix shadowed variables Change 3052110 on 2016/07/15 by Chris.Babcock Compile fixes for light channel support on mobile - missing template - accessor function for MobileDirectionalLights from scene Change 3052242 on 2016/07/15 by Chris.Babcock Compile fixes for light channel support on mobile - removed dependency on C++14 feature Change 3052730 on 2016/07/16 by Dmitriy.Dyomin Win32 build fix Change 3053041 on 2016/07/17 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3053054 on 2016/07/17 by Jack.Porter Changed use of old function ShouldUseDeferredRenderer() to new GetShadingPath() Change 3053055 on 2016/07/17 by Jack.Porter Fixed local variable aliasing in unity build Change 3053206 on 2016/07/18 by Jack.Porter Support ExecuteJavascript on iOS and Android Expose ExecuteJavascript to widget blueprint Fix ExecuteJavascript unicode string support on desktop platforms #jira UEMOB-152 Change 3053323 on 2016/07/18 by Dmitriy.Dyomin Added: Ability to set thread affinity for a device in Device Profiles (ex: +CVars=android.SetThreadAffinity=RT 0x02 GT 0x01) #jira UEMOB-107 Change 3053723 on 2016/07/18 by Jack.Porter Fix for UnrealTournamentProto.Automation.cs build errors Change 3055090 on 2016/07/19 by Dmitriy.Dyomin Junk OnlineBlueprintSupport module binaries [CL 3056789 by Jack Porter in Main branch]
1077 lines
33 KiB
C#
1077 lines
33 KiB
C#
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading;
|
|
using System.Reflection;
|
|
using System.Linq;
|
|
using System.Net.NetworkInformation;
|
|
using System.Collections;
|
|
using AutomationTool;
|
|
using UnrealBuildTool;
|
|
|
|
/// <summary>
|
|
/// Helper command to run a game.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Uses the following command line params:
|
|
/// -cooked
|
|
/// -cookonthefly
|
|
/// -dedicatedserver
|
|
/// -win32
|
|
/// -noclient
|
|
/// -logwindow
|
|
/// </remarks>
|
|
public partial class Project : CommandUtils
|
|
{
|
|
#region Fields
|
|
|
|
/// <summary>
|
|
/// Thread used to read client log file.
|
|
/// </summary>
|
|
private static Thread ClientLogReaderThread = null;
|
|
|
|
/// <summary>
|
|
/// Process for the server, can be set by the cook command when a cook on the fly server is used
|
|
/// </summary>
|
|
public static ProcessResult ServerProcess;
|
|
|
|
#endregion
|
|
|
|
#region Run Command
|
|
|
|
// debug commands for the engine to crash
|
|
public static string[] CrashCommands =
|
|
{
|
|
"crash",
|
|
"CHECK",
|
|
"GPF",
|
|
"ASSERT",
|
|
"ENSURE",
|
|
"RENDERCRASH",
|
|
"RENDERCHECK",
|
|
"RENDERGPF",
|
|
"THREADCRASH",
|
|
"THREADCHECK",
|
|
"THREADGPF",
|
|
};
|
|
|
|
/// <summary>
|
|
/// For not-installed runs, returns a temp log folder to make sure it doesn't fall into sandbox paths
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private static string GetLogFolderOutsideOfSandbox()
|
|
{
|
|
return GlobalCommandLine.Installed ?
|
|
CmdEnv.LogFolder :
|
|
CombinePaths(Path.GetTempPath(), CommandUtils.EscapePath(CmdEnv.LocalRoot), "Logs");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fot not-installed runs, copies all logs from the temp log folder back to the UAT log folder.
|
|
/// </summary>
|
|
private static void CopyLogsBackToLogFolder()
|
|
{
|
|
if (!GlobalCommandLine.Installed)
|
|
{
|
|
var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox();
|
|
var TempLogFiles = FindFiles_NoExceptions("*", false, LogFolderOutsideOfSandbox);
|
|
foreach (var LogFilename in TempLogFiles)
|
|
{
|
|
var DestFilename = CombinePaths(CmdEnv.LogFolder, Path.GetFileName(LogFilename));
|
|
CopyFile_NoExceptions(LogFilename, DestFilename);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void Run(ProjectParams Params)
|
|
{
|
|
Params.ValidateAndLog();
|
|
if (!Params.Run)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Log("********** RUN COMMAND STARTED **********");
|
|
|
|
var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox();
|
|
if (!GlobalCommandLine.Installed && ServerProcess == null)
|
|
{
|
|
// In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed
|
|
DeleteDirectory(LogFolderOutsideOfSandbox);
|
|
CreateDirectory(LogFolderOutsideOfSandbox);
|
|
}
|
|
var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log");
|
|
var ClientLogFile = CombinePaths(LogFolderOutsideOfSandbox, Params.EditorTest ? "Editor.log" : "Client.log");
|
|
|
|
try
|
|
{
|
|
RunInternal(Params, ServerLogFile, ClientLogFile);
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
CopyLogsBackToLogFolder();
|
|
}
|
|
|
|
Log("********** RUN COMMAND COMPLETED **********");
|
|
}
|
|
|
|
private static void RunInternal(ProjectParams Params, string ServerLogFile, string ClientLogFile)
|
|
{
|
|
// Setup server process if required.
|
|
if (Params.DedicatedServer && !Params.SkipServer)
|
|
{
|
|
if (Params.ServerTargetPlatforms.Count > 0)
|
|
{
|
|
TargetPlatformDescriptor ServerPlatformDesc = Params.ServerTargetPlatforms[0];
|
|
ServerProcess = RunDedicatedServer(Params, ServerLogFile, Params.RunCommandline);
|
|
// With dedicated server, the client connects to local host to load a map.
|
|
if (ServerPlatformDesc.Type == UnrealTargetPlatform.Linux)
|
|
{
|
|
Params.MapToRun = Params.ServerDeviceAddress;
|
|
}
|
|
else
|
|
{
|
|
Params.MapToRun = "127.0.0.1";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new AutomationException("Failed to run, server target platform not specified");
|
|
}
|
|
}
|
|
else if (Params.FileServer && !Params.SkipServer)
|
|
{
|
|
ServerProcess = RunFileServer(Params, ServerLogFile, Params.RunCommandline);
|
|
}
|
|
|
|
if (ServerProcess != null)
|
|
{
|
|
Log("Waiting a few seconds for the server to start...");
|
|
Thread.Sleep(5000);
|
|
}
|
|
|
|
if (!Params.NoClient)
|
|
{
|
|
Log("Starting Client....");
|
|
|
|
var SC = CreateDeploymentContext(Params, false);
|
|
|
|
ERunOptions ClientRunFlags;
|
|
string ClientApp;
|
|
string ClientCmdLine;
|
|
SetupClientParams(SC, Params, ClientLogFile, out ClientRunFlags, out ClientApp, out ClientCmdLine);
|
|
|
|
// Run the client.
|
|
if (ServerProcess != null)
|
|
{
|
|
RunClientWithServer(SC, ServerLogFile, ServerProcess, ClientApp, ClientCmdLine, ClientRunFlags, ClientLogFile, Params);
|
|
}
|
|
else
|
|
{
|
|
RunStandaloneClient(SC, ClientLogFile, ClientRunFlags, ClientApp, ClientCmdLine, Params);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Client
|
|
|
|
private static void RunStandaloneClient(List<DeploymentContext> DeployContextList, string ClientLogFile, ERunOptions ClientRunFlags, string ClientApp, string ClientCmdLine, ProjectParams Params)
|
|
{
|
|
if (Params.Unattended)
|
|
{
|
|
string LookFor = "Bringing up level for play took";
|
|
bool bCommandlet = false;
|
|
|
|
if (Params.RunAutomationTest != "")
|
|
{
|
|
LookFor = "Automation Test Succeeded";
|
|
}
|
|
else if (Params.RunAutomationTests)
|
|
{
|
|
LookFor = "Automation Test Queue Empty";
|
|
}
|
|
else if (Params.EditorTest)
|
|
{
|
|
LookFor = "Asset discovery search completed in";
|
|
}
|
|
// If running a commandlet, just detect a normal exit
|
|
else if (ClientCmdLine.IndexOf("-run=", StringComparison.InvariantCultureIgnoreCase) >= 0)
|
|
{
|
|
LookFor = "Game engine shut down";
|
|
bCommandlet = true;
|
|
}
|
|
|
|
{
|
|
|
|
string AllClientOutput = "";
|
|
int LastAutoFailIndex = -1;
|
|
ProcessResult ClientProcess = null;
|
|
FileStream ClientProcessLog = null;
|
|
StreamReader ClientLogReader = null;
|
|
Log("Starting Client for unattended test....");
|
|
ClientProcess = Run(ClientApp, ClientCmdLine + " -FORCELOGFLUSH -testexit=\"" + LookFor + "\"", null, ClientRunFlags | ERunOptions.NoWaitForExit);
|
|
while (!FileExists(ClientLogFile) && !ClientProcess.HasExited)
|
|
{
|
|
Log("Waiting for client logging process to start...{0}", ClientLogFile);
|
|
Thread.Sleep(2000);
|
|
}
|
|
if (FileExists(ClientLogFile))
|
|
{
|
|
Thread.Sleep(2000);
|
|
Log("Client logging process started...{0}", ClientLogFile);
|
|
ClientProcessLog = File.Open(ClientLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
|
ClientLogReader = new StreamReader(ClientProcessLog);
|
|
}
|
|
if (ClientLogReader == null)
|
|
{
|
|
throw new AutomationException("Client exited without creating a log file.");
|
|
}
|
|
bool bKeepReading = true;
|
|
bool WelcomedCorrectly = false;
|
|
bool bClientExited = false;
|
|
DateTime ExitTime = DateTime.UtcNow;
|
|
|
|
while (bKeepReading)
|
|
{
|
|
if (!bClientExited && ClientProcess.HasExited)
|
|
{
|
|
ExitTime = DateTime.UtcNow;
|
|
bClientExited = true;
|
|
}
|
|
string ClientOutput = ClientLogReader.ReadToEnd();
|
|
if (!String.IsNullOrEmpty(ClientOutput))
|
|
{
|
|
if (bClientExited)
|
|
{
|
|
ExitTime = DateTime.UtcNow; // as long as it is spewing, we reset the timer
|
|
}
|
|
AllClientOutput += ClientOutput;
|
|
Console.Write(ClientOutput);
|
|
|
|
if (AllClientOutput.LastIndexOf(LookFor) > AllClientOutput.IndexOf(LookFor))
|
|
{
|
|
WelcomedCorrectly = true;
|
|
Log("Test complete...");
|
|
bKeepReading = false;
|
|
}
|
|
else if (Params.RunAutomationTests)
|
|
{
|
|
int FailIndex = AllClientOutput.LastIndexOf("Automation Test Failed");
|
|
int ParenIndex = AllClientOutput.LastIndexOf(")");
|
|
if (FailIndex >= 0 && ParenIndex > FailIndex && FailIndex > LastAutoFailIndex)
|
|
{
|
|
string Tail = AllClientOutput.Substring(FailIndex);
|
|
int CloseParenIndex = Tail.IndexOf(")");
|
|
int OpenParenIndex = Tail.IndexOf("(");
|
|
string Test = "";
|
|
if (OpenParenIndex >= 0 && CloseParenIndex > OpenParenIndex)
|
|
{
|
|
Test = Tail.Substring(OpenParenIndex + 1, CloseParenIndex - OpenParenIndex - 1);
|
|
LogError("Automated test failed ({0}).", Test);
|
|
LastAutoFailIndex = FailIndex;
|
|
}
|
|
}
|
|
}
|
|
// Detect commandlet failure
|
|
else if (bCommandlet)
|
|
{
|
|
const string ResultLog = "Commandlet->Main return this error code: ";
|
|
|
|
int ResultStart = AllClientOutput.LastIndexOf(ResultLog);
|
|
int ResultValIdx = ResultStart + ResultLog.Length;
|
|
|
|
if (ResultStart >= 0 && ResultValIdx < AllClientOutput.Length &&
|
|
AllClientOutput.Substring(ResultValIdx, 1) == "1")
|
|
{
|
|
// Parse the full commandlet warning/error summary
|
|
string FullSummary = "";
|
|
int SummaryStart = AllClientOutput.LastIndexOf("Warning/Error Summary");
|
|
|
|
if (SummaryStart >= 0 && SummaryStart < ResultStart)
|
|
{
|
|
FullSummary = AllClientOutput.Substring(SummaryStart, ResultStart - SummaryStart);
|
|
}
|
|
|
|
|
|
if (FullSummary.Length > 0)
|
|
{
|
|
LogError("Commandlet failed, summary:" + Environment.NewLine +
|
|
FullSummary);
|
|
}
|
|
else
|
|
{
|
|
LogError("Commandlet failed.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (bClientExited && (DateTime.UtcNow - ExitTime).TotalSeconds > 30)
|
|
{
|
|
Log("Client exited and has been quiet for 30 seconds...exiting");
|
|
bKeepReading = false;
|
|
}
|
|
}
|
|
if (ClientProcess != null && !ClientProcess.HasExited)
|
|
{
|
|
Log("Client is supposed to exit, lets wait a while for it to exit naturally...");
|
|
for (int i = 0; i < 120 && !ClientProcess.HasExited; i++)
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
if (ClientProcess != null && !ClientProcess.HasExited)
|
|
{
|
|
Log("Stopping client...");
|
|
ClientProcess.StopProcess();
|
|
Thread.Sleep(10000);
|
|
}
|
|
while (ClientLogReader != null && !ClientLogReader.EndOfStream)
|
|
{
|
|
string ClientOutput = ClientLogReader.ReadToEnd();
|
|
if (!String.IsNullOrEmpty(ClientOutput))
|
|
{
|
|
Console.Write(ClientOutput);
|
|
}
|
|
}
|
|
|
|
if (!WelcomedCorrectly)
|
|
{
|
|
throw new AutomationException("Client exited before we asked it to.");
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var SC = DeployContextList[0];
|
|
ProcessResult ClientProcess = SC.StageTargetPlatform.RunClient(ClientRunFlags, ClientApp, ClientCmdLine, Params);
|
|
if (ClientProcess != null)
|
|
{
|
|
// If the client runs without StdOut redirect we're going to read the log output directly from log file on
|
|
// a separate thread.
|
|
if ((ClientRunFlags & ERunOptions.NoStdOutRedirect) == ERunOptions.NoStdOutRedirect)
|
|
{
|
|
ClientLogReaderThread = new System.Threading.Thread(ClientLogReaderProc);
|
|
ClientLogReaderThread.Start(new object[] { ClientLogFile, ClientProcess });
|
|
}
|
|
|
|
do
|
|
{
|
|
Thread.Sleep(100);
|
|
}
|
|
while (ClientProcess.HasExited == false);
|
|
|
|
SC.StageTargetPlatform.PostRunClient(ClientProcess, Params);
|
|
|
|
// any non-zero exit code should propagate an exception. The Virtual function above may have
|
|
// already thrown a more specific exception or given a more specific ErrorCode, but this catches the rest.
|
|
if (ClientProcess.ExitCode != 0)
|
|
{
|
|
throw new AutomationException("Client exited with error code: " + ClientProcess.ExitCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void RunClientWithServer(List<DeploymentContext> DeployContextList, string ServerLogFile, ProcessResult ServerProcess, string ClientApp, string ClientCmdLine, ERunOptions ClientRunFlags, string ClientLogFile, ProjectParams Params)
|
|
{
|
|
ProcessResult ClientProcess = null;
|
|
var OtherClients = new List<ProcessResult>();
|
|
|
|
bool WelcomedCorrectly = false;
|
|
int NumClients = Params.NumClients;
|
|
string AllClientOutput = "";
|
|
int LastAutoFailIndex = -1;
|
|
|
|
if (Params.Unattended)
|
|
{
|
|
string LookFor = "Bringing up level for play took";
|
|
if (Params.DedicatedServer)
|
|
{
|
|
LookFor = "Welcomed by server";
|
|
}
|
|
else if (Params.RunAutomationTest != "")
|
|
{
|
|
LookFor = "Automation Test Succeeded";
|
|
}
|
|
else if (Params.RunAutomationTests)
|
|
{
|
|
LookFor = "Automation Test Queue Empty";
|
|
}
|
|
{
|
|
while (!FileExists(ServerLogFile) && !ServerProcess.HasExited)
|
|
{
|
|
Log("Waiting for logging process to start...");
|
|
Thread.Sleep(2000);
|
|
}
|
|
Thread.Sleep(1000);
|
|
|
|
string AllServerOutput = "";
|
|
using (FileStream ProcessLog = File.Open(ServerLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
|
{
|
|
StreamReader LogReader = new StreamReader(ProcessLog);
|
|
bool bKeepReading = true;
|
|
|
|
FileStream ClientProcessLog = null;
|
|
StreamReader ClientLogReader = null;
|
|
|
|
// Read until the process has exited.
|
|
while (!ServerProcess.HasExited && bKeepReading)
|
|
{
|
|
while (!LogReader.EndOfStream && bKeepReading && ClientProcess == null)
|
|
{
|
|
string Output = LogReader.ReadToEnd();
|
|
if (!String.IsNullOrEmpty(Output))
|
|
{
|
|
AllServerOutput += Output;
|
|
if (ClientProcess == null &&
|
|
(AllServerOutput.Contains("Game Engine Initialized") || AllServerOutput.Contains("Unreal Network File Server is ready")))
|
|
{
|
|
Log("Starting Client for unattended test....");
|
|
ClientProcess = Run(ClientApp, ClientCmdLine + " -FORCELOGFLUSH -testexit=\"" + LookFor + "\"", null, ClientRunFlags | ERunOptions.NoWaitForExit);
|
|
//@todo no testing is done on these
|
|
if (NumClients > 1 && NumClients < 9)
|
|
{
|
|
for (int i = 1; i < NumClients; i++)
|
|
{
|
|
Log("Starting Extra Client....");
|
|
OtherClients.Add(Run(ClientApp, ClientCmdLine, null, ClientRunFlags | ERunOptions.NoWaitForExit));
|
|
}
|
|
}
|
|
while (!FileExists(ClientLogFile) && !ClientProcess.HasExited)
|
|
{
|
|
Log("Waiting for client logging process to start...{0}", ClientLogFile);
|
|
Thread.Sleep(2000);
|
|
}
|
|
if (!ClientProcess.HasExited)
|
|
{
|
|
Thread.Sleep(2000);
|
|
Log("Client logging process started...{0}", ClientLogFile);
|
|
ClientProcessLog = File.Open(ClientLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
|
ClientLogReader = new StreamReader(ClientProcessLog);
|
|
}
|
|
}
|
|
else if (ClientProcess == null && !ServerProcess.HasExited)
|
|
{
|
|
Log("Waiting for server to start....");
|
|
Thread.Sleep(2000);
|
|
}
|
|
if (ClientProcess != null && ClientProcess.HasExited)
|
|
{
|
|
ServerProcess.StopProcess();
|
|
throw new AutomationException("Client exited before we asked it to.");
|
|
}
|
|
}
|
|
}
|
|
if (ClientLogReader != null)
|
|
{
|
|
if (ClientProcess.HasExited)
|
|
{
|
|
ServerProcess.StopProcess();
|
|
throw new AutomationException("Client exited or closed the log before we asked it to.");
|
|
}
|
|
while (!ClientProcess.HasExited && !ServerProcess.HasExited && bKeepReading)
|
|
{
|
|
while (!ClientLogReader.EndOfStream && bKeepReading && !ServerProcess.HasExited && !ClientProcess.HasExited)
|
|
{
|
|
string ClientOutput = ClientLogReader.ReadToEnd();
|
|
if (!String.IsNullOrEmpty(ClientOutput))
|
|
{
|
|
AllClientOutput += ClientOutput;
|
|
Console.Write(ClientOutput);
|
|
|
|
if (AllClientOutput.LastIndexOf(LookFor) > AllClientOutput.IndexOf(LookFor))
|
|
{
|
|
if (Params.FakeClient)
|
|
{
|
|
Log("Welcomed by server or client loaded, lets wait ten minutes...");
|
|
Thread.Sleep(60000 * 10);
|
|
}
|
|
else
|
|
{
|
|
Log("Welcomed by server or client loaded, lets wait 30 seconds...");
|
|
Thread.Sleep(30000);
|
|
}
|
|
WelcomedCorrectly = true;
|
|
bKeepReading = false;
|
|
}
|
|
else if (Params.RunAutomationTests)
|
|
{
|
|
int FailIndex = AllClientOutput.LastIndexOf("Automation Test Failed");
|
|
int ParenIndex = AllClientOutput.LastIndexOf(")");
|
|
if (FailIndex >= 0 && ParenIndex > FailIndex && FailIndex > LastAutoFailIndex)
|
|
{
|
|
string Tail = AllClientOutput.Substring(FailIndex);
|
|
int CloseParenIndex = Tail.IndexOf(")");
|
|
int OpenParenIndex = Tail.IndexOf("(");
|
|
string Test = "";
|
|
if (OpenParenIndex >= 0 && CloseParenIndex > OpenParenIndex)
|
|
{
|
|
Test = Tail.Substring(OpenParenIndex + 1, CloseParenIndex - OpenParenIndex - 1);
|
|
LogError("Automated test failed ({0}).", Test);
|
|
LastAutoFailIndex = FailIndex;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
LogFileReaderProcess(ServerLogFile, ServerProcess, (string Output) =>
|
|
{
|
|
bool bKeepReading = true;
|
|
if (ClientProcess == null && !String.IsNullOrEmpty(Output))
|
|
{
|
|
AllClientOutput += Output;
|
|
if (ClientProcess == null && (AllClientOutput.Contains("Game Engine Initialized") || AllClientOutput.Contains("Unreal Network File Server is ready")))
|
|
{
|
|
Log("Starting Client....");
|
|
var SC = DeployContextList[0];
|
|
ClientProcess = SC.StageTargetPlatform.RunClient(ClientRunFlags | ERunOptions.NoWaitForExit, ClientApp, ClientCmdLine, Params);
|
|
// ClientProcess = Run(ClientApp, ClientCmdLine, null, ClientRunFlags | ERunOptions.NoWaitForExit);
|
|
if (NumClients > 1 && NumClients < 9)
|
|
{
|
|
for (int i = 1; i < NumClients; i++)
|
|
{
|
|
Log("Starting Extra Client....");
|
|
ProcessResult NewClient = SC.StageTargetPlatform.RunClient(ClientRunFlags | ERunOptions.NoWaitForExit, ClientApp, ClientCmdLine, Params);
|
|
OtherClients.Add(NewClient);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (ClientProcess == null && !ServerProcess.HasExited)
|
|
{
|
|
Log("Waiting for server to start....");
|
|
Thread.Sleep(2000);
|
|
}
|
|
|
|
if (String.IsNullOrEmpty(Output) == false)
|
|
{
|
|
Console.Write(Output);
|
|
}
|
|
|
|
if (ClientProcess != null && ClientProcess.HasExited)
|
|
{
|
|
|
|
Log("Client exited, stopping server....");
|
|
if (!GlobalCommandLine.NoKill)
|
|
{
|
|
ServerProcess.StopProcess();
|
|
}
|
|
bKeepReading = false;
|
|
}
|
|
|
|
return bKeepReading; // Keep reading
|
|
});
|
|
}
|
|
Log("Server exited....");
|
|
if (ClientProcess != null && !ClientProcess.HasExited)
|
|
{
|
|
ClientProcess.StopProcess();
|
|
}
|
|
foreach (var OtherClient in OtherClients)
|
|
{
|
|
if (OtherClient != null && !OtherClient.HasExited)
|
|
{
|
|
OtherClient.StopProcess();
|
|
}
|
|
}
|
|
if (Params.Unattended)
|
|
{
|
|
if (!WelcomedCorrectly)
|
|
{
|
|
throw new AutomationException("Server or client exited before we asked it to.");
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void SetupClientParams(List<DeploymentContext> DeployContextList, ProjectParams Params, string ClientLogFile, out ERunOptions ClientRunFlags, out string ClientApp, out string ClientCmdLine)
|
|
{
|
|
if (Params.ClientTargetPlatforms.Count == 0)
|
|
{
|
|
throw new AutomationException("No ClientTargetPlatform set for SetupClientParams.");
|
|
}
|
|
|
|
// var DeployContextList = CreateDeploymentContext(Params, false);
|
|
|
|
if (DeployContextList.Count == 0)
|
|
{
|
|
throw new AutomationException("No DeployContextList for SetupClientParams.");
|
|
}
|
|
|
|
var SC = DeployContextList[0];
|
|
|
|
// Get client app name and command line.
|
|
ClientRunFlags = ERunOptions.AllowSpew | ERunOptions.AppMustExist;
|
|
ClientApp = "";
|
|
ClientCmdLine = "";
|
|
string TempCmdLine = "";
|
|
var PlatformName = Params.ClientTargetPlatforms[0].ToString();
|
|
if (Params.Cook || Params.CookOnTheFly)
|
|
{
|
|
List<string> Exes = SC.StageTargetPlatform.GetExecutableNames(SC, true);
|
|
ClientApp = Exes[0];
|
|
if (SC.StageTargetPlatform.PlatformType != UnrealTargetPlatform.IOS)
|
|
{
|
|
TempCmdLine += SC.ProjectArgForCommandLines + " ";
|
|
}
|
|
TempCmdLine += Params.MapToRun + " ";
|
|
|
|
if (Params.CookOnTheFly || Params.FileServer)
|
|
{
|
|
TempCmdLine += "-filehostip=";
|
|
bool FirstParam = true;
|
|
if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
|
|
{
|
|
NetworkInterface[] Interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
|
foreach (NetworkInterface adapter in Interfaces)
|
|
{
|
|
if (adapter.NetworkInterfaceType != NetworkInterfaceType.Loopback)
|
|
{
|
|
IPInterfaceProperties IP = adapter.GetIPProperties();
|
|
for (int Index = 0; Index < IP.UnicastAddresses.Count; ++Index)
|
|
{
|
|
if (IP.UnicastAddresses[Index].IsDnsEligible && IP.UnicastAddresses[Index].Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
|
{
|
|
if (!IsNullOrEmpty(Params.Port))
|
|
{
|
|
foreach (var Port in Params.Port)
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
string[] PortProtocol = Port.Split(new char[] { ':' });
|
|
if (PortProtocol.Length > 1)
|
|
{
|
|
TempCmdLine += String.Format("{0}://{1}:{2}", PortProtocol[0], IP.UnicastAddresses[Index].Address.ToString(), PortProtocol[1]);
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += IP.UnicastAddresses[Index].Address.ToString();
|
|
TempCmdLine += ":";
|
|
TempCmdLine += Params.Port;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
|
|
// use default port
|
|
TempCmdLine += IP.UnicastAddresses[Index].Address.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
NetworkInterface[] Interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
|
foreach (NetworkInterface adapter in Interfaces)
|
|
{
|
|
if (adapter.OperationalStatus == OperationalStatus.Up)
|
|
{
|
|
IPInterfaceProperties IP = adapter.GetIPProperties();
|
|
for (int Index = 0; Index < IP.UnicastAddresses.Count; ++Index)
|
|
{
|
|
if (IP.UnicastAddresses[Index].IsDnsEligible)
|
|
{
|
|
if (!IsNullOrEmpty(Params.Port))
|
|
{
|
|
foreach (var Port in Params.Port)
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
string[] PortProtocol = Port.Split(new char[] { ':' });
|
|
if (PortProtocol.Length > 1)
|
|
{
|
|
TempCmdLine += String.Format("{0}://{1}:{2}", PortProtocol[0], IP.UnicastAddresses[Index].Address.ToString(), PortProtocol[1]);
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += IP.UnicastAddresses[Index].Address.ToString();
|
|
TempCmdLine += ":";
|
|
TempCmdLine += Params.Port;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
|
|
// use default port
|
|
TempCmdLine += IP.UnicastAddresses[Index].Address.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
const string LocalHost = "127.0.0.1";
|
|
|
|
if (!IsNullOrEmpty(Params.Port))
|
|
{
|
|
foreach (var Port in Params.Port)
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
string[] PortProtocol = Port.Split(new char[] { ':' });
|
|
if (PortProtocol.Length > 1)
|
|
{
|
|
TempCmdLine += String.Format("{0}://{1}:{2}", PortProtocol[0], LocalHost, PortProtocol[1]);
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += LocalHost;
|
|
TempCmdLine += ":";
|
|
TempCmdLine += Params.Port;
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!FirstParam)
|
|
{
|
|
TempCmdLine += "+";
|
|
}
|
|
FirstParam = false;
|
|
|
|
// use default port
|
|
TempCmdLine += LocalHost;
|
|
}
|
|
TempCmdLine += " ";
|
|
|
|
if (Params.CookOnTheFlyStreaming)
|
|
{
|
|
TempCmdLine += "-streaming ";
|
|
}
|
|
else if (SC.StageTargetPlatform.PlatformType != UnrealTargetPlatform.IOS)
|
|
{
|
|
// per josh, allowcaching is deprecated/doesn't make sense for iOS.
|
|
TempCmdLine += "-allowcaching ";
|
|
}
|
|
}
|
|
else if (Params.UsePak(SC.StageTargetPlatform))
|
|
{
|
|
if (Params.SignedPak)
|
|
{
|
|
TempCmdLine += "-signedpak ";
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += "-pak ";
|
|
}
|
|
}
|
|
else if (!Params.Stage)
|
|
{
|
|
var SandboxPath = CombinePaths(SC.RuntimeProjectRootDir, "Saved", "Cooked", SC.CookPlatform);
|
|
if (!SC.StageTargetPlatform.LaunchViaUFE)
|
|
{
|
|
TempCmdLine += "-sandbox=" + CommandUtils.MakePathSafeToUseWithCommandLine(SandboxPath) + " ";
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += "-sandbox=\'" + SandboxPath + "\' ";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ClientApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries", PlatformName, "UE4Editor.exe");
|
|
TempCmdLine += SC.ProjectArgForCommandLines + " ";
|
|
if (!Params.EditorTest)
|
|
{
|
|
TempCmdLine += "-game " + Params.MapToRun + " ";
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += Params.MapToRun + " ";
|
|
}
|
|
}
|
|
if (Params.LogWindow)
|
|
{
|
|
// Without NoStdOutRedirect '-log' doesn't log anything to the window
|
|
ClientRunFlags |= ERunOptions.NoStdOutRedirect;
|
|
TempCmdLine += "-log ";
|
|
}
|
|
else
|
|
{
|
|
TempCmdLine += "-stdout ";
|
|
}
|
|
if (Params.Unattended)
|
|
{
|
|
TempCmdLine += "-unattended ";
|
|
}
|
|
if (IsBuildMachine || Params.Unattended)
|
|
{
|
|
TempCmdLine += "-buildmachine ";
|
|
}
|
|
if (Params.CrashIndex > 0)
|
|
{
|
|
int RealIndex = Params.CrashIndex - 1;
|
|
if (RealIndex < 0 || RealIndex >= CrashCommands.Count())
|
|
{
|
|
throw new AutomationException("CrashIndex {0} is out of range...max={1}", Params.CrashIndex, CrashCommands.Count());
|
|
}
|
|
TempCmdLine += String.Format("-execcmds=\"debug {0}\" ", CrashCommands[RealIndex]);
|
|
}
|
|
else if (Params.RunAutomationTest != "")
|
|
{
|
|
TempCmdLine += "-execcmds=\"automation list;runtests " + Params.RunAutomationTest + "\" ";
|
|
}
|
|
else if (Params.RunAutomationTests)
|
|
{
|
|
TempCmdLine += "-execcmds=\"automation list;runall\" ";
|
|
}
|
|
if (SC.StageTargetPlatform.UseAbsLog)
|
|
{
|
|
TempCmdLine += "-abslog=" + CommandUtils.MakePathSafeToUseWithCommandLine(ClientLogFile) + " ";
|
|
}
|
|
if (SC.StageTargetPlatform.PlatformType != UnrealTargetPlatform.IOS)
|
|
{
|
|
TempCmdLine += "-Messaging -nomcp -Windowed ";
|
|
}
|
|
else
|
|
{
|
|
// skip arguments which don't make sense for iOS
|
|
TempCmdLine += "-Messaging -nomcp ";
|
|
}
|
|
if (Params.NullRHI && SC.StageTargetPlatform.PlatformType != UnrealTargetPlatform.Mac) // all macs have GPUs, and currently the mac dies with nullrhi
|
|
{
|
|
TempCmdLine += "-nullrhi ";
|
|
}
|
|
if (Params.Deploy && !Params.CookOnTheFly && (SC.StageTargetPlatform.PlatformType == UnrealTargetPlatform.PS4))
|
|
{
|
|
TempCmdLine += "-deployedbuild ";
|
|
}
|
|
|
|
TempCmdLine += "-CrashForUAT ";
|
|
TempCmdLine += Params.RunCommandline;
|
|
|
|
// todo: move this into the platform
|
|
if (SC.StageTargetPlatform.LaunchViaUFE)
|
|
{
|
|
ClientCmdLine = "-run=Launch ";
|
|
ClientCmdLine += "-Device=" + Params.Devices[0] + " ";
|
|
ClientCmdLine += "-Exe=\"" + ClientApp + "\" ";
|
|
ClientCmdLine += "-Targetplatform=" + Params.ClientTargetPlatforms[0].ToString() + " ";
|
|
ClientCmdLine += "-Params=\"" + TempCmdLine + "\"";
|
|
ClientApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/Win64/UnrealFrontend.exe");
|
|
|
|
Log("Launching via UFE:");
|
|
Log("\tClientCmdLine: " + ClientCmdLine + "");
|
|
}
|
|
else
|
|
{
|
|
ClientCmdLine = TempCmdLine;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Client Thread
|
|
|
|
private static void ClientLogReaderProc(object ArgsContainer)
|
|
{
|
|
var Args = ArgsContainer as object[];
|
|
var ClientLogFile = (string)Args[0];
|
|
var ClientProcess = (ProcessResult)Args[1];
|
|
LogFileReaderProcess(ClientLogFile, ClientProcess, (string Output) =>
|
|
{
|
|
if (String.IsNullOrEmpty(Output) == false)
|
|
{
|
|
Log(Output);
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Servers
|
|
|
|
private static ProcessResult RunDedicatedServer(ProjectParams Params, string ServerLogFile, string AdditionalCommandLine)
|
|
{
|
|
ProjectParams ServerParams = new ProjectParams(Params);
|
|
ServerParams.Devices = new ParamList<string>(Params.ServerDevice);
|
|
|
|
if (ServerParams.ServerTargetPlatforms.Count == 0)
|
|
{
|
|
throw new AutomationException("No ServerTargetPlatform set for RunDedicatedServer.");
|
|
}
|
|
|
|
var DeployContextList = CreateDeploymentContext(ServerParams, true);
|
|
|
|
if (DeployContextList.Count == 0)
|
|
{
|
|
throw new AutomationException("No DeployContextList for RunDedicatedServer.");
|
|
}
|
|
|
|
var SC = DeployContextList[0];
|
|
|
|
var ServerApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/Win64/UE4Editor.exe");
|
|
if (ServerParams.Cook)
|
|
{
|
|
List<string> Exes = SC.StageTargetPlatform.GetExecutableNames(SC);
|
|
ServerApp = Exes[0];
|
|
}
|
|
var Args = ServerParams.Cook ? "" : (SC.ProjectArgForCommandLines + " ");
|
|
Console.WriteLine(Params.ServerDeviceAddress);
|
|
TargetPlatformDescriptor ServerPlatformDesc = ServerParams.ServerTargetPlatforms[0];
|
|
if (ServerParams.Cook && ServerPlatformDesc.Type == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress))
|
|
{
|
|
ServerApp = @"C:\Windows\system32\cmd.exe";
|
|
|
|
string plinkPath = CombinePaths(Environment.GetEnvironmentVariable("LINUX_ROOT"), "bin/PLINK.exe ");
|
|
string exePath = CombinePaths(SC.ShortProjectName, "Binaries", ServerPlatformDesc.Type.ToString(), SC.ShortProjectName + "Server");
|
|
if (ServerParams.ServerConfigsToBuild[0] != UnrealTargetConfiguration.Development)
|
|
{
|
|
exePath += "-" + ServerPlatformDesc.Type.ToString() + "-" + ServerParams.ServerConfigsToBuild[0].ToString();
|
|
}
|
|
exePath = CombinePaths("LinuxServer", exePath.ToLower()).Replace("\\", "/");
|
|
Args = String.Format("/k {0} -batch -ssh -t -i {1} {2}@{3} {4} {5} {6} -server -Messaging", plinkPath, ServerParams.DevicePassword, ServerParams.DeviceUsername, ServerParams.ServerDeviceAddress, exePath, Args, ServerParams.MapToRun);
|
|
}
|
|
else
|
|
{
|
|
var Map = ServerParams.MapToRun;
|
|
if (!String.IsNullOrEmpty(ServerParams.AdditionalServerMapParams))
|
|
{
|
|
Map += ServerParams.AdditionalServerMapParams;
|
|
}
|
|
if (Params.FakeClient)
|
|
{
|
|
Map += "?fake";
|
|
}
|
|
Args += String.Format("{0} -server -abslog={1} -unattended -FORCELOGFLUSH -log -Messaging -nomcp", Map, CommandUtils.MakePathSafeToUseWithCommandLine(ServerLogFile));
|
|
}
|
|
|
|
if (ServerParams.UsePak(SC.StageTargetPlatform))
|
|
{
|
|
if (ServerParams.SignedPak)
|
|
{
|
|
Args += " -signedpak";
|
|
}
|
|
else
|
|
{
|
|
Args += " -pak";
|
|
}
|
|
}
|
|
if (IsBuildMachine || Params.Unattended)
|
|
{
|
|
Args += " -buildmachine";
|
|
}
|
|
Args += " -CrashForUAT";
|
|
Args += " " + AdditionalCommandLine;
|
|
|
|
|
|
if (ServerParams.Cook && ServerPlatformDesc.Type == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress))
|
|
{
|
|
Args += String.Format(" 2>&1 > {0}", ServerLogFile);
|
|
}
|
|
|
|
PushDir(Path.GetDirectoryName(ServerApp));
|
|
var Result = Run(ServerApp, Args, null, ERunOptions.AllowSpew | ERunOptions.NoWaitForExit | ERunOptions.AppMustExist | ERunOptions.NoStdOutRedirect);
|
|
PopDir();
|
|
|
|
return Result;
|
|
}
|
|
|
|
private static ProcessResult RunCookOnTheFlyServer(FileReference ProjectName, string ServerLogFile, string TargetPlatform, string AdditionalCommandLine)
|
|
{
|
|
var ServerApp = HostPlatform.Current.GetUE4ExePath("UE4Editor.exe");
|
|
var Args = String.Format("{0} -run=cook -cookonthefly -unattended -CrashForUAT -FORCELOGFLUSH -log",
|
|
CommandUtils.MakePathSafeToUseWithCommandLine(ProjectName.FullName));
|
|
if (!String.IsNullOrEmpty(ServerLogFile))
|
|
{
|
|
Args += " -abslog=" + CommandUtils.MakePathSafeToUseWithCommandLine(ServerLogFile);
|
|
}
|
|
if (IsBuildMachine)
|
|
{
|
|
Args += " -buildmachine";
|
|
}
|
|
Args += " " + AdditionalCommandLine;
|
|
|
|
// Run the server (Without NoStdOutRedirect -log doesn't log anything to the window)
|
|
PushDir(Path.GetDirectoryName(ServerApp));
|
|
var Result = Run(ServerApp, Args, null, ERunOptions.AllowSpew | ERunOptions.NoWaitForExit | ERunOptions.AppMustExist | ERunOptions.NoStdOutRedirect);
|
|
PopDir();
|
|
return Result;
|
|
}
|
|
|
|
private static ProcessResult RunFileServer(ProjectParams Params, string ServerLogFile, string AdditionalCommandLine)
|
|
{
|
|
#if false
|
|
// this section of code would provide UFS with a more accurate file mapping
|
|
var SC = new StagingContext(Params, false);
|
|
CreateStagingManifest(SC);
|
|
MaybeConvertToLowerCase(Params, SC);
|
|
var UnrealFileServerResponseFile = new List<string>();
|
|
|
|
foreach (var Pair in SC.UFSStagingFiles)
|
|
{
|
|
string Src = Pair.Key;
|
|
string Dest = Pair.Value;
|
|
|
|
Dest = CombinePaths(PathSeparator.Slash, SC.UnrealFileServerInternalRoot, Dest);
|
|
|
|
UnrealFileServerResponseFile.Add("\"" + Src + "\" \"" + Dest + "\"");
|
|
}
|
|
|
|
|
|
string UnrealFileServerResponseFileName = CombinePaths(CmdEnv.LogFolder, "UnrealFileServerList.txt");
|
|
File.WriteAllLines(UnrealFileServerResponseFileName, UnrealFileServerResponseFile);
|
|
#endif
|
|
var UnrealFileServerExe = HostPlatform.Current.GetUE4ExePath("UnrealFileServer.exe");
|
|
|
|
Log("Running UnrealFileServer *******");
|
|
var Args = String.Format("{0} -abslog={1} -unattended -CrashForUAT -FORCELOGFLUSH -log {2}",
|
|
CommandUtils.MakePathSafeToUseWithCommandLine(Params.RawProjectPath.FullName),
|
|
CommandUtils.MakePathSafeToUseWithCommandLine(ServerLogFile),
|
|
AdditionalCommandLine);
|
|
if (IsBuildMachine)
|
|
{
|
|
Args += " -buildmachine";
|
|
}
|
|
PushDir(Path.GetDirectoryName(UnrealFileServerExe));
|
|
var Result = Run(UnrealFileServerExe, Args, null, ERunOptions.AllowSpew | ERunOptions.NoWaitForExit | ERunOptions.AppMustExist | ERunOptions.NoStdOutRedirect);
|
|
PopDir();
|
|
return Result;
|
|
}
|
|
|
|
#endregion
|
|
}
|