aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-02-27 16:28:42 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-03-02 15:50:47 -0600
commited20ef6dc8caa5d585c1a715ff4ba577687bf291 (patch)
treeac457c8d3fe13578b495504bfd4c458897ce3547
parent263c62069df0f154001915cca00d6d4926f2fbb5 (diff)
downloadwix-ed20ef6dc8caa5d585c1a715ff4ba577687bf291.tar.gz
wix-ed20ef6dc8caa5d585c1a715ff4ba577687bf291.tar.bz2
wix-ed20ef6dc8caa5d585c1a715ff4ba577687bf291.zip
Add failing tests for package description and packages sharing payloads
In Core projects, treat warnings as errors.
-rw-r--r--src/Custom.Build.props6
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs9
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs6
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs129
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomPackageDescription/CustomPackageDescription.wxs12
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs18
7 files changed, 176 insertions, 5 deletions
diff --git a/src/Custom.Build.props b/src/Custom.Build.props
new file mode 100644
index 00000000..889fb62e
--- /dev/null
+++ b/src/Custom.Build.props
@@ -0,0 +1,6 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2<Project>
3 <PropertyGroup Condition="'$(Configuration)'=='Release'">
4 <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5 </PropertyGroup>
6</Project>
diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
index f85a5b62..a24137f3 100644
--- a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
@@ -211,7 +211,9 @@ namespace WixToolset.Core.Burn.Bundles
211 211
212 private void WritePayloadInfo(XmlTextWriter writer) 212 private void WritePayloadInfo(XmlTextWriter writer)
213 { 213 {
214 var payloadSymbols = this.Section.Symbols.OfType<WixBundlePayloadSymbol>(); 214 // TODO: check v3 - should this be only include package payloads or include all non-UX container payloads?
215 var payloadSymbols = this.Section.Symbols.OfType<WixBundlePayloadSymbol>()
216 .Where(p => !String.IsNullOrEmpty(p.PackageRef));
215 217
216 foreach (var payloadSymbol in payloadSymbols) 218 foreach (var payloadSymbol in payloadSymbols)
217 { 219 {
@@ -219,10 +221,7 @@ namespace WixToolset.Core.Burn.Bundles
219 221
220 writer.WriteAttributeString("Payload", payloadSymbol.Id.Id); 222 writer.WriteAttributeString("Payload", payloadSymbol.Id.Id);
221 223
222 if (!String.IsNullOrEmpty(payloadSymbol.PackageRef)) 224 writer.WriteAttributeString("Package", payloadSymbol.PackageRef);
223 {
224 writer.WriteAttributeString("Package", payloadSymbol.PackageRef);
225 }
226 225
227 if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef)) 226 if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef))
228 { 227 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
index 056b129b..7d75d74c 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
@@ -569,6 +569,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
569 /// </summary> 569 /// </summary>
570 /// <param name="actionSymbol">The action symbol to be sequenced.</param> 570 /// <param name="actionSymbol">The action symbol to be sequenced.</param>
571 /// <param name="requiredActionSymbols">Collection of actions which must be included.</param> 571 /// <param name="requiredActionSymbols">Collection of actions which must be included.</param>
572 /// <param name="firstReference">A dictionary used for detecting cyclic references among action symbols.</param>
572 private void SequenceActionSymbol(WixActionSymbol actionSymbol, Dictionary<string, WixActionSymbol> requiredActionSymbols, Dictionary<WixActionSymbol, WixActionSymbol> firstReference) 573 private void SequenceActionSymbol(WixActionSymbol actionSymbol, Dictionary<string, WixActionSymbol> requiredActionSymbols, Dictionary<WixActionSymbol, WixActionSymbol> firstReference)
573 { 574 {
574 var after = false; 575 var after = false;
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
index 0660dd7b..2cc9a39e 100644
--- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
@@ -3,6 +3,7 @@
3namespace WixToolsetTest.CoreIntegration 3namespace WixToolsetTest.CoreIntegration
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic;
6 using System.IO; 7 using System.IO;
7 using System.Linq; 8 using System.Linq;
8 using System.Text; 9 using System.Text;
@@ -115,6 +116,11 @@ namespace WixToolsetTest.CoreIntegration
115 Assert.Equal($"<Registration Id='{bundleSymbol.BundleId}' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='{bundleSymbol.BundleId}'>" + 116 Assert.Equal($"<Registration Id='{bundleSymbol.BundleId}' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='{bundleSymbol.BundleId}'>" +
116 "<Arp Register='yes' DisplayName='~TestBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' />" + 117 "<Arp Register='yes' DisplayName='~TestBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' />" +
117 "</Registration>", registrationElement.GetTestXml()); 118 "</Registration>", registrationElement.GetTestXml());
119
120 var msiPayloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload[@Id='test.msi']");
121 var msiPayload = (XmlNode)Assert.Single(msiPayloads);
122 Assert.Equal("<Payload Id='test.msi' FilePath='test.msi' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a0' Container='WixAttachedContainer' />",
123 msiPayload.GetTestXml(new Dictionary<string, List<string>>() { { "Payload", new List<string> { "FileSize", "Hash" } } }));
118 } 124 }
119 125
120 var manifestResource = new Resource(ResourceType.Manifest, "#1", 1033); 126 var manifestResource = new Resource(ResourceType.Manifest, "#1", 1033);
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
index ae83150a..3829cdf0 100644
--- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
@@ -51,6 +51,93 @@ namespace WixToolsetTest.CoreIntegration
51 } 51 }
52 } 52 }
53 53
54 [Fact(Skip = "Test demonstrates failure")]
55 public void PopulatesBAManifestWithPackageInformation()
56 {
57 var folder = TestData.Get(@"TestData");
58
59 using (var fs = new DisposableFileSystem())
60 {
61 var baseFolder = fs.GetFolder();
62 var intermediateFolder = Path.Combine(baseFolder, "obj");
63 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
64 var baFolderPath = Path.Combine(baseFolder, "ba");
65 var extractFolderPath = Path.Combine(baseFolder, "extract");
66
67 var result = WixRunner.Execute(false, new[]
68 {
69 "build",
70 Path.Combine(folder, "CustomPackageDescription", "CustomPackageDescription.wxs"),
71 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
72 "-bindpath", Path.Combine(folder, ".Data"),
73 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
74 "-intermediateFolder", intermediateFolder,
75 "-o", bundlePath
76 });
77
78 result.AssertSuccess();
79
80 Assert.True(File.Exists(bundlePath));
81
82 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
83 extractResult.AssertSuccess();
84
85 var packageElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPackageProperties");
86 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
87 {
88 { "WixPackageProperties", new List<string> { "DownloadSize", "PackageSize", "InstalledSize", "Version" } },
89 };
90 Assert.Equal(3, packageElements.Count);
91 Assert.Equal("<WixPackageProperties Package='burn.exe' Vital='yes' DisplayName='Windows Installer XML Toolset' Description='WiX Toolset Bootstrapper' DownloadSize='*' PackageSize='*' InstalledSize='*' PackageType='Exe' Permanent='yes' LogPathVariable='WixBundleLog_burn.exe' RollbackLogPathVariable='WixBundleRollbackLog_burn.exe' Compressed='yes' Version='*' Cache='yes' />", packageElements[0].GetTestXml(ignoreAttributesByElementName));
92 Assert.Equal("<WixPackageProperties Package='RemotePayloadExe' Vital='yes' DisplayName='Override RemotePayload display name' Description='Override RemotePayload description' DownloadSize='1' PackageSize='1' InstalledSize='1' PackageType='Exe' Permanent='yes' LogPathVariable='WixBundleLog_RemotePayloadExe' RollbackLogPathVariable='WixBundleRollbackLog_RemotePayloadExe' Compressed='no' Version='1.0.0.0' Cache='yes' />", packageElements[1].GetTestXml());
93 Assert.Equal("<WixPackageProperties Package='calc.exe' Vital='yes' DisplayName='Override harvested display name' Description='Override harvested description' DownloadSize='*' PackageSize='*' InstalledSize='*' PackageType='Exe' Permanent='yes' LogPathVariable='WixBundleLog_calc.exe' RollbackLogPathVariable='WixBundleRollbackLog_calc.exe' Compressed='yes' Version='*' Cache='yes' />", packageElements[2].GetTestXml(ignoreAttributesByElementName));
94 }
95 }
96
97 [Fact(Skip = "Test demonstrates failure")]
98 public void PopulatesBAManifestWithPayloadInformation()
99 {
100 var folder = TestData.Get(@"TestData");
101
102 using (var fs = new DisposableFileSystem())
103 {
104 var baseFolder = fs.GetFolder();
105 var intermediateFolder = Path.Combine(baseFolder, "obj");
106 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
107 var baFolderPath = Path.Combine(baseFolder, "ba");
108 var extractFolderPath = Path.Combine(baseFolder, "extract");
109
110 var result = WixRunner.Execute(false, new[]
111 {
112 "build",
113 Path.Combine(folder, "SharedPayloadsBetweenPackages", "SharedPayloadsBetweenPackages.wxs"),
114 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
115 "-bindpath", Path.Combine(folder, ".Data"),
116 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
117 "-intermediateFolder", intermediateFolder,
118 "-o", bundlePath
119 });
120
121 result.AssertSuccess();
122
123 Assert.True(File.Exists(bundlePath));
124
125 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
126 extractResult.AssertSuccess();
127
128 var payloadElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPayloadProperties");
129 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
130 {
131 { "WixPayloadProperties", new List<string> { "Size" } },
132 };
133 Assert.Equal(4, payloadElements.Count);
134 Assert.Equal("<WixPayloadProperties Payload='credwiz.exe' Package='credwiz.exe' Container='WixAttachedContainer' Name='credwiz.exe' Size='*' LayoutOnly='no' />", payloadElements[0].GetTestXml(ignoreAttributesByElementName));
135 Assert.Equal("<WixPayloadProperties Payload='payue_e5DuhsDGlzJxWYPhqr6S7rkc' Package='credwiz.exe' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[1].GetTestXml(ignoreAttributesByElementName));
136 Assert.Equal("<WixPayloadProperties Payload='cscript.exe' Package='cscript.exe' Container='WixAttachedContainer' Name='cscript.exe' Size='*' LayoutOnly='no' />", payloadElements[2].GetTestXml(ignoreAttributesByElementName));
137 Assert.Equal("<WixPayloadProperties Payload='payue_e5DuhsDGlzJxWYPhqr6S7rkc' Package='cscript.exe' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[3].GetTestXml(ignoreAttributesByElementName));
138 }
139 }
140
54 [Fact] 141 [Fact]
55 public void PopulatesBEManifestWithBundleExtensionBundleCustomData() 142 public void PopulatesBEManifestWithBundleExtensionBundleCustomData()
56 { 143 {
@@ -191,6 +278,48 @@ namespace WixToolsetTest.CoreIntegration
191 } 278 }
192 } 279 }
193 280
281 [Fact(Skip = "Test demonstrates failure")]
282 public void PopulatesManifestWithExePackages()
283 {
284 var folder = TestData.Get(@"TestData");
285
286 using (var fs = new DisposableFileSystem())
287 {
288 var baseFolder = fs.GetFolder();
289 var intermediateFolder = Path.Combine(baseFolder, "obj");
290 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
291 var baFolderPath = Path.Combine(baseFolder, "ba");
292 var extractFolderPath = Path.Combine(baseFolder, "extract");
293
294 var result = WixRunner.Execute(false, new[]
295 {
296 "build",
297 Path.Combine(folder, "SharedPayloadsBetweenPackages", "SharedPayloadsBetweenPackages.wxs"),
298 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
299 "-bindpath", Path.Combine(folder, ".Data"),
300 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
301 "-intermediateFolder", intermediateFolder,
302 "-o", bundlePath
303 });
304
305 result.AssertSuccess();
306
307 Assert.True(File.Exists(bundlePath));
308
309 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
310 extractResult.AssertSuccess();
311
312 var exePackageElements = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:ExePackage");
313 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
314 {
315 { "ExePackage", new List<string> { "CacheId", "InstallSize", "Size" } },
316 };
317 Assert.Equal(2, exePackageElements.Count);
318 Assert.Equal("<ExePackage Id='credwiz.exe' Cache='yes' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='yes' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' LogPathVariable='WixBundleLog_credwiz.exe' RollbackLogPathVariable='WixBundleRollbackLog_credwiz.exe' DetectCondition='' InstallArguments='' UninstallArguments='' RepairArguments='' Repairable='no'><PayloadRef Id='credwiz.exe' /><PayloadRef Id='payue_e5DuhsDGlzJxWYPhqr6S7rkc' /></ExePackage>", exePackageElements[0].GetTestXml(ignoreAttributesByElementName));
319 Assert.Equal("<ExePackage Id='cscript.exe' Cache='yes' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='yes' Vital='yes' RollbackBoundaryBackward='WixDefaultBoundary' LogPathVariable='WixBundleLog_cscript.exe' RollbackLogPathVariable='WixBundleRollbackLog_cscript.exe' DetectCondition='' InstallArguments='' UninstallArguments='' RepairArguments='' Repairable='no'><PayloadRef Id='cscript.exe' /><PayloadRef Id='payue_e5DuhsDGlzJxWYPhqr6S7rkc' /></ExePackage>", exePackageElements[1].GetTestXml(ignoreAttributesByElementName));
320 }
321 }
322
194 [Fact] 323 [Fact]
195 public void PopulatesManifestWithSetVariables() 324 public void PopulatesManifestWithSetVariables()
196 { 325 {
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomPackageDescription/CustomPackageDescription.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomPackageDescription/CustomPackageDescription.wxs
new file mode 100644
index 00000000..db8b05f2
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomPackageDescription/CustomPackageDescription.wxs
@@ -0,0 +1,12 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <PackageGroup Id="BundlePackages">
5 <ExePackage SourceFile="burn.exe" Permanent="yes" />
6 <ExePackage Id="RemotePayloadExe" Name="fake.exe" Compressed="no" DownloadUrl="example.com" Description="Override RemotePayload description" DisplayName="Override RemotePayload display name" Permanent="yes">
7 <RemotePayload Description="RemotePayload description" Hash="a" ProductName="RemotePayload product name" Size="1" Version="1.0.0.0" />
8 </ExePackage>
9 <ExePackage SourceFile="C:\Windows\system32\calc.exe" Permanent="yes" Description="Override harvested description" DisplayName="Override harvested display name" />
10 </PackageGroup>
11 </Fragment>
12</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs
new file mode 100644
index 00000000..2588ffc1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <PackageGroup Id="BundlePackages">
5 <ExePackage SourceFile="C:\Windows\system32\credwiz.exe" Permanent="yes">
6 <PayloadGroupRef Id="SharedPayloads" />
7 </ExePackage>
8 <ExePackage SourceFile="C:\Windows\system32\cscript.exe" Permanent="yes">
9 <PayloadGroupRef Id="SharedPayloads" />
10 </ExePackage>
11 </PackageGroup>
12 </Fragment>
13 <Fragment>
14 <PayloadGroup Id="SharedPayloads">
15 <Payload SourceFile="$(sys.SOURCEFILEPATH)" />
16 </PayloadGroup>
17 </Fragment>
18</Wix>