From 70f6c04122db39b5d234715c373d690f97892f8b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 1 May 2021 20:44:43 -0500 Subject: Add x64 Bundle tests. --- BurnE2ETests.sln | 2 - src/TestBA/TestBA_x64.csproj | 24 ++++ .../BundleA_x64/BundleA_x64.wixproj | 19 +++ .../BundleA_x64/BundleA_x64.wxs | 10 ++ .../BundleB/BundleB.wixproj | 19 +++ .../BundleB_x64/BundleB_x64.wixproj | 22 ++++ .../BundleC/BundleC.wixproj | 20 +++ .../BundleC_x64/BundleC_x64.wixproj | 22 ++++ .../PackageA_x64/PackageA_x64.wixproj | 10 ++ src/TestData/Templates/Bundle.wxs | 8 ++ src/TestData/Templates/Package.wxs | 2 +- .../TestBA/TestBAWixlib_x64/TestBA_x64.wxs | 30 +++++ .../TestBA/TestBAWixlib_x64/TestExe_x64.wxs | 9 ++ .../TestBAWixlib_x64/testbawixlib_x64.wixproj | 20 +++ src/TestExe/TestExe_x64.csproj | 17 +++ src/WixTestTools/BundleRegistration.cs | 5 +- src/WixTestTools/BundleVerifier.cs | 11 +- src/WixTestTools/PackageInstaller.cs | 14 +++ src/WixTestTools/PackageVerifier.cs | 30 ++--- src/WixTestTools/WixTestContext.cs | 10 +- .../BasicFunctionalityTests.cs | 137 ++++++++++++++++++++- src/WixToolsetTest.BurnE2E/TestBAController.cs | 13 +- 22 files changed, 412 insertions(+), 42 deletions(-) create mode 100644 src/TestBA/TestBA_x64.csproj create mode 100644 src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wixproj create mode 100644 src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wxs create mode 100644 src/TestData/BasicFunctionalityTests/BundleB/BundleB.wixproj create mode 100644 src/TestData/BasicFunctionalityTests/BundleB_x64/BundleB_x64.wixproj create mode 100644 src/TestData/BasicFunctionalityTests/BundleC/BundleC.wixproj create mode 100644 src/TestData/BasicFunctionalityTests/BundleC_x64/BundleC_x64.wixproj create mode 100644 src/TestData/BasicFunctionalityTests/PackageA_x64/PackageA_x64.wixproj create mode 100644 src/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs create mode 100644 src/TestData/TestBA/TestBAWixlib_x64/TestExe_x64.wxs create mode 100644 src/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj create mode 100644 src/TestExe/TestExe_x64.csproj diff --git a/BurnE2ETests.sln b/BurnE2ETests.sln index 2e3523bf..7cdb0cf0 100644 --- a/BurnE2ETests.sln +++ b/BurnE2ETests.sln @@ -73,8 +73,6 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {74DE2EED-ECAA-4FDD-9792-9D3B0C0C1321} EndGlobalSection diff --git a/src/TestBA/TestBA_x64.csproj b/src/TestBA/TestBA_x64.csproj new file mode 100644 index 00000000..1368e0f0 --- /dev/null +++ b/src/TestBA/TestBA_x64.csproj @@ -0,0 +1,24 @@ + + + + + + net35;net5.0-windows + TestBA + WixToolset.Test.BA + embedded + win-x64 + true + true + Major + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wixproj b/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wixproj new file mode 100644 index 00000000..f5c53195 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wixproj @@ -0,0 +1,19 @@ + + + + Bundle + x64 + 1154;$(SuppressSpecificWarnings) + hyperlinkLicense + {6E86B95A-24F6-4C89-AF2E-470C0C734FCB} + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wxs b/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wxs new file mode 100644 index 00000000..d34e51b6 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleA_x64/BundleA_x64.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/TestData/BasicFunctionalityTests/BundleB/BundleB.wixproj b/src/TestData/BasicFunctionalityTests/BundleB/BundleB.wixproj new file mode 100644 index 00000000..8ea9afe0 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleB/BundleB.wixproj @@ -0,0 +1,19 @@ + + + + Bundle + {02258734-E25E-4A2C-AFC5-55C34F1994CB} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/BundleB_x64/BundleB_x64.wixproj b/src/TestData/BasicFunctionalityTests/BundleB_x64/BundleB_x64.wixproj new file mode 100644 index 00000000..35f78cb8 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleB_x64/BundleB_x64.wixproj @@ -0,0 +1,22 @@ + + + + Bundle + TestBA_x64 + {79F45B7A-D990-46E4-819B-078D87C3321A} + x64 + 1154;$(SuppressSpecificWarnings) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/BundleC/BundleC.wixproj b/src/TestData/BasicFunctionalityTests/BundleC/BundleC.wixproj new file mode 100644 index 00000000..104a6003 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleC/BundleC.wixproj @@ -0,0 +1,20 @@ + + + + Bundle + TestBAdnc + {DD790BAA-FE9F-4B0D-8AF4-DE4E1D674637} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/BundleC_x64/BundleC_x64.wixproj b/src/TestData/BasicFunctionalityTests/BundleC_x64/BundleC_x64.wixproj new file mode 100644 index 00000000..aef5e18e --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/BundleC_x64/BundleC_x64.wixproj @@ -0,0 +1,22 @@ + + + + Bundle + TestBAdnc_x64 + {638D31D0-92BA-4BCD-82F0-7F549820D9AB} + x64 + 1154;$(SuppressSpecificWarnings) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestData/BasicFunctionalityTests/PackageA_x64/PackageA_x64.wixproj b/src/TestData/BasicFunctionalityTests/PackageA_x64/PackageA_x64.wixproj new file mode 100644 index 00000000..8dbab284 --- /dev/null +++ b/src/TestData/BasicFunctionalityTests/PackageA_x64/PackageA_x64.wixproj @@ -0,0 +1,10 @@ + + + + a_x64 + {BDB9EF6A-B2DE-4929-9BE3-0CD71BDAEF6E} + + + + + \ No newline at end of file diff --git a/src/TestData/Templates/Bundle.wxs b/src/TestData/Templates/Bundle.wxs index c77bfbd7..06409504 100644 --- a/src/TestData/Templates/Bundle.wxs +++ b/src/TestData/Templates/Bundle.wxs @@ -18,6 +18,10 @@ + + + + @@ -31,6 +35,10 @@ + + + + diff --git a/src/TestData/Templates/Package.wxs b/src/TestData/Templates/Package.wxs index e2aaa079..48ed5e02 100644 --- a/src/TestData/Templates/Package.wxs +++ b/src/TestData/Templates/Package.wxs @@ -35,7 +35,7 @@ - + diff --git a/src/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs b/src/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs new file mode 100644 index 00000000..078f4f01 --- /dev/null +++ b/src/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/TestData/TestBA/TestBAWixlib_x64/TestExe_x64.wxs b/src/TestData/TestBA/TestBAWixlib_x64/TestExe_x64.wxs new file mode 100644 index 00000000..02bed038 --- /dev/null +++ b/src/TestData/TestBA/TestBAWixlib_x64/TestExe_x64.wxs @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj b/src/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj new file mode 100644 index 00000000..9b7d3c17 --- /dev/null +++ b/src/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj @@ -0,0 +1,20 @@ + + + + Library + true + en-us + x64 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestExe/TestExe_x64.csproj b/src/TestExe/TestExe_x64.csproj new file mode 100644 index 00000000..1dd2d8e6 --- /dev/null +++ b/src/TestExe/TestExe_x64.csproj @@ -0,0 +1,17 @@ + + + + + + net35 + TestExe + TestExe + Exe + embedded + win-x64 + + + + + + \ No newline at end of file diff --git a/src/WixTestTools/BundleRegistration.cs b/src/WixTestTools/BundleRegistration.cs index bf9e2903..75660838 100644 --- a/src/WixTestTools/BundleRegistration.cs +++ b/src/WixTestTools/BundleRegistration.cs @@ -88,9 +88,10 @@ namespace WixTestTools public string Version { get; set; } - public static bool TryGetPerMachineBundleRegistrationById(string bundleId, out BundleRegistration registration) + public static bool TryGetPerMachineBundleRegistrationById(string bundleId, bool x64, out BundleRegistration registration) { - var registrationKeyPath = $"{BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE}\\{bundleId}"; + var baseKeyPath = x64 ? BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY : BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE; + var registrationKeyPath = $"{baseKeyPath}\\{bundleId}"; using var registrationKey = Registry.LocalMachine.OpenSubKey(registrationKeyPath); var success = registrationKey != null; registration = success ? GetBundleRegistration(registrationKey) : null; diff --git a/src/WixTestTools/BundleVerifier.cs b/src/WixTestTools/BundleVerifier.cs index 293da560..984df169 100644 --- a/src/WixTestTools/BundleVerifier.cs +++ b/src/WixTestTools/BundleVerifier.cs @@ -73,10 +73,11 @@ namespace WixTestTools public bool TryGetRegistration(out BundleRegistration registration) { var bundleSymbol = this.GetBundleSymbol(); + var x64 = bundleSymbol.Platform != Platform.X86; var bundleId = bundleSymbol.BundleId; if (bundleSymbol.PerMachine) { - return BundleRegistration.TryGetPerMachineBundleRegistrationById(bundleId, out registration); + return BundleRegistration.TryGetPerMachineBundleRegistrationById(bundleId, x64, out registration); } else { @@ -132,9 +133,9 @@ namespace WixTestTools Assert.True(Directory.Exists(cachePath)); } - public void VerifyExeTestRegistryRootDeleted(string name) + public void VerifyExeTestRegistryRootDeleted(string name, bool x64 = false) { - using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(name); + using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(x64, name); if (testRegistryRoot != null) { var actualValue = testRegistryRoot.GetValue("Version") as string; @@ -142,9 +143,9 @@ namespace WixTestTools } } - public void VerifyExeTestRegistryValue(string name, string expectedValue) + public void VerifyExeTestRegistryValue(string name, string expectedValue, bool x64 = false) { - using (var root = this.TestContext.GetTestRegistryRoot(name)) + using (var root = this.TestContext.GetTestRegistryRoot(x64, name)) { Assert.NotNull(root); var actualValue = root.GetValue("Version") as string; diff --git a/src/WixTestTools/PackageInstaller.cs b/src/WixTestTools/PackageInstaller.cs index 86376b9f..d32f499b 100644 --- a/src/WixTestTools/PackageInstaller.cs +++ b/src/WixTestTools/PackageInstaller.cs @@ -4,6 +4,10 @@ namespace WixTestTools { using System; using System.IO; + using System.Linq; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller; using static WixTestTools.MSIExec; public partial class PackageInstaller : IDisposable @@ -13,6 +17,16 @@ namespace WixTestTools this.Package = Path.Combine(testContext.TestDataFolder, $"{filename}.msi"); this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{filename}.wixpdb"); this.TestContext = testContext; + + using var wixOutput = WixOutput.Read(this.PackagePdb); + + var intermediate = Intermediate.Load(wixOutput); + var section = intermediate.Sections.Single(); + var platformSummary = section.Symbols.OfType().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage); + var platformString = platformSummary.Value.Split(new char[] { ';' }, 2)[0]; + this.IsX64 = platformString != "Intel"; + + this.WiData = WindowsInstallerData.Load(wixOutput); } public string Package { get; } diff --git a/src/WixTestTools/PackageVerifier.cs b/src/WixTestTools/PackageVerifier.cs index 073e83b0..2f42dd21 100644 --- a/src/WixTestTools/PackageVerifier.cs +++ b/src/WixTestTools/PackageVerifier.cs @@ -5,7 +5,6 @@ namespace WixTestTools using System; using System.IO; using System.Linq; - using WixToolset.Data; using WixToolset.Data.WindowsInstaller; using WixToolset.Data.WindowsInstaller.Rows; using Xunit; @@ -14,28 +13,18 @@ namespace WixTestTools { public string PackagePdb { get; } - private WindowsInstallerData WiData { get; set; } + private bool IsX64 { get; } - public string GetInstalledFilePath(string filename) - { - return this.TestContext.GetTestInstallFolder(Path.Combine(this.GetInstallFolderName(), filename)); - } + private WindowsInstallerData WiData { get; } - private WindowsInstallerData GetWindowsInstallerData() + public string GetInstalledFilePath(string filename) { - if (this.WiData == null) - { - using var wixOutput = WixOutput.Read(this.PackagePdb); - this.WiData = WindowsInstallerData.Load(wixOutput); - } - - return this.WiData; + return this.TestContext.GetTestInstallFolder(this.IsX64, Path.Combine(this.GetInstallFolderName(), filename)); } public string GetInstallFolderName() { - var wiData = this.GetWindowsInstallerData(); - var row = wiData.Tables["Directory"].Rows.Single(r => r.FieldAsString(0) == "INSTALLFOLDER"); + var row = this.WiData.Tables["Directory"].Rows.Single(r => r.FieldAsString(0) == "INSTALLFOLDER"); var value = row.FieldAsString(2); var longNameIndex = value.IndexOf('|') + 1; if (longNameIndex > 0) @@ -47,8 +36,7 @@ namespace WixTestTools public string GetProperty(string name) { - var wiData = this.GetWindowsInstallerData(); - var row = wiData.Tables["Property"].Rows.Cast().Single(r => r.Property == name); + var row = this.WiData.Tables["Property"].Rows.Cast().Single(r => r.Property == name); return row.Value; } @@ -67,7 +55,7 @@ namespace WixTestTools public void DeleteTestRegistryValue(string name) { - using (var root = this.TestContext.GetTestRegistryRoot()) + using (var root = this.TestContext.GetTestRegistryRoot(this.IsX64)) { Assert.NotNull(root); root.DeleteValue(name); @@ -76,13 +64,13 @@ namespace WixTestTools public void VerifyTestRegistryRootDeleted() { - using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(); + using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(this.IsX64); Assert.Null(testRegistryRoot); } public void VerifyTestRegistryValue(string name, string expectedValue) { - using (var root = this.TestContext.GetTestRegistryRoot()) + using (var root = this.TestContext.GetTestRegistryRoot(this.IsX64)) { Assert.NotNull(root); var actualValue = root.GetValue(name) as string; diff --git a/src/WixTestTools/WixTestContext.cs b/src/WixTestTools/WixTestContext.cs index c00f5723..a4e666f1 100644 --- a/src/WixTestTools/WixTestContext.cs +++ b/src/WixTestTools/WixTestContext.cs @@ -42,9 +42,10 @@ namespace WixTestTools /// /// The package or bundle must install into [ProgramFilesFolder]\~Test WiX\[TestGroupName]\([Additional]). /// - public string GetTestInstallFolder(string additionalPath = null) + public string GetTestInstallFolder(bool x64, string additionalPath = null) { - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "~Test WiX", this.TestGroupName, additionalPath ?? String.Empty); + var baseDirectory = x64 ? Environment.SpecialFolder.ProgramFiles : Environment.SpecialFolder.ProgramFilesX86; + return Path.Combine(Environment.GetFolderPath(baseDirectory), "~Test WiX", this.TestGroupName, additionalPath ?? String.Empty); } /// @@ -55,9 +56,10 @@ namespace WixTestTools /// /// The package must write into HKLM\Software\WiX\Tests\[TestGroupName]\([Additional]). /// - public RegistryKey GetTestRegistryRoot(string additionalPath = null) + public RegistryKey GetTestRegistryRoot(bool x64, string additionalPath = null) { - var key = String.Format(@"Software\WOW6432Node\WiX\Tests\{0}\{1}", this.TestGroupName, additionalPath ?? String.Empty); + var baseKey = x64 ? "Software" : @"Software\WOW6432Node"; + var key = String.Format(@"{0}\WiX\Tests\{1}\{2}", baseKey, this.TestGroupName, additionalPath ?? String.Empty); return Registry.LocalMachine.OpenSubKey(key, true); } diff --git a/src/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs b/src/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs index edd8536b..5df86fff 100644 --- a/src/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs +++ b/src/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs @@ -12,7 +12,7 @@ namespace WixToolsetTest.BurnE2E public BasicFunctionalityTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } [Fact] - public void CanInstallAndUninstallSimpleBundle() + public void CanInstallAndUninstallSimpleBundle_x86_wixstdba() { var packageA = this.CreatePackageInstaller("PackageA"); @@ -37,5 +37,140 @@ namespace WixToolsetTest.BurnE2E bundleA.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); } + + [Fact] + public void CanInstallAndUninstallSimpleBundle_x86_testba() + { + var packageA = this.CreatePackageInstaller("PackageA"); + + var bundleB = this.CreateBundleInstaller("BundleB"); + + var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); + + bundleB.Install(); + + var cachedBundlePath = bundleB.VerifyRegisteredAndInPackageCache(); + + // Source file should be installed + Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); + + bundleB.Uninstall(cachedBundlePath); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled)); + + bundleB.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + } + + [Fact] + public void CanInstallAndUninstallSimpleBundle_x86_dnctestba() + { + var packageA = this.CreatePackageInstaller("PackageA"); + + var bundleC = this.CreateBundleInstaller("BundleC"); + + var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); + + bundleC.Install(); + + var cachedBundlePath = bundleC.VerifyRegisteredAndInPackageCache(); + + // Source file should be installed + Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); + + bundleC.Uninstall(cachedBundlePath); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled)); + + bundleC.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + } + + [Fact] + public void CanInstallAndUninstallSimpleBundle_x64_wixstdba() + { + var packageA_x64 = this.CreatePackageInstaller("PackageA_x64"); + + var bundleA_x64 = this.CreateBundleInstaller("BundleA_x64"); + + var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs"); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}"); + + bundleA_x64.Install(); + + var cachedBundlePath = bundleA_x64.VerifyRegisteredAndInPackageCache(); + + // Source file should be installed + Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled)); + + bundleA_x64.Uninstall(cachedBundlePath); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled)); + + bundleA_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + } + + [Fact] + public void CanInstallAndUninstallSimpleBundle_x64_testba() + { + var packageA_x64 = this.CreatePackageInstaller("PackageA_x64"); + + var bundleB_x64 = this.CreateBundleInstaller("BundleB_x64"); + + var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs"); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}"); + + bundleB_x64.Install(); + + var cachedBundlePath = bundleB_x64.VerifyRegisteredAndInPackageCache(); + + // Source file should be installed + Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled)); + + bundleB_x64.Uninstall(cachedBundlePath); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled)); + + bundleB_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + } + + [Fact] + public void CanInstallAndUninstallSimpleBundle_x64_dnctestba() + { + var packageA_x64 = this.CreatePackageInstaller("PackageA_x64"); + + var bundleC_x64 = this.CreateBundleInstaller("BundleC_x64"); + + var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs"); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}"); + + bundleC_x64.Install(); + + var cachedBundlePath = bundleC_x64.VerifyRegisteredAndInPackageCache(); + + // Source file should be installed + Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled)); + + bundleC_x64.Uninstall(cachedBundlePath); + + // Source file should *not* be installed + Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled)); + + bundleC_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + } } } diff --git a/src/WixToolsetTest.BurnE2E/TestBAController.cs b/src/WixToolsetTest.BurnE2E/TestBAController.cs index 103b603b..6e4fe6c6 100644 --- a/src/WixToolsetTest.BurnE2E/TestBAController.cs +++ b/src/WixToolsetTest.BurnE2E/TestBAController.cs @@ -9,14 +9,15 @@ namespace WixToolsetTest.BurnE2E public class TestBAController : IDisposable { - private const string BaseRegKeyPath = @"Software\WOW6432Node\WiX\Tests"; - - public TestBAController(WixTestContext testContext) + public TestBAController(WixTestContext testContext, bool x64 = false) { this.TestGroupName = testContext.TestGroupName; - this.TestBaseRegKeyPath = String.Format(@"{0}\TestBAControl\{1}", BaseRegKeyPath, this.TestGroupName); + this.BaseRegKeyPath = x64 ? @"Software\WiX\Tests" : @"Software\WOW6432Node\WiX\Tests"; + this.TestBaseRegKeyPath = String.Format(@"{0}\TestBAControl\{1}", this.BaseRegKeyPath, this.TestGroupName); } + private string BaseRegKeyPath { get; } + private string TestBaseRegKeyPath { get; } public string TestGroupName { get; } @@ -179,8 +180,8 @@ namespace WixToolsetTest.BurnE2E public void Dispose() { - Registry.LocalMachine.DeleteSubKeyTree($@"{BaseRegKeyPath}\{this.TestGroupName}", false); - Registry.LocalMachine.DeleteSubKeyTree($@"{BaseRegKeyPath}\TestBAControl", false); + Registry.LocalMachine.DeleteSubKeyTree($@"{this.BaseRegKeyPath}\{this.TestGroupName}", false); + Registry.LocalMachine.DeleteSubKeyTree($@"{this.BaseRegKeyPath}\TestBAControl", false); } } } -- cgit v1.2.3-55-g6feb