Simplify patch fixture internal results
Rob Mensching committed
Sep 23, 2022 at 17:59 UTC
038b93757c3fe329d8943cae55b16536c4718b60
1 file changed
+44
-44
src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+44
-44
@@ -61,13 +61,9 @@ namespace WixToolsetTest.CoreIntegration
61
{
62
var tempFolder = fs.GetFolder();
63
64
- var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
65
- var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
66
- var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1");
67
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
68
-
69
- Assert.True(File.Exists(baselinePdb));
70
- Assert.True(File.Exists(update1Pdb));
64
+ var baselinePath = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
65
+ var update1Path = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
66
+ var patchPath = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1");
67
68
var doc = GetExtractPatchXml(patchPath);
69
WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(TargetProductCodeName).Value);
@@ -93,8 +89,7 @@ namespace WixToolsetTest.CoreIntegration
89
var baseFolder = fs.GetFolder();
90
var tempFolderPatch = Path.Combine(baseFolder, "patch");
91
96
- var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) });
97
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
92
+ var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) });
93
94
var doc = GetExtractPatchXml(patchPath);
95
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -123,8 +118,7 @@ namespace WixToolsetTest.CoreIntegration
118
var baseFolder = fs.GetFolder();
119
var tempFolderPatch = Path.Combine(baseFolder, "patch");
120
126
- var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) });
127
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
121
+ var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) });
122
123
var doc = GetExtractPatchXml(patchPath);
124
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -153,8 +147,7 @@ namespace WixToolsetTest.CoreIntegration
147
var baseFolder = fs.GetFolder();
148
var tempFolderPatch = Path.Combine(baseFolder, "patch");
149
156
- var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) }, updateBindpaths: new[] { Path.Combine(this.templateSourceFolder, ".update-data-alternative") });
157
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
150
+ var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) }, updateBindpaths: new[] { Path.Combine(this.templateSourceFolder, ".update-data-alternative") });
151
152
var doc = GetExtractPatchXml(patchPath);
153
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -186,8 +179,7 @@ namespace WixToolsetTest.CoreIntegration
179
CreateAdminImage(this.templateBaselinePdb, adminBaselineFolder);
180
CreateAdminImage(this.templateUpdatePdb, adminUpdateFolder);
181
189
- var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { adminBaselineFolder, adminUpdateFolder });
190
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
182
+ var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { adminBaselineFolder, adminUpdateFolder });
183
184
var doc = GetExtractPatchXml(patchPath);
185
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -214,8 +206,7 @@ namespace WixToolsetTest.CoreIntegration
206
{
207
var tempFolder = fs.GetFolder();
208
217
- var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true);
218
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
209
+ var patchPath = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true);
210
211
var doc = GetExtractPatchXml(patchPath);
212
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -243,10 +234,9 @@ namespace WixToolsetTest.CoreIntegration
234
var tempFolderUpdate = Path.Combine(baseFolder, "update");
235
var tempFolderPatch = Path.Combine(baseFolder, "patch");
236
246
- var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
247
- var update1Pdb = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
248
- var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(update1Pdb) });
249
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
237
+ var baselinePath = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
238
+ var update1Path = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
239
+ var patchPath = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePath), Path.GetDirectoryName(update1Path) });
240
241
var doc = GetExtractPatchXml(patchPath);
242
WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(TargetProductCodeName).Value);
@@ -286,8 +276,7 @@ namespace WixToolsetTest.CoreIntegration
276
var tempFolderUpdate = Path.Combine(baseFolder, "update");
277
var tempFolderPatch = Path.Combine(baseFolder, "patch");
278
289
- var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true, warningsAsErrors: false);
290
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
279
+ var patchPath = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true, warningsAsErrors: false);
280
281
var doc = GetExtractPatchXml(patchPath);
282
WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(TargetProductCodeName).Value);
@@ -309,10 +298,9 @@ namespace WixToolsetTest.CoreIntegration
298
var tempFolderUpdate = Path.Combine(baseFolder, "update");
299
var tempFolderPatch = Path.Combine(baseFolder, "patch");
300
312
- var baselinePdb = BuildMsi("Baseline.msi", sourceFolder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
313
- var updatePdb = BuildMsi("Update.msi", sourceFolder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
314
- var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(updatePdb) }, hasNoFiles: true);
315
- var patchPath = Path.ChangeExtension(patchPdb, ".msp");
301
+ var baselinePath = BuildMsi("Baseline.msi", sourceFolder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
302
+ var updatePath = BuildMsi("Update.msi", sourceFolder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
303
+ var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePath), Path.GetDirectoryName(updatePath) }, hasNoFiles: true);
304
305
var doc = GetExtractPatchXml(patchPath);
306
WixAssert.StringEqual("{7C871EC1-1F89-4850-A6A9-D7A4C21769F6}", doc.Root.Element(TargetProductCodeName).Value);
@@ -328,14 +316,18 @@ namespace WixToolsetTest.CoreIntegration
316
{
317
var tempFolder = fs.GetFolder();
318
331
- var baselinePdb = BuildMsi("Baseline.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.0", "A", "B");
332
- var updatePdb = BuildMsi("Update.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.1", "A", "B");
333
- var patchAPdb = BuildMsp("PatchA.msp", Path.Combine(folder, "PatchA"), tempFolder, "1.0.1", hasNoFiles: true);
334
- var patchBPdb = BuildMsp("PatchB.msp", Path.Combine(folder, "PatchB"), tempFolder, "1.0.1", hasNoFiles: true);
335
- var patchCPdb = BuildMsp("PatchC.msp", Path.Combine(folder, "PatchC"), tempFolder, "1.0.1", hasNoFiles: true);
336
- var bundleAPdb = BuildBundle("BundleA.exe", Path.Combine(folder, "BundleA"), tempFolder);
337
- var bundleBPdb = BuildBundle("BundleB.exe", Path.Combine(folder, "BundleB"), tempFolder);
338
- var bundleCPdb = BuildBundle("BundleC.exe", Path.Combine(folder, "BundleC"), tempFolder);
319
+ var baselinePath = BuildMsi("Baseline.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.0", "A", "B");
320
+ var updatePath = BuildMsi("Update.msi", Path.Combine(folder, "PackageA"), tempFolder, "1.0.1", "A", "B");
321
+ var patchAPath = BuildMsp("PatchA.msp", Path.Combine(folder, "PatchA"), tempFolder, "1.0.1", hasNoFiles: true);
322
+ var patchBPath = BuildMsp("PatchB.msp", Path.Combine(folder, "PatchB"), tempFolder, "1.0.1", hasNoFiles: true);
323
+ var patchCPath = BuildMsp("PatchC.msp", Path.Combine(folder, "PatchC"), tempFolder, "1.0.1", hasNoFiles: true);
324
+ var bundleAPath = BuildBundle("BundleA.exe", Path.Combine(folder, "BundleA"), tempFolder);
325
+ var bundleBPath = BuildBundle("BundleB.exe", Path.Combine(folder, "BundleB"), tempFolder);
326
+ var bundleCPath = BuildBundle("BundleC.exe", Path.Combine(folder, "BundleC"), tempFolder);
327
+
328
+ var bundleAPdb = Path.ChangeExtension(bundleAPath, ".wixpdb");
329
+ var bundleBPdb = Path.ChangeExtension(bundleBPath, ".wixpdb");
330
+ var bundleCPdb = Path.ChangeExtension(bundleCPath, ".wixpdb");
331
332
VerifyPatchTargetCodesInBurnManifest(bundleAPdb, new[]
333
{
@@ -359,10 +351,11 @@ namespace WixToolsetTest.CoreIntegration
351
{
352
var tempFolder = fs.GetFolder();
353
362
- var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
363
- var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
364
- var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1");
365
- var bundleAPdb = BuildBundle("BundleA.exe", Path.Combine(folder, "BundleA"), tempFolder);
354
+ var baselinePath = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
355
+ var update1Path = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
356
+ var patchPath = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1");
357
+ var bundleAPath = BuildBundle("BundleA.exe", Path.Combine(folder, "BundleA"), tempFolder);
358
+ var bundleAPdb = Path.ChangeExtension(bundleAPath, ".wixpdb");
359
360
using (var wixOutput = WixOutput.Read(bundleAPdb))
361
{
@@ -407,7 +400,7 @@ namespace WixToolsetTest.CoreIntegration
400
401
result.AssertSuccess();
402
410
- return Path.ChangeExtension(outputPath, ".wixpdb");
403
+ return outputPath;
404
}
405
406
private static string BuildMst(string transformName, string baseFolder, string templateBaselinePdb, string templateUpdatePdb)
@@ -431,9 +424,9 @@ namespace WixToolsetTest.CoreIntegration
424
return outputPath;
425
}
426
434
- private static string BuildMsp(string outputName, string sourceFolder, string baseFolder, string defineV, IEnumerable<string> bindpaths = null, IEnumerable<string> targetBindpaths = null, IEnumerable<string> updateBindpaths = null, bool hasNoFiles = false, bool warningsAsErrors = true)
427
+ private static WixRunnerResult BuildMspForResult(string outputName, string sourceFolder, string baseFolder, string defineV, IEnumerable<string> bindpaths = null, IEnumerable<string> targetBindpaths = null, IEnumerable<string> updateBindpaths = null, bool hasNoFiles = false, bool warningsAsErrors = true)
428
{
436
- var outputPath = Path.Combine(baseFolder, Path.Combine("bin", outputName));
429
+ var outputPath = Path.Combine(baseFolder, "bin", outputName);
430
431
var args = new List<string>
432
{
@@ -466,9 +459,16 @@ namespace WixToolsetTest.CoreIntegration
459
460
var result = WixRunner.Execute(warningsAsErrors, args.ToArray());
461
462
+ return result;
463
+ }
464
+
465
+ private static string BuildMsp(string outputName, string sourceFolder, string baseFolder, string defineV, IEnumerable<string> bindpaths = null, IEnumerable<string> targetBindpaths = null, IEnumerable<string> updateBindpaths = null, bool hasNoFiles = false, bool warningsAsErrors = true)
466
+ {
467
+ var result = BuildMspForResult(outputName, sourceFolder, baseFolder, defineV, bindpaths, targetBindpaths, updateBindpaths, hasNoFiles, warningsAsErrors);
468
+
469
result.AssertSuccess();
470
471
- return Path.ChangeExtension(outputPath, ".wixpdb");
471
+ return Path.Combine(baseFolder, "bin", outputName);
472
}
473
474
private static string BuildBundle(string outputName, string sourceFolder, string baseFolder)
@@ -488,7 +488,7 @@ namespace WixToolsetTest.CoreIntegration
488
489
result.AssertSuccess();
490
491
- return Path.ChangeExtension(outputPath, ".wixpdb");
491
+ return outputPath;
492
}
493
494
private static void CreateAdminImage(string msiPath, string targetDir)