diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-27 16:29:58 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-02 15:50:47 -0600 |
commit | b54ac261d0a03b75cf05ef370351445774b82155 (patch) | |
tree | db5877ab147132b9fde78b53b4927e909f33661d | |
parent | ed20ef6dc8caa5d585c1a715ff4ba577687bf291 (diff) | |
download | wix-b54ac261d0a03b75cf05ef370351445774b82155.tar.gz wix-b54ac261d0a03b75cf05ef370351445774b82155.tar.bz2 wix-b54ac261d0a03b75cf05ef370351445774b82155.zip |
Test big payloads by RemotePayload since real files are slow.
The test will be moved to a Burn e2e test.
#4008
10 files changed, 14 insertions, 83 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index c790d721..189ac9b5 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -1447,7 +1447,7 @@ namespace WixToolset.Core | |||
1447 | remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1447 | remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
1448 | break; | 1448 | break; |
1449 | case "Size": | 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; | 1451 | break; |
1452 | case "Version": | 1452 | case "Version": |
1453 | remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1453 | remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
@@ -3260,7 +3260,7 @@ namespace WixToolset.Core | |||
3260 | 3260 | ||
3261 | public string ProductName { get; set; } | 3261 | public string ProductName { get; set; } |
3262 | 3262 | ||
3263 | public int Size { get; set; } | 3263 | public long Size { get; set; } |
3264 | 3264 | ||
3265 | public string Version { get; set; } | 3265 | public string Version { get; set; } |
3266 | } | 3266 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index 2cc9a39e..38554b70 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs | |||
@@ -252,6 +252,7 @@ namespace WixToolsetTest.CoreIntegration | |||
252 | var baseFolder = fs.GetFolder(); | 252 | var baseFolder = fs.GetFolder(); |
253 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 253 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
254 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | 254 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); |
255 | var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); | ||
255 | 256 | ||
256 | var result = WixRunner.Execute(new[] | 257 | var result = WixRunner.Execute(new[] |
257 | { | 258 | { |
@@ -266,6 +267,16 @@ namespace WixToolsetTest.CoreIntegration | |||
266 | result.AssertSuccess(); | 267 | result.AssertSuccess(); |
267 | 268 | ||
268 | Assert.True(File.Exists(exePath)); | 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 | } | ||
269 | } | 280 | } |
270 | } | 281 | } |
271 | 282 | ||
@@ -372,57 +383,5 @@ namespace WixToolsetTest.CoreIntegration | |||
372 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | 383 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); |
373 | } | 384 | } |
374 | } | 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 | } | ||
427 | } | 386 | } |
428 | } | 387 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.en-us.wxl deleted file mode 100644 index bc1dee83..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.en-us.wxl +++ /dev/null | |||
@@ -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> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.wxs deleted file mode 100644 index 5c7735b5..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.wxs +++ /dev/null | |||
@@ -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> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/Shared.dll b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/Shared.dll deleted file mode 100644 index 0e461ba8..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/Shared.dll +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | This is Shared.dll. \ No newline at end of file | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/test.txt deleted file mode 100644 index 8b986220..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/test.txt +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | This is test.txt \ No newline at end of file | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/fakeba.dll b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/fakeba.dll deleted file mode 100644 index 970efdf0..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/fakeba.dll +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | This is a fakeba.dll \ No newline at end of file | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/large_file.dat b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/large_file.dat deleted file mode 100644 index 8115cc60..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/large_file.dat +++ /dev/null | |||
@@ -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. | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi deleted file mode 100644 index 0722d60e..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs index fcb9dd8d..79ba52d2 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExeRemotePayload.wxs | |||
@@ -21,7 +21,7 @@ | |||
21 | Description="Microsoft .NET Framework 4.6.2 Setup" | 21 | Description="Microsoft .NET Framework 4.6.2 Setup" |
22 | Hash="C42E6ED280290648BBD59F664008852F4CFE4548" | 22 | Hash="C42E6ED280290648BBD59F664008852F4CFE4548" |
23 | ProductName="Microsoft .NET Framework 4.6.2" | 23 | ProductName="Microsoft .NET Framework 4.6.2" |
24 | Size="1429344" | 24 | Size="9223372036854775807" |
25 | Version="4.6.1590.0" /> | 25 | Version="4.6.1590.0" /> |
26 | </ExePackage> | 26 | </ExePackage> |
27 | </PackageGroup> | 27 | </PackageGroup> |