diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-03-01 10:14:38 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-03-01 12:23:34 -0800 |
| commit | 3eb3c26c796984b64365fda077f173af8bf31559 (patch) | |
| tree | 0912d69363973bc8db704a18b1b4bcede6a84360 /src/test/WixToolsetTest.CoreIntegration | |
| parent | 697f2cdbdcd8198d06ebf14fc2b65f0ce3fa5a94 (diff) | |
| download | wix-3eb3c26c796984b64365fda077f173af8bf31559.tar.gz wix-3eb3c26c796984b64365fda077f173af8bf31559.tar.bz2 wix-3eb3c26c796984b64365fda077f173af8bf31559.zip | |
Fix handling of suppress modularization
Partially fixes wixtoolset/issues#5944
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
5 files changed, 129 insertions, 50 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs new file mode 100644 index 00000000..349bad2c --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs | |||
| @@ -0,0 +1,108 @@ | |||
| 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; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.Core.TestPackage; | ||
| 10 | using WixToolset.Data; | ||
| 11 | using WixToolset.Data.Symbols; | ||
| 12 | using WixToolset.Data.WindowsInstaller; | ||
| 13 | using Xunit; | ||
| 14 | |||
| 15 | public class ModuleFixture | ||
| 16 | { | ||
| 17 | [Fact] | ||
| 18 | public void CanBuildSimpleModule() | ||
| 19 | { | ||
| 20 | var folder = TestData.Get(@"TestData\SimpleModule"); | ||
| 21 | |||
| 22 | using (var fs = new DisposableFileSystem()) | ||
| 23 | { | ||
| 24 | var intermediateFolder = fs.GetFolder(); | ||
| 25 | |||
| 26 | var result = WixRunner.Execute(new[] | ||
| 27 | { | ||
| 28 | "build", | ||
| 29 | Path.Combine(folder, "Module.wxs"), | ||
| 30 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
| 31 | "-bindpath", Path.Combine(folder, "data"), | ||
| 32 | "-intermediateFolder", intermediateFolder, | ||
| 33 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
| 34 | }); | ||
| 35 | |||
| 36 | result.AssertSuccess(); | ||
| 37 | |||
| 38 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
| 39 | Assert.True(File.Exists(msmPath)); | ||
| 40 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
| 41 | |||
| 42 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 43 | var section = intermediate.Sections.Single(); | ||
| 44 | |||
| 45 | var dirSymbols = section.Symbols.OfType<DirectorySymbol>().OrderBy(d => d.Id.Id).ToList(); | ||
| 46 | WixAssert.CompareLineByLine(new[] | ||
| 47 | { | ||
| 48 | "MergeRedirectFolder\tTARGETDIR\t.", | ||
| 49 | "TARGETDIR\t\tSourceDir" | ||
| 50 | }, dirSymbols.Select(d => String.Join("\t", d.Id.Id, d.ParentDirectoryRef, d.Name)).ToArray()); | ||
| 51 | |||
| 52 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | ||
| 53 | Assert.Equal("filyIq8rqcxxf903Hsn5K9L0SWV73g", fileSymbol.Id.Id); | ||
| 54 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileSymbol[FileSymbolFields.Source].AsPath().Path); | ||
| 55 | Assert.Equal(@"test.txt", fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath().Path); | ||
| 56 | |||
| 57 | var data = WindowsInstallerData.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 58 | var fileRows = data.Tables["File"].Rows; | ||
| 59 | Assert.Equal(new[] | ||
| 60 | { | ||
| 61 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 62 | }, fileRows.Select(r => r.FieldAsString(0)).ToArray()); | ||
| 63 | |||
| 64 | var cabPath = Path.Combine(intermediateFolder, "msm-test.cab"); | ||
| 65 | Query.ExtractStream(msmPath, "MergeModule.CABinet", cabPath); | ||
| 66 | var files = Query.GetCabinetFiles(cabPath); | ||
| 67 | Assert.Equal(new[] | ||
| 68 | { | ||
| 69 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 70 | }, files.Select(f => Path.Combine(f.Path, f.Name)).ToArray()); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | [Fact] | ||
| 75 | public void CanSuppressModularization() | ||
| 76 | { | ||
| 77 | var folder = TestData.Get(@"TestData\SuppressModularization"); | ||
| 78 | |||
| 79 | using (var fs = new DisposableFileSystem()) | ||
| 80 | { | ||
| 81 | var intermediateFolder = fs.GetFolder(); | ||
| 82 | |||
| 83 | var result = WixRunner.Execute(new[] | ||
| 84 | { | ||
| 85 | "build", | ||
| 86 | Path.Combine(folder, "Module.wxs"), | ||
| 87 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
| 88 | "-bindpath", Path.Combine(folder, "data"), | ||
| 89 | "-intermediateFolder", intermediateFolder, | ||
| 90 | "-sw1079", | ||
| 91 | "-sw1086", | ||
| 92 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
| 93 | }); | ||
| 94 | |||
| 95 | result.AssertSuccess(); | ||
| 96 | |||
| 97 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
| 98 | |||
| 99 | var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "Property" }); | ||
| 100 | WixAssert.CompareLineByLine(new[] | ||
| 101 | { | ||
| 102 | "CustomAction:Test\t11265\tFakeCA.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tTestEntry\t", | ||
| 103 | "Property:MsiHiddenProperties\tTest" | ||
| 104 | }, rows); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | } | ||
| 108 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index e26e197f..a8ea0a18 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
| @@ -327,56 +327,6 @@ namespace WixToolsetTest.CoreIntegration | |||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | [Fact] | 329 | [Fact] |
| 330 | public void CanBuildSimpleModule() | ||
| 331 | { | ||
| 332 | var folder = TestData.Get(@"TestData\SimpleModule"); | ||
| 333 | |||
| 334 | using (var fs = new DisposableFileSystem()) | ||
| 335 | { | ||
| 336 | var intermediateFolder = fs.GetFolder(); | ||
| 337 | |||
| 338 | var result = WixRunner.Execute(new[] | ||
| 339 | { | ||
| 340 | "build", | ||
| 341 | Path.Combine(folder, "Module.wxs"), | ||
| 342 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
| 343 | "-bindpath", Path.Combine(folder, "data"), | ||
| 344 | "-intermediateFolder", intermediateFolder, | ||
| 345 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
| 346 | }); | ||
| 347 | |||
| 348 | result.AssertSuccess(); | ||
| 349 | |||
| 350 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
| 351 | Assert.True(File.Exists(msmPath)); | ||
| 352 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
| 353 | |||
| 354 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 355 | var section = intermediate.Sections.Single(); | ||
| 356 | |||
| 357 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | ||
| 358 | Assert.Equal("filyIq8rqcxxf903Hsn5K9L0SWV73g", fileSymbol.Id.Id); | ||
| 359 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileSymbol[FileSymbolFields.Source].AsPath().Path); | ||
| 360 | Assert.Equal(@"test.txt", fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath().Path); | ||
| 361 | |||
| 362 | var data = WindowsInstallerData.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 363 | var fileRows = data.Tables["File"].Rows; | ||
| 364 | Assert.Equal(new[] | ||
| 365 | { | ||
| 366 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 367 | }, fileRows.Select(r => r.FieldAsString(0)).ToArray()); | ||
| 368 | |||
| 369 | var cabPath = Path.Combine(intermediateFolder, "msm-test.cab"); | ||
| 370 | Query.ExtractStream(msmPath, "MergeModule.CABinet", cabPath); | ||
| 371 | var files = Query.GetCabinetFiles(cabPath); | ||
| 372 | Assert.Equal(new[] | ||
| 373 | { | ||
| 374 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 375 | }, files.Select(f => Path.Combine(f.Path, f.Name)).ToArray()); | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | [Fact] | ||
| 380 | public void CanBuildManualUpgrade() | 330 | public void CanBuildManualUpgrade() |
| 381 | { | 331 | { |
| 382 | var folder = TestData.Get(@"TestData\ManualUpgrade"); | 332 | var folder = TestData.Get(@"TestData\ManualUpgrade"); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.en-us.wxl new file mode 100644 index 00000000..c74e86a7 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.en-us.wxl | |||
| @@ -0,0 +1,10 @@ | |||
| 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="Manufacturer">Example Company</String> | ||
| 9 | |||
| 10 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.wxs new file mode 100644 index 00000000..f4ce9c48 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/Module.wxs | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Module Id="MergeModule1" Language="1033" Version="1.0.0.0" Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE"> | ||
| 3 | <SummaryInformation Manufacturer="!(loc.Manufacturer)" /> | ||
| 4 | |||
| 5 | <Property Id="Test" Hidden="true" SuppressModularization="true" /> | ||
| 6 | <CustomAction Id="Test" DllEntry="TestEntry" Execute="deferred" Return="check" Impersonate="no" HideTarget="yes" SuppressModularization="yes" BinaryRef="FakeCA" /> | ||
| 7 | |||
| 8 | <Binary Id="FakeCA" SourceFile="test.txt" /> | ||
| 9 | </Module> | ||
| 10 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SuppressModularization/data/test.txt | |||
| @@ -0,0 +1 @@ | |||
| This is test.txt. \ No newline at end of file | |||
