diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-07-01 09:30:10 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 12:50:09 -0500 |
commit | 9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2 (patch) | |
tree | ea2a05de5a8a1dfcb2af8e9e3805fe015729f66a /src/test | |
parent | 8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc (diff) | |
download | wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.gz wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.bz2 wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.zip |
Add bundle option for command line variables to always be uppercase.
Fixes #3777
Diffstat (limited to 'src/test')
7 files changed, 166 insertions, 0 deletions
diff --git a/src/test/burn/TestData/VariableTests/BundleA/BundleA.wixproj b/src/test/burn/TestData/VariableTests/BundleA/BundleA.wixproj new file mode 100644 index 00000000..91049cee --- /dev/null +++ b/src/test/burn/TestData/VariableTests/BundleA/BundleA.wixproj | |||
@@ -0,0 +1,17 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <BA>hyperlinkLicense</BA> | ||
6 | <UpgradeCode>{DDB62589-C5AD-4E92-A697-EAD7D7C37C8D}</UpgradeCode> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
16 | </ItemGroup> | ||
17 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/VariableTests/BundleA/BundleA.wxs b/src/test/burn/TestData/VariableTests/BundleA/BundleA.wxs new file mode 100644 index 00000000..f243c97d --- /dev/null +++ b/src/test/burn/TestData/VariableTests/BundleA/BundleA.wxs | |||
@@ -0,0 +1,17 @@ | |||
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 | |||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
6 | <Fragment> | ||
7 | <PackageGroup Id="BundlePackages"> | ||
8 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)"> | ||
9 | <MsiProperty Name="INSTALLLOCATION" Value="[INSTALLLOCATION]" /> | ||
10 | <MsiProperty Name="LICENSEKEY" Value="[LICENSEKEY]" /> | ||
11 | </MsiPackage> | ||
12 | </PackageGroup> | ||
13 | |||
14 | <Variable Name="INSTALLLOCATION" bal:Overridable="yes" /> | ||
15 | <Variable Name="LICENSEKEY" Hidden="yes" bal:Overridable="yes" /> | ||
16 | </Fragment> | ||
17 | </Wix> | ||
diff --git a/src/test/burn/TestData/VariableTests/BundleB/Bundle.wxs b/src/test/burn/TestData/VariableTests/BundleB/Bundle.wxs new file mode 100644 index 00000000..fb293d9b --- /dev/null +++ b/src/test/burn/TestData/VariableTests/BundleB/Bundle.wxs | |||
@@ -0,0 +1,40 @@ | |||
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 | <?ifndef Version?> | ||
4 | <?define Version = 1.0.0.0?> | ||
5 | <?endif?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
8 | <!-- CommandLineVariables should be the only thing different from the template --> | ||
9 | <Bundle Name="~$(var.TestGroupName) - $(var.BundleName)" Version="$(var.Version)" UpgradeCode="$(var.UpgradeCode)" Compressed="yes" CommandLineVariables="caseSensitive"> | ||
10 | <Log Prefix="~$(var.TestGroupName)_$(var.BundleName)" /> | ||
11 | |||
12 | <Variable Name="TestGroupName" Value="$(var.TestGroupName)" /> | ||
13 | |||
14 | <?ifdef SoftwareTag?> | ||
15 | <SoftwareTag Regid="regid.1995-08.com.example" InstallPath="[CommonAppDataFolder]regid.1995-08.com.example" /> | ||
16 | <?endif?> | ||
17 | |||
18 | <?ifndef BA?> | ||
19 | <!-- pulled in through the PackageGroupRef below --> | ||
20 | <?elseif $(var.BA) = "TestBAdnc"?> | ||
21 | <!-- pulled in through the PackageGroupRef below --> | ||
22 | <?elseif $(var.BA) = "hyperlinkLicense"?> | ||
23 | <BootstrapperApplication> | ||
24 | <bal:WixStandardBootstrapperApplication LicenseUrl="" Theme="hyperlinkLicense" /> | ||
25 | </BootstrapperApplication> | ||
26 | <?else?> | ||
27 | <BootstrapperApplicationRef Id="$(var.BA)" /> | ||
28 | <?endif?> | ||
29 | |||
30 | <Chain> | ||
31 | <?ifndef BA?> | ||
32 | <PackageGroupRef Id="TestBA" /> | ||
33 | <?elseif $(var.BA) = "TestBAdnc"?> | ||
34 | <PackageGroupRef Id="TestBAdnc" /> | ||
35 | <?endif?> | ||
36 | |||
37 | <PackageGroupRef Id="BundlePackages" /> | ||
38 | </Chain> | ||
39 | </Bundle> | ||
40 | </Wix> | ||
diff --git a/src/test/burn/TestData/VariableTests/BundleB/BundleB.wixproj b/src/test/burn/TestData/VariableTests/BundleB/BundleB.wixproj new file mode 100644 index 00000000..fa11100b --- /dev/null +++ b/src/test/burn/TestData/VariableTests/BundleB/BundleB.wixproj | |||
@@ -0,0 +1,14 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <BA>hyperlinkLicense</BA> | ||
6 | <UpgradeCode>{B735B6D2-9D4D-4E98-B464-946F7F62AFC8}</UpgradeCode> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
13 | </ItemGroup> | ||
14 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/VariableTests/BundleB/BundleB.wxs b/src/test/burn/TestData/VariableTests/BundleB/BundleB.wxs new file mode 100644 index 00000000..f243c97d --- /dev/null +++ b/src/test/burn/TestData/VariableTests/BundleB/BundleB.wxs | |||
@@ -0,0 +1,17 @@ | |||
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 | |||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
6 | <Fragment> | ||
7 | <PackageGroup Id="BundlePackages"> | ||
8 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)"> | ||
9 | <MsiProperty Name="INSTALLLOCATION" Value="[INSTALLLOCATION]" /> | ||
10 | <MsiProperty Name="LICENSEKEY" Value="[LICENSEKEY]" /> | ||
11 | </MsiPackage> | ||
12 | </PackageGroup> | ||
13 | |||
14 | <Variable Name="INSTALLLOCATION" bal:Overridable="yes" /> | ||
15 | <Variable Name="LICENSEKEY" Hidden="yes" bal:Overridable="yes" /> | ||
16 | </Fragment> | ||
17 | </Wix> | ||
diff --git a/src/test/burn/TestData/VariableTests/PackageA/PackageA.wixproj b/src/test/burn/TestData/VariableTests/PackageA/PackageA.wixproj new file mode 100644 index 00000000..da99dfea --- /dev/null +++ b/src/test/burn/TestData/VariableTests/PackageA/PackageA.wixproj | |||
@@ -0,0 +1,9 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <UpgradeCode>{7D70B3D9-968C-4599-9CB4-5A5D6CD17681}</UpgradeCode> | ||
5 | </PropertyGroup> | ||
6 | <ItemGroup> | ||
7 | <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" /> | ||
8 | </ItemGroup> | ||
9 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/VariableTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/VariableTests.cs new file mode 100644 index 00000000..fcec1df2 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/VariableTests.cs | |||
@@ -0,0 +1,52 @@ | |||
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.BurnE2E | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using System.IO; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using WixTestTools; | ||
9 | using WixToolset.Mba.Core; | ||
10 | using Xunit; | ||
11 | using Xunit.Abstractions; | ||
12 | |||
13 | public class VariableTests : BurnE2ETests | ||
14 | { | ||
15 | public VariableTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
16 | |||
17 | [Fact] | ||
18 | public void CanHideHiddenVariables() | ||
19 | { | ||
20 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
21 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
22 | |||
23 | packageA.VerifyInstalled(false); | ||
24 | |||
25 | var logFilePath = bundleA.Install(0, "INSTALLLOCATION=nothingtoseehere", "licensekey=supersecretkey"); | ||
26 | bundleA.VerifyRegisteredAndInPackageCache(); | ||
27 | |||
28 | packageA.VerifyInstalled(true); | ||
29 | |||
30 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=nothingtoseehere LICENSEKEY=*****")); | ||
31 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"nothingtoseehere\" LICENSEKEY=\"*****\"")); | ||
32 | Assert.False(LogVerifier.MessageInLogFile(logFilePath, "supersecretkey")); | ||
33 | } | ||
34 | |||
35 | [Fact] | ||
36 | public void CanSupportCaseSensitiveVariables() | ||
37 | { | ||
38 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
39 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
40 | |||
41 | packageA.VerifyInstalled(false); | ||
42 | |||
43 | var logFilePath = bundleB.Install(0, "InstallLocation=nothingtoseehere", "licensekey=supersecretkey"); | ||
44 | bundleB.VerifyRegisteredAndInPackageCache(); | ||
45 | |||
46 | packageA.VerifyInstalled(true); | ||
47 | |||
48 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "InstallLocation=nothingtoseehere licensekey=supersecretkey")); | ||
49 | Assert.True(LogVerifier.MessageInLogFile(logFilePath, "INSTALLLOCATION=\"\" LICENSEKEY=\"*****\"")); | ||
50 | } | ||
51 | } | ||
52 | } | ||