|
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 |
|
4 | 4 | using System.Collections.Generic; |
| 5 | +using System.IO; |
5 | 6 | using System.Linq; |
6 | 7 |
|
7 | 8 | using Microsoft.DotNet.Cli.Build.Framework; |
@@ -231,6 +232,37 @@ public void CallDelegateOnComponentContext_UnhandledException() |
231 | 232 | .And.ExecuteFunctionPointerWithException(entryPoint, 1); |
232 | 233 | } |
233 | 234 |
|
| 235 | + [Fact] |
| 236 | + public void CallDelegateOnComponentContext_IgnoreWorkingDirectory() |
| 237 | + { |
| 238 | + using (TestArtifact cwd = TestArtifact.Create("cwd")) |
| 239 | + { |
| 240 | + // Validate that hosting components in the working directory will not be used |
| 241 | + File.Copy(Binaries.CoreClr.MockPath, Path.Combine(cwd.Location, Binaries.CoreClr.FileName)); |
| 242 | + File.Copy(Binaries.HostPolicy.MockPath, Path.Combine(cwd.Location, Binaries.HostPolicy.FileName)); |
| 243 | + |
| 244 | + var component = sharedState.Component; |
| 245 | + string[] args = |
| 246 | + { |
| 247 | + ComponentLoadAssemblyAndGetFunctionPointerArg, |
| 248 | + sharedState.HostFxrPath, |
| 249 | + component.RuntimeConfigJson, |
| 250 | + component.AppDll, |
| 251 | + sharedState.ComponentTypeName, |
| 252 | + sharedState.ComponentEntryPoint1, |
| 253 | + }; |
| 254 | + |
| 255 | + sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) |
| 256 | + .WorkingDirectory(cwd.Location) |
| 257 | + .Execute() |
| 258 | + .Should().Pass() |
| 259 | + .And.InitializeContextForConfig(component.RuntimeConfigJson) |
| 260 | + .And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1) |
| 261 | + .And.ResolveHostPolicy(TestContext.BuiltDotNet) |
| 262 | + .And.ResolveCoreClr(TestContext.BuiltDotNet); |
| 263 | + } |
| 264 | + } |
| 265 | + |
234 | 266 | public class SharedTestState : SharedTestStateBase |
235 | 267 | { |
236 | 268 | public string HostFxrPath { get; } |
|
0 commit comments