Add and fix some bundle tests.
Sean Hall committed
Apr 23, 2020 at 08:33 UTC
2d23530fde970972c927680ee3df6466538ae8ca
5 files changed
+102
-2
src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs
+2
-2
@@ -56,7 +56,7 @@ namespace WixToolset.Core.Burn.Bundles
56
// Embedded files (aka: files from binary .wixlibs) are not content files (because they are hidden
57
// in the .wixlib).
58
var sourceFile = payload.SourceFile;
59
- payload.ContentFile = !sourceFile.Embed;
59
+ payload.ContentFile = sourceFile != null && !sourceFile.Embed;
60
61
this.UpdatePayloadPackagingType(payload);
62
@@ -85,7 +85,7 @@ namespace WixToolset.Core.Burn.Bundles
85
86
private void UpdatePayloadPackagingType(WixBundlePayloadTuple payload)
87
{
88
- if (PackagingType.Unknown == payload.Packaging)
88
+ if (!payload.Packaging.HasValue || PackagingType.Unknown == payload.Packaging)
89
{
90
if (!payload.Compressed.HasValue)
91
{
src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+59
@@ -140,5 +140,64 @@ namespace WixToolsetTest.CoreIntegration
140
Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
141
}
142
}
143
+
144
+ [Fact]
145
+ public void CanBuildSingleExeBundle()
146
+ {
147
+ var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe");
148
+ var folder = TestData.Get(@"TestData");
149
+
150
+ using (var fs = new DisposableFileSystem())
151
+ {
152
+ var baseFolder = fs.GetFolder();
153
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
154
+ var exePath = Path.Combine(baseFolder, @"bin\test.exe");
155
+
156
+ var result = WixRunner.Execute(new[]
157
+ {
158
+ "build",
159
+ Path.Combine(folder, "SingleExeBundle", "SingleExePackageGroup.wxs"),
160
+ Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
161
+ "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
162
+ "-bindpath", Path.Combine(folder, ".Data"),
163
+ "-intermediateFolder", intermediateFolder,
164
+ "-burnStub", burnStubPath,
165
+ "-o", exePath,
166
+ });
167
+
168
+ result.AssertSuccess();
169
+
170
+ Assert.True(File.Exists(exePath));
171
+ }
172
+ }
173
+
174
+ [Fact]
175
+ public void CanBuildSingleExeRemotePayloadBundle()
176
+ {
177
+ var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe");
178
+ var folder = TestData.Get(@"TestData");
179
+
180
+ using (var fs = new DisposableFileSystem())
181
+ {
182
+ var baseFolder = fs.GetFolder();
183
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
184
+ var exePath = Path.Combine(baseFolder, @"bin\test.exe");
185
+
186
+ var result = WixRunner.Execute(new[]
187
+ {
188
+ "build",
189
+ Path.Combine(folder, "SingleExeBundle", "SingleExeRemotePayload.wxs"),
190
+ Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
191
+ "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
192
+ "-intermediateFolder", intermediateFolder,
193
+ "-burnStub", burnStubPath,
194
+ "-o", exePath,
195
+ });
196
+
197
+ result.AssertSuccess();
198
+
199
+ Assert.True(File.Exists(exePath));
200
+ }
201
+ }
202
}
203
}
src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExePackageGroup.wxs
new
+8
@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Fragment>
4
+ <PackageGroup Id="BundlePackages">
5
+ <ExePackage SourceFile="burn.exe" />
6
+ </PackageGroup>
7
+ </Fragment>
8
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs
new
+31
@@ -0,0 +1,31 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Fragment>
4
+ <PackageGroup Id="BundlePackages">
5
+ <ExePackage
6
+ InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx462FullLog].html""
7
+ RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[NetFx462FullLog].html""
8
+ UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx462FullLog].html""
9
+ PerMachine="yes"
10
+ DetectCondition="A"
11
+ InstallCondition="B"
12
+ Id="NetFx462Web"
13
+ Vital="yes"
14
+ Permanent="yes"
15
+ Protocol="netfx4"
16
+ DownloadUrl="C"
17
+ LogPathVariable="NetFx462FullLog"
18
+ Compressed="no"
19
+ Name="NDP462-KB3151802-Web.exe">
20
+ <RemotePayload
21
+ CertificatePublicKey="52868DFCA6E3AF2632389E6C1EE7D0468D3797D0"
22
+ CertificateThumbprint="3BDA323E552DB1FDE5F4FBEE75D6D5B2B187EEDC"
23
+ Description="Microsoft .NET Framework 4.6.2 Setup"
24
+ Hash="C42E6ED280290648BBD59F664008852F4CFE4548"
25
+ ProductName="Microsoft .NET Framework 4.6.2"
26
+ Size="1429344"
27
+ Version="4.6.1590.0" />
28
+ </ExePackage>
29
+ </PackageGroup>
30
+ </Fragment>
31
+</Wix>
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+2
@@ -117,6 +117,8 @@
117
<Content Include="TestData\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
118
<Content Include="TestData\SimpleBundle\MultiFileBootstrapperApplication.wxs" CopyToOutputDirectory="PreserveNewest" />
119
<Content Include="TestData\SimpleBundle\MultiFileBundle.wxs" CopyToOutputDirectory="PreserveNewest" />
120
+ <Content Include="TestData\SingleExeBundle\SingleExePackageGroup.wxs" CopyToOutputDirectory="PreserveNewest" />
121
+ <Content Include="TestData\SingleExeBundle\SingleExeRemotePayload.wxs" CopyToOutputDirectory="PreserveNewest" />
122
<Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
123
<Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
124
<Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" />