diff options
| author | Rob Mensching <rob@firegiant.com> | 2022-09-02 15:31:30 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2022-09-23 09:50:52 -0700 |
| commit | 002dc6077477c6a7762f1fca225c2577913a2c82 (patch) | |
| tree | d3ab436d44621de1b4fbdf98872a8443ccb44ebb /src | |
| parent | d7d4243b78ca816bd6beb33b499a3b0c85b5a53d (diff) | |
| download | wix-002dc6077477c6a7762f1fca225c2577913a2c82.tar.gz wix-002dc6077477c6a7762f1fca225c2577913a2c82.tar.bz2 wix-002dc6077477c6a7762f1fca225c2577913a2c82.zip | |
Add simple patching test to verify file updates are included
Diffstat (limited to 'src')
5 files changed, 80 insertions, 0 deletions
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index 5bf770ac..334d03dc 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs | |||
| @@ -56,6 +56,41 @@ namespace WixToolsetTest.CoreIntegration | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | [Fact] | 58 | [Fact] |
| 59 | public void CanBuildSimplePatchWithFileChanges() | ||
| 60 | { | ||
| 61 | var folder = TestData.Get(@"TestData", "PatchWithFileChanges"); | ||
| 62 | |||
| 63 | using (var fs = new DisposableFileSystem()) | ||
| 64 | { | ||
| 65 | 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"); | ||
| 69 | |||
| 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) }); | ||
| 73 | var patchPath = Path.ChangeExtension(patchPdb, ".msp"); | ||
| 74 | |||
| 75 | var doc = GetExtractPatchXml(patchPath); | ||
| 76 | WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value); | ||
| 77 | |||
| 78 | var names = Query.GetSubStorageNames(patchPath); | ||
| 79 | WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); | ||
| 80 | |||
| 81 | var cab = Path.Combine(baseFolder, "foo.cab"); | ||
| 82 | Query.ExtractStream(patchPath, "foo.cab", cab); | ||
| 83 | Assert.True(File.Exists(cab)); | ||
| 84 | |||
| 85 | var files = Query.GetCabinetFiles(cab); | ||
| 86 | var file = files.Single(); | ||
| 87 | WixAssert.StringEqual("a.txt", file.Name); | ||
| 88 | var contents = file.OpenText().ReadToEnd(); | ||
| 89 | WixAssert.StringEqual("This is A v1.0.1\r\n", contents); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | [Fact] | ||
| 59 | public void CanBuildSimplePatchWithNoFileChanges() | 94 | public void CanBuildSimplePatchWithNoFileChanges() |
| 60 | { | 95 | { |
| 61 | var folder = TestData.Get(@"TestData", "PatchNoFileChanges"); | 96 | var folder = TestData.Get(@"TestData", "PatchNoFileChanges"); |
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 new file mode 100644 index 00000000..6fd385bd --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt | |||
| @@ -0,0 +1 @@ | |||
| This is A v1.0.0 | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt new file mode 100644 index 00000000..f7ec8b4e --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt | |||
| @@ -0,0 +1 @@ | |||
| This is A v1.0.1 | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs new file mode 100644 index 00000000..dab959d5 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs | |||
| @@ -0,0 +1,27 @@ | |||
| 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> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Patch.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Patch.wxs new file mode 100644 index 00000000..889b1220 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Patch.wxs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'> | ||
| 2 | <Patch | ||
| 3 | AllowRemoval="yes" | ||
| 4 | DisplayName="~Test Patch v$(V)" | ||
| 5 | Description="~Test Small Update Patch v$(V)" | ||
| 6 | MoreInfoURL="http://www.example.com/" | ||
| 7 | Manufacturer="Example Corporation" | ||
| 8 | Classification="Update"> | ||
| 9 | |||
| 10 | <Media Id="1" Cabinet="foo.cab"> | ||
| 11 | <PatchBaseline Id="RTM" BaselineFile="Baseline.wixpdb" UpdateFile="Update.wixpdb" /> | ||
| 12 | </Media> | ||
| 13 | |||
| 14 | <PatchFamily Id='SequenceFamily' Version='$(V)' /> | ||
| 15 | </Patch> | ||
| 16 | </Wix> | ||
