From 1139509cc3fbba160b8ac3befd6b7548d94de65c Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 22 Jul 2021 21:27:11 +0200 Subject: [PATCH] Cherry-pick (#55283) * Update SDK to 6.0 Preview 6 Part of https://github.com/dotnet/runtime/issues/55281 * Enable COM support to work around missing symbols in tests * Update eng/testing/linker/project.csproj.template * Disable the workload targets * Disable workloads for wasm builds For in-tree builds, and tests we don't want to use workloads from dotnet being used to build these. For the projects being built on the build machine, we can disable them via `Directory.Build.props`, and wasm's InTree/LocalBuild props. But for projects that get built on helix, eg. the runtime tests, we are setting the property values as environment variables. * Fix setting envvars for disabling workloads * Another attempt to fix wasm tests In preview5, the workload manifest overrides `$(UsingBrowserRuntimeWorkload)` setting, so pass it on the command line. ``xml true $(WasmNativeWorkload) ``` * Fix host tests after upgrade to P5 In P5 we don't generate .runtimeconfig.dev.json anymore. Some tests started to fail because they relied on the .runtime.dev.json to include local nuget cache in the probing paths. I changed one of those tests to force-generate .runtimeconfig.dev.json as for the tested scenario it seems to make sense. For the other test I modified it to copy the necessary dependency into the right location instead. * Fix up reflection to private FileStatus field * Disable workload resolver for wasm.build.tests, EMSDK run * Disable workloads for wasm with MSBuildEnableWorkloadResolver=false everywhere * remove linker workaround * [wasm] Remove args unnecessary for disabling workloads * Pass MSBuildEnableWorkloadResolver property to individual trimming projects Co-authored-by: Juan Sebastian Hoyos Ayala Co-authored-by: Santiago Fernandez Madero Co-authored-by: Larry Ewing Co-authored-by: Ankit Jain Co-authored-by: vitek-karas Co-authored-by: Eric Erhardt Co-authored-by: Anirudh Agnihotry --- eng/testing/linker/trimmingTests.targets | 1 + .../TestProjects/LightupClient/LightupClient.csproj | 1 + .../tests/HostActivation.Tests/PortableAppActivation.cs | 8 ++++++++ .../AppHostUpdateTests.cs | 2 +- src/mono/wasm/build/WasmApp.LocalBuild.props | 1 + .../BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs | 3 +++ .../Wasm.Build.Tests/data/Local.Directory.Build.props | 3 +++ src/tests/Common/CLRTest.Execute.Bash.targets | 2 +- src/tests/Directory.Build.props | 4 ++++ 9 files changed, 23 insertions(+), 2 deletions(-) diff --git a/eng/testing/linker/trimmingTests.targets b/eng/testing/linker/trimmingTests.targets index 649ad3e25bf2d9..e31fc4e0acdbba 100644 --- a/eng/testing/linker/trimmingTests.targets +++ b/eng/testing/linker/trimmingTests.targets @@ -42,6 +42,7 @@ %(Identity) + diff --git a/src/installer/tests/Assets/TestProjects/LightupClient/LightupClient.csproj b/src/installer/tests/Assets/TestProjects/LightupClient/LightupClient.csproj index f413febe3ff59a..06ac4b1d7256b9 100644 --- a/src/installer/tests/Assets/TestProjects/LightupClient/LightupClient.csproj +++ b/src/installer/tests/Assets/TestProjects/LightupClient/LightupClient.csproj @@ -4,6 +4,7 @@ $(NetCoreAppCurrent) Exe $(MNAVersion) + true diff --git a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs index a2a0d963e1f094..fa3e03bd972016 100644 --- a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs +++ b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs @@ -162,7 +162,15 @@ public void Muxer_Exec_activation_of_Build_Output_Portable_DLL_with_DepsJson_Rem var fixture = sharedTestState.PortableAppFixture_Built .Copy(); + // Move the .deps.json to a subdirectory, note that in this case we have to move all of the app's dependencies + // along with it - in this case Newtonsoft.Json.dll + // For framework dependent apps (dotnet build produces those) the probing directories are: + // - The directory where the .deps.json is + // - Any framework directory var depsJson = MoveDepsJsonToSubdirectory(fixture); + File.Move( + Path.Combine(Path.GetDirectoryName(fixture.TestProject.AppDll), "Newtonsoft.Json.dll"), + Path.Combine(Path.GetDirectoryName(depsJson), "Newtonsoft.Json.dll")); var dotnet = fixture.BuiltDotnet; var appDll = fixture.TestProject.AppDll; diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.AppHost.Tests/AppHostUpdateTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.AppHost.Tests/AppHostUpdateTests.cs index 3aa8886babe37d..e3dc7a14a2ee8b 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.AppHost.Tests/AppHostUpdateTests.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.AppHost.Tests/AppHostUpdateTests.cs @@ -400,7 +400,7 @@ static CoreFxFileStatusProvider() try { s_fileSystem_fileStatusField = typeof(FileSystemInfo).GetField("_fileStatus", BindingFlags.NonPublic | BindingFlags.Instance); - s_fileStatus_fileStatusField = s_fileSystem_fileStatusField.FieldType.GetField("_fileStatus", BindingFlags.NonPublic | BindingFlags.Instance); + s_fileStatus_fileStatusField = s_fileSystem_fileStatusField.FieldType.GetField("_fileCache", BindingFlags.NonPublic | BindingFlags.Instance); s_fileStatusModeField = s_fileStatus_fileStatusField.FieldType.GetField("Mode", BindingFlags.NonPublic | BindingFlags.Instance); } catch (Exception ex) diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.props b/src/mono/wasm/build/WasmApp.LocalBuild.props index ea5624a1591376..ea87a8bb8ec0e9 100644 --- a/src/mono/wasm/build/WasmApp.LocalBuild.props +++ b/src/mono/wasm/build/WasmApp.LocalBuild.props @@ -23,6 +23,7 @@ <_NetCoreAppToolCurrent>net6.0 + false diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs index a8f67d09eb689a..2212d57b2377e7 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs @@ -95,6 +95,9 @@ public BuildEnvironment() DefaultBuildArgs = $" /p:RuntimeSrcDir={solutionRoot.FullName} /p:RuntimeConfig={s_runtimeConfig} /p:EMSDK_PATH={emsdkPath} "; } + // for EMSDK runs, we don't want to get the dependencies from workloads + DefaultBuildArgs += " /p:MSBuildEnableWorkloadResolver=false"; + IsWorkload = false; DotNet = "dotnet"; EnvVars = new Dictionary() diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props index 1a9c112e747d9b..3282feb5b35532 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props @@ -1,5 +1,8 @@ + + false + <_WasmTargetsDir Condition="'$(RuntimeSrcDir)' != ''">$(RuntimeSrcDir)\src\mono\wasm\build\ <_WasmTargetsDir Condition="'$(WasmBuildSupportDir)' != ''">$(WasmBuildSupportDir)\wasm\ $(WasmBuildSupportDir)\emsdk\ diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index d44f83d4292042..7031b45d72e95b 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -275,7 +275,7 @@ else __Command+=" dotnet" fi -$__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssemblyFileName=$(MsBuildProjectName).dll /p:TestBinDir=`pwd` || exit $? +$__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssemblyFileName=$(MsBuildProjectName).dll /p:TestBinDir=`pwd` $(CLRTestMSBuildArgs) || exit $? ]]> diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props index f00de4d102e503..6841b4938e70b2 100644 --- a/src/tests/Directory.Build.props +++ b/src/tests/Directory.Build.props @@ -149,4 +149,8 @@ as we do with many of the package versions above --> 2.1.0-preview3-26416-01 + + + /p:MSBuildEnableWorkloadResolver=false +