diff options
author | Rob Mensching <rob@firegiant.com> | 2023-01-14 17:29:40 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2023-01-16 00:54:06 -0800 |
commit | 5f744a8c7da649721f7022dc174febd79e7e3e14 (patch) | |
tree | 643db84523bda1a2eae6dbeb02557e69f4e445e1 /src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |
parent | ecbaffc08239e061a7dbaa92ff3c72acd53a0bae (diff) | |
download | wix-5f744a8c7da649721f7022dc174febd79e7e3e14.tar.gz wix-5f744a8c7da649721f7022dc174febd79e7e3e14.tar.bz2 wix-5f744a8c7da649721f7022dc174febd79e7e3e14.zip |
Remove extension data after extensions get PreDecompileTables callback
Also update Util.wixext decompiler extension to handle the new
elements that compile into CustomActions with no additional table data.
These exposed the weakness in the decompiler where extension data was
removed before extensions got a chance to pre-decompile.
Fixes 7151
Diffstat (limited to 'src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs')
-rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 2b59b2a9..a9b37870 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
@@ -9,6 +9,7 @@ namespace WixToolsetTest.Util | |||
9 | using WixInternal.Core.TestPackage; | 9 | using WixInternal.Core.TestPackage; |
10 | using WixToolset.Util; | 10 | using WixToolset.Util; |
11 | using Xunit; | 11 | using Xunit; |
12 | using System.Xml.Linq; | ||
12 | 13 | ||
13 | public class UtilExtensionFixture | 14 | public class UtilExtensionFixture |
14 | { | 15 | { |
@@ -62,9 +63,20 @@ namespace WixToolsetTest.Util | |||
62 | var output = Path.Combine(folder, "decompile.xml"); | 63 | var output = Path.Combine(folder, "decompile.xml"); |
63 | 64 | ||
64 | build.BuildAndDecompileAndBuild(Build, Decompile, output); | 65 | build.BuildAndDecompileAndBuild(Build, Decompile, output); |
65 | File.Exists(output); | ||
66 | } | ||
67 | 66 | ||
67 | var doc = XDocument.Load(output); | ||
68 | var utilElementNames = doc.Descendants() | ||
69 | .Where(e => e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/util") | ||
70 | .Select(e => e.Name.LocalName) | ||
71 | .OrderBy(s => s) | ||
72 | .ToArray(); | ||
73 | WixAssert.CompareLineByLine(new[] | ||
74 | { | ||
75 | "FileShare", | ||
76 | "FileSharePermission", | ||
77 | "User", | ||
78 | }, utilElementNames); | ||
79 | } | ||
68 | 80 | ||
69 | [Fact] | 81 | [Fact] |
70 | public void CanBuildCloseApplication() | 82 | public void CanBuildCloseApplication() |
@@ -225,12 +237,39 @@ namespace WixToolsetTest.Util | |||
225 | "CustomAction:Wix4BroadcastEnvironmentChange_A64\t65\tWix4UtilCA_A64\tWixBroadcastEnvironmentChange\t", | 237 | "CustomAction:Wix4BroadcastEnvironmentChange_A64\t65\tWix4UtilCA_A64\tWixBroadcastEnvironmentChange\t", |
226 | "CustomAction:Wix4BroadcastSettingChange_A64\t65\tWix4UtilCA_A64\tWixBroadcastSettingChange\t", | 238 | "CustomAction:Wix4BroadcastSettingChange_A64\t65\tWix4UtilCA_A64\tWixBroadcastSettingChange\t", |
227 | "CustomAction:Wix4CheckRebootRequired_A64\t65\tWix4UtilCA_A64\tWixCheckRebootRequired\t", | 239 | "CustomAction:Wix4CheckRebootRequired_A64\t65\tWix4UtilCA_A64\tWixCheckRebootRequired\t", |
240 | "CustomAction:Wix4QueryNativeMachine_A64\t257\tWix4UtilCA_A64\tWixQueryNativeMachine\t", | ||
228 | "CustomAction:Wix4QueryOsDriverInfo_A64\t257\tWix4UtilCA_A64\tWixQueryOsDriverInfo\t", | 241 | "CustomAction:Wix4QueryOsDriverInfo_A64\t257\tWix4UtilCA_A64\tWixQueryOsDriverInfo\t", |
229 | "CustomAction:Wix4QueryOsInfo_A64\t257\tWix4UtilCA_A64\tWixQueryOsInfo\t", | 242 | "CustomAction:Wix4QueryOsInfo_A64\t257\tWix4UtilCA_A64\tWixQueryOsInfo\t", |
230 | }, results.OrderBy(s => s).ToArray()); | 243 | }, results.OrderBy(s => s).ToArray()); |
231 | } | 244 | } |
232 | 245 | ||
233 | [Fact] | 246 | [Fact] |
247 | public void CanBuildAndDecompiileQueries() | ||
248 | { | ||
249 | var folder = TestData.Get(@"TestData\Queries"); | ||
250 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); | ||
251 | var output = Path.Combine(folder, "decompile.xml"); | ||
252 | |||
253 | build.BuildAndDecompileAndBuild(Build, Decompile, output); | ||
254 | |||
255 | var doc = XDocument.Load(output); | ||
256 | var utilElementNames = doc.Descendants() | ||
257 | .Where(e => e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/util") | ||
258 | .Select(e => e.Name.LocalName) | ||
259 | .OrderBy(s => s) | ||
260 | .ToArray(); | ||
261 | WixAssert.CompareLineByLine(new[] | ||
262 | { | ||
263 | "BroadcastEnvironmentChange", | ||
264 | "BroadcastSettingChange", | ||
265 | "CheckRebootRequired", | ||
266 | "QueryNativeMachine", | ||
267 | "QueryWindowsDriverInfo", | ||
268 | "QueryWindowsSuiteInfo", | ||
269 | }, utilElementNames); | ||
270 | } | ||
271 | |||
272 | [Fact] | ||
234 | public void CanBuildWithXmlConfig() | 273 | public void CanBuildWithXmlConfig() |
235 | { | 274 | { |
236 | var folder = TestData.Get(@"TestData", "XmlConfig"); | 275 | var folder = TestData.Get(@"TestData", "XmlConfig"); |