diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-01-06 15:15:35 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-01-06 15:24:56 -0800 |
| commit | 093e1dd144b260b58a0ae46d722d1dbc4019d9d5 (patch) | |
| tree | 6fd63241e2b196b040d26b3b1749d4c3ecbc531c /src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs | |
| parent | bf30546113c5f1ffc4cf917b560c5a0451eda37d (diff) | |
| download | wix-093e1dd144b260b58a0ae46d722d1dbc4019d9d5.tar.gz wix-093e1dd144b260b58a0ae46d722d1dbc4019d9d5.tar.bz2 wix-093e1dd144b260b58a0ae46d722d1dbc4019d9d5.zip | |
Implement improved file sequence optimization
First ensures files are grouped by DiskId. Then files are sequenced by
target directory order to optimize MSI installation behavior. Finally,
files are alphabetized in the directory. Additional optimizations could
be considered in the future from here.
Fixes wixtoolset/issues#4409
Fixes wixtoolset/issues#4708
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs new file mode 100644 index 00000000..de18e30c --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/MediaFixture.cs | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.CoreIntegration | ||
| 4 | { | ||
| 5 | using System.IO; | ||
| 6 | using System.Linq; | ||
| 7 | using WixBuildTools.TestSupport; | ||
| 8 | using WixToolset.Core.TestPackage; | ||
| 9 | using WixToolset.Data; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class MediaFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void CanBuildMultiMedia() | ||
| 16 | { | ||
| 17 | var folder = TestData.Get(@"TestData"); | ||
| 18 | |||
| 19 | using (var fs = new DisposableFileSystem()) | ||
| 20 | { | ||
| 21 | var baseFolder = fs.GetFolder(); | ||
| 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 23 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
| 24 | |||
| 25 | var result = WixRunner.Execute(new[] | ||
| 26 | { | ||
| 27 | "build", | ||
| 28 | Path.Combine(folder, "Media", "MultiMedia.wxs"), | ||
| 29 | "-bindpath", Path.Combine(folder, "Media", "data"), | ||
| 30 | "-intermediateFolder", intermediateFolder, | ||
| 31 | "-o", msiPath | ||
| 32 | }); | ||
| 33 | |||
| 34 | result.AssertSuccess(); | ||
| 35 | |||
| 36 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
| 37 | var section = intermediate.Sections.Single(); | ||
| 38 | |||
| 39 | var mediaSymbols = section.Symbols.OfType<WixToolset.Data.Symbols.MediaSymbol>().OrderBy(m => m.DiskId).ToList(); | ||
| 40 | var fileSymbols = section.Symbols.OfType<WixToolset.Data.Symbols.FileSymbol>().OrderBy(f => f.Sequence).ToList(); | ||
| 41 | Assert.Equal(1, mediaSymbols[0].DiskId); | ||
| 42 | Assert.Equal(2, mediaSymbols[0].LastSequence); | ||
| 43 | Assert.Equal(2, mediaSymbols[1].DiskId); | ||
| 44 | Assert.Equal(4, mediaSymbols[1].LastSequence); | ||
| 45 | Assert.Equal(new[] | ||
| 46 | { | ||
| 47 | "a1.txt", | ||
| 48 | "a2.txt", | ||
| 49 | "b1.txt", | ||
| 50 | "b2.txt", | ||
| 51 | }, fileSymbols.Select(f => f.Name).ToArray()); | ||
| 52 | Assert.Equal(new[] | ||
| 53 | { | ||
| 54 | 1, | ||
| 55 | 2, | ||
| 56 | 3, | ||
| 57 | 4, | ||
| 58 | }, fileSymbols.Select(f => f.Sequence).ToArray()); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
