From 002dc6077477c6a7762f1fca225c2577913a2c82 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Sep 2022 15:31:30 -0700 Subject: Add simple patching test to verify file updates are included --- .../WixToolsetTest.CoreIntegration/PatchFixture.cs | 35 ++++++++++++++++++++++ .../PatchWithFileChanges/.baseline-data/A.txt | 1 + .../PatchWithFileChanges/.update-data/A.txt | 1 + .../TestData/PatchWithFileChanges/Package.wxs | 27 +++++++++++++++++ .../TestData/PatchWithFileChanges/Patch.wxs | 16 ++++++++++ 5 files changed, 80 insertions(+) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.baseline-data/A.txt create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/.update-data/A.txt create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Package.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithFileChanges/Patch.wxs (limited to 'src') 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 @@ -55,6 +55,41 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildSimplePatchWithFileChanges() + { + var folder = TestData.Get(@"TestData", "PatchWithFileChanges"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var tempFolderBaseline = Path.Combine(baseFolder, "baseline"); + var tempFolderUpdate = Path.Combine(baseFolder, "update"); + var tempFolderPatch = Path.Combine(baseFolder, "patch"); + + var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0", new[] { Path.Combine(folder, ".baseline-data") }); + var update1Pdb = BuildMsi("Update.msi", folder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1", new[] { Path.Combine(folder, ".update-data") }); + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePdb), Path.GetDirectoryName(update1Pdb) }); + var patchPath = Path.ChangeExtension(patchPdb, ".msp"); + + var doc = GetExtractPatchXml(patchPath); + WixAssert.StringEqual("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value); + + var names = Query.GetSubStorageNames(patchPath); + WixAssert.CompareLineByLine(new[] { "#RTM.1", "RTM.1" }, names); + + var cab = Path.Combine(baseFolder, "foo.cab"); + Query.ExtractStream(patchPath, "foo.cab", cab); + Assert.True(File.Exists(cab)); + + var files = Query.GetCabinetFiles(cab); + var file = files.Single(); + WixAssert.StringEqual("a.txt", file.Name); + var contents = file.OpenText().ReadToEnd(); + WixAssert.StringEqual("This is A v1.0.1\r\n", contents); + } + } + [Fact] public void CanBuildSimplePatchWithNoFileChanges() { 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + -- cgit v1.2.3-55-g6feb