diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-06-03 17:48:57 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-06-07 19:44:36 -0500 |
commit | 648f370f7966b2738c1446601057d888bbd2c70f (patch) | |
tree | 9022566b1016f94127dfb7e84c9b4dfa057993cd /src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | |
parent | 6b0f2d978504da82070523eb6adb0b59f9812e93 (diff) | |
download | wix-648f370f7966b2738c1446601057d888bbd2c70f.tar.gz wix-648f370f7966b2738c1446601057d888bbd2c70f.tar.bz2 wix-648f370f7966b2738c1446601057d888bbd2c70f.zip |
Make PathGetSystemPath return an array of paths ordered by preference.
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs')
-rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs index 6c8250d9..f5a1cda8 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | |||
@@ -5,6 +5,7 @@ namespace WixToolsetTest.BurnE2E | |||
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | 7 | using System.IO; |
8 | using Microsoft.Win32; | ||
8 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
9 | using WixTestTools; | 10 | using WixTestTools; |
10 | using WixToolset.Mba.Core; | 11 | using WixToolset.Mba.Core; |
@@ -201,5 +202,72 @@ namespace WixToolsetTest.BurnE2E | |||
201 | packageB.VerifyInstalled(true); | 202 | packageB.VerifyInstalled(true); |
202 | } | 203 | } |
203 | } | 204 | } |
205 | |||
206 | [RuntimeFact] | ||
207 | public void CanGetEngineWorkingDirectoryFromCommandLine() | ||
208 | { | ||
209 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
210 | var testBAController = this.CreateTestBAController(); | ||
211 | |||
212 | testBAController.SetImmediatelyQuit(); | ||
213 | |||
214 | using (var dfs = new DisposableFileSystem()) | ||
215 | { | ||
216 | var baseTempPath = dfs.GetFolder(true); | ||
217 | var logPath = bundleA.Install(0, $"-burn.engine.working.directory=\"{baseTempPath}\""); | ||
218 | LogVerifier.MessageInLogFileRegex(logPath, $"Burn x86 v4.*, Windows v.* \\(Build .*: Service Pack .*\\), path: {baseTempPath.Replace("\\", "\\\\")}\\\\.*\\\\.cr\\\\BundleA.exe"); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | [RuntimeFact] | ||
223 | public void CanGetEngineWorkingDirectoryFromPolicy() | ||
224 | { | ||
225 | var deletePolicyKey = false; | ||
226 | string originalPolicyValue = null; | ||
227 | |||
228 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
229 | var testBAController = this.CreateTestBAController(); | ||
230 | var policyPath = bundleA.GetFullBurnPolicyRegistryPath(); | ||
231 | |||
232 | testBAController.SetImmediatelyQuit(); | ||
233 | |||
234 | try | ||
235 | { | ||
236 | using (var dfs = new DisposableFileSystem()) | ||
237 | { | ||
238 | var baseTempPath = dfs.GetFolder(true); | ||
239 | |||
240 | var policyKey = Registry.LocalMachine.OpenSubKey(policyPath, writable: true); | ||
241 | if (policyKey == null) | ||
242 | { | ||
243 | policyKey = Registry.LocalMachine.CreateSubKey(policyPath, writable: true); | ||
244 | deletePolicyKey = true; | ||
245 | } | ||
246 | |||
247 | using (policyKey) | ||
248 | { | ||
249 | originalPolicyValue = policyKey.GetValue("EngineWorkingDirectory") as string; | ||
250 | policyKey.SetValue("EngineWorkingDirectory", baseTempPath); | ||
251 | } | ||
252 | |||
253 | var logPath = bundleA.Install(); | ||
254 | LogVerifier.MessageInLogFileRegex(logPath, $"Burn x86 v4.*, Windows v.* \\(Build .*: Service Pack .*\\), path: {baseTempPath.Replace("\\", "\\\\")}\\\\.*\\\\.cr\\\\BundleA.exe"); | ||
255 | } | ||
256 | } | ||
257 | finally | ||
258 | { | ||
259 | if (deletePolicyKey) | ||
260 | { | ||
261 | Registry.LocalMachine.DeleteSubKeyTree(policyPath); | ||
262 | } | ||
263 | else if (originalPolicyValue != null) | ||
264 | { | ||
265 | using (var policyKey = Registry.LocalMachine.CreateSubKey(policyPath, writable: true)) | ||
266 | { | ||
267 | policyKey.SetValue("EngineWorkingDirectory", originalPolicyValue); | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | } | ||
204 | } | 272 | } |
205 | } | 273 | } |