From 9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 25 Oct 2019 00:48:35 -0700 Subject: Update to WixOutput file structure to fix embedded file handling --- src/test/Example.Extension/Data/example.wir | Bin 588 -> 535 bytes .../WixToolsetTest.CoreIntegration/MsiFixture.cs | 87 ++++++++++++++++++--- .../TestData/SameFileFolders/TestComponents.wxs | 16 ++++ .../TestData/SameFileFolders/data/a/test.txt | 1 + .../TestData/SameFileFolders/data/b/test.txt | 1 + .../TestData/SameFileFolders/data/c/test.txt | 1 + .../WixToolsetTest.CoreIntegration.csproj | 4 + .../WixiplFixture.cs | 12 +-- 8 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt (limited to 'src/test') diff --git a/src/test/Example.Extension/Data/example.wir b/src/test/Example.Extension/Data/example.wir index 8e32f901..d1ee8b90 100644 Binary files a/src/test/Example.Extension/Data/example.wir and b/src/test/Example.Extension/Data/example.wir differ diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index d056a1d6..e201b61f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs @@ -312,9 +312,8 @@ namespace WixToolsetTest.CoreIntegration var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); Assert.True(File.Exists(pdbPath)); - var pdb = Pdb.Load(pdbPath, suppressVersionCheck: true); - Assert.NotNull(pdb); - Assert.NotNull(pdb.Output); + var output = Output.Load(pdbPath, suppressVersionCheck: true); + Assert.NotNull(output); } } @@ -448,6 +447,74 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildBinaryWixlib() + { + var folder = TestData.Get(@"TestData\SingleFile"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var result = WixRunner.Execute( + "build", + Path.Combine(folder, "Package.wxs"), + Path.Combine(folder, "PackageComponents.wxs"), + "-loc", Path.Combine(folder, "Package.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-bindfiles", + "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); + + result.AssertSuccess(); + + using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) + { + Assert.NotNull(wixout.GetDataStream("wix-ir.json")); + + var text = wixout.GetData("wix-ir/test.txt"); + Assert.Equal("This is test.txt.", text); + } + } + } + + [Fact] + public void CanBuildBinaryWixlibWithCollidingFilenames() + { + var folder = TestData.Get(@"TestData\SameFileFolders"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var result = WixRunner.Execute( + "build", + Path.Combine(folder, "TestComponents.wxs"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-bindfiles", + "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); + + result.AssertSuccess(); + + using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) + { + Assert.NotNull(wixout.GetDataStream("wix-ir.json")); + + var text = wixout.GetData("wix-ir/test.txt"); + Assert.Equal(@"This is a\test.txt.", text); + + var text2 = wixout.GetData("wix-ir/test.txt-1"); + Assert.Equal(@"This is b\test.txt.", text2); + + var text3 = wixout.GetData("wix-ir/test.txt-2"); + Assert.Equal(@"This is c\test.txt.", text3); + } + } + } + [Fact] public void CanBuildWithIncludePath() { @@ -459,8 +526,7 @@ namespace WixToolsetTest.CoreIntegration var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); - var result = WixRunner.Execute(new[] - { + var result = WixRunner.Execute( "build", Path.Combine(folder, "Package.wxs"), Path.Combine(folder, "PackageComponents.wxs"), @@ -468,8 +534,7 @@ namespace WixToolsetTest.CoreIntegration "-bindpath", bindpath, "-intermediateFolder", intermediateFolder, "-o", Path.Combine(baseFolder, @"bin\test.msi"), - "-i", bindpath, - }); + "-i", bindpath); result.AssertSuccess(); @@ -635,8 +700,8 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); - var pdb = Pdb.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); - var caRows = pdb.Output.Tables["CustomAction"].Rows.Single(); + var output = Output.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); + var caRows = output.Tables["CustomAction"].Rows.Single(); Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); Assert.Equal("51", caRows.FieldAsString(1)); Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); @@ -711,8 +776,8 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); - var pdb = Pdb.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); - Assert.NotEmpty(pdb.Output.SubStorages); + var output = Output.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); + Assert.NotEmpty(output.SubStorages); } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs new file mode 100644 index 00000000..765e6778 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/TestComponents.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt new file mode 100644 index 00000000..1970cae6 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/a/test.txt @@ -0,0 +1 @@ +This is a\test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt new file mode 100644 index 00000000..fa2c7082 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/b/test.txt @@ -0,0 +1 @@ +This is b\test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt new file mode 100644 index 00000000..1c0cbda6 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SameFileFolders/data/c/test.txt @@ -0,0 +1 @@ +This is c\test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 1f8860ef..dba30bd6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -36,6 +36,10 @@ + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs index 668c273a..1d359241 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs @@ -128,14 +128,14 @@ namespace WixToolsetTest.CoreIntegration { var binary = section.Tuples.OfType().Single(); var path = binary[BinaryTupleFields.Data].AsPath().Path; - Assert.Contains("Example.Extension", path); - Assert.EndsWith(@"\0", path); + Assert.StartsWith(Path.Combine(baseFolder, @"obj\Example.Extension"), path); + Assert.EndsWith(@"wix-ir\example.txt", path); Assert.Equal(@"BinFromWir", binary.Id.Id); } } } - [Fact(Skip = "Test demonstrates failure")] + [Fact] public void CanBuildWixiplUsingExtensionLibrary() { var folder = TestData.Get(@"TestData\Wixipl"); @@ -171,7 +171,7 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); - var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); var section = intermediate.Sections.Single(); { @@ -183,8 +183,8 @@ namespace WixToolsetTest.CoreIntegration { var binary = section.Tuples.OfType().Single(); var path = binary[BinaryTupleFields.Data].AsPath().Path; - Assert.Contains("Example.Extension", path); - Assert.EndsWith(@"\0", path); + Assert.StartsWith(Path.Combine(baseFolder, @"obj\test"), path); + Assert.EndsWith(@"wix-ir\example.txt", path); Assert.Equal(@"BinFromWir", binary.Id.Id); } } -- cgit v1.2.3-55-g6feb