From: Steve MacLean Date: Thu, 18 Apr 2019 00:42:38 +0000 (-0400) Subject: Add AddMicrosoftNETCoreAppFrameworkMockCoreclr X-Git-Tag: submit/tizen/20210909.063632~11032^2~244^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=528e8e975c10e79cfbd181a0973ea5efec6206f5;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add AddMicrosoftNETCoreAppFrameworkMockCoreclr Commit migrated from https://github.com/dotnet/core-setup/commit/cd5d0985a659cfb86a239b49578450fc8adb15e6 --- diff --git a/src/installer/test/HostActivationTests/DotNetBuilder.cs b/src/installer/test/HostActivationTests/DotNetBuilder.cs index 70cf2cd..06597cb 100644 --- a/src/installer/test/HostActivationTests/DotNetBuilder.cs +++ b/src/installer/test/HostActivationTests/DotNetBuilder.cs @@ -49,7 +49,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation /// /// Product runtime binaries are not added. All the added mock framework will contain is a mock version of host policy. /// - public DotNetBuilder AddMicrosoftNETCoreAppFramework(string version) + public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockHostPolicy(string version) { // ./shared/Microsoft.NETCore.App/ - create a mock of the root framework string netCoreAppPath = Path.Combine(_path, "shared", "Microsoft.NETCore.App", version); @@ -66,6 +66,68 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation } /// + /// Add a mock of the Microsoft.NETCore.App framework with the specified version + /// + /// Version to add + /// + /// Product runtime binaries are not added. All the added mock framework will contain is hostpolicy, + /// a mock version of coreclr, and a minimal Microsoft.NETCore.App.deps.json. + /// + public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version) + { + // ./shared/Microsoft.NETCore.App/ - create a mock of the root framework + string netCoreAppPath = Path.Combine(_path, "shared", "Microsoft.NETCore.App", version); + Directory.CreateDirectory(netCoreAppPath); + + // ./shared/Microsoft.NETCore.App//hostpolicy.dll - this is the real component and will load CoreClr library + string hostPolicyFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy"); + File.Copy( + Path.Combine(_repoDirectories.Artifacts, "corehost", hostPolicyFileName), + Path.Combine(netCoreAppPath, hostPolicyFileName), + true); + + // ./shared/Microsoft.NETCore.App//coreclr.dll - this is a mock, will not actually run CoreClr + string coreclrFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("coreclr"); + string mockCoreclrFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("mockcoreclr"); + File.Copy( + Path.Combine(_repoDirectories.Artifacts, "corehost_test", mockCoreclrFileName), + Path.Combine(netCoreAppPath, coreclrFileName), + true); + + string netCoreAppPathDepsJson = Path.Combine(netCoreAppPath, "Microsoft.NETCore.App.deps.json"); + + string currentRid = _repoDirectories.TargetRID; + + string depsJsonBody = $@"{{ + ""runtimeTarget"": "".NETCoreApp"", + ""targets"": {{ + "".NETCoreApp"": {{ + ""Microsoft.NETCore.App/{version}"": {{ + ""native"": {{ + ""runtimes/{currentRid}/native/{coreclrFileName}"": {{ }} + }} + }}, + ""runtime.{currentRid}.Microsoft.NETCore.DotNetHostPolicy/{version}"": {{ + ""native"": {{ + ""runtimes/{currentRid}/native/{hostPolicyFileName}"": {{}} + }} + }} + }} + }}, + ""libraries"": {{ + ""Microsoft.NETCore.App/{version}"": {{ + ""type"": ""package"", + ""serviceable"": true, + ""sha512"": """" + }} + }} + }}"; + + File.WriteAllText(netCoreAppPathDepsJson, depsJsonBody); + return this; + } + + /// /// Add a mock framework with the specified framework name and version /// /// Framework name diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/ApplyPatchesSettings.cs b/src/installer/test/HostActivationTests/FrameworkResolution/ApplyPatchesSettings.cs index 3d4f365..60d0d71 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/ApplyPatchesSettings.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/ApplyPatchesSettings.cs @@ -153,8 +153,8 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetWithFrameworks = DotNet("WithOneFramework") - .AddMicrosoftNETCoreAppFramework("5.1.2") - .AddMicrosoftNETCoreAppFramework("5.1.3") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3") .AddFramework(MiddleWare, "2.1.2", runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.2")) .Build(); diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/FxVersionCLI.cs b/src/installer/test/HostActivationTests/FrameworkResolution/FxVersionCLI.cs index 02da6af..2a3617b 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/FxVersionCLI.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/FxVersionCLI.cs @@ -114,8 +114,8 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetWithFrameworks = DotNet("WithOneFramework") - .AddMicrosoftNETCoreAppFramework("2.5.4") - .AddMicrosoftNETCoreAppFramework("2.5.5") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("2.5.4") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("2.5.5") .AddFramework( MiddleWare, "2.1.2", runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "2.5.5")) diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/MultipleHives.cs b/src/installer/test/HostActivationTests/FrameworkResolution/MultipleHives.cs index 87f941d..9a71b49 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/MultipleHives.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/MultipleHives.cs @@ -98,17 +98,17 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetMainHive = DotNet("MainHive") - .AddMicrosoftNETCoreAppFramework("5.2.0") - .AddMicrosoftNETCoreAppFramework("6.1.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.2.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.1.2") .Build(); DotNetGlobalHive = DotNet("GlobalHive") - .AddMicrosoftNETCoreAppFramework("5.1.2") - .AddMicrosoftNETCoreAppFramework("6.2.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.2.0") .Build(); DotNetCurrentHive = DotNet("CurrentHive") - .AddMicrosoftNETCoreAppFramework("5.1.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.0") .Build(); FrameworkReferenceApp = CreateFrameworkReferenceApp(); diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFx.cs b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFx.cs index 3bbd2b7..4a46596 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFx.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFx.cs @@ -751,31 +751,31 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetWithOneFramework = DotNet("WithOneFramework") - .AddMicrosoftNETCoreAppFramework("5.1.3") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3") .Build(); DotNetWithPreReleaseFramework = DotNet("WithPreReleaseFramework") - .AddMicrosoftNETCoreAppFramework("5.1.3-preview.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3-preview.2") .Build(); DotNetWithManyVersions = DotNet("WithManyVersions") - .AddMicrosoftNETCoreAppFramework("2.3.1-preview.1") - .AddMicrosoftNETCoreAppFramework("2.3.2") - .AddMicrosoftNETCoreAppFramework("4.1.1") - .AddMicrosoftNETCoreAppFramework("4.1.2") - .AddMicrosoftNETCoreAppFramework("4.1.3-preview.1") - .AddMicrosoftNETCoreAppFramework("4.2.1") - .AddMicrosoftNETCoreAppFramework("4.5.1-preview.1") - .AddMicrosoftNETCoreAppFramework("4.5.2") - .AddMicrosoftNETCoreAppFramework("5.1.3-preview.1") - .AddMicrosoftNETCoreAppFramework("5.1.3-preview.2") - .AddMicrosoftNETCoreAppFramework("5.1.4-preview.1") - .AddMicrosoftNETCoreAppFramework("5.2.3-preview.1") - .AddMicrosoftNETCoreAppFramework("5.2.3-preview.2") - .AddMicrosoftNETCoreAppFramework("6.1.1") - .AddMicrosoftNETCoreAppFramework("6.1.2-preview.1") - .AddMicrosoftNETCoreAppFramework("7.1.1-preview.1") - .AddMicrosoftNETCoreAppFramework("7.1.2-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("2.3.1-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("2.3.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.1.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.1.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.1.3-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.2.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.5.1-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("4.5.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3-preview.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.4-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.2.3-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.2.3-preview.2") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.1.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.1.2-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("7.1.1-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("7.1.2-preview.1") .Build(); FrameworkReferenceApp = CreateFrameworkReferenceApp(); diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxMultipleFrameworks.cs b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxMultipleFrameworks.cs index b3577f0..ba5ed7c 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxMultipleFrameworks.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxMultipleFrameworks.cs @@ -461,12 +461,12 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetWithMultipleFrameworks = DotNet("WithOneFramework") - .AddMicrosoftNETCoreAppFramework("5.1.1") - .AddMicrosoftNETCoreAppFramework("5.1.3") - .AddMicrosoftNETCoreAppFramework("5.4.1") - .AddMicrosoftNETCoreAppFramework("5.6.0") - .AddMicrosoftNETCoreAppFramework("6.0.0") - .AddMicrosoftNETCoreAppFramework("6.1.1-preview.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.4.1") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.6.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.0.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.1.1-preview.1") .AddFramework(MiddleWare, "2.1.2", runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3")) .AddFramework(AnotherMiddleWare, "3.0.0", runtimeConfig => diff --git a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs index bdfea46..e916cf0 100644 --- a/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs +++ b/src/installer/test/HostActivationTests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs @@ -234,7 +234,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution public SharedTestState() { DotNetWithFrameworks = DotNet("WithOneFramework") - .AddMicrosoftNETCoreAppFramework("5.1.3") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3") .AddFramework( MiddleWare, "2.1.2", runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3")) diff --git a/src/installer/test/HostActivationTests/MultilevelSDKLookup.cs b/src/installer/test/HostActivationTests/MultilevelSDKLookup.cs index 288ccc7..1dbf21e 100644 --- a/src/installer/test/HostActivationTests/MultilevelSDKLookup.cs +++ b/src/installer/test/HostActivationTests/MultilevelSDKLookup.cs @@ -53,7 +53,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation _regDir = Path.Combine(_multilevelDir, "reg"); DotNet = new DotNetBuilder(_multilevelDir, Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), "exe") - .AddMicrosoftNETCoreAppFramework("9999.0.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("9999.0.0") .Build(); RepoDirectories = new RepoDirectoriesProvider(builtDotnet: DotNet.BinPath); diff --git a/src/installer/test/HostActivationTests/SDKLookup.cs b/src/installer/test/HostActivationTests/SDKLookup.cs index 434049b..12cec08 100644 --- a/src/installer/test/HostActivationTests/SDKLookup.cs +++ b/src/installer/test/HostActivationTests/SDKLookup.cs @@ -48,7 +48,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation _executableDir = Path.Combine(_baseDir, "exe"); DotNet = new DotNetBuilder(_baseDir, Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), "exe") - .AddMicrosoftNETCoreAppFramework("9999.0.0") + .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("9999.0.0") .Build(); RepoDirectories = new RepoDirectoriesProvider(builtDotnet: DotNet.BinPath);