From 223606fcd02e6d15e065d1e108e17c8848d35f9f Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 15 Jun 2022 17:09:55 -0500 Subject: Update some skipped tests to be dynamically skipped. --- src/test/burn/WixTestTools/BundleInstaller.cs | 8 +++++++- src/test/burn/WixTestTools/TestTool.cs | 12 +++++++++--- .../BasicFunctionalityTests.cs | 20 ++++++++++++++------ 3 files changed, 30 insertions(+), 10 deletions(-) (limited to 'src/test') diff --git a/src/test/burn/WixTestTools/BundleInstaller.cs b/src/test/burn/WixTestTools/BundleInstaller.cs index 0ab02d1b..5551d3c0 100644 --- a/src/test/burn/WixTestTools/BundleInstaller.cs +++ b/src/test/burn/WixTestTools/BundleInstaller.cs @@ -26,6 +26,10 @@ namespace WixTestTools public string TestName { get; } + public int? AlternateExitCode { get; set; } + + public int? LastExitCode { get; set; } + /// /// Runs the bundle asking for help. /// @@ -226,7 +230,9 @@ namespace WixTestTools // Run the tool and assert the expected code. bundle.ExpectedExitCode = expectedExitCode; - bundle.Run(assertOnError); + bundle.AlternateExitCode = this.AlternateExitCode; + var result = bundle.Run(assertOnError); + this.LastExitCode = result.ExitCode; // Return the log file name. return logFile; diff --git a/src/test/burn/WixTestTools/TestTool.cs b/src/test/burn/WixTestTools/TestTool.cs index 9c3a3ea6..eb77c75b 100644 --- a/src/test/burn/WixTestTools/TestTool.cs +++ b/src/test/burn/WixTestTools/TestTool.cs @@ -29,6 +29,11 @@ namespace WixTestTools this.PrintOutputToConsole = true; } + /// + /// The alternate expected exit code of the tool + /// + public int? AlternateExitCode { get; set; } + /// /// The arguments to pass to the tool /// @@ -139,12 +144,13 @@ namespace WixTestTools List errors = new List(); // Verify that the expected return code matched the actual return code - if (null != this.ExpectedExitCode && this.ExpectedExitCode != result.ExitCode) + if (null != this.ExpectedExitCode && this.ExpectedExitCode != result.ExitCode && + (null == this.AlternateExitCode || this.AlternateExitCode != result.ExitCode)) { errors.Add(String.Format("Expected exit code {0} did not match actual exit code {1}", this.ExpectedExitCode, result.ExitCode)); } - var standardErrorString = string.Join(Environment.NewLine, result.StandardError); + var standardErrorString = String.Join(Environment.NewLine, result.StandardError); // Verify that the expected error string are in stderr if (null != this.ExpectedErrorStrings) @@ -158,7 +164,7 @@ namespace WixTestTools } } - var standardOutputString = string.Join(Environment.NewLine, result.StandardOutput); + var standardOutputString = String.Join(Environment.NewLine, result.StandardOutput); // Verify that the expected output string are in stdout if (null != this.ExpectedOutputStrings) diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs index de817e90..4d915c02 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs @@ -4,6 +4,7 @@ namespace WixToolsetTest.BurnE2E { using System; using System.IO; + using WixBuildTools.TestSupport; using WixTestTools; using Xunit; using Xunit.Abstractions; @@ -42,14 +43,10 @@ namespace WixToolsetTest.BurnE2E this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleA_x64"); } -#if DEBUG - [RuntimeFact(Skip = "0xc0000005 during shutdown from tiptsf.dll")] -#else [RuntimeFact] -#endif public void CanInstallAndUninstallSimplePerUserBundle_x64_wixstdba() { - this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs"); + this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs", unchecked((int)0xc0000005)); } [RuntimeFact] @@ -70,11 +67,12 @@ namespace WixToolsetTest.BurnE2E this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleD_x64"); } - private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs") + private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs", int? alternateExitCode = null) { var package = this.CreatePackageInstaller(packageName); var bundle = this.CreateBundleInstaller(bundleName); + bundle.AlternateExitCode = alternateExitCode; var packageSourceCodeInstalled = package.GetInstalledFilePath(fileName); @@ -89,12 +87,22 @@ namespace WixToolsetTest.BurnE2E // Source file should be installed Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}"); + if (alternateExitCode == bundle.LastExitCode) + { + WixAssert.Skip($"Install exited with {bundle.LastExitCode}"); + } + bundle.Uninstall(cachedBundlePath); // Source file should *not* be installed Assert.False(File.Exists(packageSourceCodeInstalled), $"{packageName} payload should have been removed by uninstall from: {packageSourceCodeInstalled}"); bundle.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); + + if (alternateExitCode == bundle.LastExitCode) + { + WixAssert.Skip($"Uninstall exited with {bundle.LastExitCode}"); + } } } } -- cgit v1.2.3-55-g6feb