aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/test/WixToolsetTest.ManagedHost
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.ManagedHost')
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs285
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs100
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md5
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs76
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs12
-rw-r--r--src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj19
6 files changed, 0 insertions, 497 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs
deleted file mode 100644
index fe644d2d..00000000
--- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs
+++ /dev/null
@@ -1,285 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.ManagedHost
4{
5 using System;
6 using WixInternal.TestSupport;
7 using WixInternal.TestSupport.XunitExtensions;
8 using Xunit;
9
10 public class DncHostFixture
11 {
12 static readonly string bundleBasePath = TestData.Get("..", "examples");
13
14 [Fact]
15 public void CanLoadFDDEarliestCoreMBA()
16 {
17 using (var fs = new DisposableFileSystem())
18 {
19 var baseFolder = fs.GetFolder();
20 var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleFDD.exe");
21 var testEngine = new TestEngine();
22
23 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
24 WixAssert.CompareLineByLine(new[]
25 {
26 "Loading .NET Core FDD bootstrapper application.",
27 "Creating BA thread to run asynchronously.",
28 "EarliestCoreBA",
29 "Shutdown,ReloadBootstrapper,0",
30 }, result.Output.ToArray());
31 }
32 }
33
34 [SkippableFact]
35 public void CanLoadFDDx86EarliestCoreMBA()
36 {
37 // https://github.com/microsoft/vstest/issues/3586
38 Environment.SetEnvironmentVariable("DOTNET_ROOT", null);
39
40 using (var fs = new DisposableFileSystem())
41 {
42 var baseFolder = fs.GetFolder();
43 var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleFDDx86.exe");
44 var testEngine = new TestEngine();
45
46 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true);
47 var resultOutput = result.Output.ToArray();
48
49 if (resultOutput.Length > 0 && (resultOutput[0] == "error from hostfxr: It was not possible to find any compatible framework version" ||
50 resultOutput[0] == "error from hostfxr: You must install or update .NET to run this application."))
51 {
52 WixAssert.Skip(String.Join(Environment.NewLine, resultOutput));
53 }
54
55 WixAssert.CompareLineByLine(new[]
56 {
57 "Loading .NET Core FDD bootstrapper application.",
58 "Creating BA thread to run asynchronously.",
59 "EarliestCoreBA",
60 "Shutdown,ReloadBootstrapper,0",
61 }, resultOutput);
62 }
63 }
64
65 [Fact]
66 public void CanLoadSCDEarliestCoreMBA()
67 {
68 using (var fs = new DisposableFileSystem())
69 {
70 var baseFolder = fs.GetFolder();
71 var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe");
72 var testEngine = new TestEngine();
73
74 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
75 WixAssert.CompareLineByLine(new[]
76 {
77 "Loading .NET Core SCD bootstrapper application.",
78 "Creating BA thread to run asynchronously.",
79 "EarliestCoreBA",
80 "Shutdown,ReloadBootstrapper,0",
81 }, result.Output.ToArray());
82 }
83 }
84
85 [Fact]
86 public void CanLoadTrimmedSCDEarliestCoreMBA()
87 {
88 using (var fs = new DisposableFileSystem())
89 {
90 var baseFolder = fs.GetFolder();
91 var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleTrimmedSCD.exe");
92 var testEngine = new TestEngine();
93
94 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
95 WixAssert.CompareLineByLine(new[]
96 {
97 "Loading .NET Core SCD bootstrapper application.",
98 "Creating BA thread to run asynchronously.",
99 "EarliestCoreBA",
100 "Shutdown,ReloadBootstrapper,0",
101 }, result.Output.ToArray());
102 }
103 }
104
105 [Fact]
106 public void CanReloadSCDEarliestCoreMBA()
107 {
108 using (var fs = new DisposableFileSystem())
109 {
110 var baseFolder = fs.GetFolder();
111 var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe");
112 var testEngine = new TestEngine();
113
114 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
115 WixAssert.CompareLineByLine(new[]
116 {
117 "Loading .NET Core SCD bootstrapper application.",
118 "Creating BA thread to run asynchronously.",
119 "EarliestCoreBA",
120 "Shutdown,ReloadBootstrapper,0",
121 "Loading .NET Core SCD bootstrapper application.",
122 "Reloaded 1 time(s)", // dnchost doesn't currently support unloading
123 "Creating BA thread to run asynchronously.",
124 "EarliestCoreBA",
125 "Shutdown,Restart,0",
126
127 }, result.Output.ToArray());
128 }
129 }
130
131 [Fact]
132 public void CanLoadFDDLatestCoreMBA()
133 {
134 using (var fs = new DisposableFileSystem())
135 {
136 var baseFolder = fs.GetFolder();
137 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe");
138 var testEngine = new TestEngine();
139
140 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
141 WixAssert.CompareLineByLine(new[]
142 {
143 "Loading .NET Core FDD bootstrapper application.",
144 "Creating BA thread to run asynchronously.",
145 "LatestCoreBA",
146 "Shutdown,ReloadBootstrapper,0",
147 }, result.Output.ToArray());
148 }
149 }
150
151 [Fact]
152 public void CanLoadFDDx86LatestCoreMBA()
153 {
154 // https://github.com/microsoft/vstest/issues/3586
155 Environment.SetEnvironmentVariable("DOTNET_ROOT", null);
156
157 using (var fs = new DisposableFileSystem())
158 {
159 var baseFolder = fs.GetFolder();
160 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDDx86.exe");
161 var testEngine = new TestEngine();
162
163 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true);
164 WixAssert.CompareLineByLine(new[]
165 {
166 "Loading .NET Core FDD bootstrapper application.",
167 "Creating BA thread to run asynchronously.",
168 "LatestCoreBA",
169 "Shutdown,ReloadBootstrapper,0",
170 }, result.Output.ToArray());
171 }
172 }
173
174 [Fact]
175 public void CanReloadFDDLatestCoreMBA()
176 {
177 using (var fs = new DisposableFileSystem())
178 {
179 var baseFolder = fs.GetFolder();
180 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe");
181 var testEngine = new TestEngine();
182
183 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
184 WixAssert.CompareLineByLine(new[]
185 {
186 "Loading .NET Core FDD bootstrapper application.",
187 "Creating BA thread to run asynchronously.",
188 "LatestCoreBA",
189 "Shutdown,ReloadBootstrapper,0",
190 "Loading .NET Core FDD bootstrapper application.",
191 "Reloaded 1 time(s)", // dnchost doesn't currently support unloading
192 "Creating BA thread to run asynchronously.",
193 "LatestCoreBA",
194 "Shutdown,Restart,0",
195 }, result.Output.ToArray());
196 }
197 }
198
199 [Fact]
200 public void CanLoadSCDLatestCoreMBA()
201 {
202 using (var fs = new DisposableFileSystem())
203 {
204 var baseFolder = fs.GetFolder();
205 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe");
206 var testEngine = new TestEngine();
207
208 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
209 WixAssert.CompareLineByLine(new[]
210 {
211 "Loading .NET Core SCD bootstrapper application.",
212 "Creating BA thread to run asynchronously.",
213 "LatestCoreBA",
214 "Shutdown,ReloadBootstrapper,0",
215 }, result.Output.ToArray());
216 var logMessages = result.Output;
217 }
218 }
219
220 [Fact]
221 public void CanLoadTrimmedSCDLatestCoreMBA()
222 {
223 using (var fs = new DisposableFileSystem())
224 {
225 var baseFolder = fs.GetFolder();
226 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleTrimmedSCD.exe");
227 var testEngine = new TestEngine();
228
229 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
230 WixAssert.CompareLineByLine(new[]
231 {
232 "Loading .NET Core SCD bootstrapper application.",
233 "Creating BA thread to run asynchronously.",
234 "LatestCoreBA",
235 "Shutdown,ReloadBootstrapper,0",
236 }, result.Output.ToArray());
237 }
238 }
239
240 [Fact]
241 public void CanReloadSCDLatestCoreMBA()
242 {
243 using (var fs = new DisposableFileSystem())
244 {
245 var baseFolder = fs.GetFolder();
246 var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe");
247 var testEngine = new TestEngine();
248
249 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
250 WixAssert.CompareLineByLine(new[]
251 {
252 "Loading .NET Core SCD bootstrapper application.",
253 "Creating BA thread to run asynchronously.",
254 "LatestCoreBA",
255 "Shutdown,ReloadBootstrapper,0",
256 "Loading .NET Core SCD bootstrapper application.",
257 "Reloaded 1 time(s)", // dnchost doesn't currently support unloading
258 "Creating BA thread to run asynchronously.",
259 "LatestCoreBA",
260 "Shutdown,Restart,0",
261 }, result.Output.ToArray());
262 }
263 }
264
265 [Fact]
266 public void CanLoadFDDWPFCoreMBA()
267 {
268 using (var fs = new DisposableFileSystem())
269 {
270 var baseFolder = fs.GetFolder();
271 var bundleFile = TestData.Get(bundleBasePath, "WPFCoreBundleFDD.exe");
272 var testEngine = new TestEngine();
273
274 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
275 WixAssert.CompareLineByLine(new[]
276 {
277 "Loading .NET Core FDD bootstrapper application.",
278 "Creating BA thread to run asynchronously.",
279 "WPFCoreBA",
280 "Shutdown,ReloadBootstrapper,0",
281 }, result.Output.ToArray());
282 }
283 }
284 }
285}
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
deleted file mode 100644
index 6f7709b5..00000000
--- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
+++ /dev/null
@@ -1,100 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.ManagedHost
4{
5 using WixInternal.TestSupport;
6 using Xunit;
7
8 public class MbaHostFixture
9 {
10 static readonly string bundleBasePath = TestData.Get("..", "examples");
11
12 [Fact]
13 public void CanLoadFullFramework2MBA()
14 {
15 using (var fs = new DisposableFileSystem())
16 {
17 var baseFolder = fs.GetFolder();
18 var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe");
19 var testEngine = new TestEngine();
20
21 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
22 WixAssert.CompareLineByLine(new[]
23 {
24 "Loading managed bootstrapper application.",
25 "Creating BA thread to run asynchronously.",
26 "FullFramework2BA",
27 "Shutdown,ReloadBootstrapper,0",
28 }, result.Output.ToArray());
29 }
30 }
31
32 [Fact]
33 public void CanLoadFullFramework4MBA()
34 {
35 using (var fs = new DisposableFileSystem())
36 {
37 var baseFolder = fs.GetFolder();
38 var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe");
39 var testEngine = new TestEngine();
40
41 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
42 WixAssert.CompareLineByLine(new[]
43 {
44 "Loading managed bootstrapper application.",
45 "Creating BA thread to run asynchronously.",
46 "FullFramework4BA",
47 "Shutdown,ReloadBootstrapper,0",
48 }, result.Output.ToArray());
49 }
50 }
51
52 [Fact]
53 public void CanReloadFullFramework2MBA()
54 {
55 using (var fs = new DisposableFileSystem())
56 {
57 var baseFolder = fs.GetFolder();
58 var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe");
59 var testEngine = new TestEngine();
60
61 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
62 WixAssert.CompareLineByLine(new[]
63 {
64 "Loading managed bootstrapper application.",
65 "Creating BA thread to run asynchronously.",
66 "FullFramework2BA",
67 "Shutdown,ReloadBootstrapper,0",
68 "Loading managed bootstrapper application.",
69 "Creating BA thread to run asynchronously.",
70 "FullFramework2BA",
71 "Shutdown,Restart,0",
72 }, result.Output.ToArray());
73 }
74 }
75
76 [Fact]
77 public void CanReloadFullFramework4MBA()
78 {
79 using (var fs = new DisposableFileSystem())
80 {
81 var baseFolder = fs.GetFolder();
82 var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe");
83 var testEngine = new TestEngine();
84
85 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
86 WixAssert.CompareLineByLine(new[]
87 {
88 "Loading managed bootstrapper application.",
89 "Creating BA thread to run asynchronously.",
90 "FullFramework4BA",
91 "Shutdown,ReloadBootstrapper,0",
92 "Loading managed bootstrapper application.",
93 "Creating BA thread to run asynchronously.",
94 "FullFramework4BA",
95 "Shutdown,Restart,0",
96 }, result.Output.ToArray());
97 }
98 }
99 }
100}
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md
deleted file mode 100644
index cbec1387..00000000
--- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
1In order to properly test dnchost and mbahost,
2the managed BAs need to be published and a bundle needs to be built for each scenario.
3Making this happen on every build for the solution takes too long,
4so this project relies on manually running devbuild.cmd to publish everything before the tests can be run.
5devbuild.cmd needs to be ran again every time changes are made in other projects. \ No newline at end of file
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 @@
1// 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.
2
3namespace WixToolsetTest.ManagedHost
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.IO;
9 using WixInternal.TestSupport;
10 using WixInternal.Core.TestPackage;
11
12 public class TestEngine
13 {
14 private static readonly string TestEngineFile = TestData.Get(@"..\x64\examples\Example.TestEngine\Example.TestEngine.exe");
15 private static readonly string TestEngineFileX86 = TestData.Get(@"..\x86\examples\Example.TestEngine\Example.TestEngine.exe");
16
17 public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath, bool x86 = false)
18 {
19 return this.RunTestEngine("reload", bundleFilePath, tempFolderPath, x86);
20 }
21
22 public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath, bool x86 = false)
23 {
24 return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath, x86);
25 }
26
27 private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath, bool x86 = false)
28 {
29 var baFolderPath = Path.Combine(tempFolderPath, "ba");
30 var extractFolderPath = Path.Combine(tempFolderPath, "extract");
31 var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath);
32 extractResult.AssertSuccess();
33
34 var args = new string[] {
35 engineMode,
36 '"' + bundleFilePath + '"',
37 '"' + extractResult.GetBAFilePath(baFolderPath) + '"',
38 };
39 return RunProcessCaptureOutput(x86 ? TestEngineFileX86 : TestEngineFile, args);
40 }
41
42 private static TestEngineResult RunProcessCaptureOutput(string executablePath, string[] arguments = null, string workingFolder = null)
43 {
44 var startInfo = new ProcessStartInfo(executablePath)
45 {
46 Arguments = String.Join(' ', arguments),
47 CreateNoWindow = true,
48 RedirectStandardError = true,
49 RedirectStandardOutput = true,
50 UseShellExecute = false,
51 WorkingDirectory = workingFolder,
52 };
53
54 var exitCode = 0;
55 var output = new List<string>();
56
57 using (var process = Process.Start(startInfo))
58 {
59 process.OutputDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } };
60 process.ErrorDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } };
61
62 process.BeginErrorReadLine();
63 process.BeginOutputReadLine();
64
65 process.WaitForExit();
66 exitCode = process.ExitCode;
67 }
68
69 return new TestEngineResult
70 {
71 ExitCode = exitCode,
72 Output = output,
73 };
74 }
75 }
76}
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs
deleted file mode 100644
index 63f6f7f5..00000000
--- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs
+++ /dev/null
@@ -1,12 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.ManagedHost
4{
5 using System.Collections.Generic;
6
7 public class TestEngineResult
8 {
9 public int ExitCode { get; set; }
10 public List<string> Output { get; set; }
11 }
12}
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj b/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
deleted file mode 100644
index 9caf3aa6..00000000
--- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3
4<Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFramework>net6.0</TargetFramework>
7 <IsWixTestProject>true</IsWixTestProject>
8 </PropertyGroup>
9
10 <ItemGroup>
11 <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" Properties="Platform=ARM64" ReferenceOutputAssembly="false" />
12 <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" Properties="Platform=x86" ReferenceOutputAssembly="false" />
13 <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" Properties="Platform=x64" ReferenceOutputAssembly="false" />
14 </ItemGroup>
15
16 <ItemGroup>
17 <PackageReference Include="WixInternal.Core.TestPackage" />
18 </ItemGroup>
19</Project>