diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-01-02 23:20:25 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-01-03 15:49:32 -0600 |
| commit | d5e31dec3a753f98955f3cde3d49a653cfc4aed0 (patch) | |
| tree | bb1c4b97c125652cfca7cf26faad1000ae0ba0a7 /src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs | |
| parent | df40c2722e4a41e01cf326353e2583ae82ccc9a4 (diff) | |
| download | wix-d5e31dec3a753f98955f3cde3d49a653cfc4aed0.tar.gz wix-d5e31dec3a753f98955f3cde3d49a653cfc4aed0.tar.bz2 wix-d5e31dec3a753f98955f3cde3d49a653cfc4aed0.zip | |
Add failing tests.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs | 140 |
1 files changed, 140 insertions, 0 deletions
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 @@ | |||
| 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 | |||
| 3 | namespace WixToolsetTest.CoreIntegration | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.IO; | ||
| 8 | using System.Linq; | ||
| 9 | using WixBuildTools.TestSupport; | ||
| 10 | using WixToolset.Core.TestPackage; | ||
| 11 | using WixToolset.Data; | ||
| 12 | using WixToolset.Data.Symbols; | ||
| 13 | using Xunit; | ||
| 14 | |||
| 15 | public class ContainerFixture | ||
| 16 | { | ||
| 17 | [Fact] | ||
| 18 | public void HarvestedPayloadsArePutInCorrectContainer() | ||
| 19 | { | ||
| 20 | var folder = TestData.Get(@"TestData"); | ||
| 21 | |||
| 22 | using (var fs = new DisposableFileSystem()) | ||
| 23 | { | ||
| 24 | var baseFolder = fs.GetFolder(); | ||
| 25 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 26 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
| 27 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
| 28 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 29 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 30 | |||
| 31 | var result = WixRunner.Execute(new[] | ||
| 32 | { | ||
| 33 | "build", | ||
| 34 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | ||
| 35 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
| 36 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
| 37 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
| 38 | "-intermediateFolder", intermediateFolder, | ||
| 39 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | ||
| 40 | }); | ||
| 41 | |||
| 42 | result.AssertSuccess(); | ||
| 43 | |||
| 44 | result = WixRunner.Execute(new[] | ||
| 45 | { | ||
| 46 | "build", | ||
| 47 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | ||
| 48 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
| 49 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
| 50 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
| 51 | "-intermediateFolder", intermediateFolder, | ||
| 52 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | ||
| 53 | }); | ||
| 54 | |||
| 55 | result.AssertSuccess(); | ||
| 56 | |||
| 57 | result = WixRunner.Execute(new[] | ||
| 58 | { | ||
| 59 | "build", | ||
| 60 | Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), | ||
| 61 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
| 62 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
| 63 | "-bindpath", binFolder, | ||
| 64 | "-intermediateFolder", intermediateFolder, | ||
| 65 | "-o", bundlePath | ||
| 66 | }); | ||
| 67 | |||
| 68 | result.AssertSuccess(); | ||
| 69 | |||
| 70 | Assert.True(File.Exists(bundlePath)); | ||
| 71 | |||
| 72 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
| 73 | extractResult.AssertSuccess(); | ||
| 74 | |||
| 75 | var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload"); | ||
| 76 | Assert.Equal(4, payloads.Count); | ||
| 77 | var ignoreAttributes = new Dictionary<string, List<string>> { { "Payload", new List<string> { "FileSize", "Hash" } } }; | ||
| 78 | Assert.Equal(@"<Payload Id='FirstX86.msi' FilePath='FirstX86.msi' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a0' Container='WixAttachedContainer' />", payloads[0].GetTestXml(ignoreAttributes)); | ||
| 79 | Assert.Equal(@"<Payload Id='FirstX64.msi' FilePath='FirstX64.msi' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a1' Container='FirstX64' />", payloads[1].GetTestXml(ignoreAttributes)); | ||
| 80 | Assert.Equal(@"<Payload Id='fk1m38Cf9RZ2Bx_ipinRY6BftelU' FilePath='PFiles\MsiPackage\test.txt' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a2' Container='WixAttachedContainer' />", payloads[2].GetTestXml(ignoreAttributes)); | ||
| 81 | Assert.Equal(@"<Payload Id='fC0n41rZK8oW3JK8LzHu6AT3CjdQ' FilePath='PFiles\MsiPackage\test.txt' FileSize='*' Hash='*' Packaging='embedded' SourcePath='a3' Container='FirstX64' />", payloads[3].GetTestXml(ignoreAttributes)); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6144")] | ||
| 86 | public void MultipleAttachedContainersAreNotCurrentlySupported() | ||
| 87 | { | ||
| 88 | var folder = TestData.Get(@"TestData"); | ||
| 89 | |||
| 90 | using (var fs = new DisposableFileSystem()) | ||
| 91 | { | ||
| 92 | var baseFolder = fs.GetFolder(); | ||
| 93 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 94 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
| 95 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
| 96 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 97 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 98 | |||
| 99 | var result = WixRunner.Execute(new[] | ||
| 100 | { | ||
| 101 | "build", | ||
| 102 | Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), | ||
| 103 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
| 104 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
| 105 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
| 106 | "-intermediateFolder", intermediateFolder, | ||
| 107 | "-o", Path.Combine(binFolder, "FirstX86.msi"), | ||
| 108 | }); | ||
| 109 | |||
| 110 | result.AssertSuccess(); | ||
| 111 | |||
| 112 | result = WixRunner.Execute(new[] | ||
| 113 | { | ||
| 114 | "build", | ||
| 115 | Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), | ||
| 116 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
| 117 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
| 118 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
| 119 | "-intermediateFolder", intermediateFolder, | ||
| 120 | "-o", Path.Combine(binFolder, "FirstX64.msi"), | ||
| 121 | }); | ||
| 122 | |||
| 123 | result.AssertSuccess(); | ||
| 124 | |||
| 125 | result = WixRunner.Execute(new[] | ||
| 126 | { | ||
| 127 | "build", | ||
| 128 | Path.Combine(folder, "Container", "MultipleAttachedContainers.wxs"), | ||
| 129 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
| 130 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
| 131 | "-bindpath", binFolder, | ||
| 132 | "-intermediateFolder", intermediateFolder, | ||
| 133 | "-o", bundlePath | ||
| 134 | }); | ||
| 135 | |||
| 136 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
