@joebigelow / wix-1 / commits / 9ca5e0a9

Add failing test for decompiler with database that has old schemas and missing foreign key relationships.

Sean Hall committed Oct 18, 2019 at 10:50 UTC 9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84
4 files changed +60
src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+31
@@ -65,5 +65,36 @@ namespace WixToolsetTest.CoreIntegration
65 Assert.Equal(expected, actualFormatted);
66 }
67 }
68 +
69 + [Fact(Skip = "Test demonstrates failure")]
70 + public void CanDecompileOldClassTableDefinition()
71 + {
72 + // The input MSI was not created using standard methods, it is an example of a real world database that needs to be decompiled.
73 + // The Class/@Feature_ column has length of 32, the File/@Attributes has length of 2,
74 + // and numerous foreign key relationships are missing.
75 + var folder = TestData.Get(@"TestData\Class");
76 +
77 + using (var fs = new DisposableFileSystem())
78 + {
79 + var intermediateFolder = fs.GetFolder();
80 + var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
81 +
82 + var result = WixRunner.Execute(new[]
83 + {
84 + "decompile",
85 + Path.Combine(folder, "OldClassTableDef.msi"),
86 + "-intermediateFolder", intermediateFolder,
87 + "-o", outputPath
88 + });
89 +
90 + result.AssertSuccess();
91 +
92 + var actual = File.ReadAllText(outputPath);
93 + var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
94 + var expected = XDocument.Load(Path.Combine(folder, "DecompiledOldClassTableDef.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
95 +
96 + Assert.Equal(expected, actualFormatted);
97 + }
98 + }
99 }
100 }
src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs new
+27
@@ -0,0 +1,27 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="{FE17A505-11A9-44D2-8D94-EB6BEAB8FF93}" Codepage="1252" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{12E4699F-E774-4D05-8A01-5BDD41BBA127}" Version="1.0.0.0">
4 + <Package Description="MsiPackage" InstallerVersion="500" Languages="1033" Manufacturer="Example Corporation" Platform="x86" />
5 + <Directory Id="TARGETDIR" Name="SourceDir">
6 + <Directory Id="ProgramFilesFolder">
7 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="oekcr5lq">
8 + <Component Id="ProgIdComp" Guid="{5B3B3FC1-533D-4C29-BFB3-0E88B51E59D8}" Win64="no">
9 + <Class Id="{F12A6F69-117F-471F-AE73-F8E74218F498}" Context="LocalServer32" Description="FakeClassF12A" Advertise="yes">
10 + <ProgId Id="73E7DF7E-EFAC-4E11-90E2-6EBAEB8DE58D" Description="FakeClassF12A" Advertise="yes" />
11 + </Class>
12 + <File Id="filTki4JQ2gSapF7wK4K1vd.4mDSFQ" Name="ProgIdComp.txt" KeyPath="yes" ShortName="bnvvntsc.txt" Source="SourceDir\\MsiPackage\ProgIdComp.txt" />
13 + <RegistryValue Id="regUIIK326nDZpkWHuexeF58EikQvA" Root="HKCR" Key="73E7DF7E-EFAC-4E11-90E2-6EBAEB8DE58D" Name="NoOpen" Value="NoOpen73E7" Type="string" />
14 + <RegistryValue Id="regY1F4E2lvu_Up6gV6c3jeN5ukn8s" Root="HKCR" Key="CLSID\{F12A6F69-117F-471F-AE73-F8E74218F498}\LocalServer32" Name="ThreadingModel" Value="Apartment" Type="string" />
15 + <RegistryValue Id="regvrhMurMp98anbQJkpgA8yJCefdM" Root="HKCR" Key="CLSID\{F12A6F69-117F-471F-AE73-F8E74218F498}\Version" Value="0.0.0.1" Type="string" />
16 + </Component>
17 + </Directory>
18 + </Directory>
19 + </Directory>
20 + <Feature Id="ProductFeature" Level="1" Title="MsiPackageTitle">
21 + <ComponentRef Id="ProgIdComp" Primary="yes" />
22 + </Feature>
23 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
24 + <Media Id="1" />
25 + <Property Id="ALLUSERS" Value="1" />
26 + </Product>
27 +</Wix>
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi differ
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+2
@@ -18,7 +18,9 @@
18 <Content Include="TestData\AppSearch\DirectorySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
20 <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
21 + <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" />
23 + <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" />
26 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" />