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 | |
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')
17 files changed, 183 insertions, 72 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> |
diff --git a/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml b/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml deleted file mode 100644 index 7c4169b1..00000000 --- a/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj index 494d1987..644bab44 100644 --- a/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj +++ b/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj | |||
@@ -28,7 +28,6 @@ | |||
28 | <Compile Include="Properties\AssemblyInfo.cs" /> | 28 | <Compile Include="Properties\AssemblyInfo.cs" /> |
29 | </ItemGroup> | 29 | </ItemGroup> |
30 | <ItemGroup> | 30 | <ItemGroup> |
31 | <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" /> | ||
32 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | 31 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> |
33 | </ItemGroup> | 32 | </ItemGroup> |
34 | <ItemGroup> | 33 | <ItemGroup> |
@@ -43,22 +42,6 @@ | |||
43 | <HintPath>..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\lib\net20\WixToolset.Mba.Core.dll</HintPath> | 42 | <HintPath>..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\lib\net20\WixToolset.Mba.Core.dll</HintPath> |
44 | </Reference> | 43 | </Reference> |
45 | </ItemGroup> | 44 | </ItemGroup> |
46 | <ItemGroup> | ||
47 | <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj"> | ||
48 | <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project> | ||
49 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
50 | </ProjectReference> | ||
51 | <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj"> | ||
52 | <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project> | ||
53 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
54 | <OutputItemType>Content</OutputItemType> | ||
55 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
56 | </ProjectReference> | ||
57 | </ItemGroup> | ||
58 | |||
59 | <ItemGroup> | ||
60 | <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" /> | ||
61 | </ItemGroup> | ||
62 | 45 | ||
63 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | 46 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
64 | 47 | ||
@@ -70,8 +53,4 @@ | |||
70 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props'))" /> | 53 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props'))" /> |
71 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> | 54 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> |
72 | </Target> | 55 | </Target> |
73 | |||
74 | <Target Name="CopyMbaHostDependencies" AfterTargets="Build"> | ||
75 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" /> | ||
76 | </Target> | ||
77 | </Project> \ No newline at end of file | 56 | </Project> \ No newline at end of file |
diff --git a/src/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/test/examples/FullFramework2MBA/FullFramework2BA.cs index 13d4673a..32cd19c8 100644 --- a/src/test/examples/FullFramework2MBA/FullFramework2BA.cs +++ b/src/test/examples/FullFramework2MBA/FullFramework2BA.cs | |||
@@ -16,6 +16,13 @@ namespace Example.FullFramework2MBA | |||
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | protected override void OnStartup(StartupEventArgs args) | ||
20 | { | ||
21 | base.OnStartup(args); | ||
22 | |||
23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework2BA)); | ||
24 | } | ||
25 | |||
19 | protected override void OnShutdown(ShutdownEventArgs args) | 26 | protected override void OnShutdown(ShutdownEventArgs args) |
20 | { | 27 | { |
21 | base.OnShutdown(args); | 28 | base.OnShutdown(args); |
diff --git a/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml b/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml deleted file mode 100644 index 7c4169b1..00000000 --- a/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml +++ /dev/null | |||
Binary files differ | |||
diff --git a/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj index 40f6d008..2d0dd790 100644 --- a/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj +++ b/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj | |||
@@ -1,5 +1,7 @@ | |||
1 | <Project Sdk="Microsoft.NET.Sdk"> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- 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 | ||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
3 | <PropertyGroup> | 5 | <PropertyGroup> |
4 | <TargetFramework>net48</TargetFramework> | 6 | <TargetFramework>net48</TargetFramework> |
5 | <Description>Full Framework v4 MBA</Description> | 7 | <Description>Full Framework v4 MBA</Description> |
@@ -11,28 +13,6 @@ | |||
11 | </ItemGroup> | 13 | </ItemGroup> |
12 | 14 | ||
13 | <ItemGroup> | 15 | <ItemGroup> |
14 | <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" /> | ||
15 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | 16 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> |
16 | </ItemGroup> | 17 | </ItemGroup> |
17 | |||
18 | <ItemGroup> | ||
19 | <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj"> | ||
20 | <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project> | ||
21 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
22 | </ProjectReference> | ||
23 | <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj"> | ||
24 | <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project> | ||
25 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
26 | <OutputItemType>Content</OutputItemType> | ||
27 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
28 | </ProjectReference> | ||
29 | </ItemGroup> | ||
30 | |||
31 | <ItemGroup> | ||
32 | <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" /> | ||
33 | </ItemGroup> | ||
34 | |||
35 | <Target Name="CopyMbaHostDependencies" AfterTargets="Build"> | ||
36 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" /> | ||
37 | </Target> | ||
38 | </Project> \ No newline at end of file | 18 | </Project> \ No newline at end of file |
diff --git a/src/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/test/examples/FullFramework4MBA/FullFramework4BA.cs index 556a61a7..8ee3bd19 100644 --- a/src/test/examples/FullFramework4MBA/FullFramework4BA.cs +++ b/src/test/examples/FullFramework4MBA/FullFramework4BA.cs | |||
@@ -16,6 +16,13 @@ namespace Example.FullFramework4MBA | |||
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | protected override void OnStartup(StartupEventArgs args) | ||
20 | { | ||
21 | base.OnStartup(args); | ||
22 | |||
23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework4BA)); | ||
24 | } | ||
25 | |||
19 | protected override void OnShutdown(ShutdownEventArgs args) | 26 | protected override void OnShutdown(ShutdownEventArgs args) |
20 | { | 27 | { |
21 | base.OnShutdown(args); | 28 | base.OnShutdown(args); |
diff --git a/src/test/examples/TestEngine/ExampleTestEngine.cpp b/src/test/examples/TestEngine/ExampleTestEngine.cpp index 9f051875..848b385c 100644 --- a/src/test/examples/TestEngine/ExampleTestEngine.cpp +++ b/src/test/examples/TestEngine/ExampleTestEngine.cpp | |||
@@ -8,15 +8,15 @@ int __cdecl wmain(int argc, LPWSTR argv[]) | |||
8 | 8 | ||
9 | ConsoleInitialize(); | 9 | ConsoleInitialize(); |
10 | 10 | ||
11 | if (argc != 2) | 11 | if (argc != 3) |
12 | { | 12 | { |
13 | ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe BA.dll"); | 13 | ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe Bundle.exe BA.dll"); |
14 | } | 14 | } |
15 | else | 15 | else |
16 | { | 16 | { |
17 | hr = RunShutdownEngine(argv[1]); | 17 | hr = RunShutdownEngine(argv[1], argv[2]); |
18 | } | 18 | } |
19 | 19 | ||
20 | ConsoleUninitialize(); | 20 | ConsoleUninitialize(); |
21 | return HRESULT_CODE(hr); | 21 | return hr; |
22 | } | 22 | } |
diff --git a/src/test/examples/TestEngine/ShutdownEngine.cpp b/src/test/examples/TestEngine/ShutdownEngine.cpp index 69321d91..912d36ba 100644 --- a/src/test/examples/TestEngine/ShutdownEngine.cpp +++ b/src/test/examples/TestEngine/ShutdownEngine.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | HRESULT RunShutdownEngine( | 5 | HRESULT RunShutdownEngine( |
6 | __in LPCWSTR wzBundleFilePath, | ||
6 | __in LPCWSTR wzBAFilePath | 7 | __in LPCWSTR wzBAFilePath |
7 | ) | 8 | ) |
8 | { | 9 | { |
@@ -12,12 +13,17 @@ HRESULT RunShutdownEngine( | |||
12 | pTestEngine = new TestEngine(); | 13 | pTestEngine = new TestEngine(); |
13 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | 14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); |
14 | 15 | ||
15 | hr = pTestEngine->LoadBA(wzBAFilePath); | 16 | hr = pTestEngine->LoadBA(wzBundleFilePath, wzBAFilePath); |
16 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | 17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); |
17 | 18 | ||
19 | hr = pTestEngine->SendStartupEvent(); | ||
20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
21 | |||
18 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | 22 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); |
19 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | 23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); |
20 | 24 | ||
25 | pTestEngine->UnloadBA(); | ||
26 | |||
21 | LExit: | 27 | LExit: |
22 | return hr; | 28 | return hr; |
23 | } | 29 | } |
diff --git a/src/test/examples/TestEngine/TestEngine.cpp b/src/test/examples/TestEngine/TestEngine.cpp index c0a62eda..9d8f8638 100644 --- a/src/test/examples/TestEngine/TestEngine.cpp +++ b/src/test/examples/TestEngine/TestEngine.cpp | |||
@@ -3,13 +3,13 @@ | |||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | HRESULT TestEngine::LoadBA( | 5 | HRESULT TestEngine::LoadBA( |
6 | __in LPCWSTR wzBundleFilePath, | ||
6 | __in LPCWSTR wzBAFilePath | 7 | __in LPCWSTR wzBAFilePath |
7 | ) | 8 | ) |
8 | { | 9 | { |
9 | HRESULT hr = S_OK; | 10 | HRESULT hr = S_OK; |
10 | BOOTSTRAPPER_COMMAND command = { }; | 11 | BOOTSTRAPPER_COMMAND command = { }; |
11 | BOOTSTRAPPER_CREATE_ARGS args = { }; | 12 | BOOTSTRAPPER_CREATE_ARGS args = { }; |
12 | HMODULE hBAModule = NULL; | ||
13 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; | 13 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; |
14 | 14 | ||
15 | if (m_pCreateResults) | 15 | if (m_pCreateResults) |
@@ -19,7 +19,7 @@ HRESULT TestEngine::LoadBA( | |||
19 | 19 | ||
20 | LogInitialize(::GetModuleHandleW(NULL)); | 20 | LogInitialize(::GetModuleHandleW(NULL)); |
21 | 21 | ||
22 | hr = LogOpen(NULL, L"ExampleTestEngine", NULL, L"txt", FALSE, FALSE, NULL); | 22 | hr = LogOpen(NULL, PathFile(wzBundleFilePath), NULL, L"txt", FALSE, FALSE, NULL); |
23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); | 23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); |
24 | 24 | ||
25 | m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); | 25 | m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); |
@@ -34,10 +34,10 @@ HRESULT TestEngine::LoadBA( | |||
34 | 34 | ||
35 | m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); | 35 | m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); |
36 | 36 | ||
37 | hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); | 37 | m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); |
38 | ExitOnNullWithLastError(hBAModule, hr, "Failed to load BA dll."); | 38 | ExitOnNullWithLastError(m_hBAModule, hr, "Failed to load BA dll."); |
39 | 39 | ||
40 | pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(hBAModule, "BootstrapperApplicationCreate"); | 40 | pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(m_hBAModule, "BootstrapperApplicationCreate"); |
41 | ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); | 41 | ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); |
42 | 42 | ||
43 | hr = pfnCreate(&args, m_pCreateResults); | 43 | hr = pfnCreate(&args, m_pCreateResults); |
@@ -68,6 +68,29 @@ HRESULT TestEngine::SendShutdownEvent( | |||
68 | return hr; | 68 | return hr; |
69 | } | 69 | } |
70 | 70 | ||
71 | HRESULT TestEngine::SendStartupEvent() | ||
72 | { | ||
73 | HRESULT hr = S_OK; | ||
74 | BA_ONSTARTUP_ARGS startupArgs = { }; | ||
75 | BA_ONSTARTUP_RESULTS startupResults = { }; | ||
76 | startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS); | ||
77 | startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS); | ||
78 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
79 | return hr; | ||
80 | } | ||
81 | |||
82 | void TestEngine::UnloadBA() | ||
83 | { | ||
84 | PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; | ||
85 | |||
86 | pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(m_hBAModule, "BootstrapperApplicationDestroy"); | ||
87 | |||
88 | if (pfnDestroy) | ||
89 | { | ||
90 | pfnDestroy(); | ||
91 | } | ||
92 | } | ||
93 | |||
71 | HRESULT TestEngine::BAEngineLog( | 94 | HRESULT TestEngine::BAEngineLog( |
72 | __in TestEngine* pContext, | 95 | __in TestEngine* pContext, |
73 | __in BAENGINE_LOG_ARGS* pArgs, | 96 | __in BAENGINE_LOG_ARGS* pArgs, |
@@ -108,6 +131,7 @@ LExit: | |||
108 | 131 | ||
109 | TestEngine::TestEngine() | 132 | TestEngine::TestEngine() |
110 | { | 133 | { |
134 | m_hBAModule = NULL; | ||
111 | m_pCreateResults = NULL; | 135 | m_pCreateResults = NULL; |
112 | } | 136 | } |
113 | 137 | ||
diff --git a/src/test/examples/TestEngine/TestEngine.h b/src/test/examples/TestEngine/TestEngine.h index 52872100..e5db9480 100644 --- a/src/test/examples/TestEngine/TestEngine.h +++ b/src/test/examples/TestEngine/TestEngine.h | |||
@@ -7,6 +7,7 @@ class TestEngine | |||
7 | { | 7 | { |
8 | public: | 8 | public: |
9 | HRESULT LoadBA( | 9 | HRESULT LoadBA( |
10 | __in LPCWSTR wzBundleFilePath, | ||
10 | __in LPCWSTR wzBAFilePath | 11 | __in LPCWSTR wzBAFilePath |
11 | ); | 12 | ); |
12 | 13 | ||
@@ -18,6 +19,10 @@ public: | |||
18 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | 19 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction |
19 | ); | 20 | ); |
20 | 21 | ||
22 | HRESULT SendStartupEvent(); | ||
23 | |||
24 | void UnloadBA(); | ||
25 | |||
21 | private: | 26 | private: |
22 | static HRESULT BAEngineLog( | 27 | static HRESULT BAEngineLog( |
23 | __in TestEngine* pContext, | 28 | __in TestEngine* pContext, |
@@ -38,5 +43,6 @@ public: | |||
38 | ~TestEngine(); | 43 | ~TestEngine(); |
39 | 44 | ||
40 | private: | 45 | private: |
46 | HMODULE m_hBAModule; | ||
41 | BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; | 47 | BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; |
42 | }; \ No newline at end of file | 48 | }; \ No newline at end of file |
diff --git a/src/test/examples/TestEngine/precomp.h b/src/test/examples/TestEngine/precomp.h index 6e867e89..d0068747 100644 --- a/src/test/examples/TestEngine/precomp.h +++ b/src/test/examples/TestEngine/precomp.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "conutil.h" | 8 | #include "conutil.h" |
9 | #include "logutil.h" | 9 | #include "logutil.h" |
10 | #include "memutil.h" | 10 | #include "memutil.h" |
11 | #include "pathutil.h" | ||
11 | 12 | ||
12 | #include "BootstrapperEngine.h" | 13 | #include "BootstrapperEngine.h" |
13 | #include "BootstrapperApplication.h" | 14 | #include "BootstrapperApplication.h" |
@@ -15,5 +16,6 @@ | |||
15 | #include "TestEngine.h" | 16 | #include "TestEngine.h" |
16 | 17 | ||
17 | HRESULT RunShutdownEngine( | 18 | HRESULT RunShutdownEngine( |
19 | __in LPCWSTR wzBundleFilePath, | ||
18 | __in LPCWSTR wzBAFilePath | 20 | __in LPCWSTR wzBAFilePath |
19 | ); | 21 | ); |
diff --git a/src/wixstdba/WixStandardBootstrapperApplication.cpp b/src/wixstdba/WixStandardBootstrapperApplication.cpp index 4aef8ce5..88a26534 100644 --- a/src/wixstdba/WixStandardBootstrapperApplication.cpp +++ b/src/wixstdba/WixStandardBootstrapperApplication.cpp | |||
@@ -3752,6 +3752,11 @@ HRESULT CreateBootstrapperApplication( | |||
3752 | HRESULT hr = S_OK; | 3752 | HRESULT hr = S_OK; |
3753 | CWixStandardBootstrapperApplication* pApplication = NULL; | 3753 | CWixStandardBootstrapperApplication* pApplication = NULL; |
3754 | 3754 | ||
3755 | if (BOOTSTRAPPER_DISPLAY_UNKNOWN == pArgs->pCommand->display) | ||
3756 | { | ||
3757 | ExitOnFailure(hr = E_INVALIDARG, "Engine requested Unknown display type."); | ||
3758 | } | ||
3759 | |||
3755 | pApplication = new CWixStandardBootstrapperApplication(hModule, fPrereq, hrHostInitialization, pEngine, pArgs); | 3760 | pApplication = new CWixStandardBootstrapperApplication(hModule, fPrereq, hrHostInitialization, pEngine, pArgs); |
3756 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new standard bootstrapper application object."); | 3761 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new standard bootstrapper application object."); |
3757 | 3762 | ||