aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-05-30 18:56:15 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-05-31 15:11:21 +1000
commit0fbada441640a27352935edc43e1ea16c7a4d8f8 (patch)
tree4d9a522eef941a6ed01dfb43bef0ede3ea441cb9 /src
parent05ee2175b44c68816c24a33a16861a637fa15ad7 (diff)
downloadwix-0fbada441640a27352935edc43e1ea16c7a4d8f8.tar.gz
wix-0fbada441640a27352935edc43e1ea16c7a4d8f8.tar.bz2
wix-0fbada441640a27352935edc43e1ea16c7a4d8f8.zip
Update all MSBuild tests to run on x86 and x64 MSBuild.
Diffstat (limited to 'src')
-rw-r--r--src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs113
-rw-r--r--src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs24
-rw-r--r--src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs46
3 files changed, 114 insertions, 69 deletions
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs
index 4a831061..3515b314 100644
--- a/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs
+++ b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs
@@ -11,10 +11,10 @@ namespace WixToolsetTest.MSBuild
11 11
12 public class MsbuildFixture 12 public class MsbuildFixture
13 { 13 {
14 private static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildFixture).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props"); 14 [Theory]
15 15 [InlineData(BuildSystem.MSBuild)]
16 [Fact] 16 [InlineData(BuildSystem.MSBuild64)]
17 public void CanBuildSimpleBundle() 17 public void CanBuildSimpleBundle(BuildSystem buildSystem)
18 { 18 {
19 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage"); 19 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage");
20 20
@@ -25,10 +25,7 @@ namespace WixToolsetTest.MSBuild
25 var binFolder = Path.Combine(baseFolder, @"bin\"); 25 var binFolder = Path.Combine(baseFolder, @"bin\");
26 var projectPath = Path.Combine(baseFolder, "SimpleBundle.wixproj"); 26 var projectPath = Path.Combine(baseFolder, "SimpleBundle.wixproj");
27 27
28 var result = MsbuildRunner.Execute(projectPath, new[] 28 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath);
29 {
30 $"-p:WixMSBuildProps={WixPropsPath}",
31 });
32 result.AssertSuccess(); 29 result.AssertSuccess();
33 30
34 var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); 31 var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86"));
@@ -49,8 +46,10 @@ namespace WixToolsetTest.MSBuild
49 } 46 }
50 } 47 }
51 48
52 [Fact] 49 [Theory]
53 public void CanBuildSimpleMsiPackage() 50 [InlineData(BuildSystem.MSBuild)]
51 [InlineData(BuildSystem.MSBuild64)]
52 public void CanBuildSimpleMsiPackage(BuildSystem buildSystem)
54 { 53 {
55 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 54 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
56 55
@@ -61,10 +60,7 @@ namespace WixToolsetTest.MSBuild
61 var binFolder = Path.Combine(baseFolder, @"bin\"); 60 var binFolder = Path.Combine(baseFolder, @"bin\");
62 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 61 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
63 62
64 var result = MsbuildRunner.Execute(projectPath, new[] 63 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath);
65 {
66 $"-p:WixMSBuildProps={WixPropsPath}",
67 });
68 result.AssertSuccess(); 64 result.AssertSuccess();
69 65
70 var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); 66 var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86"));
@@ -86,8 +82,10 @@ namespace WixToolsetTest.MSBuild
86 } 82 }
87 } 83 }
88 84
89 [Fact] 85 [Theory]
90 public void CanBuildWithDefaultAndExplicitlyFullWixpdbs() 86 [InlineData(BuildSystem.MSBuild)]
87 [InlineData(BuildSystem.MSBuild64)]
88 public void CanBuildWithDefaultAndExplicitlyFullWixpdbs(BuildSystem buildSystem)
91 { 89 {
92 var expectedOutputs = new[] 90 var expectedOutputs = new[]
93 { 91 {
@@ -96,21 +94,23 @@ namespace WixToolsetTest.MSBuild
96 @"bin\x86\Debug\en-US\MsiPackage.wixpdb", 94 @"bin\x86\Debug\en-US\MsiPackage.wixpdb",
97 }; 95 };
98 96
99 this.AssertWixpdb(null, expectedOutputs); 97 this.AssertWixpdb(buildSystem, null, expectedOutputs);
100 this.AssertWixpdb("Full", expectedOutputs); 98 this.AssertWixpdb(buildSystem, "Full", expectedOutputs);
101 } 99 }
102 100
103 [Fact] 101 [Theory]
104 public void CanBuildWithNoWixpdb() 102 [InlineData(BuildSystem.MSBuild)]
103 [InlineData(BuildSystem.MSBuild64)]
104 public void CanBuildWithNoWixpdb(BuildSystem buildSystem)
105 { 105 {
106 this.AssertWixpdb("NONE", new[] 106 this.AssertWixpdb(buildSystem, "NONE", new[]
107 { 107 {
108 @"bin\x86\Debug\en-US\cab1.cab", 108 @"bin\x86\Debug\en-US\cab1.cab",
109 @"bin\x86\Debug\en-US\MsiPackage.msi", 109 @"bin\x86\Debug\en-US\MsiPackage.msi",
110 }); 110 });
111 } 111 }
112 112
113 private void AssertWixpdb(string wixpdbType, string[] expectedOutputFiles) 113 private void AssertWixpdb(BuildSystem buildSystem, string wixpdbType, string[] expectedOutputFiles)
114 { 114 {
115 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 115 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
116 116
@@ -121,10 +121,9 @@ namespace WixToolsetTest.MSBuild
121 var binFolder = Path.Combine(baseFolder, @"bin\"); 121 var binFolder = Path.Combine(baseFolder, @"bin\");
122 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 122 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
123 123
124 var result = MsbuildRunner.Execute(projectPath, new[] 124 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
125 { 125 {
126 wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}", 126 wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}",
127 $"-p:WixMSBuildProps={WixPropsPath}",
128 }); 127 });
129 result.AssertSuccess(); 128 result.AssertSuccess();
130 129
@@ -136,8 +135,10 @@ namespace WixToolsetTest.MSBuild
136 } 135 }
137 } 136 }
138 137
139 [Fact] 138 [Theory]
140 public void CanBuild64BitMsiPackage() 139 [InlineData(BuildSystem.MSBuild)]
140 [InlineData(BuildSystem.MSBuild64)]
141 public void CanBuild64BitMsiPackage(BuildSystem buildSystem)
141 { 142 {
142 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 143 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
143 144
@@ -148,10 +149,9 @@ namespace WixToolsetTest.MSBuild
148 var binFolder = Path.Combine(baseFolder, @"bin\"); 149 var binFolder = Path.Combine(baseFolder, @"bin\");
149 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 150 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
150 151
151 var result = MsbuildRunner.Execute(projectPath, new[] 152 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
152 { 153 {
153 $"-p:WixMSBuildProps={WixPropsPath}", 154 $"-p:Platform=x64",
154 $"-p:InstallerPlatform=x64",
155 }); 155 });
156 result.AssertSuccess(); 156 result.AssertSuccess();
157 157
@@ -164,15 +164,17 @@ namespace WixToolsetTest.MSBuild
164 .ToArray(); 164 .ToArray();
165 Assert.Equal(new[] 165 Assert.Equal(new[]
166 { 166 {
167 @"bin\x86\Debug\en-US\cab1.cab", 167 @"bin\x64\Debug\en-US\cab1.cab",
168 @"bin\x86\Debug\en-US\MsiPackage.msi", 168 @"bin\x64\Debug\en-US\MsiPackage.msi",
169 @"bin\x86\Debug\en-US\MsiPackage.wixpdb", 169 @"bin\x64\Debug\en-US\MsiPackage.wixpdb",
170 }, paths); 170 }, paths);
171 } 171 }
172 } 172 }
173 173
174 [Fact(Skip = "Currently fails")] 174 [Theory(Skip = "Currently fails")]
175 public void CanBuildSimpleMsiPackageWithIceSuppressions() 175 [InlineData(BuildSystem.MSBuild)]
176 [InlineData(BuildSystem.MSBuild64)]
177 public void CanBuildSimpleMsiPackageWithIceSuppressions(BuildSystem buildSystem)
176 { 178 {
177 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 179 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
178 180
@@ -183,17 +185,18 @@ namespace WixToolsetTest.MSBuild
183 var binFolder = Path.Combine(baseFolder, @"bin\"); 185 var binFolder = Path.Combine(baseFolder, @"bin\");
184 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 186 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
185 187
186 var result = MsbuildRunner.Execute(projectPath, new[] 188 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
187 { 189 {
188 $"-p:WixMSBuildProps={WixPropsPath}", 190 "-p:SuppressIces=\"ICE45;ICE46\"",
189 "-p:SuppressIces=\"ICE45;ICE46\""
190 }); 191 });
191 result.AssertSuccess(); 192 result.AssertSuccess();
192 } 193 }
193 } 194 }
194 195
195 [Fact] 196 [Theory]
196 public void CanBuildSimpleMsiPackageWithWarningSuppressions() 197 [InlineData(BuildSystem.MSBuild)]
198 [InlineData(BuildSystem.MSBuild64)]
199 public void CanBuildSimpleMsiPackageWithWarningSuppressions(BuildSystem buildSystem)
197 { 200 {
198 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 201 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
199 202
@@ -204,10 +207,9 @@ namespace WixToolsetTest.MSBuild
204 var binFolder = Path.Combine(baseFolder, @"bin\"); 207 var binFolder = Path.Combine(baseFolder, @"bin\");
205 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 208 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
206 209
207 var result = MsbuildRunner.Execute(projectPath, new[] 210 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
208 { 211 {
209 $"-p:WixMSBuildProps={WixPropsPath}", 212 "-p:SuppressSpecificWarnings=\"1118;1102\"",
210 "-p:SuppressSpecificWarnings=\"1118;1102\""
211 }); 213 });
212 result.AssertSuccess(); 214 result.AssertSuccess();
213 215
@@ -216,8 +218,10 @@ namespace WixToolsetTest.MSBuild
216 } 218 }
217 } 219 }
218 220
219 [Fact] 221 [Theory]
220 public void CanBuildSimpleMsiPackageAsWixipl() 222 [InlineData(BuildSystem.MSBuild)]
223 [InlineData(BuildSystem.MSBuild64)]
224 public void CanBuildSimpleMsiPackageAsWixipl(BuildSystem buildSystem)
221 { 225 {
222 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 226 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
223 227
@@ -228,10 +232,9 @@ namespace WixToolsetTest.MSBuild
228 var binFolder = Path.Combine(baseFolder, @"bin\"); 232 var binFolder = Path.Combine(baseFolder, @"bin\");
229 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 233 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
230 234
231 var result = MsbuildRunner.Execute(projectPath, new[] 235 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
232 { 236 {
233 $"-p:WixMSBuildProps={WixPropsPath}", 237 "-p:OutputType=IntermediatePostLink",
234 "-p:OutputType=IntermediatePostLink"
235 }); 238 });
236 result.AssertSuccess(); 239 result.AssertSuccess();
237 240
@@ -242,8 +245,10 @@ namespace WixToolsetTest.MSBuild
242 } 245 }
243 } 246 }
244 247
245 [Fact] 248 [Theory]
246 public void CanBuildAndCleanSimpleMsiPackage() 249 [InlineData(BuildSystem.MSBuild)]
250 [InlineData(BuildSystem.MSBuild64)]
251 public void CanBuildAndCleanSimpleMsiPackage(BuildSystem buildSystem)
247 { 252 {
248 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 253 var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
249 254
@@ -254,10 +259,9 @@ namespace WixToolsetTest.MSBuild
254 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); 259 var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj");
255 260
256 // Build 261 // Build
257 var result = MsbuildRunner.Execute(projectPath, new[] 262 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
258 { 263 {
259 $"-p:WixMSBuildProps={WixPropsPath}", 264 "-v:diag",
260 "-v:diag"
261 }); 265 });
262 result.AssertSuccess(); 266 result.AssertSuccess();
263 267
@@ -270,11 +274,10 @@ namespace WixToolsetTest.MSBuild
270 Assert.NotEmpty(createdPaths); 274 Assert.NotEmpty(createdPaths);
271 275
272 // Clean 276 // Clean
273 result = MsbuildRunner.Execute(projectPath, new[] 277 result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[]
274 { 278 {
275 $"-p:WixMSBuildProps={WixPropsPath}",
276 "-t:Clean", 279 "-t:Clean",
277 "-v:diag" 280 "-v:diag",
278 }); 281 });
279 result.AssertSuccess(); 282 result.AssertSuccess();
280 283
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs
index 58a3d333..63c83bc7 100644
--- a/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs
+++ b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs
@@ -13,10 +13,10 @@ namespace WixToolsetTest.MSBuild
13 13
14 public class MsbuildHeatFixture 14 public class MsbuildHeatFixture
15 { 15 {
16 private static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildHeatFixture).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props"); 16 [Theory]
17 17 [InlineData(BuildSystem.MSBuild)]
18 [Fact] 18 [InlineData(BuildSystem.MSBuild64)]
19 public void CanBuildHeatFilePackage() 19 public void CanBuildHeatFilePackage(BuildSystem buildSystem)
20 { 20 {
21 var sourceFolder = TestData.Get(@"TestData\HeatFilePackage"); 21 var sourceFolder = TestData.Get(@"TestData\HeatFilePackage");
22 22
@@ -28,10 +28,7 @@ namespace WixToolsetTest.MSBuild
28 var intermediateFolder = Path.Combine(baseFolder, @"obj\"); 28 var intermediateFolder = Path.Combine(baseFolder, @"obj\");
29 var projectPath = Path.Combine(baseFolder, "HeatFilePackage.wixproj"); 29 var projectPath = Path.Combine(baseFolder, "HeatFilePackage.wixproj");
30 30
31 var result = MsbuildRunner.Execute(projectPath, new[] 31 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath);
32 {
33 $"-p:WixMSBuildProps={WixPropsPath}",
34 });
35 result.AssertSuccess(); 32 result.AssertSuccess();
36 33
37 var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); 34 var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file"));
@@ -71,8 +68,10 @@ namespace WixToolsetTest.MSBuild
71 } 68 }
72 } 69 }
73 70
74 [Fact] 71 [Theory]
75 public void CanBuildHeatFileWithMultipleFilesPackage() 72 [InlineData(BuildSystem.MSBuild)]
73 [InlineData(BuildSystem.MSBuild64)]
74 public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem)
76 { 75 {
77 var sourceFolder = TestData.Get(@"TestData\HeatFileMultipleFilesSameFileName"); 76 var sourceFolder = TestData.Get(@"TestData\HeatFileMultipleFilesSameFileName");
78 77
@@ -84,10 +83,7 @@ namespace WixToolsetTest.MSBuild
84 var intermediateFolder = Path.Combine(baseFolder, @"obj\"); 83 var intermediateFolder = Path.Combine(baseFolder, @"obj\");
85 var projectPath = Path.Combine(baseFolder, "HeatFileMultipleFilesSameFileName.wixproj"); 84 var projectPath = Path.Combine(baseFolder, "HeatFileMultipleFilesSameFileName.wixproj");
86 85
87 var result = MsbuildRunner.Execute(projectPath, new[] 86 var result = MsbuildUtilities.BuildProject(buildSystem, projectPath);
88 {
89 $"-p:WixMSBuildProps={WixPropsPath}",
90 });
91 result.AssertSuccess(); 87 result.AssertSuccess();
92 88
93 var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); 89 var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file"));
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs
new file mode 100644
index 00000000..d4815bde
--- /dev/null
+++ b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs
@@ -0,0 +1,46 @@
1// Copyright(c) .NET Foundation and contributors.All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolsetTest.MSBuild
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using WixBuildTools.TestSupport;
9
10 public enum BuildSystem
11 {
12 MSBuild,
13 MSBuild64,
14 }
15
16 public static class MsbuildUtilities
17 {
18 public static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props");
19
20 public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, params string[] arguments)
21 {
22 var allArgs = new List<string>
23 {
24 $"-p:WixMSBuildProps={MsbuildUtilities.WixPropsPath}",
25 };
26
27 if (arguments != null)
28 {
29 allArgs.AddRange(arguments);
30 }
31
32 switch (buildSystem)
33 {
34 case BuildSystem.MSBuild:
35 case BuildSystem.MSBuild64:
36 {
37 return MsbuildRunner.Execute(projectPath, allArgs.ToArray(), buildSystem == BuildSystem.MSBuild64);
38 }
39 default:
40 {
41 throw new NotImplementedException();
42 }
43 }
44 }
45 }
46}