From b54ac261d0a03b75cf05ef370351445774b82155 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 27 Feb 2021 16:29:58 -0600 Subject: Test big payloads by RemotePayload since real files are slow. The test will be moved to a Burn e2e test. #4008 --- src/WixToolset.Core/Compiler_Bundle.cs | 4 +- .../BundleFixture.cs | 63 ++++----------------- .../TestData/LargePayload/Bundle.en-us.wxl | 10 ---- .../TestData/LargePayload/Bundle.wxs | 13 ----- .../LargePayload/data/MsiPackage/Shared.dll | 1 - .../TestData/LargePayload/data/MsiPackage/test.txt | 1 - .../TestData/LargePayload/data/fakeba.dll | 1 - .../TestData/LargePayload/data/large_file.dat | 2 - .../TestData/LargePayload/data/test.msi | Bin 32768 -> 0 bytes .../SingleExeBundle/SingleExeRemotePayload.wxs | 2 +- 10 files changed, 14 insertions(+), 83 deletions(-) delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.en-us.wxl delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/Bundle.wxs delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/Shared.dll delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/MsiPackage/test.txt delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/fakeba.dll delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/large_file.dat delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi (limited to 'src') 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 remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; case "Size": - remotePayload.Size = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue); + remotePayload.Size = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, Int64.MaxValue); break; case "Version": remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); @@ -3260,7 +3260,7 @@ namespace WixToolset.Core public string ProductName { get; set; } - public int Size { get; set; } + public long Size { get; set; } public string Version { get; set; } } 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 var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var exePath = Path.Combine(baseFolder, @"bin\test.exe"); + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); var result = WixRunner.Execute(new[] { @@ -266,6 +267,16 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); Assert.True(File.Exists(exePath)); + Assert.True(File.Exists(pdbPath)); + + using (var wixOutput = WixOutput.Read(pdbPath)) + { + var intermediate = Intermediate.Load(wixOutput); + var section = intermediate.Sections.Single(); + + var payloadSymbol = section.Symbols.OfType().Where(x => x.Id.Id == "NetFx462Web").Single(); + Assert.Equal(Int64.MaxValue, payloadSymbol.FileSize); + } } } @@ -372,57 +383,5 @@ namespace WixToolsetTest.CoreIntegration Assert.InRange(result.ExitCode, 2, Int32.MaxValue); } } - - [Fact] - public void CanBuildBundleWithLargePayload() - { - var folder = TestData.Get(@"TestData\LargePayload"); - - // Overwrite the payload with a 2.5 GiB file. We do this dynamically to avoid committing such - // a large file to source control. - var largeFile = Path.Combine(folder, "data", "large_file.dat"); - const long TwoAndAHalfGigabytes = 2_684_354_560; - using (var stream = File.Create(largeFile)) - { - stream.Seek(TwoAndAHalfGigabytes - 1, SeekOrigin.Begin); - stream.WriteByte(1); - } - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var intermediateFolder = Path.Combine(baseFolder, "obj"); - var exePath = Path.Combine(baseFolder, @"bin\test.exe"); - var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); - - var result = WixRunner.Execute(new[] - { - "build", - Path.Combine(folder, "Bundle.wxs"), - "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), - "-bindpath", Path.Combine(folder, "data"), - "-intermediateFolder", intermediateFolder, - "-o", exePath, - }); - - result.AssertSuccess(); - Assert.Empty(result.Messages.Where(m => m.Level == MessageLevel.Warning)); - - Assert.True(File.Exists(exePath)); - Assert.True(File.Exists(pdbPath)); - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\large_file.dat"))); - - using (var wixOutput = WixOutput.Read(pdbPath)) - { - var intermediate = Intermediate.Load(wixOutput); - var section = intermediate.Sections.Single(); - - var payloadSymbol = section.Symbols.OfType().Where(x => x.Name == "large_file.dat").Single(); - Assert.Equal(TwoAndAHalfGigabytes, payloadSymbol.FileSize); - } - } - - File.Delete(largeFile); - } } } 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 @@ - - - - - - ~TestBundle - - 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 @@ - - - - - - - - - - - - - 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 @@ -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 @@ -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 @@ -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 @@ -When running the tests, this file will be overwritten with 2.5GB of data to test how Wix handles large files. We've avoided -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 Binary files a/src/test/WixToolsetTest.CoreIntegration/TestData/LargePayload/data/test.msi and /dev/null 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 @@ Description="Microsoft .NET Framework 4.6.2 Setup" Hash="C42E6ED280290648BBD59F664008852F4CFE4548" ProductName="Microsoft .NET Framework 4.6.2" - Size="1429344" + Size="9223372036854775807" Version="4.6.1590.0" /> -- cgit v1.2.3-55-g6feb