From d5e31dec3a753f98955f3cde3d49a653cfc4aed0 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 2 Jan 2021 23:20:25 -0600 Subject: Add failing tests. --- .../BundleFixture.cs | 8 +- .../ContainerFixture.cs | 140 +++++++++++++++++++++ .../CustomActionFixture.cs | 2 +- .../PayloadFixture.cs | 27 ++++ .../RegistryFixture.cs | 2 +- .../RollbackBoundaryFixture.cs | 41 ++++++ .../Container/HarvestIntoDetachedContainer.wxs | 15 +++ .../Container/MultipleAttachedContainers.wxs | 15 +++ .../Payload/SharedBAAndPackagePayloadBundle.wxs | 16 +++ .../TestData/RollbackBoundary/BeginningOfChain.wxs | 9 ++ .../WixToolsetTest.CoreIntegration.csproj | 4 + 11 files changed, 273 insertions(+), 6 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/RollbackBoundaryFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Container/HarvestIntoDetachedContainer.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Container/MultipleAttachedContainers.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/RollbackBoundary/BeginningOfChain.wxs (limited to 'src') diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index fae2ff4c..1e314281 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs @@ -216,7 +216,7 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/4628 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/4628")] public void CantBuildWithDuplicateCacheIds() { var folder = TestData.Get(@"TestData"); @@ -242,7 +242,7 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/4574 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/4574")] public void CantBuildWithDuplicatePayloadNames() { var folder = TestData.Get(@"TestData"); @@ -268,7 +268,7 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/6291 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6291")] public void CantBuildWithUnscheduledPackage() { var folder = TestData.Get(@"TestData"); @@ -294,7 +294,7 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/6291 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6291")] public void CantBuildWithUnscheduledRollbackBoundary() { var folder = TestData.Get(@"TestData"); diff --git a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs new file mode 100644 index 00000000..0799cc24 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs @@ -0,0 +1,140 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using Xunit; + + public class ContainerFixture + { + [Fact] + public void HarvestedPayloadsArePutInCorrectContainer() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var binFolder = Path.Combine(baseFolder, "bin"); + var bundlePath = Path.Combine(binFolder, "test.exe"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX86.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX64.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-bindpath", binFolder, + "-intermediateFolder", intermediateFolder, + "-o", bundlePath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(bundlePath)); + + var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload"); + Assert.Equal(4, payloads.Count); + var ignoreAttributes = new Dictionary> { { "Payload", new List { "FileSize", "Hash" } } }; + Assert.Equal(@"", payloads[0].GetTestXml(ignoreAttributes)); + Assert.Equal(@"", payloads[1].GetTestXml(ignoreAttributes)); + Assert.Equal(@"", payloads[2].GetTestXml(ignoreAttributes)); + Assert.Equal(@"", payloads[3].GetTestXml(ignoreAttributes)); + } + } + + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6144")] + public void MultipleAttachedContainersAreNotCurrentlySupported() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var binFolder = Path.Combine(baseFolder, "bin"); + var bundlePath = Path.Combine(binFolder, "test.exe"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX86.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX64.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Container", "MultipleAttachedContainers.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-bindpath", binFolder, + "-intermediateFolder", intermediateFolder, + "-o", bundlePath + }); + + Assert.InRange(result.ExitCode, 2, Int32.MaxValue); + } + } + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs index 00088fb9..65f4be31 100644 --- a/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs @@ -11,7 +11,7 @@ namespace WixToolsetTest.CoreIntegration public class CustomActionFixture { - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/6201 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6201")] public void CanDetectCustomActionCycle() { var folder = TestData.Get(@"TestData"); diff --git a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs index 4fc57c76..5b6bbeb5 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs @@ -3,6 +3,7 @@ namespace WixToolsetTest.CoreIntegration { using System; + using System.Collections.Generic; using System.IO; using System.Linq; using WixBuildTools.TestSupport; @@ -114,5 +115,31 @@ namespace WixToolsetTest.CoreIntegration Assert.Equal(expectedPayloadMustBeRelativeToCache, result.Messages.Where(m => m.Id == (int)ErrorMessages.Ids.PayloadMustBeRelativeToCache).Count()); } } + + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/5273")] + public void RejectsPayloadSharedBetweenPackageAndBA() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Payload", "SharedBAAndPackagePayloadBundle.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-bindpath", Path.Combine(folder, ".Data"), + "-intermediateFolder", intermediateFolder, + "-o", bundlePath, + }); + + Assert.InRange(result.ExitCode, 2, int.MaxValue); + } + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs index 3b13d8f5..a7d6edb4 100644 --- a/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs @@ -111,7 +111,7 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Test demonstrates failure")] //https://github.com/wixtoolset/issues/issues/4753 + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/4753")] public void PopulatesRegistryTableWithoutExtraBackslash() { var folder = TestData.Get(@"TestData"); diff --git a/src/test/WixToolsetTest.CoreIntegration/RollbackBoundaryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/RollbackBoundaryFixture.cs new file mode 100644 index 00000000..b713920c --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/RollbackBoundaryFixture.cs @@ -0,0 +1,41 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class RollbackBoundaryFixture + { + [Fact(Skip = "Test demonstrates failure")] + public void CanStartChainWithRollbackBoundary() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var exePath = Path.Combine(baseFolder, @"bin\test.exe"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "RollbackBoundary", "BeginningOfChain.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-intermediateFolder", intermediateFolder, + "-o", exePath, + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(exePath)); + } + } + + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Container/HarvestIntoDetachedContainer.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/HarvestIntoDetachedContainer.wxs new file mode 100644 index 00000000..e175a18f --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/HarvestIntoDetachedContainer.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Container/MultipleAttachedContainers.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/MultipleAttachedContainers.wxs new file mode 100644 index 00000000..28900e55 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Container/MultipleAttachedContainers.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs new file mode 100644 index 00000000..4cfeb99f --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Payload/SharedBAAndPackagePayloadBundle.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/RollbackBoundary/BeginningOfChain.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/RollbackBoundary/BeginningOfChain.wxs new file mode 100644 index 00000000..ecfccfcb --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/RollbackBoundary/BeginningOfChain.wxs @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 918635e9..595c8a39 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -38,6 +38,8 @@ + + @@ -72,6 +74,7 @@ + @@ -187,6 +190,7 @@ + -- cgit v1.2.3-55-g6feb