@joebigelow / wix / commits / 6bcf25fe

Add failing test for patch from MSI that included a file from a wixext.

Sean Hall committed Mar 7, 2021 at 14:48 UTC 6bcf25fe37f0b4dc5f2f43720777e7ab0d26b030
3 files changed +70 -1
src/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+24 -1
@@ -2,6 +2,7 @@
2
3 namespace WixToolsetTest.CoreIntegration
4 {
5 + using System;
6 using System.Collections.Generic;
7 using System.ComponentModel;
8 using System.IO;
@@ -10,6 +11,7 @@ namespace WixToolsetTest.CoreIntegration
11 using System.Text;
12 using System.Xml;
13 using System.Xml.Linq;
14 + using Example.Extension;
15 using WixBuildTools.TestSupport;
16 using WixToolset.Core.TestPackage;
17 using WixToolset.Data;
@@ -84,6 +86,25 @@ namespace WixToolsetTest.CoreIntegration
86 }
87 }
88
89 + [Fact(Skip = "Test demonstrates failure")]
90 + public void CanBuildPatchFromProductWithFilesFromWixlib()
91 + {
92 + var folder = TestData.Get(@"TestData\PatchFromWixlib");
93 +
94 + using (var fs = new DisposableFileSystem())
95 + {
96 + var tempFolder = fs.GetFolder();
97 +
98 + var baselinePdb = BuildMsi("Baseline.msi", folder, tempFolder, "1.0.0", "1.0.0", "1.0.0");
99 + var update1Pdb = BuildMsi("Update.msi", folder, tempFolder, "1.0.1", "1.0.1", "1.0.1");
100 + var patchPdb = BuildMsp("Patch1.msp", folder, tempFolder, "1.0.1", hasNoFiles: true);
101 + var patchPath = Path.ChangeExtension(patchPdb, ".msp");
102 +
103 + Assert.True(File.Exists(baselinePdb));
104 + Assert.True(File.Exists(update1Pdb));
105 + }
106 + }
107 +
108 [Fact]
109 public void CanBuildBundleWithNonSpecificPatches()
110 {
@@ -164,6 +185,7 @@ namespace WixToolsetTest.CoreIntegration
185
186 private static string BuildMsi(string outputName, string sourceFolder, string baseFolder, string defineV, string defineA, string defineB)
187 {
188 + var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath);
189 var outputPath = Path.Combine(baseFolder, Path.Combine("bin", outputName));
190
191 var result = WixRunner.Execute(new[]
@@ -175,7 +197,8 @@ namespace WixToolsetTest.CoreIntegration
197 "-d", "B=" + defineB,
198 "-bindpath", Path.Combine(sourceFolder, ".data"),
199 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
178 - "-o", outputPath
200 + "-o", outputPath,
201 + "-ext", extensionPath,
202 });
203
204 result.AssertSuccess();
src/test/WixToolsetTest.CoreIntegration/TestData/PatchFromWixlib/Package.wxs new
+30
@@ -0,0 +1,30 @@
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="{7C871EC1-1F89-4850-A6A9-D7A4C21769F6}">
3 + <MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
4 + <MediaTemplate EmbedCab="yes" />
5 +
6 + <CustomAction Id="CAFromExtension" DllEntry="DoesntExist" BinaryRef="BinFromWir" />
7 +
8 + <Directory Id="TARGETDIR" Name="SourceDir">
9 + <Directory Id="ProgramFilesFolder">
10 + <Directory Id="INSTALLFOLDER" Name="~Test App" />
11 + </Directory>
12 + </Directory>
13 +
14 + <Feature Id="Main">
15 + <ComponentGroupRef Id="Components" />
16 + </Feature>
17 + </Package>
18 +
19 + <Fragment>
20 + <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
21 + <Component>
22 + <File Source="$(sys.SOURCEFILEPATH)" />
23 + </Component>
24 +
25 + <Component>
26 + <RegistryValue Root="HKLM" Key="SOFTWARE\!(bind.property.ProductName)\Patch" Name="Version" Value="$(var.V)" />
27 + </Component>
28 + </ComponentGroup>
29 + </Fragment>
30 +</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/PatchFromWixlib/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$(var.V)"
5 + Description="~Test Small Update Patch v$(var.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='$(var.V)' />
15 + </Patch>
16 +</Wix>