Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

#4008 - Allow packages and payloads over 2GiB #228

Merged
merged 1 commit into from Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs
Expand Up @@ -117,7 +117,7 @@ private void UpdatePayloadFileInformation(WixBundlePayloadSymbol payload, Interm

if (null != fileInfo)
{
payload.FileSize = (int)fileInfo.Length;
payload.FileSize = fileInfo.Length;

payload.Hash = BundleHashAlgorithm.Hash(fileInfo);
}
Expand Down
52 changes: 52 additions & 0 deletions src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
Expand Up @@ -366,5 +366,57 @@ public void CantBuildWithUnscheduledRollbackBoundary()
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<WixBundlePayloadSymbol>().Where(x => x.Name == "large_file.dat").Single();
Assert.Equal(TwoAndAHalfGigabytes, payloadSymbol.FileSize);
}
}

File.Delete(largeFile);
}
}
}
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
This file contains the declaration of all the localizable strings.
-->
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">

<String Id="BundleName">~TestBundle</String>

</WixLocalization>
@@ -0,0 +1,13 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Bundle Name="!(loc.BundleName)" Version="!(bind.packageVersion.test.msi)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
<BootstrapperApplication>
<BootstrapperApplicationDll SourceFile="fakeba.dll" />
</BootstrapperApplication>
<Chain>
<MsiPackage SourceFile="test.msi">
<MsiProperty Name="TEST" Value="1" />
<Payload Compressed="no" SourceFile="large_file.dat" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>
@@ -0,0 +1 @@
This is Shared.dll.
@@ -0,0 +1 @@
This is test.txt
@@ -0,0 +1 @@
This is a fakeba.dll
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robmen Like you wanted them to narrow what was being tested, I would like tests not to have their own files unless it's necessary. Creating fake BA dlls and using localization seems like overkill in most scenarios and will also bloat the repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree but we should clean up all the tests to work this way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already write all of my tests that way, I haven't looked lately at how many need to be cleaned up.

@@ -0,0 +1,2 @@
When running the tests, this file will be overwritten with 2.5GB of data to test how Wix handles large files. We've avoided
robmen marked this conversation as resolved.
Show resolved Hide resolved
committing such a large file to Git as it would bloat the repo.
Binary file not shown.