From e362f93f9fa9ed4b174333d44fcda25790bc85e0 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 2 Mar 2021 11:26:55 -0800 Subject: Add test to verify patches without files work Resolves wixtoolset/issues#4912 --- .../WixToolsetTest.CoreIntegration/PatchFixture.cs | 32 ++++++++++++++++++++++ .../TestData/PatchNoFileChanges/.data/A.txt | 1 + .../TestData/PatchNoFileChanges/Package.wxs | 25 +++++++++++++++++ .../TestData/PatchNoFileChanges/Patch.wxs | 16 +++++++++++ 4 files changed, 74 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Patch.wxs diff --git a/src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index dda4ca28..788cc01f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs @@ -52,6 +52,38 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildSimplePatchWithNoFileChanges() + { + var folder = TestData.Get(@"TestData\PatchNoFileChanges"); + + using (var fs = new DisposableFileSystem()) + { + var tempFolder = fs.GetFolder(); + + var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0"); + var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1"); + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", hasNoFiles: true); + var patchPath = Path.ChangeExtension(patchPdb, ".msp"); + + Assert.True(File.Exists(baselinePdb)); + Assert.True(File.Exists(update1Pdb)); + + var doc = GetExtractPatchXml(patchPath); + Assert.Equal("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value); + + var names = Query.GetSubStorageNames(patchPath); + Assert.Equal(new[] { "#RTM.1", "RTM.1" }, names); + + var cab = Path.Combine(tempFolder, "foo.cab"); + Query.ExtractStream(patchPath, "foo.cab", cab); + Assert.True(File.Exists(cab)); + + var files = Query.GetCabinetFiles(cab); + Assert.Empty(files); + } + } + [Fact] public void CanBuildBundleWithNonSpecificPatches() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt new file mode 100644 index 00000000..6fd385bd --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt @@ -0,0 +1 @@ +This is A v1.0.0 diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs new file mode 100644 index 00000000..9d530376 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Patch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Patch.wxs new file mode 100644 index 00000000..889b1220 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Patch.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + -- cgit v1.2.3-55-g6feb