diff options
author | Rob Mensching <rob@firegiant.com> | 2022-09-03 16:05:40 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-09-23 09:50:52 -0700 |
commit | db2fe6554f449a108b77cd3d2c7f30a68d54ddc2 (patch) | |
tree | f81939504fcc564feda01ec6f76d07652aae65fb | |
parent | 7074da16f85458e535f38c68830ee56361f119f6 (diff) | |
download | wix-db2fe6554f449a108b77cd3d2c7f30a68d54ddc2.tar.gz wix-db2fe6554f449a108b77cd3d2c7f30a68d54ddc2.tar.bz2 wix-db2fe6554f449a108b77cd3d2c7f30a68d54ddc2.zip |
Build some common products to share across multiple patch tests
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs | 51 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchBaselineIdTooLong/Package.wxs | 28 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.baseline-data/A.txt (renamed from src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt) | 0 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.update-data/A.txt (renamed from src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt) | 0 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/Package.wxs (renamed from src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs) | 13 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt | 1 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs | 27 |
7 files changed, 40 insertions, 80 deletions
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index aa1ea6b3..a8aff8d8 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs | |||
@@ -19,9 +19,34 @@ namespace WixToolsetTest.CoreIntegration | |||
19 | using WixToolset.Data.Burn; | 19 | using WixToolset.Data.Burn; |
20 | using Xunit; | 20 | using Xunit; |
21 | 21 | ||
22 | public class PatchFixture | 22 | public class PatchFixture : IDisposable |
23 | { | 23 | { |
24 | private static readonly XNamespace PatchNamespace = "http://www.microsoft.com/msi/patch_applicability.xsd"; | 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 | } | ||
25 | 50 | ||
26 | [Fact] | 51 | [Fact] |
27 | public void CanBuildSimplePatch() | 52 | public void CanBuildSimplePatch() |
@@ -58,29 +83,24 @@ namespace WixToolsetTest.CoreIntegration | |||
58 | [Fact] | 83 | [Fact] |
59 | public void CanBuildSimplePatchWithFileChanges() | 84 | public void CanBuildSimplePatchWithFileChanges() |
60 | { | 85 | { |
61 | var folder = TestData.Get(@"TestData", "PatchWithFileChanges"); | 86 | var sourceFolder = TestData.Get(@"TestData", "PatchWithFileChanges"); |
62 | 87 | ||
63 | using (var fs = new DisposableFileSystem()) | 88 | using (var fs = new DisposableFileSystem()) |
64 | { | 89 | { |
65 | var baseFolder = fs.GetFolder(); | 90 | var baseFolder = fs.GetFolder(); |
66 | var tempFolderBaseline = Path.Combine(baseFolder, "baseline"); | ||
67 | var tempFolderUpdate = Path.Combine(baseFolder, "update"); | ||
68 | var tempFolderPatch = Path.Combine(baseFolder, "patch"); | 91 | var tempFolderPatch = Path.Combine(baseFolder, "patch"); |
69 | 92 | ||
70 | var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0", new[] { Path.Combine(folder, ".baseline-data") }); | 93 | var patchPdb = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdatePdb) }); |
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) }); | ||
73 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); | 94 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); |
74 | 95 | ||
75 | var doc = GetExtractPatchXml(patchPath); | 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); |
77 | 98 | ||
78 | var names = Query.GetSubStorageNames(patchPath); | 99 | var names = Query.GetSubStorageNames(patchPath); |
79 | WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); | 100 | WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); |
80 | 101 | ||
81 | var cab = Path.Combine(baseFolder, "foo.cab"); | 102 | var cab = Path.Combine(baseFolder, "foo.cab"); |
82 | Query.ExtractStream(patchPath, "foo.cab", cab); | 103 | Query.ExtractStream(patchPath, "foo.cab", cab); |
83 | Assert.True(File.Exists(cab)); | ||
84 | 104 | ||
85 | var files = Query.GetCabinetFiles(cab); | 105 | var files = Query.GetCabinetFiles(cab); |
86 | var file = files.Single(); | 106 | var file = files.Single(); |
@@ -99,16 +119,11 @@ namespace WixToolsetTest.CoreIntegration | |||
99 | { | 119 | { |
100 | var tempFolder = fs.GetFolder(); | 120 | var tempFolder = fs.GetFolder(); |
101 | 121 | ||
102 | var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0"); | 122 | var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(this.templateBaselinePdb), Path.GetDirectoryName(this.templateUpdateNoFilesChangedPdb) }, hasNoFiles: true); |
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); | ||
105 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); | 123 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); |
106 | 124 | ||
107 | Assert.True(File.Exists(baselinePdb)); | ||
108 | Assert.True(File.Exists(update1Pdb)); | ||
109 | |||
110 | var doc = GetExtractPatchXml(patchPath); | 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); |
112 | 127 | ||
113 | var names = Query.GetSubStorageNames(patchPath); | 128 | var names = Query.GetSubStorageNames(patchPath); |
114 | WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); | 129 | WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); |
@@ -178,9 +193,7 @@ namespace WixToolsetTest.CoreIntegration | |||
178 | var tempFolderUpdate = Path.Combine(baseFolder, "update"); | 193 | var tempFolderUpdate = Path.Combine(baseFolder, "update"); |
179 | var tempFolderPatch = Path.Combine(baseFolder, "patch"); | 194 | var tempFolderPatch = Path.Combine(baseFolder, "patch"); |
180 | 195 | ||
181 | var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0"); | 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); |
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); | ||
184 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); | 197 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); |
185 | 198 | ||
186 | var doc = GetExtractPatchXml(patchPath); | 199 | var doc = GetExtractPatchXml(patchPath); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchBaselineIdTooLong/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchBaselineIdTooLong/Package.wxs deleted file mode 100644 index 1c8a34c5..00000000 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchBaselineIdTooLong/Package.wxs +++ /dev/null | |||
@@ -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> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.baseline-data/A.txt index 6fd385bd..6fd385bd 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.baseline-data/A.txt | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.update-data/A.txt index f7ec8b4e..f7ec8b4e 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/.update-data/A.txt | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/Package.wxs index dab959d5..4d98db90 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchTemplatePackage/Package.wxs | |||
@@ -1,13 +1,10 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 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"> | ||
3 | 4 | ||
4 | <MajorUpgrade DowngradeErrorMessage="Newer version already installed." /> | 5 | <MajorUpgrade DowngradeErrorMessage="Newer version already installed." /> |
5 | <MediaTemplate EmbedCab="yes" /> | 6 | <MediaTemplate EmbedCab="yes" /> |
6 | 7 | ||
7 | <StandardDirectory Id="ProgramFilesFolder"> | ||
8 | <Directory Id="INSTALLFOLDER" Name="~Test App" /> | ||
9 | </StandardDirectory> | ||
10 | |||
11 | <Feature Id="Main"> | 8 | <Feature Id="Main"> |
12 | <ComponentGroupRef Id="Components" /> | 9 | <ComponentGroupRef Id="Components" /> |
13 | </Feature> | 10 | </Feature> |
@@ -24,4 +21,10 @@ | |||
24 | </Component> | 21 | </Component> |
25 | </ComponentGroup> | 22 | </ComponentGroup> |
26 | </Fragment> | 23 | </Fragment> |
24 | |||
25 | <Fragment> | ||
26 | <StandardDirectory Id="ProgramFilesFolder"> | ||
27 | <Directory Id="INSTALLFOLDER" Name="~Test App" /> | ||
28 | </StandardDirectory> | ||
29 | </Fragment> | ||
27 | </Wix> | 30 | </Wix> |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt deleted file mode 100644 index 6fd385bd..00000000 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | This is A v1.0.0 | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs deleted file mode 100644 index dab959d5..00000000 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs +++ /dev/null | |||
@@ -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> | ||