From ee41358bb583619ef4fe6707958dc3c6c62cd13f Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Sun, 28 Jul 2024 00:12:25 +1000 Subject: Fix up COM+ to be back in working order under Wix4+ Table names updated for Wix4 prefix. Custom action names similarly updated. Table names Wix4ComPlusUserInApplicationRole, Wix4ComPlusGroupInApplicationRole and Wix4ComPlusApplicationRoleProperty had to be shortened to fit within MSI 31 character table name limit. Migrated from fixed GUID for RegistrationHelper to use CLSIDFromProgID in an attempt to fix behaviour under .NET 4+ DLLs. Added setting of Partition enable if a Partition is configured in authoring, new Windows config has Partitions disabled by default, and they don't work at all under Windows workstation (non-server) versions. Added a new Runtime condition for `RequireWindowsServer` which will skip execution of Runtime test on workstation/desktop OSes, since COM+ Partitions only work correctly under Windows Server. Quite a lot of basic typos fixed also. Signed-off-by: Bevan Weiss --- src/test/burn/WixTestTools/RuntimeFactAttribute.cs | 30 +++++++++++++ .../Components/TestComponentNET3.dll | Bin 0 -> 16384 bytes .../Components/TestComponentNET3.tlb | Bin 0 -> 2088 bytes .../Components/TestComponentNET4.dll | Bin 0 -> 16384 bytes .../Components/TestComponentNET4.tlb | Bin 0 -> 2088 bytes .../Components/TestComponentNative.dll | Bin 0 -> 56832 bytes .../InstallUninstallNET3WithoutPartitions.wixproj | 15 +++++++ .../product.wxs | 24 ++++++++++ .../InstallUninstallNET4WithoutPartitions.wixproj | 15 +++++++ .../product.wxs | 24 ++++++++++ ...InstallUninstallNativeWithoutPartitions.wixproj | 15 +++++++ .../product.wxs | 24 ++++++++++ .../InstallUninstallWithPartitions.wixproj | 15 +++++++ .../InstallUninstallWithPartitions/product.wxs | 30 +++++++++++++ .../WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs | 50 +++++++++++++++++++++ 15 files changed, 242 insertions(+) create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs create mode 100644 src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs (limited to 'src/test') diff --git a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs index f73c87a2..573a9de2 100644 --- a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs +++ b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs @@ -5,6 +5,7 @@ namespace WixTestTools using System; using System.Security.Principal; using WixInternal.TestSupport.XunitExtensions; + using System.Runtime.InteropServices; public class RuntimeFactAttribute : SkippableFactAttribute { @@ -12,6 +13,16 @@ namespace WixTestTools public static bool RuntimeTestsEnabled { get; } public static bool RunningAsAdministrator { get; } + public static bool RunningOnWindowsServer { get; } + + [DllImport("shlwapi.dll", SetLastError = true, EntryPoint = "#437")] + private static extern bool IsOS(int os); + private static bool IsWindowsServer() + { + const int OS_ANYSERVER = 29; + return IsOS(OS_ANYSERVER); + } + static RuntimeFactAttribute() { @@ -21,6 +32,25 @@ namespace WixTestTools var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); RuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled; + + RunningOnWindowsServer = IsWindowsServer(); + } + + private bool _RequireWindowsServer; + public bool RequireWindowsServer + { + get + { + return _RequireWindowsServer; + } + set + { + _RequireWindowsServer = value; + if (_RequireWindowsServer && !RunningOnWindowsServer) + { + this.Skip = $"These tests are only run on Windows Server"; + } + } } public RuntimeFactAttribute() diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll new file mode 100644 index 00000000..b46be649 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb new file mode 100644 index 00000000..87419ee1 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll new file mode 100644 index 00000000..e0fd3dee Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb new file mode 100644 index 00000000..63647bdc Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll new file mode 100644 index 00000000..dbcb5807 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs new file mode 100644 index 00000000..129669cc --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs new file mode 100644 index 00000000..eabd7794 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs new file mode 100644 index 00000000..ee3c4d8f --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs new file mode 100644 index 00000000..92dc892b --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs new file mode 100644 index 00000000..b143c19d --- /dev/null +++ b/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs @@ -0,0 +1,50 @@ +// 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. + +namespace WixToolsetTest.MsiE2E +{ + using System; + using WixTestTools; + using Xunit; + using Xunit.Abstractions; + + public class ComPlusExtensionTests : MsiE2ETests + { + public ComPlusExtensionTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } + + [RuntimeFact] + public void CanInstallUninstallNativeWithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNativeWithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact] + public void CanInstallUninstallNET3WithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNET3WithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact] + public void CanInstallUninstallNET4WithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNET4WithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact(RequireWindowsServer = true)] + public void CanInstallAndUninstallWithPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallWithPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + } +} -- cgit v1.2.3-55-g6feb