From 0d3d54992104288e9ee0c834d0b96e8502fd2d42 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 11 Jan 2024 18:26:20 -0800 Subject: Move the BootstrapperApplication out of proc --- .../test/WixToolsetTest.ManagedHost/TestEngine.cs | 76 ---------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs (limited to 'src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs') diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs deleted file mode 100644 index 8be62e92..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolsetTest.ManagedHost -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using WixInternal.TestSupport; - using WixInternal.Core.TestPackage; - - public class TestEngine - { - private static readonly string TestEngineFile = TestData.Get(@"..\x64\examples\Example.TestEngine\Example.TestEngine.exe"); - private static readonly string TestEngineFileX86 = TestData.Get(@"..\x86\examples\Example.TestEngine\Example.TestEngine.exe"); - - public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath, bool x86 = false) - { - return this.RunTestEngine("reload", bundleFilePath, tempFolderPath, x86); - } - - public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath, bool x86 = false) - { - return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath, x86); - } - - private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath, bool x86 = false) - { - var baFolderPath = Path.Combine(tempFolderPath, "ba"); - var extractFolderPath = Path.Combine(tempFolderPath, "extract"); - var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath); - extractResult.AssertSuccess(); - - var args = new string[] { - engineMode, - '"' + bundleFilePath + '"', - '"' + extractResult.GetBAFilePath(baFolderPath) + '"', - }; - return RunProcessCaptureOutput(x86 ? TestEngineFileX86 : TestEngineFile, args); - } - - private static TestEngineResult RunProcessCaptureOutput(string executablePath, string[] arguments = null, string workingFolder = null) - { - var startInfo = new ProcessStartInfo(executablePath) - { - Arguments = String.Join(' ', arguments), - CreateNoWindow = true, - RedirectStandardError = true, - RedirectStandardOutput = true, - UseShellExecute = false, - WorkingDirectory = workingFolder, - }; - - var exitCode = 0; - var output = new List(); - - using (var process = Process.Start(startInfo)) - { - process.OutputDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; - process.ErrorDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; - - process.BeginErrorReadLine(); - process.BeginOutputReadLine(); - - process.WaitForExit(); - exitCode = process.ExitCode; - } - - return new TestEngineResult - { - ExitCode = exitCode, - Output = output, - }; - } - } -} -- cgit v1.2.3-55-g6feb