@joebigelow / wix / commits / b54ac261

Test big payloads by RemotePayload since real files are slow. The test will be moved to a Burn e2e test.

Test big payloads by RemotePayload since real files are slow. The test will be moved to a Burn e2e test. #4008

Sean Hall committed Feb 27, 2021 at 16:29 UTC b54ac261d0a03b75cf05ef370351445774b82155
10 files changed +14 -83
src/WixToolset.Core/Compiler_Bundle.cs
+2 -2
@@ -1447,7 +1447,7 @@ namespace WixToolset.Core
1447 remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1448 break;
1449 case "Size":
1450 - remotePayload.Size = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
1450 + remotePayload.Size = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, Int64.MaxValue);
1451 break;
1452 case "Version":
1453 remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -3260,7 +3260,7 @@ namespace WixToolset.Core
3260
3261 public string ProductName { get; set; }
3262
3263 - public int Size { get; set; }
3263 + public long Size { get; set; }
3264
3265 public string Version { get; set; }
3266 }
src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+11 -52
@@ -252,6 +252,7 @@ namespace WixToolsetTest.CoreIntegration
252 var baseFolder = fs.GetFolder();
253 var intermediateFolder = Path.Combine(baseFolder, "obj");
254 var exePath = Path.Combine(baseFolder, @"bin\test.exe");
255 + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb");
256
257 var result = WixRunner.Execute(new[]
258 {
@@ -266,6 +267,16 @@ namespace WixToolsetTest.CoreIntegration
267 result.AssertSuccess();
268
269 Assert.True(File.Exists(exePath));
270 + Assert.True(File.Exists(pdbPath));
271 +
272 + using (var wixOutput = WixOutput.Read(pdbPath))
273 + {
274 + var intermediate = Intermediate.Load(wixOutput);
275 + var section = intermediate.Sections.Single();
276 +
277 + var payloadSymbol = section.Symbols.OfType<WixBundlePayloadSymbol>().Where(x => x.Id.Id == "NetFx462Web").Single();
278 + Assert.Equal(Int64.MaxValue, payloadSymbol.FileSize);
279 + }
280 }
281 }
282
@@ -372,57 +383,5 @@ namespace WixToolsetTest.CoreIntegration
383 Assert.InRange(result.ExitCode, 2, Int32.MaxValue);
384 }
385 }
375 -
376 - [Fact]
377 - public void CanBuildBundleWithLargePayload()
378 - {
379 - var folder = TestData.Get(@"TestData\LargePayload");
380 -
381 - // Overwrite the payload with a 2.5 GiB file. We do this dynamically to avoid committing such
382 - // a large file to source control.
383 - var largeFile = Path.Combine(folder, "data", "large_file.dat");
384 - const long TwoAndAHalfGigabytes = 2_684_354_560;
385 - using (var stream = File.Create(largeFile))
386 - {
387 - stream.Seek(TwoAndAHalfGigabytes - 1, SeekOrigin.Begin);
388 - stream.WriteByte(1);
389 - }
390 -
391 - using (var fs = new DisposableFileSystem())
392 - {
393 - var baseFolder = fs.GetFolder();
394 - var intermediateFolder = Path.Combine(baseFolder, "obj");
395 - var exePath = Path.Combine(baseFolder, @"bin\test.exe");
396 - var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb");
397 -
398 - var result = WixRunner.Execute(new[]
399 - {
400 - "build",
401 - Path.Combine(folder, "Bundle.wxs"),
402 - "-loc", Path.Combine(folder, "Bundle.en-us.wxl"),
403 - "-bindpath", Path.Combine(folder, "data"),
404 - "-intermediateFolder", intermediateFolder,
405 - "-o", exePath,
406 - });
407 -
408 - result.AssertSuccess();
409 - Assert.Empty(result.Messages.Where(m => m.Level == MessageLevel.Warning));
410 -
411 - Assert.True(File.Exists(exePath));
412 - Assert.True(File.Exists(pdbPath));
413 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\large_file.dat")));
414 -
415 - using (var wixOutput = WixOutput.Read(pdbPath))
416 - {
417 - var intermediate = Intermediate.Load(wixOutput);
418 - var section = intermediate.Sections.Single();
419 -
420 - var payloadSymbol = section.Symbols.OfType<WixBundlePayloadSymbol>().Where(x => x.Name == "large_file.dat").Single();
421 - Assert.Equal(TwoAndAHalfGigabytes, payloadSymbol.FileSize);
422 - }
423 - }
424 -
425 - File.Delete(largeFile);
426 - }
386 }
387 }
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.en-us.wxl deleted
-10
@@ -1,10 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -
3 -<!--
4 -This file contains the declaration of all the localizable strings.
5 --->
6 -<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7 -
8 - <String Id="BundleName">~TestBundle</String>
9 -
10 -</WixLocalization>
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.wxs deleted
-13
@@ -1,13 +0,0 @@
1 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 - <Bundle Name="!(loc.BundleName)" Version="!(bind.packageVersion.test.msi)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 - <BootstrapperApplication>
4 - <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 - </BootstrapperApplication>
6 - <Chain>
7 - <MsiPackage SourceFile="test.msi">
8 - <MsiProperty Name="TEST" Value="1" />
9 - <Payload Compressed="no" SourceFile="large_file.dat" />
10 - </MsiPackage>
11 - </Chain>
12 - </Bundle>
13 -</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/Shared.dll deleted
-1
@@ -1 +0,0 @@
1 -This is Shared.dll.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/test.txt deleted
-1
@@ -1 +0,0 @@
1 -This is test.txt
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/fakeba.dll deleted
-1
@@ -1 +0,0 @@
1 -This is a fakeba.dll
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/large_file.dat deleted
-2
@@ -1,2 +0,0 @@
1 -When running the tests, this file will be overwritten with 2.5GB of data to test how Wix handles large files. We've avoided
2 -committing such a large file to Git as it would bloat the repo.
src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi
Binary files a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi and /dev/null differ
src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs
+1 -1
@@ -21,7 +21,7 @@
21 Description="Microsoft .NET Framework 4.6.2 Setup"
22 Hash="C42E6ED280290648BBD59F664008852F4CFE4548"
23 ProductName="Microsoft .NET Framework 4.6.2"
24 - Size="1429344"
24 + Size="9223372036854775807"
25 Version="4.6.1590.0" />
26 </ExePackage>
27 </PackageGroup>