diff options
Diffstat (limited to 'src')
5 files changed, 75 insertions, 19 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs index 25856f4d..3aa2bec7 100644 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs | |||
| @@ -4,6 +4,7 @@ namespace WixToolsetTest.ManagedHost | |||
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using WixBuildTools.TestSupport; | 6 | using WixBuildTools.TestSupport; |
| 7 | using WixBuildTools.TestSupport.XunitExtensions; | ||
| 7 | using Xunit; | 8 | using Xunit; |
| 8 | 9 | ||
| 9 | public class DncHostFixture | 10 | public class DncHostFixture |
| @@ -30,7 +31,7 @@ namespace WixToolsetTest.ManagedHost | |||
| 30 | } | 31 | } |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | [Fact(Skip = "Requires .NET Core 3.1 x86 runtime which might be missing")] | 34 | [SkippableFact] |
| 34 | public void CanLoadFDDx86EarliestCoreMBA() | 35 | public void CanLoadFDDx86EarliestCoreMBA() |
| 35 | { | 36 | { |
| 36 | // https://github.com/microsoft/vstest/issues/3586 | 37 | // https://github.com/microsoft/vstest/issues/3586 |
| @@ -43,13 +44,20 @@ namespace WixToolsetTest.ManagedHost | |||
| 43 | var testEngine = new TestEngine(); | 44 | var testEngine = new TestEngine(); |
| 44 | 45 | ||
| 45 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true); | 46 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true); |
| 47 | var resultOutput = result.Output.ToArray(); | ||
| 48 | |||
| 49 | if (resultOutput.Length > 0 && resultOutput[0] == "error from hostfxr: It was not possible to find any compatible framework version") | ||
| 50 | { | ||
| 51 | WixAssert.Skip(String.Join(Environment.NewLine, resultOutput)); | ||
| 52 | } | ||
| 53 | |||
| 46 | WixAssert.CompareLineByLine(new[] | 54 | WixAssert.CompareLineByLine(new[] |
| 47 | { | 55 | { |
| 48 | "Loading .NET Core FDD bootstrapper application.", | 56 | "Loading .NET Core FDD bootstrapper application.", |
| 49 | "Creating BA thread to run asynchronously.", | 57 | "Creating BA thread to run asynchronously.", |
| 50 | "EarliestCoreBA", | 58 | "EarliestCoreBA", |
| 51 | "Shutdown,ReloadBootstrapper,0", | 59 | "Shutdown,ReloadBootstrapper,0", |
| 52 | }, result.Output.ToArray()); | 60 | }, resultOutput); |
| 53 | } | 61 | } |
| 54 | } | 62 | } |
| 55 | 63 | ||
diff --git a/src/libs/dutil/test/DUtilUnitTest/DUtilTests.cpp b/src/libs/dutil/test/DUtilUnitTest/DUtilTests.cpp index 70e5a256..5e2d69e1 100644 --- a/src/libs/dutil/test/DUtilUnitTest/DUtilTests.cpp +++ b/src/libs/dutil/test/DUtilUnitTest/DUtilTests.cpp | |||
| @@ -5,26 +5,49 @@ | |||
| 5 | using namespace System; | 5 | using namespace System; |
| 6 | using namespace Xunit; | 6 | using namespace Xunit; |
| 7 | using namespace WixBuildTools::TestSupport; | 7 | using namespace WixBuildTools::TestSupport; |
| 8 | using namespace WixBuildTools::TestSupport::XunitExtensions; | ||
| 8 | 9 | ||
| 9 | namespace DutilTests | 10 | namespace DutilTests |
| 10 | { | 11 | { |
| 12 | [Collection("Dutil_TraceErrorSource")] | ||
| 11 | public ref class DUtil | 13 | public ref class DUtil |
| 12 | { | 14 | { |
| 13 | public: | 15 | public: |
| 14 | [Fact(Skip="Flaky")] | 16 | [SkippableFact] |
| 15 | void DUtilTraceErrorSourceFiltersOnTraceLevel() | 17 | void DUtilTraceErrorSourceFiltersOnTraceLevel() |
| 16 | { | 18 | { |
| 17 | DutilInitialize(&DutilTestTraceError); | 19 | DutilInitialize(&DutilTestTraceError); |
| 18 | 20 | ||
| 19 | CallDutilTraceErrorSource(); | 21 | try |
| 22 | { | ||
| 23 | CallDutilTraceErrorSource(); | ||
| 20 | 24 | ||
| 21 | Dutil_TraceSetLevel(REPORT_DEBUG, FALSE); | 25 | Dutil_TraceSetLevel(REPORT_DEBUG, FALSE); |
| 22 | 26 | ||
| 23 | Action^ action = gcnew Action(this, &DUtil::CallDutilTraceErrorSource); | 27 | Exception^ traceErrorException = nullptr; |
| 24 | // See the comments in WixBuildTools.WixAssert for details. | ||
| 25 | WixAssert::Throws<Exception^>(action); | ||
| 26 | 28 | ||
| 27 | DutilUninitialize(); | 29 | try |
| 30 | { | ||
| 31 | CallDutilTraceErrorSource(); | ||
| 32 | } | ||
| 33 | catch (Exception^ e) | ||
| 34 | { | ||
| 35 | traceErrorException = e; | ||
| 36 | } | ||
| 37 | |||
| 38 | if (traceErrorException == nullptr) | ||
| 39 | { | ||
| 40 | WixAssert::Skip("Dutil_TraceErrorSource did not call the registered callback."); | ||
| 41 | } | ||
| 42 | else | ||
| 43 | { | ||
| 44 | WixAssert::StringEqual("hr = 0x80004005, message = Error message", traceErrorException->Message, false); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | finally | ||
| 48 | { | ||
| 49 | DutilUninitialize(); | ||
| 50 | } | ||
| 28 | } | 51 | } |
| 29 | 52 | ||
| 30 | private: | 53 | private: |
| @@ -33,4 +56,9 @@ namespace DutilTests | |||
| 33 | Dutil_TraceErrorSource(__FILE__, __LINE__, REPORT_DEBUG, DUTIL_SOURCE_EXTERNAL, E_FAIL, "Error message"); | 56 | Dutil_TraceErrorSource(__FILE__, __LINE__, REPORT_DEBUG, DUTIL_SOURCE_EXTERNAL, E_FAIL, "Error message"); |
| 34 | } | 57 | } |
| 35 | }; | 58 | }; |
| 59 | |||
| 60 | [CollectionDefinition("Dutil_TraceErrorSource", DisableParallelization = true)] | ||
| 61 | public ref class Dutil_TraceErrorSourceCollectionDefinition | ||
| 62 | { | ||
| 63 | }; | ||
| 36 | } | 64 | } |
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 | |||
| 26 | 26 | ||
| 27 | public string TestName { get; } | 27 | public string TestName { get; } |
| 28 | 28 | ||
| 29 | public int? AlternateExitCode { get; set; } | ||
| 30 | |||
| 31 | public int? LastExitCode { get; set; } | ||
| 32 | |||
| 29 | /// <summary> | 33 | /// <summary> |
| 30 | /// Runs the bundle asking for help. | 34 | /// Runs the bundle asking for help. |
| 31 | /// </summary> | 35 | /// </summary> |
| @@ -226,7 +230,9 @@ namespace WixTestTools | |||
| 226 | 230 | ||
| 227 | // Run the tool and assert the expected code. | 231 | // Run the tool and assert the expected code. |
| 228 | bundle.ExpectedExitCode = expectedExitCode; | 232 | bundle.ExpectedExitCode = expectedExitCode; |
| 229 | bundle.Run(assertOnError); | 233 | bundle.AlternateExitCode = this.AlternateExitCode; |
| 234 | var result = bundle.Run(assertOnError); | ||
| 235 | this.LastExitCode = result.ExitCode; | ||
| 230 | 236 | ||
| 231 | // Return the log file name. | 237 | // Return the log file name. |
| 232 | return logFile; | 238 | 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 | |||
| @@ -30,6 +30,11 @@ namespace WixTestTools | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /// <summary> | 32 | /// <summary> |
| 33 | /// The alternate expected exit code of the tool | ||
| 34 | /// </summary> | ||
| 35 | public int? AlternateExitCode { get; set; } | ||
| 36 | |||
| 37 | /// <summary> | ||
| 33 | /// The arguments to pass to the tool | 38 | /// The arguments to pass to the tool |
| 34 | /// </summary> | 39 | /// </summary> |
| 35 | public virtual string Arguments { get; set; } | 40 | public virtual string Arguments { get; set; } |
| @@ -139,12 +144,13 @@ namespace WixTestTools | |||
| 139 | List<string> errors = new List<string>(); | 144 | List<string> errors = new List<string>(); |
| 140 | 145 | ||
| 141 | // Verify that the expected return code matched the actual return code | 146 | // Verify that the expected return code matched the actual return code |
| 142 | if (null != this.ExpectedExitCode && this.ExpectedExitCode != result.ExitCode) | 147 | if (null != this.ExpectedExitCode && this.ExpectedExitCode != result.ExitCode && |
| 148 | (null == this.AlternateExitCode || this.AlternateExitCode != result.ExitCode)) | ||
| 143 | { | 149 | { |
| 144 | errors.Add(String.Format("Expected exit code {0} did not match actual exit code {1}", this.ExpectedExitCode, result.ExitCode)); | 150 | errors.Add(String.Format("Expected exit code {0} did not match actual exit code {1}", this.ExpectedExitCode, result.ExitCode)); |
| 145 | } | 151 | } |
| 146 | 152 | ||
| 147 | var standardErrorString = string.Join(Environment.NewLine, result.StandardError); | 153 | var standardErrorString = String.Join(Environment.NewLine, result.StandardError); |
| 148 | 154 | ||
| 149 | // Verify that the expected error string are in stderr | 155 | // Verify that the expected error string are in stderr |
| 150 | if (null != this.ExpectedErrorStrings) | 156 | if (null != this.ExpectedErrorStrings) |
| @@ -158,7 +164,7 @@ namespace WixTestTools | |||
| 158 | } | 164 | } |
| 159 | } | 165 | } |
| 160 | 166 | ||
| 161 | var standardOutputString = string.Join(Environment.NewLine, result.StandardOutput); | 167 | var standardOutputString = String.Join(Environment.NewLine, result.StandardOutput); |
| 162 | 168 | ||
| 163 | // Verify that the expected output string are in stdout | 169 | // Verify that the expected output string are in stdout |
| 164 | if (null != this.ExpectedOutputStrings) | 170 | 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 | |||
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.IO; | 6 | using System.IO; |
| 7 | using WixBuildTools.TestSupport; | ||
| 7 | using WixTestTools; | 8 | using WixTestTools; |
| 8 | using Xunit; | 9 | using Xunit; |
| 9 | using Xunit.Abstractions; | 10 | using Xunit.Abstractions; |
| @@ -42,14 +43,10 @@ namespace WixToolsetTest.BurnE2E | |||
| 42 | this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleA_x64"); | 43 | this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleA_x64"); |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | #if DEBUG | ||
| 46 | [RuntimeFact(Skip = "0xc0000005 during shutdown from tiptsf.dll")] | ||
| 47 | #else | ||
| 48 | [RuntimeFact] | 46 | [RuntimeFact] |
| 49 | #endif | ||
| 50 | public void CanInstallAndUninstallSimplePerUserBundle_x64_wixstdba() | 47 | public void CanInstallAndUninstallSimplePerUserBundle_x64_wixstdba() |
| 51 | { | 48 | { |
| 52 | this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs"); | 49 | this.CanInstallAndUninstallSimpleBundle("PackageApu_x64", "BundleApu_x64", "PackagePerUser.wxs", unchecked((int)0xc0000005)); |
| 53 | } | 50 | } |
| 54 | 51 | ||
| 55 | [RuntimeFact] | 52 | [RuntimeFact] |
| @@ -70,11 +67,12 @@ namespace WixToolsetTest.BurnE2E | |||
| 70 | this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleD_x64"); | 67 | this.CanInstallAndUninstallSimpleBundle("PackageA_x64", "BundleD_x64"); |
| 71 | } | 68 | } |
| 72 | 69 | ||
| 73 | private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs") | 70 | private void CanInstallAndUninstallSimpleBundle(string packageName, string bundleName, string fileName = "Package.wxs", int? alternateExitCode = null) |
| 74 | { | 71 | { |
| 75 | var package = this.CreatePackageInstaller(packageName); | 72 | var package = this.CreatePackageInstaller(packageName); |
| 76 | 73 | ||
| 77 | var bundle = this.CreateBundleInstaller(bundleName); | 74 | var bundle = this.CreateBundleInstaller(bundleName); |
| 75 | bundle.AlternateExitCode = alternateExitCode; | ||
| 78 | 76 | ||
| 79 | var packageSourceCodeInstalled = package.GetInstalledFilePath(fileName); | 77 | var packageSourceCodeInstalled = package.GetInstalledFilePath(fileName); |
| 80 | 78 | ||
| @@ -89,12 +87,22 @@ namespace WixToolsetTest.BurnE2E | |||
| 89 | // Source file should be installed | 87 | // Source file should be installed |
| 90 | Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}"); | 88 | Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}"); |
| 91 | 89 | ||
| 90 | if (alternateExitCode == bundle.LastExitCode) | ||
| 91 | { | ||
| 92 | WixAssert.Skip($"Install exited with {bundle.LastExitCode}"); | ||
| 93 | } | ||
| 94 | |||
| 92 | bundle.Uninstall(cachedBundlePath); | 95 | bundle.Uninstall(cachedBundlePath); |
| 93 | 96 | ||
| 94 | // Source file should *not* be installed | 97 | // Source file should *not* be installed |
| 95 | Assert.False(File.Exists(packageSourceCodeInstalled), $"{packageName} payload should have been removed by uninstall from: {packageSourceCodeInstalled}"); | 98 | Assert.False(File.Exists(packageSourceCodeInstalled), $"{packageName} payload should have been removed by uninstall from: {packageSourceCodeInstalled}"); |
| 96 | 99 | ||
| 97 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); | 100 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath); |
| 101 | |||
| 102 | if (alternateExitCode == bundle.LastExitCode) | ||
| 103 | { | ||
| 104 | WixAssert.Skip($"Uninstall exited with {bundle.LastExitCode}"); | ||
| 105 | } | ||
| 98 | } | 106 | } |
| 99 | } | 107 | } |
| 100 | } | 108 | } |
