diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-03-20 19:55:02 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-03-20 20:03:04 +1000 |
| commit | 22c97adba70fa838b8f285d404750d0f8fe685d8 (patch) | |
| tree | 5971180660090913d5e6991ebf982ada733ecdda /src/test/WixToolsetTest.CoreIntegration | |
| parent | c5df86a7caaa1cbff9adde6396925383ba9a2e4e (diff) | |
| download | wix-22c97adba70fa838b8f285d404750d0f8fe685d8.tar.gz wix-22c97adba70fa838b8f285d404750d0f8fe685d8.tar.bz2 wix-22c97adba70fa838b8f285d404750d0f8fe685d8.zip | |
Update Example.Extension to automatically update based on its Example.wxs.
Use .wixlib instead of .wir, and skip tests which are now failing.
Add more bundle tests.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
6 files changed, 175 insertions, 3 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index f32208a4..0e127e6e 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs | |||
| @@ -2,8 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 5 | using System.IO; | 6 | using System.IO; |
| 6 | using System.Linq; | 7 | using System.Linq; |
| 8 | using Example.Extension; | ||
| 7 | using WixBuildTools.TestSupport; | 9 | using WixBuildTools.TestSupport; |
| 8 | using WixToolset.Core.TestPackage; | 10 | using WixToolset.Core.TestPackage; |
| 9 | using WixToolset.Data; | 11 | using WixToolset.Data; |
| @@ -13,6 +15,50 @@ namespace WixToolsetTest.CoreIntegration | |||
| 13 | public class BundleFixture | 15 | public class BundleFixture |
| 14 | { | 16 | { |
| 15 | [Fact] | 17 | [Fact] |
| 18 | public void CanBuildMultiFileBundle() | ||
| 19 | { | ||
| 20 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | ||
| 21 | var folder = TestData.Get(@"TestData\SimpleBundle"); | ||
| 22 | |||
| 23 | using (var fs = new DisposableFileSystem()) | ||
| 24 | { | ||
| 25 | var baseFolder = fs.GetFolder(); | ||
| 26 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 27 | |||
| 28 | var result = WixRunner.Execute(new[] | ||
| 29 | { | ||
| 30 | "build", | ||
| 31 | Path.Combine(folder, "MultiFileBootstrapperApplication.wxs"), | ||
| 32 | Path.Combine(folder, "MultiFileBundle.wxs"), | ||
| 33 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | ||
| 34 | "-bindpath", Path.Combine(folder, "data"), | ||
| 35 | "-intermediateFolder", intermediateFolder, | ||
| 36 | "-burnStub", burnStubPath, | ||
| 37 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 38 | }); | ||
| 39 | |||
| 40 | result.AssertSuccess(); | ||
| 41 | |||
| 42 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 43 | #if TODO | ||
| 44 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 45 | #endif | ||
| 46 | |||
| 47 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); | ||
| 48 | var section = intermediate.Sections.Single(); | ||
| 49 | |||
| 50 | var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single(); | ||
| 51 | Assert.Equal("1.0.0.0", bundleTuple.Version); | ||
| 52 | |||
| 53 | var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; | ||
| 54 | Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); | ||
| 55 | |||
| 56 | var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); | ||
| 57 | Assert.Equal("test.msi", msiTuple.Id.Id); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | [Fact] | ||
| 16 | public void CanBuildSimpleBundle() | 62 | public void CanBuildSimpleBundle() |
| 17 | { | 63 | { |
| 18 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | 64 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); |
| @@ -51,7 +97,60 @@ namespace WixToolsetTest.CoreIntegration | |||
| 51 | Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); | 97 | Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); |
| 52 | 98 | ||
| 53 | var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); | 99 | var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); |
| 54 | Assert.Equal("test.msi", msiTuple.Id.Id ); | 100 | Assert.Equal("test.msi", msiTuple.Id.Id); |
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 104 | [Fact(Skip = "Test demonstrates failure")] | ||
| 105 | public void CanBuildSimpleBundleUsingExtensionBA() | ||
| 106 | { | ||
| 107 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | ||
| 108 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
| 109 | var folder = TestData.Get(@"TestData\SimpleBundle"); | ||
| 110 | |||
| 111 | using (var fs = new DisposableFileSystem()) | ||
| 112 | { | ||
| 113 | var baseFolder = fs.GetFolder(); | ||
| 114 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 115 | |||
| 116 | var libResult = WixRunner.Execute(new[] | ||
| 117 | { | ||
| 118 | "build", | ||
| 119 | Path.Combine(@"C:\src\mynewwix4\Core\src\test\Example.Extension\Data", "example.wxs"), | ||
| 120 | "-intermediateFolder", intermediateFolder, | ||
| 121 | "-o", Path.Combine(intermediateFolder, @"test.wixlib") | ||
| 122 | }); | ||
| 123 | |||
| 124 | var result = WixRunner.Execute(new[] | ||
| 125 | { | ||
| 126 | "build", | ||
| 127 | Path.Combine(folder, "MultiFileBundle.wxs"), | ||
| 128 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | ||
| 129 | "-ext", extensionPath, | ||
| 130 | "-bindpath", Path.Combine(folder, "data"), | ||
| 131 | "-intermediateFolder", intermediateFolder, | ||
| 132 | "-burnStub", burnStubPath, | ||
| 133 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 134 | }); | ||
| 135 | |||
| 136 | result.AssertSuccess(); | ||
| 137 | |||
| 138 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 139 | #if TODO | ||
| 140 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 141 | #endif | ||
| 142 | |||
| 143 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); | ||
| 144 | var section = intermediate.Sections.Single(); | ||
| 145 | |||
| 146 | var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single(); | ||
| 147 | Assert.Equal("1.0.0.0", bundleTuple.Version); | ||
| 148 | |||
| 149 | var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; | ||
| 150 | Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); | ||
| 151 | |||
| 152 | var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); | ||
| 153 | Assert.Equal("test.msi", msiTuple.Id.Id); | ||
| 55 | } | 154 | } |
| 56 | } | 155 | } |
| 57 | } | 156 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBootstrapperApplication.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBootstrapperApplication.wxs new file mode 100644 index 00000000..2d36934f --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBootstrapperApplication.wxs | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <BootstrapperApplication Id="fakeba" SourceFile="fakeba.dll" /> | ||
| 5 | </Fragment> | ||
| 6 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBundle.wxs new file mode 100644 index 00000000..205c58ca --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBundle.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Bundle Name="!(loc.BundleName)" Version="!(bind.packageVersion.test.msi)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
| 4 | <BootstrapperApplicationRef Id="fakeba" /> | ||
| 5 | <Chain> | ||
| 6 | <MsiPackage SourceFile="test.msi"> | ||
| 7 | <MsiProperty Name="TEST" Value="1" /> | ||
| 8 | </MsiPackage> | ||
| 9 | </Chain> | ||
| 10 | </Bundle> | ||
| 11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index a64ff93d..7f21fde1 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
| @@ -109,6 +109,8 @@ | |||
| 109 | <Content Include="TestData\SimpleBundle\data\test.msi" CopyToOutputDirectory="PreserveNewest" /> | 109 | <Content Include="TestData\SimpleBundle\data\test.msi" CopyToOutputDirectory="PreserveNewest" /> |
| 110 | <Content Include="TestData\SimpleBundle\Bundle.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 110 | <Content Include="TestData\SimpleBundle\Bundle.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 111 | <Content Include="TestData\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 111 | <Content Include="TestData\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| 112 | <Content Include="TestData\SimpleBundle\MultiFileBootstrapperApplication.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 113 | <Content Include="TestData\SimpleBundle\MultiFileBundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 112 | <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> | 114 | <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> |
| 113 | <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 115 | <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 114 | <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 116 | <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs index e45fa711..5927987b 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs | |||
| @@ -91,7 +91,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | [Fact] | 94 | [Fact(Skip = "Test demonstrates failure")] |
| 95 | public void CanBuildMsiUsingExtensionLibrary() | 95 | public void CanBuildMsiUsingExtensionLibrary() |
| 96 | { | 96 | { |
| 97 | var folder = TestData.Get(@"TestData\Wixipl"); | 97 | var folder = TestData.Get(@"TestData\Wixipl"); |
| @@ -135,7 +135,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | [Fact] | 138 | [Fact(Skip = "Test demonstrates failure")] |
| 139 | public void CanBuildWixiplUsingExtensionLibrary() | 139 | public void CanBuildWixiplUsingExtensionLibrary() |
| 140 | { | 140 | { |
| 141 | var folder = TestData.Get(@"TestData\Wixipl"); | 141 | var folder = TestData.Get(@"TestData\Wixipl"); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs index b7f2f9c0..a48a8370 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs | |||
| @@ -15,6 +15,60 @@ namespace WixToolsetTest.CoreIntegration | |||
| 15 | public class WixlibFixture | 15 | public class WixlibFixture |
| 16 | { | 16 | { |
| 17 | [Fact] | 17 | [Fact] |
| 18 | public void CanBuildSimpleBundleUsingWixlib() | ||
| 19 | { | ||
| 20 | var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe"); | ||
| 21 | var folder = TestData.Get(@"TestData\SimpleBundle"); | ||
| 22 | |||
| 23 | using (var fs = new DisposableFileSystem()) | ||
| 24 | { | ||
| 25 | var baseFolder = fs.GetFolder(); | ||
| 26 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 27 | |||
| 28 | var result = WixRunner.Execute(new[] | ||
| 29 | { | ||
| 30 | "build", | ||
| 31 | Path.Combine(folder, "MultiFileBootstrapperApplication.wxs"), | ||
| 32 | "-intermediateFolder", intermediateFolder, | ||
| 33 | "-o", Path.Combine(intermediateFolder, @"test.wixlib") | ||
| 34 | }); | ||
| 35 | |||
| 36 | result.AssertSuccess(); | ||
| 37 | |||
| 38 | result = WixRunner.Execute(new[] | ||
| 39 | { | ||
| 40 | "build", | ||
| 41 | Path.Combine(folder, "MultiFileBundle.wxs"), | ||
| 42 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | ||
| 43 | "-lib", Path.Combine(intermediateFolder, @"test.wixlib"), | ||
| 44 | "-bindpath", Path.Combine(folder, "data"), | ||
| 45 | "-intermediateFolder", intermediateFolder, | ||
| 46 | "-burnStub", burnStubPath, | ||
| 47 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 48 | }); | ||
| 49 | |||
| 50 | result.AssertSuccess(); | ||
| 51 | |||
| 52 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 53 | #if TODO | ||
| 54 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 55 | #endif | ||
| 56 | |||
| 57 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); | ||
| 58 | var section = intermediate.Sections.Single(); | ||
| 59 | |||
| 60 | var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single(); | ||
| 61 | Assert.Equal("1.0.0.0", bundleTuple.Version); | ||
| 62 | |||
| 63 | var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; | ||
| 64 | Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); | ||
| 65 | |||
| 66 | var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); | ||
| 67 | Assert.Equal("test.msi", msiTuple.Id.Id); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | [Fact] | ||
| 18 | public void CanBuildSingleFileUsingWixlib() | 72 | public void CanBuildSingleFileUsingWixlib() |
| 19 | { | 73 | { |
| 20 | var folder = TestData.Get(@"TestData\SingleFile"); | 74 | var folder = TestData.Get(@"TestData\SingleFile"); |
