|
|
|
@ -34,6 +34,11 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
private static readonly Lazy<string> NetCoreVersionLazy = new Lazy<string>(GetNetCoreVersion); |
|
|
|
|
|
|
|
static TestEnvironment() |
|
|
|
{ |
|
|
|
PrepareRemoteExecutor(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the .NET Core version, if running on .NET Core, otherwise returns an empty string.
|
|
|
|
/// </summary>
|
|
|
|
@ -111,6 +116,13 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
internal static bool IsFramework => string.IsNullOrEmpty(NetCoreVersion); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A dummy operation to enforce the execution of the static constructor.
|
|
|
|
/// </summary>
|
|
|
|
internal static void EnsureSharedInitializersDone() |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates the image output directory.
|
|
|
|
/// </summary>
|
|
|
|
@ -141,7 +153,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
/// When running in 32 bits, enforces 32 bit execution of Microsoft.DotNet.RemoteExecutor.exe
|
|
|
|
/// with the help of CorFlags.exe found in Windows SDK.
|
|
|
|
/// </summary>
|
|
|
|
internal static void PrepareRemoteExecutor() |
|
|
|
private static void PrepareRemoteExecutor() |
|
|
|
{ |
|
|
|
if (!IsFramework) |
|
|
|
{ |
|
|
|
@ -153,12 +165,11 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
if (File.Exists(remoteExecutorConfigPath)) |
|
|
|
{ |
|
|
|
// already prepared
|
|
|
|
// Already initialized
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
string testProjectConfigPath = TestAssemblyFile.FullName + ".config"; |
|
|
|
|
|
|
|
File.Copy(testProjectConfigPath, remoteExecutorConfigPath); |
|
|
|
|
|
|
|
if (Is64BitProcess) |
|
|
|
@ -184,7 +195,17 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
string remoteExecutorPath = Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe"); |
|
|
|
|
|
|
|
string args = $"{remoteExecutorPath} /32Bit+ /Force"; |
|
|
|
string remoteExecutorTmpPath = $"{remoteExecutorPath}._tmp"; |
|
|
|
|
|
|
|
if (File.Exists(remoteExecutorTmpPath)) |
|
|
|
{ |
|
|
|
// Already initialized
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
File.Copy(remoteExecutorPath, remoteExecutorTmpPath); |
|
|
|
|
|
|
|
string args = $"{remoteExecutorTmpPath} /32Bit+ /Force"; |
|
|
|
|
|
|
|
var si = new ProcessStartInfo() |
|
|
|
{ |
|
|
|
@ -206,6 +227,9 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
$@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}"); |
|
|
|
} |
|
|
|
|
|
|
|
File.Delete(remoteExecutorPath); |
|
|
|
File.Copy(remoteExecutorTmpPath, remoteExecutorPath); |
|
|
|
|
|
|
|
static FileInfo Find(DirectoryInfo root, string name) |
|
|
|
{ |
|
|
|
FileInfo fi = root.EnumerateFiles(name).FirstOrDefault(); |
|
|
|
|