aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.ManagedHost
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-23 12:26:07 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-23 12:43:38 +1000
commitab495395492055c8c016e54ab0b1f7af2e9f164c (patch)
treef7f86e82cb463303c5bf2e501065ea09a9b62af0 /src/test/WixToolsetTest.ManagedHost
parentbd3ee565f342bc0bb015594f303d13b67285a958 (diff)
downloadwix-ab495395492055c8c016e54ab0b1f7af2e9f164c.tar.gz
wix-ab495395492055c8c016e54ab0b1f7af2e9f164c.tar.bz2
wix-ab495395492055c8c016e54ab0b1f7af2e9f164c.zip
Add reload engine and test.
Diffstat (limited to 'src/test/WixToolsetTest.ManagedHost')
-rw-r--r--src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs78
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestEngine.cs11
2 files changed, 89 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
index 8ef0320e..8b0a3691 100644
--- a/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
+++ b/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
@@ -78,5 +78,83 @@ namespace WixToolsetTest.ManagedHost
78 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); 78 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
79 } 79 }
80 } 80 }
81
82 [Fact]
83 public void CanReloadFullFramework2MBA()
84 {
85 using (var fs = new DisposableFileSystem())
86 {
87 var baseFolder = fs.GetFolder();
88 var binFolder = Path.Combine(baseFolder, "bin");
89 var bundleFile = Path.Combine(binFolder, "FullFramework2MBA.exe");
90 var baSourceFolder = TestData.Get(@"..\examples");
91 var bundleSourceFolder = TestData.Get(@"TestData\FullFramework2MBA");
92 var intermediateFolder = Path.Combine(baseFolder, "obj");
93
94 var compileResult = WixRunner.Execute(new[]
95 {
96 "build",
97 Path.Combine(bundleSourceFolder, "Bundle.wxs"),
98 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
99 "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
100 "-intermediateFolder", intermediateFolder,
101 "-bindpath", baSourceFolder,
102 "-burnStub", TestEngine.BurnStubFile,
103 "-o", bundleFile,
104 });
105 compileResult.AssertSuccess();
106 var testEngine = new TestEngine();
107
108 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
109 var logMessages = result.Output;
110 Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
111 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
112 Assert.Equal("FullFramework2BA", logMessages[2]);
113 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
114 Assert.Equal("Loading managed bootstrapper application.", logMessages[4]);
115 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]);
116 Assert.Equal("FullFramework2BA", logMessages[6]);
117 Assert.Equal("Shutdown,Restart,0", logMessages[7]);
118 }
119 }
120
121 [Fact]
122 public void CanReloadFullFramework4MBA()
123 {
124 using (var fs = new DisposableFileSystem())
125 {
126 var baseFolder = fs.GetFolder();
127 var binFolder = Path.Combine(baseFolder, "bin");
128 var bundleFile = Path.Combine(binFolder, "FullFramework4MBA.exe");
129 var baSourceFolder = TestData.Get(@"..\examples");
130 var bundleSourceFolder = TestData.Get(@"TestData\FullFramework4MBA");
131 var intermediateFolder = Path.Combine(baseFolder, "obj");
132
133 var compileResult = WixRunner.Execute(new[]
134 {
135 "build",
136 Path.Combine(bundleSourceFolder, "Bundle.wxs"),
137 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
138 "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
139 "-intermediateFolder", intermediateFolder,
140 "-bindpath", baSourceFolder,
141 "-burnStub", TestEngine.BurnStubFile,
142 "-o", bundleFile,
143 });
144 compileResult.AssertSuccess();
145 var testEngine = new TestEngine();
146
147 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
148 var logMessages = result.Output;
149 Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
150 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
151 Assert.Equal("FullFramework4BA", logMessages[2]);
152 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
153 Assert.Equal("Loading managed bootstrapper application.", logMessages[4]);
154 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]);
155 Assert.Equal("FullFramework4BA", logMessages[6]);
156 Assert.Equal("Shutdown,Restart,0", logMessages[7]);
157 }
158 }
81 } 159 }
82} 160}
diff --git a/src/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/test/WixToolsetTest.ManagedHost/TestEngine.cs
index 751ed59c..cda32895 100644
--- a/src/test/WixToolsetTest.ManagedHost/TestEngine.cs
+++ b/src/test/WixToolsetTest.ManagedHost/TestEngine.cs
@@ -13,14 +13,25 @@ namespace WixToolsetTest.ManagedHost
13 private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe"); 13 private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe");
14 public static readonly string BurnStubFile = TestData.Get(@"runtimes\win-x86\native\burn.x86.exe"); 14 public static readonly string BurnStubFile = TestData.Get(@"runtimes\win-x86\native\burn.x86.exe");
15 15
16 public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath)
17 {
18 return this.RunTestEngine("reload", bundleFilePath, tempFolderPath);
19 }
20
16 public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath) 21 public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath)
17 { 22 {
23 return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath);
24 }
25
26 private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath)
27 {
18 var baFolderPath = Path.Combine(tempFolderPath, "ba"); 28 var baFolderPath = Path.Combine(tempFolderPath, "ba");
19 var extractFolderPath = Path.Combine(tempFolderPath, "extract"); 29 var extractFolderPath = Path.Combine(tempFolderPath, "extract");
20 var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath); 30 var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath);
21 extractResult.AssertSuccess(); 31 extractResult.AssertSuccess();
22 32
23 var args = new string[] { 33 var args = new string[] {
34 engineMode,
24 '"' + bundleFilePath + '"', 35 '"' + bundleFilePath + '"',
25 '"' + extractResult.GetBAFilePath(baFolderPath) + '"', 36 '"' + extractResult.GetBAFilePath(baFolderPath) + '"',
26 }; 37 };