Add test to verify patches without files work
Resolves wixtoolset/issues#4912
Rob Mensching committed
Mar 2, 2021 at 11:26 UTC
e362f93f9fa9ed4b174333d44fcda25790bc85e0
4 files changed
+74
src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+32
@@ -52,6 +52,38 @@ namespace WixToolsetTest.CoreIntegration
52
}
53
}
54
55
+ [Fact]
56
+ public void CanBuildSimplePatchWithNoFileChanges()
57
+ {
58
+ var folder = TestData.Get(@"TestData\PatchNoFileChanges");
59
+
60
+ using (var fs = new DisposableFileSystem())
61
+ {
62
+ var tempFolder = fs.GetFolder();
63
+
64
+ var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
65
+ var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
66
+ var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", hasNoFiles: true);
67
+ var patchPath = Path.ChangeExtension(patchPdb, ".msp");
68
+
69
+ Assert.True(File.Exists(baselinePdb));
70
+ Assert.True(File.Exists(update1Pdb));
71
+
72
+ var doc = GetExtractPatchXml(patchPath);
73
+ Assert.Equal("{7D326855-E790-4A94-8611-5351F8321FCA}", doc.Root.Element(PatchNamespace + "TargetProductCode").Value);
74
+
75
+ var names = Query.GetSubStorageNames(patchPath);
76
+ Assert.Equal(new[] { "#RTM.1", "RTM.1" }, names);
77
+
78
+ var cab = Path.Combine(tempFolder, "foo.cab");
79
+ Query.ExtractStream(patchPath, "foo.cab", cab);
80
+ Assert.True(File.Exists(cab));
81
+
82
+ var files = Query.GetCabinetFiles(cab);
83
+ Assert.Empty(files);
84
+ }
85
+ }
86
+
87
[Fact]
88
public void CanBuildBundleWithNonSpecificPatches()
89
{
src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/.data/A.txt
new
+1
@@ -0,0 +1 @@
1
+This is A v1.0.0
src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Package.wxs
new
+25
@@ -0,0 +1,25 @@
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
+ <Directory Id="INSTALLFOLDER" Name="ProgramFilesFolder:\~Test App" />
8
+
9
+ <Feature Id="Main">
10
+ <ComponentGroupRef Id="Components" />
11
+ </Feature>
12
+ </Package>
13
+
14
+ <Fragment>
15
+ <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
16
+ <Component>
17
+ <File Id="a.txt" Name="a.txt" Source="A.txt" />
18
+ </Component>
19
+
20
+ <Component>
21
+ <RegistryValue Root="HKLM" Key="SOFTWARE\!(bind.property.ProductName)\Patch" Name="Version" Value="$(V)" />
22
+ </Component>
23
+ </ComponentGroup>
24
+ </Fragment>
25
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/PatchNoFileChanges/Patch.wxs
new
+16
@@ -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>