diff options
author | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:48:35 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:53:29 -0700 |
commit | 9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5 (patch) | |
tree | ebf26d0e37244f3014e0c4924a29af7f7e56e2f2 /src/test | |
parent | 87580cbe111a8df836231a0192dee674cf482f08 (diff) | |
download | wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.gz wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.bz2 wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.zip |
Update to WixOutput file structure to fix embedded file handling
Diffstat (limited to 'src/test')
8 files changed, 105 insertions, 17 deletions
diff --git a/src/test/Example.Extension/Data/example.wir b/src/test/Example.Extension/Data/example.wir index 8e32f901..d1ee8b90 100644 --- a/src/test/Example.Extension/Data/example.wir +++ b/src/test/Example.Extension/Data/example.wir | |||
Binary files 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 | |||
312 | var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); | 312 | var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); |
313 | Assert.True(File.Exists(pdbPath)); | 313 | Assert.True(File.Exists(pdbPath)); |
314 | 314 | ||
315 | var pdb = Pdb.Load(pdbPath, suppressVersionCheck: true); | 315 | var output = Output.Load(pdbPath, suppressVersionCheck: true); |
316 | Assert.NotNull(pdb); | 316 | Assert.NotNull(output); |
317 | Assert.NotNull(pdb.Output); | ||
318 | } | 317 | } |
319 | } | 318 | } |
320 | 319 | ||
@@ -449,6 +448,74 @@ namespace WixToolsetTest.CoreIntegration | |||
449 | } | 448 | } |
450 | 449 | ||
451 | [Fact] | 450 | [Fact] |
451 | public void CanBuildBinaryWixlib() | ||
452 | { | ||
453 | var folder = TestData.Get(@"TestData\SingleFile"); | ||
454 | |||
455 | using (var fs = new DisposableFileSystem()) | ||
456 | { | ||
457 | var baseFolder = fs.GetFolder(); | ||
458 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
459 | |||
460 | var result = WixRunner.Execute( | ||
461 | "build", | ||
462 | Path.Combine(folder, "Package.wxs"), | ||
463 | Path.Combine(folder, "PackageComponents.wxs"), | ||
464 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
465 | "-bindpath", Path.Combine(folder, "data"), | ||
466 | "-intermediateFolder", intermediateFolder, | ||
467 | "-bindfiles", | ||
468 | "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); | ||
469 | |||
470 | result.AssertSuccess(); | ||
471 | |||
472 | using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) | ||
473 | { | ||
474 | Assert.NotNull(wixout.GetDataStream("wix-ir.json")); | ||
475 | |||
476 | var text = wixout.GetData("wix-ir/test.txt"); | ||
477 | Assert.Equal("This is test.txt.", text); | ||
478 | } | ||
479 | } | ||
480 | } | ||
481 | |||
482 | [Fact] | ||
483 | public void CanBuildBinaryWixlibWithCollidingFilenames() | ||
484 | { | ||
485 | var folder = TestData.Get(@"TestData\SameFileFolders"); | ||
486 | |||
487 | using (var fs = new DisposableFileSystem()) | ||
488 | { | ||
489 | var baseFolder = fs.GetFolder(); | ||
490 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
491 | |||
492 | var result = WixRunner.Execute( | ||
493 | "build", | ||
494 | Path.Combine(folder, "TestComponents.wxs"), | ||
495 | "-bindpath", Path.Combine(folder, "data"), | ||
496 | "-intermediateFolder", intermediateFolder, | ||
497 | "-bindfiles", | ||
498 | "-o", Path.Combine(baseFolder, @"bin\test.wixlib")); | ||
499 | |||
500 | result.AssertSuccess(); | ||
501 | |||
502 | using (var wixout = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixlib"))) | ||
503 | { | ||
504 | Assert.NotNull(wixout.GetDataStream("wix-ir.json")); | ||
505 | |||
506 | var text = wixout.GetData("wix-ir/test.txt"); | ||
507 | Assert.Equal(@"This is a\test.txt.", text); | ||
508 | |||
509 | var text2 = wixout.GetData("wix-ir/test.txt-1"); | ||
510 | Assert.Equal(@"This is b\test.txt.", text2); | ||
511 | |||
512 | var text3 = wixout.GetData("wix-ir/test.txt-2"); | ||
513 | Assert.Equal(@"This is c\test.txt.", text3); | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | |||
518 | [Fact] | ||
452 | public void CanBuildWithIncludePath() | 519 | public void CanBuildWithIncludePath() |
453 | { | 520 | { |
454 | var folder = TestData.Get(@"TestData\IncludePath"); | 521 | var folder = TestData.Get(@"TestData\IncludePath"); |
@@ -459,8 +526,7 @@ namespace WixToolsetTest.CoreIntegration | |||
459 | var baseFolder = fs.GetFolder(); | 526 | var baseFolder = fs.GetFolder(); |
460 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 527 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
461 | 528 | ||
462 | var result = WixRunner.Execute(new[] | 529 | var result = WixRunner.Execute( |
463 | { | ||
464 | "build", | 530 | "build", |
465 | Path.Combine(folder, "Package.wxs"), | 531 | Path.Combine(folder, "Package.wxs"), |
466 | Path.Combine(folder, "PackageComponents.wxs"), | 532 | Path.Combine(folder, "PackageComponents.wxs"), |
@@ -468,8 +534,7 @@ namespace WixToolsetTest.CoreIntegration | |||
468 | "-bindpath", bindpath, | 534 | "-bindpath", bindpath, |
469 | "-intermediateFolder", intermediateFolder, | 535 | "-intermediateFolder", intermediateFolder, |
470 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | 536 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), |
471 | "-i", bindpath, | 537 | "-i", bindpath); |
472 | }); | ||
473 | 538 | ||
474 | result.AssertSuccess(); | 539 | result.AssertSuccess(); |
475 | 540 | ||
@@ -635,8 +700,8 @@ namespace WixToolsetTest.CoreIntegration | |||
635 | 700 | ||
636 | result.AssertSuccess(); | 701 | result.AssertSuccess(); |
637 | 702 | ||
638 | var pdb = Pdb.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); | 703 | var output = Output.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); |
639 | var caRows = pdb.Output.Tables["CustomAction"].Rows.Single(); | 704 | var caRows = output.Tables["CustomAction"].Rows.Single(); |
640 | Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); | 705 | Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); |
641 | Assert.Equal("51", caRows.FieldAsString(1)); | 706 | Assert.Equal("51", caRows.FieldAsString(1)); |
642 | Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); | 707 | Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); |
@@ -711,8 +776,8 @@ namespace WixToolsetTest.CoreIntegration | |||
711 | 776 | ||
712 | result.AssertSuccess(); | 777 | result.AssertSuccess(); |
713 | 778 | ||
714 | var pdb = Pdb.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); | 779 | var output = Output.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb"), false); |
715 | Assert.NotEmpty(pdb.Output.SubStorages); | 780 | Assert.NotEmpty(output.SubStorages); |
716 | } | 781 | } |
717 | } | 782 | } |
718 | } | 783 | } |
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 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Directory="INSTALLFOLDER:\a"> | ||
6 | <File Source="a\test.txt" /> | ||
7 | </Component> | ||
8 | <Component Directory="INSTALLFOLDER:\b"> | ||
9 | <File Source="b\test.txt" /> | ||
10 | </Component> | ||
11 | <Component Directory="INSTALLFOLDER:\c"> | ||
12 | <File Source="c\test.txt" /> | ||
13 | </Component> | ||
14 | </ComponentGroup> | ||
15 | </Fragment> | ||
16 | </Wix> | ||
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 @@ | |||
36 | <Content Include="TestData\Font\FontTitle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 36 | <Content Include="TestData\Font\FontTitle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
37 | <Content Include="TestData\Icon\SampleIcon.wxs" CopyToOutputDirectory="PreserveNewest" /> | 37 | <Content Include="TestData\Icon\SampleIcon.wxs" CopyToOutputDirectory="PreserveNewest" /> |
38 | <Content Include="TestData\LockPermissions\EmptyPermissions.wxs" CopyToOutputDirectory="PreserveNewest" /> | 38 | <Content Include="TestData\LockPermissions\EmptyPermissions.wxs" CopyToOutputDirectory="PreserveNewest" /> |
39 | <Content Include="TestData\SameFileFolders\data\a\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
40 | <Content Include="TestData\SameFileFolders\data\c\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
41 | <Content Include="TestData\SameFileFolders\data\b\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
42 | <Content Include="TestData\SameFileFolders\TestComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
39 | <Content Include="TestData\ProductWithComponentGroupRef\MinimalComponentGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> | 43 | <Content Include="TestData\ProductWithComponentGroupRef\MinimalComponentGroup.wxs" CopyToOutputDirectory="PreserveNewest" /> |
40 | <Content Include="TestData\ProductWithComponentGroupRef\Product.wxs" CopyToOutputDirectory="PreserveNewest" /> | 44 | <Content Include="TestData\ProductWithComponentGroupRef\Product.wxs" CopyToOutputDirectory="PreserveNewest" /> |
41 | <Content Include="TestData\Registry\RegistryValue.wxs" CopyToOutputDirectory="PreserveNewest" /> | 45 | <Content Include="TestData\Registry\RegistryValue.wxs" CopyToOutputDirectory="PreserveNewest" /> |
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 | |||
128 | { | 128 | { |
129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | 129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); |
130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | 130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; |
131 | Assert.Contains("Example.Extension", path); | 131 | Assert.StartsWith(Path.Combine(baseFolder, @"obj\Example.Extension"), path); |
132 | Assert.EndsWith(@"\0", path); | 132 | Assert.EndsWith(@"wix-ir\example.txt", path); |
133 | Assert.Equal(@"BinFromWir", binary.Id.Id); | 133 | Assert.Equal(@"BinFromWir", binary.Id.Id); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | [Fact(Skip = "Test demonstrates failure")] | 138 | [Fact] |
139 | public void CanBuildWixiplUsingExtensionLibrary() | 139 | public void CanBuildWixiplUsingExtensionLibrary() |
140 | { | 140 | { |
141 | var folder = TestData.Get(@"TestData\Wixipl"); | 141 | var folder = TestData.Get(@"TestData\Wixipl"); |
@@ -171,7 +171,7 @@ namespace WixToolsetTest.CoreIntegration | |||
171 | 171 | ||
172 | result.AssertSuccess(); | 172 | result.AssertSuccess(); |
173 | 173 | ||
174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | 174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); |
175 | var section = intermediate.Sections.Single(); | 175 | var section = intermediate.Sections.Single(); |
176 | 176 | ||
177 | { | 177 | { |
@@ -183,8 +183,8 @@ namespace WixToolsetTest.CoreIntegration | |||
183 | { | 183 | { |
184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | 184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); |
185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | 185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; |
186 | Assert.Contains("Example.Extension", path); | 186 | Assert.StartsWith(Path.Combine(baseFolder, @"obj\test"), path); |
187 | Assert.EndsWith(@"\0", path); | 187 | Assert.EndsWith(@"wix-ir\example.txt", path); |
188 | Assert.Equal(@"BinFromWir", binary.Id.Id); | 188 | Assert.Equal(@"BinFromWir", binary.Id.Id); |
189 | } | 189 | } |
190 | } | 190 | } |