diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-23 12:17:32 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-23 12:43:38 +1000 |
| commit | bd3ee565f342bc0bb015594f303d13b67285a958 (patch) | |
| tree | 1994e37e385851a7cfdd69b3f7cf03b3bfaa8a7b /src/test/WixToolsetTest.ManagedHost | |
| parent | 05edba00dc08b74a6d9b32b4e56f4da6ef90c638 (diff) | |
| download | wix-bd3ee565f342bc0bb015594f303d13b67285a958.tar.gz wix-bd3ee565f342bc0bb015594f303d13b67285a958.tar.bz2 wix-bd3ee565f342bc0bb015594f303d13b67285a958.zip | |
Update ManagedHost tests to run off of a bundle.
Diffstat (limited to 'src/test/WixToolsetTest.ManagedHost')
5 files changed, 113 insertions, 18 deletions
diff --git a/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs index 8da42e77..8ef0320e 100644 --- a/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs +++ b/src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs | |||
| @@ -2,7 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.ManagedHost | 3 | namespace WixToolsetTest.ManagedHost |
| 4 | { | 4 | { |
| 5 | using System.IO; | ||
| 5 | using WixBuildTools.TestSupport; | 6 | using WixBuildTools.TestSupport; |
| 7 | using WixToolset.Core.TestPackage; | ||
| 6 | using Xunit; | 8 | using Xunit; |
| 7 | 9 | ||
| 8 | public class MbaHostFixture | 10 | public class MbaHostFixture |
| @@ -10,31 +12,71 @@ namespace WixToolsetTest.ManagedHost | |||
| 10 | [Fact] | 12 | [Fact] |
| 11 | public void CanLoadFullFramework2MBA() | 13 | public void CanLoadFullFramework2MBA() |
| 12 | { | 14 | { |
| 13 | var testEngine = new TestEngine(); | 15 | using (var fs = new DisposableFileSystem()) |
| 14 | var baFile = TestData.Get(@"..\examples\Example.FullFramework2MBA\mbahost.dll"); | 16 | { |
| 17 | var baseFolder = fs.GetFolder(); | ||
| 18 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
| 19 | var bundleFile = Path.Combine(binFolder, "FullFramework2MBA.exe"); | ||
| 20 | var baSourceFolder = TestData.Get(@"..\examples"); | ||
| 21 | var bundleSourceFolder = TestData.Get(@"TestData\FullFramework2MBA"); | ||
| 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 15 | 23 | ||
| 16 | var result = testEngine.RunShutdownEngine(baFile); | 24 | var compileResult = WixRunner.Execute(new[] |
| 17 | Assert.Equal(0, result.ExitCode); | 25 | { |
| 26 | "build", | ||
| 27 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 28 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 29 | "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"), | ||
| 30 | "-intermediateFolder", intermediateFolder, | ||
| 31 | "-bindpath", baSourceFolder, | ||
| 32 | "-burnStub", TestEngine.BurnStubFile, | ||
| 33 | "-o", bundleFile, | ||
| 34 | }); | ||
| 35 | compileResult.AssertSuccess(); | ||
| 36 | var testEngine = new TestEngine(); | ||
| 18 | 37 | ||
| 19 | var logMessages = result.Output; | 38 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
| 20 | Assert.Equal(2, logMessages.Count); | 39 | var logMessages = result.Output; |
| 21 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 40 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); |
| 22 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]); | 41 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); |
| 42 | Assert.Equal("FullFramework2BA", logMessages[2]); | ||
| 43 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
| 44 | } | ||
| 23 | } | 45 | } |
| 24 | 46 | ||
| 25 | [Fact] | 47 | [Fact] |
| 26 | public void CanLoadFullFramework4MBA() | 48 | public void CanLoadFullFramework4MBA() |
| 27 | { | 49 | { |
| 28 | var testEngine = new TestEngine(); | 50 | using (var fs = new DisposableFileSystem()) |
| 29 | var baFile = TestData.Get(@"..\examples\Example.FullFramework4MBA\net48\mbahost.dll"); | 51 | { |
| 52 | var baseFolder = fs.GetFolder(); | ||
| 53 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
| 54 | var bundleFile = Path.Combine(binFolder, "FullFramework4MBA.exe"); | ||
| 55 | var baSourceFolder = TestData.Get(@"..\examples"); | ||
| 56 | var bundleSourceFolder = TestData.Get(@"TestData\FullFramework4MBA"); | ||
| 57 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 30 | 58 | ||
| 31 | var result = testEngine.RunShutdownEngine(baFile); | 59 | var compileResult = WixRunner.Execute(new[] |
| 32 | Assert.Equal(0, result.ExitCode); | 60 | { |
| 61 | "build", | ||
| 62 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
| 63 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 64 | "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"), | ||
| 65 | "-intermediateFolder", intermediateFolder, | ||
| 66 | "-bindpath", baSourceFolder, | ||
| 67 | "-burnStub", TestEngine.BurnStubFile, | ||
| 68 | "-o", bundleFile, | ||
| 69 | }); | ||
| 70 | compileResult.AssertSuccess(); | ||
| 71 | var testEngine = new TestEngine(); | ||
| 33 | 72 | ||
| 34 | var logMessages = result.Output; | 73 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
| 35 | Assert.Equal(2, logMessages.Count); | 74 | var logMessages = result.Output; |
| 36 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 75 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); |
| 37 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]); | 76 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); |
| 77 | Assert.Equal("FullFramework4BA", logMessages[2]); | ||
| 78 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
| 79 | } | ||
| 38 | } | 80 | } |
| 39 | } | 81 | } |
| 40 | } | 82 | } |
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework2MBA/Bundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework2MBA/Bundle.wxs new file mode 100644 index 00000000..b38e9f6e --- /dev/null +++ b/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework2MBA/Bundle.wxs | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
| 3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 4 | <Bundle Name="FullFramework2MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 5 | <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost"> | ||
| 6 | <Payload SourceFile="Example.FullFramework2MBA\Example.FullFramework2MBA.dll" /> | ||
| 7 | <Payload SourceFile="Example.FullFramework2MBA\mbanative.dll" /> | ||
| 8 | <Payload SourceFile="Example.FullFramework2MBA\WixToolset.Mba.Core.dll" /> | ||
| 9 | <Payload SourceFile="Example.FullFramework2MBA\WixToolset.Mba.Host.config" /> | ||
| 10 | </BootstrapperApplicationRef> | ||
| 11 | <Chain> | ||
| 12 | <PackageGroupRef Id="NetFx462RedistAsPrereq" /> | ||
| 13 | </Chain> | ||
| 14 | </Bundle> | ||
| 15 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework4MBA/Bundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework4MBA/Bundle.wxs new file mode 100644 index 00000000..b3072e63 --- /dev/null +++ b/src/test/WixToolsetTest.ManagedHost/TestData/FullFramework4MBA/Bundle.wxs | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
| 3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 4 | <Bundle Name="FullFramework4MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="E08068E0-4FBA-439D-A1C8-4CD1FE27093F"> | ||
| 5 | <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost"> | ||
| 6 | <Payload SourceFile="Example.FullFramework4MBA\net48\Example.FullFramework4MBA.dll" /> | ||
| 7 | <Payload SourceFile="Example.FullFramework4MBA\net48\mbanative.dll" /> | ||
| 8 | <Payload SourceFile="Example.FullFramework4MBA\net48\WixToolset.Mba.Core.dll" /> | ||
| 9 | <Payload SourceFile="Example.FullFramework4MBA\net48\WixToolset.Mba.Host.config" /> | ||
| 10 | </BootstrapperApplicationRef> | ||
| 11 | <Chain> | ||
| 12 | <PackageGroupRef Id="NetFx462RedistAsPrereq" /> | ||
| 13 | </Chain> | ||
| 14 | </Bundle> | ||
| 15 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/test/WixToolsetTest.ManagedHost/TestEngine.cs index 4dd531ad..751ed59c 100644 --- a/src/test/WixToolsetTest.ManagedHost/TestEngine.cs +++ b/src/test/WixToolsetTest.ManagedHost/TestEngine.cs | |||
| @@ -4,15 +4,26 @@ namespace WixToolsetTest.ManagedHost | |||
| 4 | { | 4 | { |
| 5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
| 6 | using System.Diagnostics; | 6 | using System.Diagnostics; |
| 7 | using System.IO; | ||
| 7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
| 9 | using WixToolset.Core.TestPackage; | ||
| 8 | 10 | ||
| 9 | public class TestEngine | 11 | public class TestEngine |
| 10 | { | 12 | { |
| 11 | private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe"); | 13 | private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe"); |
| 14 | public static readonly string BurnStubFile = TestData.Get(@"runtimes\win-x86\native\burn.x86.exe"); | ||
| 12 | 15 | ||
| 13 | public TestEngineResult RunShutdownEngine(string baFile) | 16 | public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath) |
| 14 | { | 17 | { |
| 15 | var args = new string[] { '"' + baFile + '"' }; | 18 | var baFolderPath = Path.Combine(tempFolderPath, "ba"); |
| 19 | var extractFolderPath = Path.Combine(tempFolderPath, "extract"); | ||
| 20 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath); | ||
| 21 | extractResult.AssertSuccess(); | ||
| 22 | |||
| 23 | var args = new string[] { | ||
| 24 | '"' + bundleFilePath + '"', | ||
| 25 | '"' + extractResult.GetBAFilePath(baFolderPath) + '"', | ||
| 26 | }; | ||
| 16 | return RunProcessCaptureOutput(TestEngineFile, args); | 27 | return RunProcessCaptureOutput(TestEngineFile, args); |
| 17 | } | 28 | } |
| 18 | 29 | ||
diff --git a/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj b/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj index 02b0b109..5026af85 100644 --- a/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj +++ b/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj | |||
| @@ -12,15 +12,27 @@ | |||
| 12 | </PropertyGroup> | 12 | </PropertyGroup> |
| 13 | 13 | ||
| 14 | <ItemGroup> | 14 | <ItemGroup> |
| 15 | <Content Include="TestData\FullFramework2MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/> | ||
| 16 | <Content Include="TestData\FullFramework4MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/> | ||
| 15 | </ItemGroup> | 17 | </ItemGroup> |
| 16 | 18 | ||
| 19 | <Target Name="CopyExtensions" AfterTargets="Build"> | ||
| 20 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(WixExtension)" /> | ||
| 21 | </Target> | ||
| 22 | |||
| 17 | <ItemGroup> | 23 | <ItemGroup> |
| 18 | <ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" /> | 24 | <ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" /> |
| 25 | <ProjectReference Include="..\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj" /> | ||
| 19 | <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" /> | 26 | <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" /> |
| 27 | <ProjectReference Include="..\..\wixext\WixToolset.Bal.wixext.csproj" /> | ||
| 20 | </ItemGroup> | 28 | </ItemGroup> |
| 21 | 29 | ||
| 22 | <ItemGroup> | 30 | <ItemGroup> |
| 31 | <PackageReference Include="runtime.win.WixToolset.Burn" Version="4.0.*" /> | ||
| 23 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | 32 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> |
| 33 | <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> | ||
| 34 | <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> | ||
| 35 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> | ||
| 24 | </ItemGroup> | 36 | </ItemGroup> |
| 25 | 37 | ||
| 26 | <ItemGroup> | 38 | <ItemGroup> |
