Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Gauntlet/Platform/Null/Gauntlet.TargetDeviceNull.cs
Ryan Vance 7c51ff94af Merging //UE4/Dev-Main to Dev-VR (//UE4/Dev-VR)
CL 1 of 8
#rb integration

[CL 4748712 by Ryan Vance in Dev-VR branch]
2019-01-17 18:54:05 -05:00

187 lines
4.2 KiB
C#

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using AutomationTool;
using UnrealBuildTool;
using System.Text.RegularExpressions;
namespace Gauntlet
{
class NullAppInstance : IAppInstance
{
public NullAppInstance(ITargetDevice InDevice)
{
Device = InDevice;
}
public string ArtifactPath
{
get
{
return Globals.TempDir;
}
}
public string CommandLine { get { return ""; } }
public ITargetDevice Device { get; protected set; }
public bool HasExited { get; protected set; }
public bool WasKilled { get; protected set; }
public string StdOut { get { return ""; } }
public int ExitCode { get { return 0; }}
public void Kill()
{
if (!HasExited)
{
WasKilled = true;
HasExited = true;
}
}
public int WaitForExit()
{
HasExited = true;
return 0;
}
}
class NullAppInstall : IAppInstall
{
public ITargetDevice Device { get; protected set; }
public string Name { get; protected set; }
public string CommandLine { get; protected set; }
public NullAppInstall(string InName, TargetDeviceNull InDevice, string InCommandLine)
{
Name = InName;
Device = InDevice;
CommandLine = InCommandLine;
}
public IAppInstance Run()
{
return Device.Run(this);
}
}
public class NullDeviceFactory : IDeviceFactory
{
public bool CanSupportPlatform(UnrealTargetPlatform Platform)
{
return Platform == UnrealTargetPlatform.Unknown;
}
public ITargetDevice CreateDevice(string InRef, string InParam)
{
return new TargetDeviceNull(InRef);
}
}
/// <summary>
/// Win32/64 implementation of a device to run applications
/// </summary>
public class TargetDeviceNull : ITargetDevice
{
public string Name { get; protected set; }
protected Dictionary<EIntendedBaseCopyDirectory, string> LocalDirectoryMappings { get; set; }
public TargetDeviceNull(string InName)
{
Name = InName;
LocalDirectoryMappings = new Dictionary<EIntendedBaseCopyDirectory, string>();
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// TODO: dispose managed state (managed objects).
}
// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.
disposedValue = true;
}
}
// This code added to correctly implement the disposable pattern.
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
// TODO: uncomment the following line if the finalizer is overridden above.
// GC.SuppressFinalize(this);
}
#endregion
public CommandUtils.ERunOptions RunOptions { get; set; }
public IAppInstance Run(IAppInstall App)
{
NullAppInstall NullApp = App as NullAppInstall;
if (NullApp == null)
{
throw new DeviceException("AppInstance is of incorrect type!");
}
Log.Info("Launching {0} on {1}", App.Name, ToString());
Log.Info("\t{0}", NullApp.CommandLine);
return new NullAppInstance(this);
}
public IAppInstall InstallApplication(UnrealAppConfig AppConfig)
{
NullAppInstall NullApp = new NullAppInstall(AppConfig.Name, this, AppConfig.CommandLine);
return NullApp;
}
public UnrealTargetPlatform Platform { get { return UnrealTargetPlatform.Unknown; } }
public bool IsAvailable { get { return true; } }
public bool IsConnected { get { return true; } }
public bool IsOn { get { return true; } }
public bool PowerOn() { return true; }
public bool PowerOff() { return true; }
public bool Reboot() { return true; }
public bool Connect() { return true; }
public bool Disconnect() { return true; }
public override string ToString()
{
return Name;
}
public Dictionary<EIntendedBaseCopyDirectory, string> GetPlatformDirectoryMappings()
{
if (LocalDirectoryMappings.Count == 0)
{
Log.Warning("Platform directory mappings have not been populated for this platform! This should be done within InstallApplication()");
}
return LocalDirectoryMappings;
}
}
}