diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-02-25 09:58:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-02-27 07:47:08 -0800 |
| commit | 760fb810ba5ecc3c6ce752a9bfa3755f7b7c0f6a (patch) | |
| tree | 3ad06ffe520f31142e23ce9e752473110d232ec5 /src/test/WixToolsetTest.CoreIntegration | |
| parent | 4536440f8d76346bcd120fe9e1410e428f855ee9 (diff) | |
| download | wix-760fb810ba5ecc3c6ce752a9bfa3755f7b7c0f6a.tar.gz wix-760fb810ba5ecc3c6ce752a9bfa3755f7b7c0f6a.tar.bz2 wix-760fb810ba5ecc3c6ce752a9bfa3755f7b7c0f6a.zip | |
Absorb Tag.wixext into Core as SoftwareTag element
Resolves wixtoolset/issues#5949
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
7 files changed, 158 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs b/src/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs new file mode 100644 index 00000000..15276b18 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs | |||
| @@ -0,0 +1,100 @@ | |||
| 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.IO; | ||
| 6 | using System.Linq; | ||
| 7 | using System.Xml.Linq; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.Core.TestPackage; | ||
| 10 | using WixToolset.Data; | ||
| 11 | using Xunit; | ||
| 12 | |||
| 13 | public class SoftwareTagFixture | ||
| 14 | { | ||
| 15 | private static readonly XNamespace BurnManifestNamespace = "http://wixtoolset.org/schemas/v4/2008/Burn"; | ||
| 16 | private static readonly XNamespace SwidTagNamespace = "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"; | ||
| 17 | |||
| 18 | [Fact] | ||
| 19 | public void CanBuildPackageWithTag() | ||
| 20 | { | ||
| 21 | var folder = TestData.Get(@"TestData\ProductTag"); | ||
| 22 | var build = new Builder(folder, null, new[] { folder }); | ||
| 23 | |||
| 24 | var results = build.BuildAndQuery(Build, "File", "SoftwareIdentificationTag"); | ||
| 25 | |||
| 26 | var replacePackageCodeStart = results[2].IndexOf("\tmsi:package/") + "\tmsi:package/".Length; | ||
| 27 | var replacePackageCodeEnd = results[2].IndexOf("\t", replacePackageCodeStart); | ||
| 28 | results[2] = results[2].Substring(0, replacePackageCodeStart) + "???" + results[2].Substring(replacePackageCodeEnd); | ||
| 29 | WixAssert.CompareLineByLine(new[] | ||
| 30 | { | ||
| 31 | "File:filF5_pLhBuF5b4N9XEo52g_hUM5Lo\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\texample.txt\t20\t\t\t512\t1", | ||
| 32 | "File:tagEYRYWwOt95punO7qPPAQ9p1GBpY\ttagEYRYWwOt95punO7qPPAQ9p1GBpY\trdcfonyt.swi|~TagTestPackage.swidtag\t449\t\t\t1\t2", | ||
| 33 | "SoftwareIdentificationTag:tagEYRYWwOt95punO7qPPAQ9p1GBpY\twixtoolset.org\tmsi:package/???\tmsi:upgrade/047730A5-30FE-4A62-A520-DA9381B8226A\t" | ||
| 34 | }, results.ToArray()); | ||
| 35 | } | ||
| 36 | |||
| 37 | [Fact] | ||
| 38 | public void CanBuildBundleWithTag() | ||
| 39 | { | ||
| 40 | var testDataFolder = TestData.Get(@"TestData"); | ||
| 41 | |||
| 42 | using (var fs = new DisposableFileSystem()) | ||
| 43 | { | ||
| 44 | var baseFolder = fs.GetFolder(); | ||
| 45 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 46 | |||
| 47 | var result = WixRunner.Execute(new[] | ||
| 48 | { | ||
| 49 | "build", | ||
| 50 | Path.Combine(testDataFolder, "ProductTag", "PackageWithTag.wxs"), | ||
| 51 | Path.Combine(testDataFolder, "ProductTag", "PackageComponents.wxs"), | ||
| 52 | "-loc", Path.Combine(testDataFolder, "ProductTag", "Package.en-us.wxl"), | ||
| 53 | "-bindpath", Path.Combine(testDataFolder, "ProductTag"), | ||
| 54 | "-intermediateFolder", Path.Combine(intermediateFolder, "package"), | ||
| 55 | "-o", Path.Combine(baseFolder, "package", @"test.msi") | ||
| 56 | }); | ||
| 57 | |||
| 58 | result.AssertSuccess(); | ||
| 59 | |||
| 60 | result = WixRunner.Execute(new[] | ||
| 61 | { | ||
| 62 | "build", | ||
| 63 | Path.Combine(testDataFolder, "BundleTag", "BundleWithTag.wxs"), | ||
| 64 | "-bindpath", Path.Combine(testDataFolder, "BundleTag"), | ||
| 65 | "-bindpath", Path.Combine(baseFolder, "package"), | ||
| 66 | "-intermediateFolder", intermediateFolder, | ||
| 67 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 68 | }); | ||
| 69 | |||
| 70 | result.AssertSuccess(); | ||
| 71 | |||
| 72 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 73 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 74 | |||
| 75 | using (var ouput = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixpdb"))) | ||
| 76 | { | ||
| 77 | var badata = ouput.GetDataStream("wix-burndata.xml"); | ||
| 78 | var doc = XDocument.Load(badata); | ||
| 79 | |||
| 80 | var swidTag = doc.Root.Element(BurnManifestNamespace + "Registration").Element(BurnManifestNamespace + "SoftwareTag").Value; | ||
| 81 | |||
| 82 | var swidTagPath = Path.Combine(baseFolder, "test.swidtag"); | ||
| 83 | File.WriteAllText(swidTagPath, swidTag); | ||
| 84 | |||
| 85 | var docTag = XDocument.Load(swidTagPath); | ||
| 86 | var title = docTag.Root.Attribute("name").Value; | ||
| 87 | var version = docTag.Root.Attribute("version").Value; | ||
| 88 | Assert.Equal("~TagTestBundle", title); | ||
| 89 | Assert.Equal("4.3.2.1", version); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | private static void Build(string[] args) | ||
| 95 | { | ||
| 96 | var result = WixRunner.Execute(args) | ||
| 97 | .AssertSuccess(); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/BundleWithTag.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/BundleWithTag.wxs new file mode 100644 index 00000000..f44fb7bc --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/BundleWithTag.wxs | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" > | ||
| 2 | <Bundle Name="~TagTestBundle" Version="4.3.2.1" Manufacturer="Example Corporation" UpgradeCode="047730A5-30FE-4A62-A520-DA9381B8226A"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <BootstrapperApplicationDll SourceFile="fakeba.dll" /> | ||
| 5 | </BootstrapperApplication> | ||
| 6 | |||
| 7 | <SoftwareTag Regid="wixtoolset.org" InstallPath="[ProgramFiles6432Folder]\Test\swidtag" /> | ||
| 8 | |||
| 9 | <Chain> | ||
| 10 | <MsiPackage SourceFile="test.msi"> | ||
| 11 | <MsiProperty Name="TEST" Value="1" /> | ||
| 12 | </MsiPackage> | ||
| 13 | </Chain> | ||
| 14 | </Bundle> | ||
| 15 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/fakeba.dll b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/fakeba.dll new file mode 100644 index 00000000..64061ea0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleTag/fakeba.dll | |||
| @@ -0,0 +1 @@ | |||
| This is fakeba.dll. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/Package.en-us.wxl | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | |||
| 3 | <!-- | ||
| 4 | This file contains the declaration of all the localizable strings. | ||
| 5 | --> | ||
| 6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
| 7 | |||
| 8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
| 9 | <String Id="FeatureTitle">MsiPackage</String> | ||
| 10 | |||
| 11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageComponents.wxs new file mode 100644 index 00000000..37a2c462 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageComponents.wxs | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
| 5 | <Component> | ||
| 6 | <File Source="example.txt" /> | ||
| 7 | </Component> | ||
| 8 | </ComponentGroup> | ||
| 9 | </Fragment> | ||
| 10 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageWithTag.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageWithTag.wxs new file mode 100644 index 00000000..17543c1a --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/PackageWithTag.wxs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Package ProductCode="8738B0C5-C4AA-4634-8C03-11EAA2F1E15D" Name="~TagTestPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
| 3 | |||
| 4 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
| 5 | |||
| 6 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
| 7 | <ComponentGroupRef Id="ProductComponents" /> | ||
| 8 | </Feature> | ||
| 9 | |||
| 10 | <SoftwareTag Regid="wixtoolset.org" InstallDirectory="INSTALLFOLDER" /> | ||
| 11 | </Package> | ||
| 12 | |||
| 13 | <Fragment> | ||
| 14 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 15 | <Directory Id="ProgramFilesFolder"> | ||
| 16 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
| 17 | </Directory> | ||
| 18 | </Directory> | ||
| 19 | </Fragment> | ||
| 20 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/example.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductTag/example.txt | |||
| @@ -0,0 +1 @@ | |||
| This is example.txt. \ No newline at end of file | |||
