diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-15 10:48:06 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-30 15:00:45 -0600 |
| commit | 9e2cda60e3852660f235beb5e0af1c746d0045e6 (patch) | |
| tree | 8fca357e80bf638750fe900c4803a081e16adee8 /src/test | |
| parent | 07599b27596af68f0917c1afc6a748af3a3cda2f (diff) | |
| download | wix-9e2cda60e3852660f235beb5e0af1c746d0045e6.tar.gz wix-9e2cda60e3852660f235beb5e0af1c746d0045e6.tar.bz2 wix-9e2cda60e3852660f235beb5e0af1c746d0045e6.zip | |
FilesInUse messages are too different to unify in the Burn engine.
Fixes #6348
Diffstat (limited to 'src/test')
8 files changed, 101 insertions, 1 deletions
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index 5c70253d..5ef26253 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs | |||
| @@ -399,7 +399,7 @@ namespace WixToolset.Test.BA | |||
| 399 | 399 | ||
| 400 | protected override void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args) | 400 | protected override void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args) |
| 401 | { | 401 | { |
| 402 | this.Log("OnExecuteFilesInUse() - package: {0}, retries remaining: {1}, data: {2}", args.PackageId, this.retryExecuteFilesInUse, String.Join(", ", args.Files.ToArray())); | 402 | this.Log("OnExecuteFilesInUse() - package: {0}, source: {1}, retries remaining: {2}, data: {3}", args.PackageId, args.Source, this.retryExecuteFilesInUse, String.Join(", ", args.Files.ToArray())); |
| 403 | 403 | ||
| 404 | if (this.retryExecuteFilesInUse > 0) | 404 | if (this.retryExecuteFilesInUse > 0) |
| 405 | { | 405 | { |
diff --git a/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wixproj b/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wixproj new file mode 100644 index 00000000..c71410c2 --- /dev/null +++ b/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wixproj | |||
| @@ -0,0 +1,18 @@ | |||
| 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 | <UpgradeCode>{6A348108-8ACE-4D13-A352-D8F76785BFE4}</UpgradeCode> | ||
| 6 | </PropertyGroup> | ||
| 7 | <ItemGroup> | ||
| 8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
| 9 | </ItemGroup> | ||
| 10 | <ItemGroup> | ||
| 11 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
| 12 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
| 13 | </ItemGroup> | ||
| 14 | <ItemGroup> | ||
| 15 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
| 16 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
| 17 | </ItemGroup> | ||
| 18 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wxs b/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wxs new file mode 100644 index 00000000..bd164a29 --- /dev/null +++ b/src/test/burn/TestData/FilesInUseTests/BundleA/BundleA.wxs | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Fragment> | ||
| 6 | <PackageGroup Id="BundlePackages"> | ||
| 7 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" /> | ||
| 8 | </PackageGroup> | ||
| 9 | </Fragment> | ||
| 10 | </Wix> | ||
diff --git a/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.wixproj b/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.wixproj new file mode 100644 index 00000000..57825f7b --- /dev/null +++ b/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.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 | <PropertyGroup> | ||
| 4 | <ProductComponentsRef>true</ProductComponentsRef> | ||
| 5 | <UpgradeCode>{C94C8FC9-1347-44CE-B1FB-0A6196928921}</UpgradeCode> | ||
| 6 | </PropertyGroup> | ||
| 7 | <ItemGroup> | ||
| 8 | <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" /> | ||
| 9 | </ItemGroup> | ||
| 10 | <ItemGroup> | ||
| 11 | <PackageReference Include="WixToolset.UI.wixext" /> | ||
| 12 | </ItemGroup> | ||
| 13 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.wxs b/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.wxs new file mode 100644 index 00000000..a96c2a11 --- /dev/null +++ b/src/test/burn/TestData/FilesInUseTests/PackageA/PackageA.wxs | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 4 | <Fragment> | ||
| 5 | <ComponentGroup Id="ProductComponents" /> | ||
| 6 | |||
| 7 | <UIRef Id="WixUI_Minimal" /> | ||
| 8 | <WixVariable Id="WixUILicenseRtf" Value="license.txt" /> | ||
| 9 | </Fragment> | ||
| 10 | </Wix> | ||
diff --git a/src/test/burn/TestData/FilesInUseTests/PackageA/license.txt b/src/test/burn/TestData/FilesInUseTests/PackageA/license.txt new file mode 100644 index 00000000..2e65efe2 --- /dev/null +++ b/src/test/burn/TestData/FilesInUseTests/PackageA/license.txt | |||
| @@ -0,0 +1 @@ | |||
| a \ No newline at end of file | |||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/FilesInUseTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/FilesInUseTests.cs new file mode 100644 index 00000000..6ad68d22 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/FilesInUseTests.cs | |||
| @@ -0,0 +1,38 @@ | |||
| 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.IO; | ||
| 6 | using WixTestTools; | ||
| 7 | using Xunit; | ||
| 8 | using Xunit.Abstractions; | ||
| 9 | |||
| 10 | public class FilesInUseTests : BurnE2ETests | ||
| 11 | { | ||
| 12 | public FilesInUseTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
| 13 | |||
| 14 | [Fact] | ||
| 15 | public void CanCancelInstallAfterRetryingLockedFile() | ||
| 16 | { | ||
| 17 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
| 18 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
| 19 | var testBAController = this.CreateTestBAController(); | ||
| 20 | |||
| 21 | testBAController.SetPackageRetryExecuteFilesInUse("PackageA", 1); | ||
| 22 | |||
| 23 | packageA.VerifyInstalled(false); | ||
| 24 | |||
| 25 | // Lock the file that will be installed. | ||
| 26 | string targetInstallFile = packageA.GetInstalledFilePath("Package.wxs"); | ||
| 27 | Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile)); | ||
| 28 | using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, 4096, FileOptions.DeleteOnClose)) | ||
| 29 | { | ||
| 30 | bundleA.Install(expectedExitCode: (int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT); | ||
| 31 | } | ||
| 32 | |||
| 33 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 34 | |||
| 35 | packageA.VerifyInstalled(false); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs index 6e4fe6c6..d2e8a1ca 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs | |||
| @@ -118,6 +118,16 @@ namespace WixToolsetTest.BurnE2E | |||
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | /// <summary> | 120 | /// <summary> |
| 121 | /// Retries the files in use one or more times before canceling. | ||
| 122 | /// </summary> | ||
| 123 | /// <param name="packageId">Package identity.</param> | ||
| 124 | /// <param name="cancelPoint">Sets or removes the retry count on a package's file in use message.</param> | ||
| 125 | public void SetPackageRetryExecuteFilesInUse(string packageId, int? retryCount) | ||
| 126 | { | ||
| 127 | this.SetPackageState(packageId, "RetryExecuteFilesInUse", retryCount.HasValue ? retryCount.ToString() : null); | ||
| 128 | } | ||
| 129 | |||
| 130 | /// <summary> | ||
| 121 | /// Sets the requested state for a package that the TestBA will return to the engine during plan. | 131 | /// Sets the requested state for a package that the TestBA will return to the engine during plan. |
| 122 | /// </summary> | 132 | /// </summary> |
| 123 | /// <param name="packageId">Package identity.</param> | 133 | /// <param name="packageId">Package identity.</param> |
