diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs | 30 | ||||
-rw-r--r-- | src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs | 11 | ||||
-rw-r--r-- | src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs | 46 |
3 files changed, 67 insertions, 20 deletions
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs index 6862f2a8..71255165 100644 --- a/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs +++ b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs | |||
@@ -12,6 +12,7 @@ namespace WixToolsetTest.MSBuild | |||
12 | public class MsbuildFixture | 12 | public class MsbuildFixture |
13 | { | 13 | { |
14 | [Theory] | 14 | [Theory] |
15 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
15 | [InlineData(BuildSystem.MSBuild)] | 16 | [InlineData(BuildSystem.MSBuild)] |
16 | [InlineData(BuildSystem.MSBuild64)] | 17 | [InlineData(BuildSystem.MSBuild64)] |
17 | public void CanBuildSimpleBundle(BuildSystem buildSystem) | 18 | public void CanBuildSimpleBundle(BuildSystem buildSystem) |
@@ -44,6 +45,7 @@ namespace WixToolsetTest.MSBuild | |||
44 | } | 45 | } |
45 | 46 | ||
46 | [Theory] | 47 | [Theory] |
48 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
47 | [InlineData(BuildSystem.MSBuild)] | 49 | [InlineData(BuildSystem.MSBuild)] |
48 | [InlineData(BuildSystem.MSBuild64)] | 50 | [InlineData(BuildSystem.MSBuild64)] |
49 | public void CanBuildSimpleMergeModule(BuildSystem buildSystem) | 51 | public void CanBuildSimpleMergeModule(BuildSystem buildSystem) |
@@ -76,6 +78,7 @@ namespace WixToolsetTest.MSBuild | |||
76 | } | 78 | } |
77 | 79 | ||
78 | [Theory] | 80 | [Theory] |
81 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
79 | [InlineData(BuildSystem.MSBuild)] | 82 | [InlineData(BuildSystem.MSBuild)] |
80 | [InlineData(BuildSystem.MSBuild64)] | 83 | [InlineData(BuildSystem.MSBuild64)] |
81 | public void CanBuildSimpleMsiPackage(BuildSystem buildSystem) | 84 | public void CanBuildSimpleMsiPackage(BuildSystem buildSystem) |
@@ -112,6 +115,7 @@ namespace WixToolsetTest.MSBuild | |||
112 | } | 115 | } |
113 | 116 | ||
114 | [Theory] | 117 | [Theory] |
118 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
115 | [InlineData(BuildSystem.MSBuild)] | 119 | [InlineData(BuildSystem.MSBuild)] |
116 | [InlineData(BuildSystem.MSBuild64)] | 120 | [InlineData(BuildSystem.MSBuild64)] |
117 | public void CanBuildSimpleMsiPackageWithMergeModule(BuildSystem buildSystem) | 121 | public void CanBuildSimpleMsiPackageWithMergeModule(BuildSystem buildSystem) |
@@ -145,6 +149,7 @@ namespace WixToolsetTest.MSBuild | |||
145 | } | 149 | } |
146 | 150 | ||
147 | [Theory] | 151 | [Theory] |
152 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
148 | [InlineData(BuildSystem.MSBuild)] | 153 | [InlineData(BuildSystem.MSBuild)] |
149 | [InlineData(BuildSystem.MSBuild64)] | 154 | [InlineData(BuildSystem.MSBuild64)] |
150 | public void CanBuildWithDefaultAndExplicitlyFullWixpdbs(BuildSystem buildSystem) | 155 | public void CanBuildWithDefaultAndExplicitlyFullWixpdbs(BuildSystem buildSystem) |
@@ -161,6 +166,7 @@ namespace WixToolsetTest.MSBuild | |||
161 | } | 166 | } |
162 | 167 | ||
163 | [Theory] | 168 | [Theory] |
169 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
164 | [InlineData(BuildSystem.MSBuild)] | 170 | [InlineData(BuildSystem.MSBuild)] |
165 | [InlineData(BuildSystem.MSBuild64)] | 171 | [InlineData(BuildSystem.MSBuild64)] |
166 | public void CanBuildWithNoWixpdb(BuildSystem buildSystem) | 172 | public void CanBuildWithNoWixpdb(BuildSystem buildSystem) |
@@ -198,6 +204,7 @@ namespace WixToolsetTest.MSBuild | |||
198 | } | 204 | } |
199 | 205 | ||
200 | [Theory] | 206 | [Theory] |
207 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
201 | [InlineData(BuildSystem.MSBuild)] | 208 | [InlineData(BuildSystem.MSBuild)] |
202 | [InlineData(BuildSystem.MSBuild64)] | 209 | [InlineData(BuildSystem.MSBuild64)] |
203 | public void CanBuild64BitMsiPackage(BuildSystem buildSystem) | 210 | public void CanBuild64BitMsiPackage(BuildSystem buildSystem) |
@@ -234,6 +241,7 @@ namespace WixToolsetTest.MSBuild | |||
234 | } | 241 | } |
235 | 242 | ||
236 | [Theory(Skip = "Currently fails")] | 243 | [Theory(Skip = "Currently fails")] |
244 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
237 | [InlineData(BuildSystem.MSBuild)] | 245 | [InlineData(BuildSystem.MSBuild)] |
238 | [InlineData(BuildSystem.MSBuild64)] | 246 | [InlineData(BuildSystem.MSBuild64)] |
239 | public void CanBuildSimpleMsiPackageWithIceSuppressions(BuildSystem buildSystem) | 247 | public void CanBuildSimpleMsiPackageWithIceSuppressions(BuildSystem buildSystem) |
@@ -249,13 +257,14 @@ namespace WixToolsetTest.MSBuild | |||
249 | 257 | ||
250 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 258 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
251 | { | 259 | { |
252 | "-p:SuppressIces=\"ICE45;ICE46\"", | 260 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "SuppressIces", "ICE45;ICE46"), |
253 | }); | 261 | }); |
254 | result.AssertSuccess(); | 262 | result.AssertSuccess(); |
255 | } | 263 | } |
256 | } | 264 | } |
257 | 265 | ||
258 | [Theory] | 266 | [Theory] |
267 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
259 | [InlineData(BuildSystem.MSBuild)] | 268 | [InlineData(BuildSystem.MSBuild)] |
260 | [InlineData(BuildSystem.MSBuild64)] | 269 | [InlineData(BuildSystem.MSBuild64)] |
261 | public void CanBuildSimpleMsiPackageWithWarningSuppressions(BuildSystem buildSystem) | 270 | public void CanBuildSimpleMsiPackageWithWarningSuppressions(BuildSystem buildSystem) |
@@ -271,7 +280,7 @@ namespace WixToolsetTest.MSBuild | |||
271 | 280 | ||
272 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 281 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
273 | { | 282 | { |
274 | "-p:SuppressSpecificWarnings=\"1118;1102\"", | 283 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "SuppressSpecificWarnings", "1118;1102"), |
275 | }); | 284 | }); |
276 | result.AssertSuccess(); | 285 | result.AssertSuccess(); |
277 | 286 | ||
@@ -281,6 +290,8 @@ namespace WixToolsetTest.MSBuild | |||
281 | } | 290 | } |
282 | 291 | ||
283 | [Theory] | 292 | [Theory] |
293 | [InlineData(BuildSystem.DotNetCoreSdk, null)] | ||
294 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | ||
284 | [InlineData(BuildSystem.MSBuild, null)] | 295 | [InlineData(BuildSystem.MSBuild, null)] |
285 | [InlineData(BuildSystem.MSBuild, true)] | 296 | [InlineData(BuildSystem.MSBuild, true)] |
286 | [InlineData(BuildSystem.MSBuild64, null)] | 297 | [InlineData(BuildSystem.MSBuild64, null)] |
@@ -302,10 +313,8 @@ namespace WixToolsetTest.MSBuild | |||
302 | }, outOfProc: outOfProc); | 313 | }, outOfProc: outOfProc); |
303 | result.AssertSuccess(); | 314 | result.AssertSuccess(); |
304 | 315 | ||
305 | var expectedOutOfProc = outOfProc.HasValue && outOfProc.Value; | 316 | var wixBuildCommands = MsbuildUtilities.GetToolCommandLines(result, "wix", "build", buildSystem, outOfProc); |
306 | var expectedWixCommand = $"{(expectedOutOfProc ? "wix.exe" : "(wix.exe)")} build"; | 317 | Assert.Single(wixBuildCommands); |
307 | var buildCommands = result.Output.Where(line => line.TrimStart().Contains(expectedWixCommand)); | ||
308 | Assert.Single(buildCommands); | ||
309 | 318 | ||
310 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) | 319 | var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) |
311 | .Select(s => s.Substring(baseFolder.Length + 1)) | 320 | .Select(s => s.Substring(baseFolder.Length + 1)) |
@@ -315,6 +324,7 @@ namespace WixToolsetTest.MSBuild | |||
315 | } | 324 | } |
316 | 325 | ||
317 | [Theory] | 326 | [Theory] |
327 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
318 | [InlineData(BuildSystem.MSBuild)] | 328 | [InlineData(BuildSystem.MSBuild)] |
319 | [InlineData(BuildSystem.MSBuild64)] | 329 | [InlineData(BuildSystem.MSBuild64)] |
320 | public void CanBuildAndCleanSimpleMsiPackage(BuildSystem buildSystem) | 330 | public void CanBuildAndCleanSimpleMsiPackage(BuildSystem buildSystem) |
@@ -328,10 +338,7 @@ namespace WixToolsetTest.MSBuild | |||
328 | var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); | 338 | var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); |
329 | 339 | ||
330 | // Build | 340 | // Build |
331 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 341 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, verbosityLevel: "diag"); |
332 | { | ||
333 | "-v:diag", | ||
334 | }); | ||
335 | result.AssertSuccess(); | 342 | result.AssertSuccess(); |
336 | 343 | ||
337 | var buildOutput = String.Join("\r\n", result.Output); | 344 | var buildOutput = String.Join("\r\n", result.Output); |
@@ -346,8 +353,7 @@ namespace WixToolsetTest.MSBuild | |||
346 | result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 353 | result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
347 | { | 354 | { |
348 | "-t:Clean", | 355 | "-t:Clean", |
349 | "-v:diag", | 356 | }, verbosityLevel: "diag"); |
350 | }); | ||
351 | result.AssertSuccess(); | 357 | result.AssertSuccess(); |
352 | 358 | ||
353 | var cleanOutput = String.Join("\r\n", result.Output); | 359 | var cleanOutput = String.Join("\r\n", result.Output); |
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs index b5c71f86..f5f03be0 100644 --- a/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs +++ b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace WixToolsetTest.MSBuild | 3 | namespace WixToolsetTest.MSBuild |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | ||
6 | using System.IO; | 7 | using System.IO; |
7 | using System.Linq; | 8 | using System.Linq; |
8 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
@@ -14,6 +15,7 @@ namespace WixToolsetTest.MSBuild | |||
14 | public class MsbuildHeatFixture | 15 | public class MsbuildHeatFixture |
15 | { | 16 | { |
16 | [Theory] | 17 | [Theory] |
18 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
17 | [InlineData(BuildSystem.MSBuild)] | 19 | [InlineData(BuildSystem.MSBuild)] |
18 | [InlineData(BuildSystem.MSBuild64)] | 20 | [InlineData(BuildSystem.MSBuild64)] |
19 | public void CanBuildHeatFilePackage(BuildSystem buildSystem) | 21 | public void CanBuildHeatFilePackage(BuildSystem buildSystem) |
@@ -31,9 +33,7 @@ namespace WixToolsetTest.MSBuild | |||
31 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath); | 33 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath); |
32 | result.AssertSuccess(); | 34 | result.AssertSuccess(); |
33 | 35 | ||
34 | var expectedOutOfProc = false; | 36 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
35 | var expectedHeatCommand = $"{(expectedOutOfProc ? "heat.exe" : "(heat.exe)")} file"; | ||
36 | var heatCommandLines = result.Output.Where(line => line.Contains(expectedHeatCommand)); | ||
37 | Assert.Single(heatCommandLines); | 37 | Assert.Single(heatCommandLines); |
38 | 38 | ||
39 | var warnings = result.Output.Where(line => line.Contains(": warning")); | 39 | var warnings = result.Output.Where(line => line.Contains(": warning")); |
@@ -71,6 +71,7 @@ namespace WixToolsetTest.MSBuild | |||
71 | } | 71 | } |
72 | 72 | ||
73 | [Theory] | 73 | [Theory] |
74 | [InlineData(BuildSystem.DotNetCoreSdk)] | ||
74 | [InlineData(BuildSystem.MSBuild)] | 75 | [InlineData(BuildSystem.MSBuild)] |
75 | [InlineData(BuildSystem.MSBuild64)] | 76 | [InlineData(BuildSystem.MSBuild64)] |
76 | public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem) | 77 | public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem) |
@@ -88,9 +89,7 @@ namespace WixToolsetTest.MSBuild | |||
88 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath); | 89 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath); |
89 | result.AssertSuccess(); | 90 | result.AssertSuccess(); |
90 | 91 | ||
91 | var expectedOutOfProc = false; | 92 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
92 | var expectedHeatCommand = $"{(expectedOutOfProc ? "heat.exe" : "(heat.exe)")} file"; | ||
93 | var heatCommandLines = result.Output.Where(line => line.Contains(expectedHeatCommand)); | ||
94 | Assert.Equal(2, heatCommandLines.Count()); | 93 | Assert.Equal(2, heatCommandLines.Count()); |
95 | 94 | ||
96 | var warnings = result.Output.Where(line => line.Contains(": warning")); | 95 | var warnings = result.Output.Where(line => line.Contains(": warning")); |
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs index 6a6f32e0..90c3194b 100644 --- a/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs +++ b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs | |||
@@ -5,10 +5,12 @@ namespace WixToolsetTest.MSBuild | |||
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | 7 | using System.IO; |
8 | using System.Linq; | ||
8 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
9 | 10 | ||
10 | public enum BuildSystem | 11 | public enum BuildSystem |
11 | { | 12 | { |
13 | DotNetCoreSdk, | ||
12 | MSBuild, | 14 | MSBuild, |
13 | MSBuild64, | 15 | MSBuild64, |
14 | } | 16 | } |
@@ -17,12 +19,13 @@ namespace WixToolsetTest.MSBuild | |||
17 | { | 19 | { |
18 | public static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props"); | 20 | public static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props"); |
19 | 21 | ||
20 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null) | 22 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null, string verbosityLevel = "normal") |
21 | { | 23 | { |
22 | var allArgs = new List<string> | 24 | var allArgs = new List<string> |
23 | { | 25 | { |
26 | $"-verbosity:{verbosityLevel}", | ||
24 | $"-p:Configuration={configuration}", | 27 | $"-p:Configuration={configuration}", |
25 | $"-p:WixMSBuildProps={MsbuildUtilities.WixPropsPath}", | 28 | GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildUtilities.WixPropsPath), |
26 | // Node reuse means that child msbuild processes can stay around after the build completes. | 29 | // Node reuse means that child msbuild processes can stay around after the build completes. |
27 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. | 30 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. |
28 | "-nr:false", | 31 | "-nr:false", |
@@ -40,6 +43,16 @@ namespace WixToolsetTest.MSBuild | |||
40 | 43 | ||
41 | switch (buildSystem) | 44 | switch (buildSystem) |
42 | { | 45 | { |
46 | case BuildSystem.DotNetCoreSdk: | ||
47 | { | ||
48 | allArgs.Add(projectPath); | ||
49 | var result = DotnetRunner.Execute("msbuild", allArgs.ToArray()); | ||
50 | return new MsbuildRunnerResult | ||
51 | { | ||
52 | ExitCode = result.ExitCode, | ||
53 | Output = result.StandardOutput, | ||
54 | }; | ||
55 | } | ||
43 | case BuildSystem.MSBuild: | 56 | case BuildSystem.MSBuild: |
44 | case BuildSystem.MSBuild64: | 57 | case BuildSystem.MSBuild64: |
45 | { | 58 | { |
@@ -51,5 +64,34 @@ namespace WixToolsetTest.MSBuild | |||
51 | } | 64 | } |
52 | } | 65 | } |
53 | } | 66 | } |
67 | |||
68 | public static string GetQuotedPropertySwitch(BuildSystem buildSystem, string propertyName, string valueToQuote) | ||
69 | { | ||
70 | switch (buildSystem) | ||
71 | { | ||
72 | case BuildSystem.DotNetCoreSdk: | ||
73 | { | ||
74 | return $"-p:{propertyName}=\\\"{valueToQuote}\\\""; | ||
75 | } | ||
76 | case BuildSystem.MSBuild: | ||
77 | case BuildSystem.MSBuild64: | ||
78 | { | ||
79 | return $"-p:{propertyName}=\"{valueToQuote}\""; | ||
80 | } | ||
81 | default: | ||
82 | { | ||
83 | throw new NotImplementedException(); | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | public static IEnumerable<string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem, bool? outOfProc = null) | ||
89 | { | ||
90 | var expectedOutOfProc = buildSystem == BuildSystem.DotNetCoreSdk || outOfProc.HasValue && outOfProc.Value; | ||
91 | var expectedToolExe = !expectedOutOfProc ? $"({toolName}.exe)" : | ||
92 | buildSystem == BuildSystem.DotNetCoreSdk ? $"{toolName}.dll\"" : $"{toolName}.exe"; | ||
93 | var expectedToolCommand = $"{expectedToolExe} {operation}"; | ||
94 | return result.Output.Where(line => line.Contains(expectedToolCommand)); | ||
95 | } | ||
54 | } | 96 | } |
55 | } | 97 | } |