diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-06-15 17:09:55 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-06-15 18:27:22 -0500 |
commit | 223606fcd02e6d15e065d1e108e17c8848d35f9f (patch) | |
tree | 577b3187354582fd2c1c8edcbd8e16ac86624b87 /src/test | |
parent | c4090531d4caac4b8cb3356cb971ff2e1c9f8704 (diff) | |
download | wix-223606fcd02e6d15e065d1e108e17c8848d35f9f.tar.gz wix-223606fcd02e6d15e065d1e108e17c8848d35f9f.tar.bz2 wix-223606fcd02e6d15e065d1e108e17c8848d35f9f.zip |
Update some skipped tests to be dynamically skipped.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/burn/WixTestTools/BundleInstaller.cs | 8 | ||||
-rw-r--r-- | src/test/burn/WixTestTools/TestTool.cs | 12 | ||||
-rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs | 20 |
3 files changed, 30 insertions, 10 deletions
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 | } |