aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-04-21 16:51:22 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-04-21 16:54:42 -0500
commit0531df3e9f7b3e41434def0c569bd748adc721f6 (patch)
treeec8003985cac685aee6c1ece1e0a2a05907f640e /src/test
parentaee568fddd21fe0fc270f7e705dc7b9e834d9ff4 (diff)
downloadwix-0531df3e9f7b3e41434def0c569bd748adc721f6.tar.gz
wix-0531df3e9f7b3e41434def0c569bd748adc721f6.tar.bz2
wix-0531df3e9f7b3e41434def0c569bd748adc721f6.zip
Detect payload collisions.
#4574
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs40
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs8
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/DuplicatePayloadNames.wxs26
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X64AfterX86Bundle.wxs8
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X86AfterX64Bundle.wxs8
6 files changed, 75 insertions, 17 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
index d121da0f..cc91d212 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.Burn;
13 using WixToolset.Core.TestPackage; 14 using WixToolset.Core.TestPackage;
14 using WixToolset.Data; 15 using WixToolset.Data;
15 using WixToolset.Data.Burn; 16 using WixToolset.Data.Burn;
@@ -306,7 +307,7 @@ namespace WixToolsetTest.CoreIntegration
306 } 307 }
307 } 308 }
308 309
309 [Fact(Skip = "https://github.com/wixtoolset/issues/issues/4574")] 310 [Fact]
310 public void CantBuildWithDuplicatePayloadNames() 311 public void CantBuildWithDuplicatePayloadNames()
311 { 312 {
312 var folder = TestData.Get(@"TestData"); 313 var folder = TestData.Get(@"TestData");
@@ -328,7 +329,42 @@ namespace WixToolsetTest.CoreIntegration
328 "-o", exePath, 329 "-o", exePath,
329 }); 330 });
330 331
331 Assert.InRange(result.ExitCode, 2, Int32.MaxValue); 332 var attachedContainerWarnings = result.Messages.Where(m => m.Id == (int)BurnBackendWarnings.Ids.AttachedContainerPayloadCollision)
333 .Select(m => m.ToString())
334 .ToArray();
335 WixAssert.CompareLineByLine(new string[]
336 {
337 "The Payload 'Auto2' has a duplicate Name 'burn.exe' in the attached container. When extracting the bundle with dark.exe, the file will get overwritten.",
338 }, attachedContainerWarnings);
339
340 var baContainerErrors = result.Messages.Where(m => m.Id == (int)BurnBackendErrors.Ids.BAContainerPayloadCollision)
341 .Select(m => m.ToString())
342 .ToArray();
343 WixAssert.CompareLineByLine(new string[]
344 {
345 "The Payload 'DuplicatePayloadNames.wxs' has a duplicate Name 'fakeba.dll' in the BA container. When extracting the container at runtime, the file will get overwritten.",
346 "The Payload 'uxTxMXPVMXwQrPTMIGa5WGt93w0Ns' has a duplicate Name 'BootstrapperApplicationData.xml' in the BA container. When extracting the container at runtime, the file will get overwritten.",
347 "The Payload 'uxYRbgitOs0K878jn5L_z7LdJ21KI' has a duplicate Name 'BundleExtensionData.xml' in the BA container. When extracting the container at runtime, the file will get overwritten.",
348 }, baContainerErrors);
349
350 var externalErrors = result.Messages.Where(m => m.Id == (int)BurnBackendErrors.Ids.ExternalPayloadCollision)
351 .Select(m => m.ToString())
352 .ToArray();
353 WixAssert.CompareLineByLine(new string[]
354 {
355 "The external Payload 'HiddenPersistedBundleVariable.wxs' has a duplicate Name 'PayloadCollision'. When building the bundle or laying out the bundle, the file will get overwritten.",
356 "The external Container 'MsiPackagesContainer' has a duplicate Name 'ContainerCollision'. When building the bundle or laying out the bundle, the file will get overwritten.",
357 }, externalErrors);
358
359 var packageCacheErrors = result.Messages.Where(m => m.Id == (int)BurnBackendErrors.Ids.PackageCachePayloadCollision)
360 .Select(m => m.ToString())
361 .ToArray();
362 WixAssert.CompareLineByLine(new string[]
363 {
364 "The Payload 'test.msi' has a duplicate Name 'test.msi' in package 'test.msi'. When caching the package, the file will get overwritten.",
365 }, packageCacheErrors);
366
367 Assert.Equal(14, result.Messages.Length);
332 } 368 }
333 } 369 }
334 370
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs
index 7ec0ea93..a566b490 100644
--- a/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs
@@ -81,7 +81,7 @@ namespace WixToolsetTest.CoreIntegration
81 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), 81 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
82 "-bindpath", Path.Combine(folder, "SingleFile", "data"), 82 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
83 "-intermediateFolder", intermediateFolder, 83 "-intermediateFolder", intermediateFolder,
84 "-o", Path.Combine(binFolder, "FirstX86.msi"), 84 "-o", Path.Combine(binFolder, "FirstX86", "FirstX86.msi"),
85 }); 85 });
86 86
87 result.AssertSuccess(); 87 result.AssertSuccess();
@@ -94,7 +94,7 @@ namespace WixToolsetTest.CoreIntegration
94 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), 94 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
95 "-bindpath", Path.Combine(folder, "SingleFile", "data"), 95 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
96 "-intermediateFolder", intermediateFolder, 96 "-intermediateFolder", intermediateFolder,
97 "-o", Path.Combine(binFolder, "SecondX86.msi"), 97 "-o", Path.Combine(binFolder, "SecondX86", "SecondX86.msi"),
98 }); 98 });
99 99
100 result.AssertSuccess(); 100 result.AssertSuccess();
@@ -108,7 +108,7 @@ namespace WixToolsetTest.CoreIntegration
108 "-bindpath", Path.Combine(folder, "SingleFile", "data"), 108 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
109 "-intermediateFolder", intermediateFolder, 109 "-intermediateFolder", intermediateFolder,
110 "-arch", "x64", 110 "-arch", "x64",
111 "-o", Path.Combine(binFolder, "FirstX64.msi"), 111 "-o", Path.Combine(binFolder, "FirstX64", "FirstX64.msi"),
112 }); 112 });
113 113
114 result.AssertSuccess(); 114 result.AssertSuccess();
@@ -122,7 +122,7 @@ namespace WixToolsetTest.CoreIntegration
122 "-bindpath", Path.Combine(folder, "SingleFile", "data"), 122 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
123 "-intermediateFolder", intermediateFolder, 123 "-intermediateFolder", intermediateFolder,
124 "-arch", "x64", 124 "-arch", "x64",
125 "-o", Path.Combine(binFolder, "SecondX64.msi"), 125 "-o", Path.Combine(binFolder, "SecondX64", "SecondX64.msi"),
126 }); 126 });
127 127
128 result.AssertSuccess(); 128 result.AssertSuccess();
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/DuplicatePayloadNames.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/DuplicatePayloadNames.wxs
index 2d4e8a3c..4fe7e097 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/DuplicatePayloadNames.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/DuplicatePayloadNames.wxs
@@ -2,8 +2,30 @@
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 <ExePackage Id="DuplicateCacheIds.wxs" SourceFile="$(sys.SOURCEFILEDIR)DuplicateCacheIds.wxs" Compressed="no" DetectCondition="none" Name="PayloadCollision">
8 <Payload SourceFile="$(sys.SOURCEFILEDIR)BundleVariable.wxs" Compressed="no" Name="ContainerCollision" />
9 </ExePackage>
10 <ExePackage Id="HiddenPersistedBundleVariable.wxs" SourceFile="$(sys.SOURCEFILEDIR)HiddenPersistedBundleVariable.wxs" Compressed="no" DetectCondition="none" Name="PayloadCollision" />
11 <PackageGroupRef Id="MsiPackages" />
7 </PackageGroup> 12 </PackageGroup>
13
14 <PackageGroup Id="MsiPackages">
15 <MsiPackage SourceFile="test.msi">
16 <Payload SourceFile="$(sys.SOURCEFILEDIR)InvalidIds.wxs" Name="MsiPackage\test.txt" />
17 <Payload SourceFile="$(sys.SOURCEFILEDIR)RegistryKey.wxs" Name="test.msi" />
18 </MsiPackage>
19 </PackageGroup>
20
21 <Container Id="MsiPackagesContainer" Type="detached" Name="ContainerCollision">
22 <PackageGroupRef Id="MsiPackages" />
23 </Container>
24
25 <BootstrapperApplication>
26 <Payload Id="DuplicatePayloadNames.wxs" SourceFile="$(sys.SOURCEFILEPATH)" Name="fakeba.dll" />
27 <Payload Id="UnscheduledPackage.wxs" SourceFile="$(sys.SOURCEFILEDIR)UnscheduledPackage.wxs" Name="BootstrapperApplicationData.xml" />
28 <Payload Id="UnscheduledRollbackBoundary.wxs" SourceFile="$(sys.SOURCEFILEDIR)UnscheduledRollbackBoundary.wxs" Name="BundleExtensionData.xml" />
29 </BootstrapperApplication>
8 </Fragment> 30 </Fragment>
9</Wix> 31</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs
index db755171..e52302d4 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs
@@ -48,6 +48,6 @@
48 </BundleElement> 48 </BundleElement>
49 </BundleCustomDataRef> 49 </BundleCustomDataRef>
50 50
51 <BundleExtension Id="CustomTableExtension" SourceFile="fakeba.dll" /> 51 <BundleExtension Id="CustomTableExtension" SourceFile="fakeba.dll" Name="fakebext.dll" />
52 </Fragment> 52 </Fragment>
53</Wix> 53</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X64AfterX86Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X64AfterX86Bundle.wxs
index 8f4fc8bd..e6527a36 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X64AfterX86Bundle.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X64AfterX86Bundle.wxs
@@ -2,11 +2,11 @@
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 <MsiPackage SourceFile="FirstX64.msi" /> 5 <MsiPackage SourceFile="FirstX64\" Name="FirstX64\FirstX64.msi" />
6 <RollbackBoundary Transaction="yes" /> 6 <RollbackBoundary Transaction="yes" />
7 <MsiPackage SourceFile="FirstX86.msi" /> 7 <MsiPackage SourceFile="FirstX86\" Name="FirstX86\FirstX86.msi" />
8 <MsiPackage SourceFile="SecondX86.msi" /> 8 <MsiPackage SourceFile="SecondX86\" Name="SecondX86\SecondX86.msi" />
9 <MsiPackage SourceFile="SecondX64.msi" /> 9 <MsiPackage SourceFile="SecondX64\" Name="SecondX64\SecondX64.msi" />
10 </PackageGroup> 10 </PackageGroup>
11 </Fragment> 11 </Fragment>
12</Wix> 12</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X86AfterX64Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X86AfterX64Bundle.wxs
index 221f06c5..f1c939db 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X86AfterX64Bundle.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/MsiTransaction/X86AfterX64Bundle.wxs
@@ -2,11 +2,11 @@
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 <MsiPackage SourceFile="FirstX86.msi" /> 5 <MsiPackage SourceFile="FirstX86\" Name="FirstX86\FirstX86.msi" />
6 <RollbackBoundary Transaction="yes" /> 6 <RollbackBoundary Transaction="yes" />
7 <MsiPackage SourceFile="FirstX64.msi" /> 7 <MsiPackage SourceFile="FirstX64\" Name="FirstX64\FirstX64.msi" />
8 <MsiPackage SourceFile="SecondX64.msi" /> 8 <MsiPackage SourceFile="SecondX64\" Name="SecondX64\SecondX64.msi" />
9 <MsiPackage SourceFile="SecondX86.msi" /> 9 <MsiPackage SourceFile="SecondX86\" Name="SecondX86\SecondX86.msi" />
10 </PackageGroup> 10 </PackageGroup>
11 </Fragment> 11 </Fragment>
12</Wix> 12</Wix>