1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
// 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.BurnE2E
{
using System;
using System.IO;
using WixTestTools;
using WixToolset.BootstrapperApplicationApi;
using Xunit;
using Xunit.Abstractions;
public class SlipstreamTests : BurnE2ETests
{
public SlipstreamTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
private const string V090 = "0.9.0.0";
private const string V100 = "1.0.0.0";
private const string V101 = "1.0.1.0";
[RuntimeFact]
public void CanInstallBundleWithSlipstreamedPatchThenRemoveIt()
{
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleA = this.CreateBundleInstaller("BundleA");
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
/// <summary>
/// BundleA installs PackageA with slipstreamed PatchA.
/// BundleOnlyPatchA is installed which contains PatchA (which should be a no-op).
/// BundleOnlyPatchA in uninstalled which should do nothing since BundleA has a dependency on it.
/// Bundle is installed which should remove everything.
/// </summary>
[RuntimeFact]
public void ReferenceCountsSlipstreamedPatch()
{
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleOnlyPatchA = this.CreateBundleInstaller("BundleOnlyPatchA");
var bundleA = this.CreateBundleInstaller("BundleA");
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleOnlyPatchA.Install();
bundleOnlyPatchA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleOnlyPatchA.Uninstall();
bundleOnlyPatchA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact(Skip = "https://github.com/wixtoolset/issues/issues/6350")]
public void CanInstallBundleWithSlipstreamedPatchThenRepairIt()
{
this.InstallBundleWithSlipstreamedPatchThenRepairIt(false);
}
[RuntimeFact(Skip = "https://github.com/wixtoolset/issues/issues/6350")]
public void CanInstallReversedBundleWithSlipstreamedPatchThenRepairIt()
{
this.InstallBundleWithSlipstreamedPatchThenRepairIt(true);
}
private void InstallBundleWithSlipstreamedPatchThenRepairIt(bool isReversed)
{
var bundleName = isReversed ? "BundleAReverse" : "BundleA";
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleA = this.CreateBundleInstaller(bundleName);
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
// Delete the installed file and registry key so we have something to repair.
File.Delete(packageAv1SourceCodeInstalled);
packageAv1.DeleteTestRegistryValue(testRegistryValue);
bundleA.Repair();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void CanInstallSlipstreamedPatchThroughForcedRepair()
{
this.InstallSlipstreamedPatchThroughForcedRepair(false);
}
[RuntimeFact]
public void CanInstallSlipstreamedPatchThroughReversedForcedRepair()
{
this.InstallSlipstreamedPatchThroughForcedRepair(true);
}
private void InstallSlipstreamedPatchThroughForcedRepair(bool isReversed)
{
var bundleName = isReversed ? "BundleAReverse" : "BundleA";
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleA = this.CreateBundleInstaller(bundleName);
var bundleOnlyA = this.CreateBundleInstaller("BundleOnlyA");
var testBAController = this.CreateTestBAController();
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleOnlyA.Install();
bundleOnlyA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
// Delete the installed file and registry key so we have something to repair.
File.Delete(packageAv1SourceCodeInstalled);
packageAv1.DeleteTestRegistryValue(testRegistryValue);
testBAController.SetPackageRequestedState("PackageA", RequestState.Repair);
testBAController.SetPackageRequestedState("PatchA", RequestState.Repair);
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
testBAController.ResetPackageStates("PackageA");
testBAController.ResetPackageStates("PatchA");
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
bundleOnlyA.Uninstall();
bundleOnlyA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void CanUninstallSlipstreamedPatchAlone()
{
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleA = this.CreateBundleInstaller("BundleA");
var testBAController = this.CreateTestBAController();
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
testBAController.SetPackageRequestedState("PatchA", RequestState.Absent);
bundleA.Modify();
bundleA.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void CanModifyToUninstallPackageWithSlipstreamedPatch()
{
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var packageBv1 = this.CreatePackageInstaller("PackageBv1");
var bundleB = this.CreateBundleInstaller("BundleB");
var testBAController = this.CreateTestBAController();
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
bundleB.Install();
bundleB.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
Assert.True(File.Exists(packageBv1SourceCodeInstalled), String.Concat("Should have found PackageBv1 payload installed at: ", packageBv1SourceCodeInstalled));
testBAController.SetPackageRequestedState("PackageA", RequestState.Absent);
testBAController.SetPackageRequestedState("PatchA", RequestState.Absent);
bundleB.Modify();
bundleB.VerifyRegisteredAndInPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should have been removed by modify from: {packageAv1SourceCodeInstalled}");
testBAController.ResetPackageStates("PackageA");
testBAController.ResetPackageStates("PatchA");
bundleB.Uninstall();
bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should have been removed by uninstall from: ", packageBv1SourceCodeInstalled));
packageBv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void UninstallsPackageWithSlipstreamedPatchDuringRollback()
{
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var packageBv1 = this.CreatePackageInstaller("PackageBv1");
var bundleB = this.CreateBundleInstaller("BundleB");
var testBAController = this.CreateTestBAController();
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
testBAController.SetPackageCancelExecuteAtProgress("PackageB", 50);
bundleB.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should have been removed by rollback from: {packageAv1SourceCodeInstalled}");
Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should not have been installed from: ", packageBv1SourceCodeInstalled));
packageBv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void CanAutomaticallyPredetermineSlipstreamPatchesAtBuildTime()
{
var testRegistryValueA = "PackageA";
var testRegistryValueA2 = "PackageA2";
var testRegistryValueB = "PackageB";
var testRegistryValueB2 = "PackageB2";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var packageBv1 = this.CreatePackageInstaller("PackageBv1");
var bundleC = this.CreateBundleInstaller("BundleC");
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
bundleC.Install();
bundleC.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
// Product A should've slipstreamed both patches.
packageAv1.VerifyTestRegistryValue(testRegistryValueA, V101);
packageAv1.VerifyTestRegistryValue(testRegistryValueA2, V101);
// Product B should've only slipstreamed patch AB2.
packageBv1.VerifyTestRegistryValue(testRegistryValueB, V100);
packageBv1.VerifyTestRegistryValue(testRegistryValueB2, V101);
bundleC.Uninstall();
bundleC.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should have been removed by uninstall from: ", packageBv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void CanInstallSlipstreamedPatchWithPackageDuringMajorUpgrade()
{
var testRegistryValue = "PackageA";
var packageAv0 = this.CreatePackageInstaller("PackageAv0_9_0");
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleA = this.CreateBundleInstaller("BundleA");
packageAv1.VerifyInstalled(false);
packageAv0.InstallProduct();
packageAv0.VerifyInstalled(true);
packageAv1.VerifyTestRegistryValue(testRegistryValue, V090);
bundleA.Install();
bundleA.VerifyRegisteredAndInPackageCache();
packageAv0.VerifyInstalled(false);
packageAv1.VerifyInstalled(true);
packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
bundleA.Uninstall();
bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
packageAv1.VerifyInstalled(false);
packageAv1.VerifyTestRegistryRootDeleted();
}
[RuntimeFact]
public void RespectsSlipstreamedPatchInstallCondition()
{
var testRegistryValue = "PackageA";
var packageAv1 = this.CreatePackageInstaller("PackageAv1");
var bundleD = this.CreateBundleInstaller("BundleD");
var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
bundleD.Install();
bundleD.VerifyRegisteredAndInPackageCache();
Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
// The patch was not supposed to be installed.
packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
bundleD.Uninstall();
bundleD.VerifyUnregisteredAndRemovedFromPackageCache();
Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
packageAv1.VerifyTestRegistryRootDeleted();
}
}
}
|