diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-01-14 21:37:24 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-01-16 10:30:28 -0600 |
commit | da1d1376953ef1c9afb32d5eee02b785e52e372e (patch) | |
tree | 0df8550960259d7b13f5cd90f04d21b5576f16b7 /src/test | |
parent | abe316b80fae80eba54b0b79e76b6362105fa098 (diff) | |
download | wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.tar.gz wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.tar.bz2 wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.zip |
Remove orphan compatible MSI packages.
Reimplements #3190
Diffstat (limited to 'src/test')
10 files changed, 120 insertions, 6 deletions
diff --git a/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wixproj b/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wixproj new file mode 100644 index 00000000..eab737f8 --- /dev/null +++ b/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wixproj | |||
@@ -0,0 +1,16 @@ | |||
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 | <Import Project="..\BundleAv1\BundleA.props" /> | ||
4 | <PropertyGroup> | ||
5 | <Version>2.0.0.0</Version> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <ProjectReference Include="..\PackageAv2\PackageAv2.wixproj" /> | ||
9 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
13 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
14 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
15 | </ItemGroup> | ||
16 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wxs b/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wxs new file mode 100644 index 00000000..570f633f --- /dev/null +++ b/src/test/burn/TestData/DependencyTests/BundleAv2/BundleAv2.wxs | |||
@@ -0,0 +1,21 @@ | |||
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 | <?define TestExeRegistryKey = Software\WiX\Tests\$(var.TestGroupName)\ExeA?> | ||
4 | |||
5 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
6 | <Fragment> | ||
7 | <util:RegistrySearch Root="HKLM" Key="$(var.TestExeRegistryKey)" Value="Version" Variable="ExeA_Version" /> | ||
8 | |||
9 | <PackageGroup Id="BundlePackages"> | ||
10 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv2.TargetPath)" /> | ||
11 | <ExePackage Id="ExeA" Cache="remove" PerMachine="yes" | ||
12 | DetectCondition="ExeA_Version AND ExeA_Version >= v$(var.Version)" | ||
13 | InstallArguments="/regw "HKLM\$(var.TestExeRegistryKey),Version,String,$(var.Version)"" | ||
14 | RepairArguments="/regw "HKLM\$(var.TestExeRegistryKey),Version,String,$(var.Version)"" | ||
15 | UninstallArguments="/regd "HKLM\$(var.TestExeRegistryKey),Version""> | ||
16 | <Provides Key="$(var.TestGroupName)_ExeA,v1.0" Version="$(var.Version)" /> | ||
17 | <PayloadGroupRef Id="TestExePayloads" /> | ||
18 | </ExePackage> | ||
19 | </PackageGroup> | ||
20 | </Fragment> | ||
21 | </Wix> | ||
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv1/PackageA.props b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageA.props index 8cbe9aa9..d6778261 100644 --- a/src/test/burn/TestData/DependencyTests/PackageAv1/PackageA.props +++ b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageA.props | |||
@@ -3,7 +3,6 @@ | |||
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <PackageName>PackageA</PackageName> | 4 | <PackageName>PackageA</PackageName> |
5 | <ProductComponentsRef>true</ProductComponentsRef> | 5 | <ProductComponentsRef>true</ProductComponentsRef> |
6 | <ProductCode>{6F171EC9-0774-4974-A8D1-493EF53CAB74}</ProductCode> | ||
7 | <UpgradeCode>{45E933B7-B56A-44D5-8EEC-625EC199085E}</UpgradeCode> | 6 | <UpgradeCode>{45E933B7-B56A-44D5-8EEC-625EC199085E}</UpgradeCode> |
8 | </PropertyGroup> | 7 | </PropertyGroup> |
9 | <ItemGroup> | 8 | <ItemGroup> |
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.props b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.props new file mode 100644 index 00000000..e83247c0 --- /dev/null +++ b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.props | |||
@@ -0,0 +1,7 @@ | |||
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> | ||
3 | <Import Project="PackageA.props" /> | ||
4 | <PropertyGroup> | ||
5 | <ProductCode>{6F171EC9-0774-4974-A8D1-493EF53CAB74}</ProductCode> | ||
6 | </PropertyGroup> | ||
7 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.wixproj b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.wixproj index 5ebce845..add55d60 100644 --- a/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.wixproj +++ b/src/test/burn/TestData/DependencyTests/PackageAv1/PackageAv1.wixproj | |||
@@ -1,6 +1,6 @@ | |||
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. --> | 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"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <Import Project="PackageA.props" /> | 3 | <Import Project="PackageAv1.props" /> |
4 | <ItemGroup> | 4 | <ItemGroup> |
5 | <PackageReference Include="WixToolset.Dependency.wixext" /> | 5 | <PackageReference Include="WixToolset.Dependency.wixext" /> |
6 | </ItemGroup> | 6 | </ItemGroup> |
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv1_0_1/PackageAv1_0_1.wixproj b/src/test/burn/TestData/DependencyTests/PackageAv1_0_1/PackageAv1_0_1.wixproj index 73a7cb6f..e1081745 100644 --- a/src/test/burn/TestData/DependencyTests/PackageAv1_0_1/PackageAv1_0_1.wixproj +++ b/src/test/burn/TestData/DependencyTests/PackageAv1_0_1/PackageAv1_0_1.wixproj | |||
@@ -1,6 +1,6 @@ | |||
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. --> | 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"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <Import Project="..\PackageAv1\PackageA.props" /> | 3 | <Import Project="..\PackageAv1\PackageAv1.props" /> |
4 | <PropertyGroup> | 4 | <PropertyGroup> |
5 | <Version>1.0.1.0</Version> | 5 | <Version>1.0.1.0</Version> |
6 | </PropertyGroup> | 6 | </PropertyGroup> |
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv1_0_2/PackageAv1_0_2.wixproj b/src/test/burn/TestData/DependencyTests/PackageAv1_0_2/PackageAv1_0_2.wixproj index 37e88de9..60b64c9f 100644 --- a/src/test/burn/TestData/DependencyTests/PackageAv1_0_2/PackageAv1_0_2.wixproj +++ b/src/test/burn/TestData/DependencyTests/PackageAv1_0_2/PackageAv1_0_2.wixproj | |||
@@ -1,6 +1,6 @@ | |||
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. --> | 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"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <Import Project="..\PackageAv1\PackageA.props" /> | 3 | <Import Project="..\PackageAv1\PackageAv1.props" /> |
4 | <PropertyGroup> | 4 | <PropertyGroup> |
5 | <Version>1.0.2.0</Version> | 5 | <Version>1.0.2.0</Version> |
6 | </PropertyGroup> | 6 | </PropertyGroup> |
diff --git a/src/test/burn/TestData/DependencyTests/PackageAv2/PackageAv2.wixproj b/src/test/burn/TestData/DependencyTests/PackageAv2/PackageAv2.wixproj new file mode 100644 index 00000000..b61d09f5 --- /dev/null +++ b/src/test/burn/TestData/DependencyTests/PackageAv2/PackageAv2.wixproj | |||
@@ -0,0 +1,13 @@ | |||
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 | <Import Project="..\PackageAv1\PackageA.props" /> | ||
4 | <PropertyGroup> | ||
5 | <Version>2.0.0.0</Version> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\PackageAv1\ProductComponents.wxs" Link="ProductComponents.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <PackageReference Include="WixToolset.Dependency.wixext" /> | ||
12 | </ItemGroup> | ||
13 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/WixTestTools/BundleVerifier.cs b/src/test/burn/WixTestTools/BundleVerifier.cs index 54f90870..db14c228 100644 --- a/src/test/burn/WixTestTools/BundleVerifier.cs +++ b/src/test/burn/WixTestTools/BundleVerifier.cs | |||
@@ -124,14 +124,14 @@ namespace WixTestTools | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | public void VerifyPackageIsCached(string packageId) | 127 | public void VerifyPackageIsCached(string packageId, bool cached = true) |
128 | { | 128 | { |
129 | using var wixOutput = WixOutput.Read(this.BundlePdb); | 129 | using var wixOutput = WixOutput.Read(this.BundlePdb); |
130 | var intermediate = Intermediate.Load(wixOutput); | 130 | var intermediate = Intermediate.Load(wixOutput); |
131 | var section = intermediate.Sections.Single(); | 131 | var section = intermediate.Sections.Single(); |
132 | var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId); | 132 | var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().Single(p => p.Id.Id == packageId); |
133 | var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes); | 133 | var cachePath = this.GetPackageCachePathForCacheId(packageSymbol.CacheId, packageSymbol.PerMachine == YesNoDefaultType.Yes); |
134 | Assert.True(Directory.Exists(cachePath)); | 134 | Assert.Equal(cached, Directory.Exists(cachePath)); |
135 | } | 135 | } |
136 | 136 | ||
137 | public void VerifyExeTestRegistryRootDeleted(string name, bool x64 = false) | 137 | public void VerifyExeTestRegistryRootDeleted(string name, bool x64 = false) |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs index b08cd54f..825160c5 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs | |||
@@ -123,6 +123,64 @@ namespace WixToolsetTest.BurnE2E | |||
123 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "1.0.1.0"); | 123 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "1.0.1.0"); |
124 | } | 124 | } |
125 | 125 | ||
126 | [Fact] | ||
127 | public void UninstallsOrphanCompatiblePackages() | ||
128 | { | ||
129 | var testRegistryValueExe = "ExeA"; | ||
130 | |||
131 | var packageAv1 = this.CreatePackageInstaller("PackageAv1"); | ||
132 | var packageAv2 = this.CreatePackageInstaller("PackageAv2"); | ||
133 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
134 | var bundleAv1 = this.CreateBundleInstaller("BundleAv1"); | ||
135 | var bundleAv2 = this.CreateBundleInstaller("BundleAv2"); | ||
136 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
137 | |||
138 | packageAv1.VerifyInstalled(false); | ||
139 | packageAv2.VerifyInstalled(false); | ||
140 | packageB.VerifyInstalled(false); | ||
141 | |||
142 | bundleAv1.Install(); | ||
143 | bundleAv1.VerifyRegisteredAndInPackageCache(); | ||
144 | |||
145 | packageAv1.VerifyInstalled(true); | ||
146 | bundleAv1.VerifyPackageIsCached("PackageA"); | ||
147 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "1.0.0.0"); | ||
148 | |||
149 | bundleB.Install(); | ||
150 | bundleB.VerifyRegisteredAndInPackageCache(); | ||
151 | |||
152 | packageAv1.VerifyInstalled(true); | ||
153 | bundleAv1.VerifyPackageIsCached("PackageA"); | ||
154 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "1.0.0.0"); | ||
155 | packageB.VerifyInstalled(true); | ||
156 | |||
157 | bundleAv2.Install(); | ||
158 | bundleAv2.VerifyRegisteredAndInPackageCache(); | ||
159 | bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
160 | |||
161 | packageAv1.VerifyInstalled(false); | ||
162 | bundleAv1.VerifyPackageIsCached("PackageA", false); | ||
163 | packageAv2.VerifyInstalled(true); | ||
164 | bundleAv2.VerifyPackageIsCached("PackageA"); | ||
165 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "2.0.0.0"); | ||
166 | |||
167 | bundleAv2.Uninstall(); | ||
168 | bundleAv2.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
169 | |||
170 | packageAv2.VerifyInstalled(true); | ||
171 | bundleAv2.VerifyPackageIsCached("PackageA"); | ||
172 | bundleAv1.VerifyExeTestRegistryValue(testRegistryValueExe, "2.0.0.0"); | ||
173 | |||
174 | // Verify https://github.com/wixtoolset/issues/issues/3190 | ||
175 | bundleB.Uninstall(); | ||
176 | |||
177 | packageAv1.VerifyInstalled(false); | ||
178 | packageAv2.VerifyInstalled(false); | ||
179 | bundleAv2.VerifyPackageIsCached("PackageA", false); | ||
180 | packageB.VerifyInstalled(false); | ||
181 | bundleAv1.VerifyExeTestRegistryRootDeleted(testRegistryValueExe); | ||
182 | } | ||
183 | |||
126 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6401")] | 184 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6401")] |
127 | public void CanMinorUpgradeDependencyPackageFromPatchBundle() | 185 | public void CanMinorUpgradeDependencyPackageFromPatchBundle() |
128 | { | 186 | { |