aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2019-10-18 10:50:34 +1000
committerSean Hall <r.sean.hall@gmail.com>2019-10-18 10:59:16 +1000
commit9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84 (patch)
treee459b759ca002176478b857707299c08d7361ec0 /src/test
parentaa5a5e492f9a7060720056c27963cf1d06b4737f (diff)
downloadwix-9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84.tar.gz
wix-9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84.tar.bz2
wix-9ca5e0a95d0858a177fe1efdc15a962e5f7c1d84.zip
Add failing test for decompiler with database that has old schemas and missing foreign key relationships.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs31
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs27
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msibin0 -> 36864 bytes
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj2
4 files changed, 60 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
index 3a9781df..bace97b3 100644
--- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
@@ -65,5 +65,36 @@ namespace WixToolsetTest.CoreIntegration
65 Assert.Equal(expected, actualFormatted); 65 Assert.Equal(expected, actualFormatted);
66 } 66 }
67 } 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 }
68 } 99 }
69} 100}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs
new file mode 100644
index 00000000..86d41c50
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/DecompiledOldClassTableDef.wxs
@@ -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
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi
new file mode 100644
index 00000000..2cd10f09
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Class/OldClassTableDef.msi
Binary files differ
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 770f528a..ab6f8d98 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -18,7 +18,9 @@
18 <Content Include="TestData\AppSearch\DirectorySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> 18 <Content Include="TestData\AppSearch\DirectorySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" /> 19 <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
20 <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> 20 <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" /> 22 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" /> 24 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" /> 25 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" /> 26 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" />