diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-24 16:28:44 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-25 23:06:35 -0500 |
commit | f4709371fa21ca1d0c06e04d1b53c0b10bfafeed (patch) | |
tree | 622576e0b46b0cea56143fd707936f9635389bad /src/test | |
parent | 23de0a19bffe457916b0a45e07044650ace8f456 (diff) | |
download | wix-f4709371fa21ca1d0c06e04d1b53c0b10bfafeed.tar.gz wix-f4709371fa21ca1d0c06e04d1b53c0b10bfafeed.tar.bz2 wix-f4709371fa21ca1d0c06e04d1b53c0b10bfafeed.zip |
Perform more bundle validation during linking.
#5273, #6291, #6398
Diffstat (limited to 'src/test')
12 files changed, 280 insertions, 88 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index cc91d212..ab644080 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs | |||
@@ -10,6 +10,7 @@ namespace WixToolsetTest.CoreIntegration | |||
10 | using System.Xml; | 10 | using System.Xml; |
11 | using Example.Extension; | 11 | using Example.Extension; |
12 | using WixBuildTools.TestSupport; | 12 | using WixBuildTools.TestSupport; |
13 | using WixToolset.Core; | ||
13 | using WixToolset.Core.Burn; | 14 | using WixToolset.Core.Burn; |
14 | using WixToolset.Core.TestPackage; | 15 | using WixToolset.Core.TestPackage; |
15 | using WixToolset.Data; | 16 | using WixToolset.Data; |
@@ -368,7 +369,61 @@ namespace WixToolsetTest.CoreIntegration | |||
368 | } | 369 | } |
369 | } | 370 | } |
370 | 371 | ||
371 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6291")] | 372 | [Fact] |
373 | public void CantBuildWithOrphanPayload() | ||
374 | { | ||
375 | var folder = TestData.Get(@"TestData"); | ||
376 | |||
377 | using (var fs = new DisposableFileSystem()) | ||
378 | { | ||
379 | var baseFolder = fs.GetFolder(); | ||
380 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
381 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
382 | |||
383 | var result = WixRunner.Execute(new[] | ||
384 | { | ||
385 | "build", | ||
386 | Path.Combine(folder, "BadInput", "OrphanPayload.wxs"), | ||
387 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
388 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), | ||
389 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
390 | "-bindpath", Path.Combine(folder, ".Data"), | ||
391 | "-intermediateFolder", intermediateFolder, | ||
392 | "-o", exePath, | ||
393 | }); | ||
394 | |||
395 | Assert.Equal((int)LinkerErrors.Ids.OrphanedPayload, result.ExitCode); | ||
396 | } | ||
397 | } | ||
398 | |||
399 | [Fact] | ||
400 | public void CantBuildWithPackageInMultipleContainers() | ||
401 | { | ||
402 | var folder = TestData.Get(@"TestData"); | ||
403 | |||
404 | using (var fs = new DisposableFileSystem()) | ||
405 | { | ||
406 | var baseFolder = fs.GetFolder(); | ||
407 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
408 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
409 | |||
410 | var result = WixRunner.Execute(new[] | ||
411 | { | ||
412 | "build", | ||
413 | Path.Combine(folder, "BadInput", "PackageInMultipleContainers.wxs"), | ||
414 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
415 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), | ||
416 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
417 | "-bindpath", Path.Combine(folder, ".Data"), | ||
418 | "-intermediateFolder", intermediateFolder, | ||
419 | "-o", exePath, | ||
420 | }); | ||
421 | |||
422 | Assert.Equal((int)LinkerErrors.Ids.PackageInMultipleContainers, result.ExitCode); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | [Fact] | ||
372 | public void CantBuildWithUnscheduledPackage() | 427 | public void CantBuildWithUnscheduledPackage() |
373 | { | 428 | { |
374 | var folder = TestData.Get(@"TestData"); | 429 | var folder = TestData.Get(@"TestData"); |
@@ -390,11 +445,11 @@ namespace WixToolsetTest.CoreIntegration | |||
390 | "-o", exePath, | 445 | "-o", exePath, |
391 | }); | 446 | }); |
392 | 447 | ||
393 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | 448 | Assert.Equal((int)LinkerErrors.Ids.UnscheduledChainPackage, result.ExitCode); |
394 | } | 449 | } |
395 | } | 450 | } |
396 | 451 | ||
397 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6291")] | 452 | [Fact] |
398 | public void CantBuildWithUnscheduledRollbackBoundary() | 453 | public void CantBuildWithUnscheduledRollbackBoundary() |
399 | { | 454 | { |
400 | var folder = TestData.Get(@"TestData"); | 455 | var folder = TestData.Get(@"TestData"); |
@@ -416,7 +471,7 @@ namespace WixToolsetTest.CoreIntegration | |||
416 | "-o", exePath, | 471 | "-o", exePath, |
417 | }); | 472 | }); |
418 | 473 | ||
419 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | 474 | Assert.Equal((int)LinkerErrors.Ids.UnscheduledRollbackBoundary, result.ExitCode); |
420 | } | 475 | } |
421 | } | 476 | } |
422 | } | 477 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs index 4a8473df..29c741dc 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs | |||
@@ -291,7 +291,7 @@ namespace WixToolsetTest.CoreIntegration | |||
291 | var baFolderPath = Path.Combine(baseFolder, "ba"); | 291 | var baFolderPath = Path.Combine(baseFolder, "ba"); |
292 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | 292 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
293 | 293 | ||
294 | var result = WixRunner.Execute(false, new[] | 294 | var result = WixRunner.Execute(new[] |
295 | { | 295 | { |
296 | "build", | 296 | "build", |
297 | Path.Combine(folder, "SharedPayloadsBetweenPackages", "SharedPayloadsBetweenPackages.wxs"), | 297 | Path.Combine(folder, "SharedPayloadsBetweenPackages", "SharedPayloadsBetweenPackages.wxs"), |
@@ -315,8 +315,8 @@ namespace WixToolsetTest.CoreIntegration | |||
315 | { "ExePackage", new List<string> { "CacheId", "InstallSize", "Size" } }, | 315 | { "ExePackage", new List<string> { "CacheId", "InstallSize", "Size" } }, |
316 | }; | 316 | }; |
317 | Assert.Equal(2, exePackageElements.Count); | 317 | Assert.Equal(2, exePackageElements.Count); |
318 | Assert.Equal("<ExePackage Id='credwiz.exe' Cache='keep' 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='SourceFilePayload' /></ExePackage>", exePackageElements[0].GetTestXml(ignoreAttributesByElementName)); | 318 | Assert.Equal("<ExePackage Id='credwiz.exe' Cache='keep' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='yes' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' LogPathVariable='WixBundleLog_credwiz.exe' RollbackLogPathVariable='WixBundleRollbackLog_credwiz.exe' DetectCondition='none' InstallArguments='' UninstallArguments='' RepairArguments='' Repairable='no'><PayloadRef Id='credwiz.exe' /><PayloadRef Id='SourceFilePayload' /></ExePackage>", exePackageElements[0].GetTestXml(ignoreAttributesByElementName)); |
319 | Assert.Equal("<ExePackage Id='cscript.exe' Cache='keep' 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='SourceFilePayload' /></ExePackage>", exePackageElements[1].GetTestXml(ignoreAttributesByElementName)); | 319 | Assert.Equal("<ExePackage Id='cscript.exe' Cache='keep' CacheId='*' InstallSize='*' Size='*' PerMachine='yes' Permanent='yes' Vital='yes' RollbackBoundaryBackward='WixDefaultBoundary' LogPathVariable='WixBundleLog_cscript.exe' RollbackLogPathVariable='WixBundleRollbackLog_cscript.exe' DetectCondition='none' InstallArguments='' UninstallArguments='' RepairArguments='' Repairable='no'><PayloadRef Id='cscript.exe' /><PayloadRef Id='SourceFilePayload' /></ExePackage>", exePackageElements[1].GetTestXml(ignoreAttributesByElementName)); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs index f24429f7..ffeda069 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs | |||
@@ -8,10 +8,9 @@ namespace WixToolsetTest.CoreIntegration | |||
8 | using System.Linq; | 8 | using System.Linq; |
9 | using System.Xml; | 9 | using System.Xml; |
10 | using WixBuildTools.TestSupport; | 10 | using WixBuildTools.TestSupport; |
11 | using WixToolset.Core; | ||
11 | using WixToolset.Core.Burn; | 12 | using WixToolset.Core.Burn; |
12 | using WixToolset.Core.TestPackage; | 13 | using WixToolset.Core.TestPackage; |
13 | using WixToolset.Data; | ||
14 | using WixToolset.Data.Symbols; | ||
15 | using Xunit; | 14 | using Xunit; |
16 | 15 | ||
17 | public class ContainerFixture | 16 | public class ContainerFixture |
@@ -30,33 +29,9 @@ namespace WixToolsetTest.CoreIntegration | |||
30 | var baFolderPath = Path.Combine(baseFolder, "ba"); | 29 | var baFolderPath = Path.Combine(baseFolder, "ba"); |
31 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | 30 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
32 | 31 | ||
33 | var result = WixRunner.Execute(new[] | 32 | this.BuildMsis(folder, intermediateFolder, binFolder); |
34 | { | ||
35 | "build", | ||
36 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | ||
37 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
38 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
39 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
40 | "-intermediateFolder", intermediateFolder, | ||
41 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | ||
42 | }); | ||
43 | |||
44 | result.AssertSuccess(); | ||
45 | 33 | ||
46 | result = WixRunner.Execute(new[] | 34 | var result = WixRunner.Execute(new[] |
47 | { | ||
48 | "build", | ||
49 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | ||
50 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
51 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
52 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
53 | "-intermediateFolder", intermediateFolder, | ||
54 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | ||
55 | }); | ||
56 | |||
57 | result.AssertSuccess(); | ||
58 | |||
59 | result = WixRunner.Execute(new[] | ||
60 | { | 35 | { |
61 | "build", | 36 | "build", |
62 | Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), | 37 | Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), |
@@ -98,33 +73,9 @@ namespace WixToolsetTest.CoreIntegration | |||
98 | var baFolderPath = Path.Combine(baseFolder, "ba"); | 73 | var baFolderPath = Path.Combine(baseFolder, "ba"); |
99 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | 74 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
100 | 75 | ||
101 | var result = WixRunner.Execute(new[] | 76 | this.BuildMsis(folder, intermediateFolder, binFolder); |
102 | { | ||
103 | "build", | ||
104 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | ||
105 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
106 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
107 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
108 | "-intermediateFolder", intermediateFolder, | ||
109 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | ||
110 | }); | ||
111 | |||
112 | result.AssertSuccess(); | ||
113 | |||
114 | result = WixRunner.Execute(new[] | ||
115 | { | ||
116 | "build", | ||
117 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | ||
118 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
119 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
120 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
121 | "-intermediateFolder", intermediateFolder, | ||
122 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | ||
123 | }); | ||
124 | |||
125 | result.AssertSuccess(); | ||
126 | 77 | ||
127 | result = WixRunner.Execute(new[] | 78 | var result = WixRunner.Execute(new[] |
128 | { | 79 | { |
129 | "build", | 80 | "build", |
130 | Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), | 81 | Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), |
@@ -174,7 +125,7 @@ namespace WixToolsetTest.CoreIntegration | |||
174 | } | 125 | } |
175 | 126 | ||
176 | [Fact] | 127 | [Fact] |
177 | public void MultipleAttachedContainersAreNotCurrentlySupported() | 128 | public void LayoutPayloadIsPutInContainer() |
178 | { | 129 | { |
179 | var folder = TestData.Get(@"TestData"); | 130 | var folder = TestData.Get(@"TestData"); |
180 | 131 | ||
@@ -187,36 +138,92 @@ namespace WixToolsetTest.CoreIntegration | |||
187 | var baFolderPath = Path.Combine(baseFolder, "ba"); | 138 | var baFolderPath = Path.Combine(baseFolder, "ba"); |
188 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | 139 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
189 | 140 | ||
190 | var result = WixRunner.Execute(new[] | 141 | this.BuildMsis(folder, intermediateFolder, binFolder); |
142 | |||
143 | var result = WixRunner.Execute(false, new[] | ||
191 | { | 144 | { |
192 | "build", | 145 | "build", |
193 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | 146 | Path.Combine(folder, "Container", "LayoutPayloadInContainer.wxs"), |
194 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | 147 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
195 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | 148 | "-bindpath", binFolder, |
196 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
197 | "-intermediateFolder", intermediateFolder, | 149 | "-intermediateFolder", intermediateFolder, |
198 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | 150 | "-o", bundlePath |
199 | }); | 151 | }); |
200 | 152 | ||
153 | WixAssert.CompareLineByLine(new string[] | ||
154 | { | ||
155 | "The layout-only Payload 'SharedPayload' is being added to Container 'FirstX64'. It will not be extracted during layout.", | ||
156 | }, result.Messages.Select(m => m.ToString()).ToArray()); | ||
201 | result.AssertSuccess(); | 157 | result.AssertSuccess(); |
202 | 158 | ||
203 | result = WixRunner.Execute(new[] | 159 | Assert.True(File.Exists(bundlePath)); |
160 | |||
161 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
162 | extractResult.AssertSuccess(); | ||
163 | |||
164 | var ignoreAttributes = new Dictionary<string, List<string>> { { "Payload", new List<string> { "FileSize", "Hash" } } }; | ||
165 | var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload[@Id='SharedPayload']") | ||
166 | .Cast<XmlElement>() | ||
167 | .Select(e => e.GetTestXml(ignoreAttributes)) | ||
168 | .ToArray(); | ||
169 | WixAssert.CompareLineByLine(new string[] | ||
170 | { | ||
171 | "<Payload Id='SharedPayload' FilePath='LayoutPayloadInContainer.wxs' FileSize='*' Hash='*' LayoutOnly='yes' Packaging='embedded' SourcePath='a1' Container='FirstX64' />", | ||
172 | }, payloads); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | [Fact] | ||
177 | public void MultipleAttachedContainersAreNotCurrentlySupported() | ||
178 | { | ||
179 | var folder = TestData.Get(@"TestData"); | ||
180 | |||
181 | using (var fs = new DisposableFileSystem()) | ||
182 | { | ||
183 | var baseFolder = fs.GetFolder(); | ||
184 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
185 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
186 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
187 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
188 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
189 | |||
190 | this.BuildMsis(folder, intermediateFolder, binFolder); | ||
191 | |||
192 | var result = WixRunner.Execute(new[] | ||
204 | { | 193 | { |
205 | "build", | 194 | "build", |
206 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | 195 | Path.Combine(folder, "Container", "MultipleAttachedContainers.wxs"), |
207 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | 196 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), |
208 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | 197 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
209 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | 198 | "-bindpath", binFolder, |
210 | "-intermediateFolder", intermediateFolder, | 199 | "-intermediateFolder", intermediateFolder, |
211 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | 200 | "-o", bundlePath |
212 | }); | 201 | }); |
213 | 202 | ||
214 | result.AssertSuccess(); | 203 | Assert.Equal((int)BurnBackendErrors.Ids.MultipleAttachedContainersUnsupported, result.ExitCode); |
204 | } | ||
205 | } | ||
206 | |||
207 | [Fact] | ||
208 | public void PayloadIsNotPutInMultipleContainers() | ||
209 | { | ||
210 | var folder = TestData.Get(@"TestData"); | ||
211 | |||
212 | using (var fs = new DisposableFileSystem()) | ||
213 | { | ||
214 | var baseFolder = fs.GetFolder(); | ||
215 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
216 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
217 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
218 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
219 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
220 | |||
221 | this.BuildMsis(folder, intermediateFolder, binFolder); | ||
215 | 222 | ||
216 | result = WixRunner.Execute(new[] | 223 | var result = WixRunner.Execute(false, new[] |
217 | { | 224 | { |
218 | "build", | 225 | "build", |
219 | Path.Combine(folder, "Container", "MultipleAttachedContainers.wxs"), | 226 | Path.Combine(folder, "Container", "PayloadInMultipleContainers.wxs"), |
220 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | 227 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), |
221 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | 228 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
222 | "-bindpath", binFolder, | 229 | "-bindpath", binFolder, |
@@ -224,8 +231,56 @@ namespace WixToolsetTest.CoreIntegration | |||
224 | "-o", bundlePath | 231 | "-o", bundlePath |
225 | }); | 232 | }); |
226 | 233 | ||
227 | Assert.Equal((int)BurnBackendErrors.Ids.MultipleAttachedContainersUnsupported, result.ExitCode); | 234 | WixAssert.CompareLineByLine(new string[] |
235 | { | ||
236 | "The Payload 'SharedPayload' can't be added to Container 'FirstX64' because it was already added to Container 'FirstX86'.", | ||
237 | }, result.Messages.Select(m => m.ToString()).ToArray()); | ||
238 | result.AssertSuccess(); | ||
239 | |||
240 | Assert.True(File.Exists(bundlePath)); | ||
241 | |||
242 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
243 | extractResult.AssertSuccess(); | ||
244 | |||
245 | var ignoreAttributes = new Dictionary<string, List<string>> { { "Payload", new List<string> { "FileSize", "Hash" } } }; | ||
246 | var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload[@Id='SharedPayload']") | ||
247 | .Cast<XmlElement>() | ||
248 | .Select(e => e.GetTestXml(ignoreAttributes)) | ||
249 | .ToArray(); | ||
250 | WixAssert.CompareLineByLine(new string[] | ||
251 | { | ||
252 | "<Payload Id='SharedPayload' FilePath='PayloadInMultipleContainers.wxs' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a2' Container='FirstX86' />", | ||
253 | }, payloads); | ||
228 | } | 254 | } |
229 | } | 255 | } |
256 | |||
257 | private void BuildMsis(string folder, string intermediateFolder, string binFolder) | ||
258 | { | ||
259 | var result = WixRunner.Execute(new[] | ||
260 | { | ||
261 | "build", | ||
262 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | ||
263 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
264 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
265 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
266 | "-intermediateFolder", intermediateFolder, | ||
267 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | ||
268 | }); | ||
269 | |||
270 | result.AssertSuccess(); | ||
271 | |||
272 | result = WixRunner.Execute(new[] | ||
273 | { | ||
274 | "build", | ||
275 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | ||
276 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
277 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
278 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
279 | "-intermediateFolder", intermediateFolder, | ||
280 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | ||
281 | }); | ||
282 | |||
283 | result.AssertSuccess(); | ||
284 | } | ||
230 | } | 285 | } |
231 | } | 286 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs index e9e59b9e..da87bf6c 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs | |||
@@ -8,6 +8,7 @@ namespace WixToolsetTest.CoreIntegration | |||
8 | using System.Linq; | 8 | using System.Linq; |
9 | using System.Xml; | 9 | using System.Xml; |
10 | using WixBuildTools.TestSupport; | 10 | using WixBuildTools.TestSupport; |
11 | using WixToolset.Core; | ||
11 | using WixToolset.Core.TestPackage; | 12 | using WixToolset.Core.TestPackage; |
12 | using WixToolset.Data; | 13 | using WixToolset.Data; |
13 | using WixToolset.Data.Symbols; | 14 | using WixToolset.Data.Symbols; |
@@ -117,7 +118,7 @@ namespace WixToolsetTest.CoreIntegration | |||
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
120 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/5273")] | 121 | [Fact] |
121 | public void RejectsPayloadSharedBetweenPackageAndBA() | 122 | public void RejectsPayloadSharedBetweenPackageAndBA() |
122 | { | 123 | { |
123 | var folder = TestData.Get(@"TestData"); | 124 | var folder = TestData.Get(@"TestData"); |
@@ -139,7 +140,7 @@ namespace WixToolsetTest.CoreIntegration | |||
139 | "-o", bundlePath, | 140 | "-o", bundlePath, |
140 | }); | 141 | }); |
141 | 142 | ||
142 | Assert.InRange(result.ExitCode, 2, int.MaxValue); | 143 | Assert.Equal((int)LinkerErrors.Ids.PayloadSharedWithBA, result.ExitCode); |
143 | } | 144 | } |
144 | } | 145 | } |
145 | 146 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/OrphanPayload.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/OrphanPayload.wxs new file mode 100644 index 00000000..92a9602f --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/OrphanPayload.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <PackageGroup Id="BundlePackages"> | ||
5 | <PackageGroupRef Id="MinimalPackageGroup" /> | ||
6 | </PackageGroup> | ||
7 | <PayloadGroup Id="OrphanPayloads"> | ||
8 | <Payload Id="OrphanPayload" SourceFile="$(sys.SOURCEFILEPATH)" /> | ||
9 | </PayloadGroup> | ||
10 | </Fragment> | ||
11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/PackageInMultipleContainers.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/PackageInMultipleContainers.wxs new file mode 100644 index 00000000..a00874ce --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/PackageInMultipleContainers.wxs | |||
@@ -0,0 +1,14 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <PackageGroup Id="BundlePackages"> | ||
5 | <PackageGroupRef Id="MinimalPackageGroup" /> | ||
6 | </PackageGroup> | ||
7 | <Container Id="First"> | ||
8 | <PackageGroupRef Id="BundlePackages" /> | ||
9 | </Container> | ||
10 | <Container Id="Second"> | ||
11 | <PackageGroupRef Id="BundlePackages" /> | ||
12 | </Container> | ||
13 | </Fragment> | ||
14 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledPackage.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledPackage.wxs index ab86982d..fc53c4a2 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledPackage.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledPackage.wxs | |||
@@ -2,15 +2,15 @@ | |||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Fragment> | 3 | <Fragment> |
4 | <PackageGroup Id="BundlePackages"> | 4 | <PackageGroup Id="BundlePackages"> |
5 | <ExePackage Id="Auto1" SourceFile="burn.exe" CacheId="Auto1" /> | 5 | <ExePackage Id="Auto1" SourceFile="burn.exe" CacheId="Auto1" DetectCondition="none" /> |
6 | <ExePackage Id="Auto2" SourceFile="burn.exe" CacheId="Auto2" /> | 6 | <ExePackage Id="Auto2" SourceFile="burn.exe" CacheId="Auto2" DetectCondition="none" /> |
7 | </PackageGroup> | 7 | </PackageGroup> |
8 | <SetVariableRef Id="Dummy" /> | 8 | <SetVariableRef Id="Dummy" /> |
9 | </Fragment> | 9 | </Fragment> |
10 | <Fragment> | 10 | <Fragment> |
11 | <SetVariable Id="Dummy" Variable="Dummy" /> | 11 | <SetVariable Id="Dummy" Variable="Dummy" /> |
12 | <PackageGroup Id="Unscheduled"> | 12 | <PackageGroup Id="Unscheduled"> |
13 | <ExePackage Id="Unscheduled1" SourceFile="burn.exe" CacheId="Unscheduled1" /> | 13 | <ExePackage Id="Unscheduled1" SourceFile="burn.exe" CacheId="Unscheduled1" DetectCondition="none" /> |
14 | </PackageGroup> | 14 | </PackageGroup> |
15 | </Fragment> | 15 | </Fragment> |
16 | </Wix> | 16 | </Wix> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledRollbackBoundary.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledRollbackBoundary.wxs index 8015ed92..6cf8528e 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledRollbackBoundary.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/UnscheduledRollbackBoundary.wxs | |||
@@ -2,8 +2,8 @@ | |||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Fragment> | 3 | <Fragment> |
4 | <PackageGroup Id="BundlePackages"> | 4 | <PackageGroup Id="BundlePackages"> |
5 | <ExePackage Id="Auto1" SourceFile="burn.exe" CacheId="Auto1" /> | 5 | <ExePackage Id="Auto1" SourceFile="burn.exe" CacheId="Auto1" DetectCondition="none" /> |
6 | <ExePackage Id="Auto2" SourceFile="burn.exe" CacheId="Auto2" /> | 6 | <ExePackage Id="Auto2" SourceFile="burn.exe" CacheId="Auto2" DetectCondition="none" /> |
7 | </PackageGroup> | 7 | </PackageGroup> |
8 | <SetVariableRef Id="Dummy" /> | 8 | <SetVariableRef Id="Dummy" /> |
9 | </Fragment> | 9 | </Fragment> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Container/LayoutPayloadInContainer.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/LayoutPayloadInContainer.wxs new file mode 100644 index 00000000..0c5f8c7e --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/LayoutPayloadInContainer.wxs | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Bundle Name="BurnBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="{B5B23622-239B-4E3B-BDAB-67648CB975BF}"> | ||
4 | <BootstrapperApplication> | ||
5 | <BootstrapperApplicationDll SourceFile="fakeba.dll" /> | ||
6 | </BootstrapperApplication> | ||
7 | <Chain> | ||
8 | <PackageGroupRef Id="BundlePackages" /> | ||
9 | </Chain> | ||
10 | <PayloadGroupRef Id="Shared" /> | ||
11 | </Bundle> | ||
12 | <Fragment> | ||
13 | <PackageGroup Id="BundlePackages"> | ||
14 | <PackageGroupRef Id="FirstX64" /> | ||
15 | </PackageGroup> | ||
16 | <PackageGroup Id="FirstX64"> | ||
17 | <MsiPackage SourceFile="FirstX64.msi"> | ||
18 | <PayloadGroupRef Id="Shared" /> | ||
19 | </MsiPackage> | ||
20 | </PackageGroup> | ||
21 | <Container Id="FirstX64" Name="FirstX64" Type="detached"> | ||
22 | <PackageGroupRef Id="FirstX64" /> | ||
23 | </Container> | ||
24 | <PayloadGroup Id="Shared"> | ||
25 | <Payload Id="SharedPayload" SourceFile="$(sys.SOURCEFILEPATH)" /> | ||
26 | </PayloadGroup> | ||
27 | </Fragment> | ||
28 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Container/PayloadInMultipleContainers.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/PayloadInMultipleContainers.wxs new file mode 100644 index 00000000..c7f549a3 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/PayloadInMultipleContainers.wxs | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <PackageGroup Id="BundlePackages"> | ||
5 | <PackageGroupRef Id="FirstX86" /> | ||
6 | <PackageGroupRef Id="FirstX64" /> | ||
7 | </PackageGroup> | ||
8 | <PackageGroup Id="FirstX86"> | ||
9 | <MsiPackage SourceFile="FirstX86.msi"> | ||
10 | <PayloadGroupRef Id="Shared" /> | ||
11 | </MsiPackage> | ||
12 | </PackageGroup> | ||
13 | <PackageGroup Id="FirstX64"> | ||
14 | <MsiPackage SourceFile="FirstX64.msi"> | ||
15 | <PayloadGroupRef Id="Shared" /> | ||
16 | </MsiPackage> | ||
17 | </PackageGroup> | ||
18 | <Container Id="FirstX86" Name="FirstX86" Type="detached"> | ||
19 | <PackageGroupRef Id="FirstX86" /> | ||
20 | </Container> | ||
21 | <Container Id="FirstX64" Name="FirstX64" Type="detached"> | ||
22 | <PackageGroupRef Id="FirstX64" /> | ||
23 | </Container> | ||
24 | <PayloadGroup Id="Shared"> | ||
25 | <Payload Id="SharedPayload" SourceFile="$(sys.SOURCEFILEPATH)" /> | ||
26 | </PayloadGroup> | ||
27 | </Fragment> | ||
28 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs index 4cfeb99f..5263cbd4 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs | |||
@@ -2,7 +2,7 @@ | |||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Fragment> | 3 | <Fragment> |
4 | <PackageGroup Id="BundlePackages"> | 4 | <PackageGroup Id="BundlePackages"> |
5 | <ExePackage SourceFile="burn.exe"> | 5 | <ExePackage SourceFile="burn.exe" DetectCondition="none"> |
6 | <PayloadGroupRef Id="Shared" /> | 6 | <PayloadGroupRef Id="Shared" /> |
7 | </ExePackage> | 7 | </ExePackage> |
8 | </PackageGroup> | 8 | </PackageGroup> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs index 3457a3b7..f16fce0d 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SharedPayloadsBetweenPackages/SharedPayloadsBetweenPackages.wxs | |||
@@ -2,10 +2,10 @@ | |||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Fragment> | 3 | <Fragment> |
4 | <PackageGroup Id="BundlePackages"> | 4 | <PackageGroup Id="BundlePackages"> |
5 | <ExePackage SourceFile="C:\Windows\system32\credwiz.exe" Permanent="yes"> | 5 | <ExePackage SourceFile="C:\Windows\system32\credwiz.exe" Permanent="yes" DetectCondition="none"> |
6 | <PayloadGroupRef Id="SharedPayloads" /> | 6 | <PayloadGroupRef Id="SharedPayloads" /> |
7 | </ExePackage> | 7 | </ExePackage> |
8 | <ExePackage SourceFile="C:\Windows\system32\cscript.exe" Permanent="yes"> | 8 | <ExePackage SourceFile="C:\Windows\system32\cscript.exe" Permanent="yes" DetectCondition="none"> |
9 | <PayloadGroupRef Id="SharedPayloads" /> | 9 | <PayloadGroupRef Id="SharedPayloads" /> |
10 | </ExePackage> | 10 | </ExePackage> |
11 | </PackageGroup> | 11 | </PackageGroup> |