diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-06 14:06:29 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-06 14:15:26 +1000 |
commit | 59ffa86b7d62ddc52ec813fb65c47f812aeded66 (patch) | |
tree | f777a4da178d3cd1127a4c072f505dc9515d9d3c /src | |
parent | fcd88ec3995033bf802f0a637e7fce65e8739006 (diff) | |
download | wix-59ffa86b7d62ddc52ec813fb65c47f812aeded66.tar.gz wix-59ffa86b7d62ddc52ec813fb65c47f812aeded66.tar.bz2 wix-59ffa86b7d62ddc52ec813fb65c47f812aeded66.zip |
Try to fix build flakiness with Example.Extension.
Add failing test for the TableDefinition overload of EnsureTable.
Diffstat (limited to 'src')
6 files changed, 69 insertions, 1 deletions
diff --git a/src/test/Example.Extension/Example.Extension.csproj b/src/test/Example.Extension/Example.Extension.csproj index d9ac2509..7f375cb6 100644 --- a/src/test/Example.Extension/Example.Extension.csproj +++ b/src/test/Example.Extension/Example.Extension.csproj | |||
@@ -33,7 +33,7 @@ | |||
33 | </ItemGroup> | 33 | </ItemGroup> |
34 | </Target> | 34 | </Target> |
35 | 35 | ||
36 | <Target Name="BuildExtensionWixlib" AfterTargets="ResolveProjectReferences" DependsOnTargets="SetExtensionWixlib" Inputs="@(ExtensionWxs);$(CompileWixlibExePath)" Outputs="$(WixlibPath)"> | 36 | <Target Name="BuildExtensionWixlib" AfterTargets="ResolveProjectReferences" DependsOnTargets="ResolveProjectReferences;SetExtensionWixlib" Inputs="@(ExtensionWxs);$(CompileWixlibExePath)" Outputs="$(WixlibPath)"> |
37 | <Exec Command='$(CompileWixlibExePath) "$(IntermediateOutputPath)\" "$(WixlibPath)" "@(ExtensionWxs)"' /> | 37 | <Exec Command='$(CompileWixlibExePath) "$(IntermediateOutputPath)\" "$(WixlibPath)" "@(ExtensionWxs)"' /> |
38 | </Target> | 38 | </Target> |
39 | </Project> | 39 | </Project> |
diff --git a/src/test/Example.Extension/ExampleCompilerExtension.cs b/src/test/Example.Extension/ExampleCompilerExtension.cs index e821b7b6..9f0abd4c 100644 --- a/src/test/Example.Extension/ExampleCompilerExtension.cs +++ b/src/test/Example.Extension/ExampleCompilerExtension.cs | |||
@@ -23,6 +23,10 @@ namespace Example.Extension | |||
23 | case "Fragment": | 23 | case "Fragment": |
24 | switch (element.Name.LocalName) | 24 | switch (element.Name.LocalName) |
25 | { | 25 | { |
26 | case "ExampleEnsureTable": | ||
27 | this.ParseExampleEnsureTableElement(intermediate, section, element); | ||
28 | processed = true; | ||
29 | break; | ||
26 | case "ExampleSearch": | 30 | case "ExampleSearch": |
27 | this.ParseExampleSearchElement(intermediate, section, element); | 31 | this.ParseExampleSearchElement(intermediate, section, element); |
28 | processed = true; | 32 | processed = true; |
@@ -93,6 +97,12 @@ namespace Example.Extension | |||
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
100 | private void ParseExampleEnsureTableElement(Intermediate intermediate, IntermediateSection section, XElement element) | ||
101 | { | ||
102 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | ||
103 | this.ParseHelper.EnsureTable(section, sourceLineNumbers, ExampleTableDefinitions.NotInAll); | ||
104 | } | ||
105 | |||
96 | private void ParseExampleSearchElement(Intermediate intermediate, IntermediateSection section, XElement element) | 106 | private void ParseExampleSearchElement(Intermediate intermediate, IntermediateSection section, XElement element) |
97 | { | 107 | { |
98 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 108 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
diff --git a/src/test/Example.Extension/ExampleTableDefinitions.cs b/src/test/Example.Extension/ExampleTableDefinitions.cs index 124e2406..3532ffc3 100644 --- a/src/test/Example.Extension/ExampleTableDefinitions.cs +++ b/src/test/Example.Extension/ExampleTableDefinitions.cs | |||
@@ -17,6 +17,16 @@ namespace Example.Extension | |||
17 | tupleIdIsPrimaryKey: true | 17 | tupleIdIsPrimaryKey: true |
18 | ); | 18 | ); |
19 | 19 | ||
20 | public static readonly TableDefinition NotInAll = new TableDefinition( | ||
21 | "TableDefinitionNotExposedByExtension", | ||
22 | new[] | ||
23 | { | ||
24 | new ColumnDefinition("Example", ColumnType.String, 72, true, false, ColumnCategory.Identifier), | ||
25 | new ColumnDefinition("Value", ColumnType.String, 0, false, false, ColumnCategory.Formatted), | ||
26 | }, | ||
27 | tupleIdIsPrimaryKey: true | ||
28 | ); | ||
29 | |||
20 | public static readonly TableDefinition[] All = new[] { ExampleTable }; | 30 | public static readonly TableDefinition[] All = new[] { ExampleTable }; |
21 | } | 31 | } |
22 | } | 32 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index 2141e68c..ad24f346 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
@@ -2,8 +2,10 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
8 | using Example.Extension; | ||
7 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core.TestPackage; | 10 | using WixToolset.Core.TestPackage; |
9 | using WixToolset.Data; | 11 | using WixToolset.Data; |
@@ -882,5 +884,39 @@ namespace WixToolsetTest.CoreIntegration | |||
882 | Assert.NotEmpty(output.SubStorages); | 884 | Assert.NotEmpty(output.SubStorages); |
883 | } | 885 | } |
884 | } | 886 | } |
887 | |||
888 | [Fact(Skip = "Test demonstrates failure")] | ||
889 | public void FailsBuildAtLinkTimeForMissingEnsureTable() | ||
890 | { | ||
891 | var folder = TestData.Get(@"TestData"); | ||
892 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
893 | |||
894 | using (var fs = new DisposableFileSystem()) | ||
895 | { | ||
896 | var baseFolder = fs.GetFolder(); | ||
897 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
898 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
899 | |||
900 | var result = WixRunner.Execute(new[] | ||
901 | { | ||
902 | "build", | ||
903 | Path.Combine(folder, "BadEnsureTable", "BadEnsureTable.wxs"), | ||
904 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
905 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
906 | "-ext", extensionPath, | ||
907 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
908 | "-intermediateFolder", intermediateFolder, | ||
909 | "-o", msiPath | ||
910 | }); | ||
911 | Assert.Collection(result.Messages, | ||
912 | first => | ||
913 | { | ||
914 | Assert.Equal(MessageLevel.Error, first.Level); | ||
915 | Assert.Equal("The identifier 'WixCustomTable:TableDefinitionNotExposedByExtension' could not be found. Ensure you have typed the reference correctly and that all the necessary inputs are provided to the linker.", first.ToString()); | ||
916 | }); | ||
917 | |||
918 | Assert.False(File.Exists(msiPath)); | ||
919 | } | ||
920 | } | ||
885 | } | 921 | } |
886 | } | 922 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadEnsureTable/BadEnsureTable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadEnsureTable/BadEnsureTable.wxs new file mode 100644 index 00000000..3caa20ff --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadEnsureTable/BadEnsureTable.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:ex="http://www.example.com/scheams/v1/wxs"> | ||
4 | <Fragment> | ||
5 | <ComponentGroup Id="ProductComponents"> | ||
6 | <ComponentGroupRef Id="MinimalComponentGroup" /> | ||
7 | </ComponentGroup> | ||
8 | |||
9 | <ex:ExampleEnsureTable /> | ||
10 | </Fragment> | ||
11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 98402223..dbc9357c 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -21,6 +21,7 @@ | |||
21 | <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" /> | 21 | <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" /> |
22 | <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" /> |
23 | <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" /> |
24 | <Content Include="TestData\BadEnsureTable\BadEnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
24 | <Content Include="TestData\BundleExtension\BundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> | 25 | <Content Include="TestData\BundleExtension\BundleExtension.wxs" CopyToOutputDirectory="PreserveNewest" /> |
25 | <Content Include="TestData\BundleExtension\BundleExtensionSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | 26 | <Content Include="TestData\BundleExtension\BundleExtensionSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> |
26 | <Content Include="TestData\BundleExtension\BundleWithSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="TestData\BundleExtension\BundleWithSearches.wxs" CopyToOutputDirectory="PreserveNewest" /> |