@joebigelow / wix-1 / commits / db2fe655

Build some common products to share across multiple patch tests

Rob Mensching committed Sep 3, 2022 at 16:05 UTC db2fe6554f449a108b77cd3d2c7f30a68d54ddc2
7 files changed +40 -80
src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+32 -19
@@ -19,9 +19,34 @@ namespace WixToolsetTest.CoreIntegration
19 using WixToolset.Data.Burn;
20 using Xunit;
21
22 - public class PatchFixture
22 + public class PatchFixture : IDisposable
23 {
24 private static readonly XNamespace PatchNamespace = "http://www.microsoft.com/msi/patch_applicability.xsd";
25 + private readonly DisposableFileSystem tempFileSystem;
26 + private readonly string tempBaseFolder;
27 + private readonly string templateBaselinePdb;
28 + private readonly string templateUpdatePdb;
29 + private readonly string templateUpdateNoFilesChangedPdb;
30 +
31 + public PatchFixture()
32 + {
33 + this.tempFileSystem = new DisposableFileSystem();
34 + this.tempBaseFolder = this.tempFileSystem.GetFolder();
35 +
36 + var templateSourceFolder = TestData.Get(@"TestData", "PatchTemplatePackage");
37 + var tempFolderBaseline = Path.Combine(this.tempBaseFolder, "PatchTemplatePackage", "baseline");
38 + var tempFolderUpdate = Path.Combine(this.tempBaseFolder, "PatchTemplatePackage", "update");
39 + var tempFolderUpdateNoFileChanges = Path.Combine(this.tempBaseFolder, "PatchTemplatePackage", "updatewithoutfilechanges");
40 +
41 + this.templateBaselinePdb = BuildMsi("Baseline.msi", templateSourceFolder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0", new[] { Path.Combine(templateSourceFolder, ".baseline-data") });
42 + this.templateUpdatePdb = BuildMsi("Update.msi", templateSourceFolder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1", new[] { Path.Combine(templateSourceFolder, ".update-data") });
43 + this.templateUpdateNoFilesChangedPdb = BuildMsi("Update.msi", templateSourceFolder, tempFolderUpdateNoFileChanges, "1.0.1", "1.0.1", "1.0.1", new[] { Path.Combine(templateSourceFolder, ".baseline-data") });
44 + }
45 +
46 + public void Dispose()
47 + {
48 + this.tempFileSystem.Dispose();
49 + }
50
51 [Fact]
52 public void CanBuildSimplePatch()
@@ -58,29 +83,24 @@ namespace WixToolsetTest.CoreIntegration
83 [Fact]
84 public void CanBuildSimplePatchWithFileChanges()
85 {
61 - var folder = TestData.Get(@"TestData", "PatchWithFileChanges");
86 + var sourceFolder = TestData.Get(@"TestData", "PatchWithFileChanges");
87
88 using (var fs = new DisposableFileSystem())
89 {
90 var baseFolder = fs.GetFolder();
66 - var tempFolderBaseline = Path.Combine(baseFolder, "baseline");
67 - var tempFolderUpdate = Path.Combine(baseFolder, "update");
91 var tempFolderPatch = Path.Combine(baseFolder, "patch");
92
70 - var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0", new[] { Path.Combine(folder, ".baseline-data") });
71 - var update1Pdb = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1", new[] { Path.Combine(folder, ".update-data") });
72 - var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(update1Pdb) });
93 + var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) });
94 var patchPath = Path.ChangeExtension(patchPdb, ".msp");
95
96 var doc = GetExtractPatchXml(patchPath);
76 - WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value);
97 + WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value);
98
99 var names = Query.GetSubStorageNames(patchPath);
100 WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names);
101
102 var cab = Path.Combine(baseFolder, "foo.cab");
103 Query.ExtractStream(patchPath, "foo.cab", cab);
83 - Assert.True(File.Exists(cab));
104
105 var files = Query.GetCabinetFiles(cab);
106 var file = files.Single();
@@ -99,16 +119,11 @@ namespace WixToolsetTest.CoreIntegration
119 {
120 var tempFolder = fs.GetFolder();
121
102 - var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
103 - var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
104 - var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", hasNoFiles: true);
122 + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true);
123 var patchPath = Path.ChangeExtension(patchPdb, ".msp");
124
107 - Assert.True(File.Exists(baselinePdb));
108 - Assert.True(File.Exists(update1Pdb));
109 -
125 var doc = GetExtractPatchXml(patchPath);
111 - WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value);
126 + WixAssert.StringEqual("{11111111-2222-3333-4444-555555555555}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value);
127
128 var names = Query.GetSubStorageNames(patchPath);
129 WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names);
@@ -178,9 +193,7 @@ namespace WixToolsetTest.CoreIntegration
193 var tempFolderUpdate = Path.Combine(baseFolder, "update");
194 var tempFolderPatch = Path.Combine(baseFolder, "patch");
195
181 - var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
182 - var update1Pdb = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
183 - var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(update1Pdb) }, hasNoFiles: true, warningsAsErrors: false);
196 + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true, warningsAsErrors: false);
197 var patchPath = Path.ChangeExtension(patchPdb, ".msp");
198
199 var doc = GetExtractPatchXml(patchPath);
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchBaselineIdTooLong/Package.wxs deleted
-28
@@ -1,28 +0,0 @@
1 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 - <Package Name="~Test Package" Version="$(var.V)" Manufacturer="Example Corporation" Language="1033" UpgradeCode="{6B8097B9-A5D0-4BDE-B21E-AF6622DDCA01}" Scope="perMachine" ProductCode="{11111111-2222-3333-4444-555555555555}">
3 - <MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
4 - <MediaTemplate EmbedCab="yes" />
5 -
6 - <CustomAction Id="CAFromExtension" DllEntry="DoesntExist" BinaryRef="BinFromWir" />
7 -
8 - <StandardDirectory Id="ProgramFilesFolder">
9 - <Directory Id="INSTALLFOLDER" Name="~Test App" />
10 - </StandardDirectory>
11 -
12 - <Feature Id="Main">
13 - <ComponentGroupRef Id="Components" />
14 - </Feature>
15 - </Package>
16 -
17 - <Fragment>
18 - <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
19 - <Component>
20 - <File Source="$(sys.SOURCEFILEPATH)" />
21 - </Component>
22 -
23 - <Component>
24 - <RegistryValue Root="HKLM" Key="SOFTWARE\!(bind.property.ProductName)\Patch" Name="Version" Value="$(var.V)" />
25 - </Component>
26 - </ComponentGroup>
27 - </Fragment>
28 -</Wix>
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.baseline-data/A.txt renamed
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.update-data/A.txt renamed
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/Package.wxs renamed
+8 -5
@@ -1,13 +1,10 @@
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 - <Package Name="~Test Package" Version="$(V)" Manufacturer="Example Corporation" Language="1033" UpgradeCode="7d326855-e790-4a94-8611-5351f8321fca" Compressed="yes" Scope="perMachine" ProductCode="7d326855-e790-4a94-8611-5351f8321fca">
2 + <Package Name="~Patch Template Package" Version="$(V)" Manufacturer="Example Corporation" Language="1033" UpgradeCode="AAAAAAAA-BBBB-CCCC-DDDD-1234567890AB"
3 + Compressed="yes" Scope="perMachine" ProductCode="11111111-2222-3333-4444-555555555555">
4
5 <MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
6 <MediaTemplate EmbedCab="yes" />
7
7 - <StandardDirectory Id="ProgramFilesFolder">
8 - <Directory Id="INSTALLFOLDER" Name="~Test App" />
9 - </StandardDirectory>
10 -
8 <Feature Id="Main">
9 <ComponentGroupRef Id="Components" />
10 </Feature>
@@ -24,4 +21,10 @@
21 </Component>
22 </ComponentGroup>
23 </Fragment>
24 +
25 + <Fragment>
26 + <StandardDirectory Id="ProgramFilesFolder">
27 + <Directory Id="INSTALLFOLDER" Name="~Test App" />
28 + </StandardDirectory>
29 + </Fragment>
30 </Wix>
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt deleted
-1
@@ -1 +0,0 @@
1 -This is A v1.0.0
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs deleted
-27
@@ -1,27 +0,0 @@
1 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 - <Package Name="~Test Package" Version="$(V)" Manufacturer="Example Corporation" Language="1033" UpgradeCode="7d326855-e790-4a94-8611-5351f8321fca" Compressed="yes" Scope="perMachine" ProductCode="7d326855-e790-4a94-8611-5351f8321fca">
3 -
4 - <MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
5 - <MediaTemplate EmbedCab="yes" />
6 -
7 - <StandardDirectory Id="ProgramFilesFolder">
8 - <Directory Id="INSTALLFOLDER" Name="~Test App" />
9 - </StandardDirectory>
10 -
11 - <Feature Id="Main">
12 - <ComponentGroupRef Id="Components" />
13 - </Feature>
14 - </Package>
15 -
16 - <Fragment>
17 - <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
18 - <Component>
19 - <File Id="a.txt" Name="a.txt" Source="A.txt" />
20 - </Component>
21 -
22 - <Component>
23 - <RegistryValue Root="HKLM" Key="SOFTWARE\!(bind.property.ProductName)\Patch" Name="Version" Value="$(V)" />
24 - </Component>
25 - </ComponentGroup>
26 - </Fragment>
27 -</Wix>