From 76c2ac089eafe9e407cc9368ae3690b1166e6005 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 26 Feb 2021 19:00:07 -0800 Subject: [PATCH] Adding browser-wasm trimming test leg (#48429) * Adding browser-wasm trimming test leg * Fix runtime subset for browser leg * Addressing PR feedback * Removing double RuntimePackProperty * Addressing feedback and updating container image * Addressing some PR feedback and fixing runtimepack path * Disabling a test and updating the wasm container used for the build * Remove restore race condition on trimming projects * Fix last remaining failing trimming test in browser-wasm * Removing workaround since the fix is in PR now * Addressing PR feedback and rebasing to master * Adding comment on tests.mobile.targets * Removing unused trimming setting --- eng/pipelines/common/platform-matrix.yml | 2 +- eng/pipelines/runtime-linker-tests.yml | 16 +++++++++++ .../linker/SupportFiles/Directory.Build.props | 3 ++ .../SupportFiles/Directory.Build.targets | 17 ++++++++++- eng/testing/linker/project.csproj.template | 7 ++++- eng/testing/linker/trimmingTests.targets | 28 +++++++++++++------ eng/testing/tests.mobile.targets | 8 ++++-- ...ensions.Logging.Console.TrimmingTests.proj | 1 + ...System.Net.HttpListener.TrimmingTests.proj | 4 +++ .../tests/TrimmingTests/DispatchProxyTest.cs | 4 +-- .../System.Runtime.TrimmingTests.proj | 7 ++++- ...Cryptography.Algorithms.TrimmingTests.proj | 4 +++ ...curity.Cryptography.Csp.TrimmingTests.proj | 4 +++ src/libraries/tests.proj | 21 ++++++++++++-- 14 files changed, 107 insertions(+), 19 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 75df52b660a36e..cbf5370a09300b 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -193,7 +193,7 @@ jobs: targetRid: browser-wasm platform: Browser_wasm container: - image: ubuntu-18.04-webassembly-20210111135621-8ac9b02 + image: ubuntu-18.04-webassembly-20210223133559-4800846 registry: mcr jobParameters: runtimeFlavor: ${{ parameters.runtimeFlavor }} diff --git a/eng/pipelines/runtime-linker-tests.yml b/eng/pipelines/runtime-linker-tests.yml index 729cb177847a70..af32d469163f7e 100644 --- a/eng/pipelines/runtime-linker-tests.yml +++ b/eng/pipelines/runtime-linker-tests.yml @@ -63,3 +63,19 @@ jobs: nameSuffix: Runtime_Release buildArgs: -s clr+libs -c $(_BuildConfig) extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml + +# +# Build Release config vertical for Browser-wasm +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + buildConfig: release + platforms: + - Browser_wasm + jobParameters: + testGroup: innerloop + timeoutInMinutes: 120 + nameSuffix: Runtime_Release + buildArgs: -s mono+libs -c $(_BuildConfig) + extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml diff --git a/eng/testing/linker/SupportFiles/Directory.Build.props b/eng/testing/linker/SupportFiles/Directory.Build.props index 9065d7b0b97bcd..adaad9bfd9db65 100644 --- a/eng/testing/linker/SupportFiles/Directory.Build.props +++ b/eng/testing/linker/SupportFiles/Directory.Build.props @@ -1,6 +1,9 @@ + true + false true + true link false true diff --git a/eng/testing/linker/SupportFiles/Directory.Build.targets b/eng/testing/linker/SupportFiles/Directory.Build.targets index 3f5aefa6baf1f8..f6557707fe93a2 100644 --- a/eng/testing/linker/SupportFiles/Directory.Build.targets +++ b/eng/testing/linker/SupportFiles/Directory.Build.targets @@ -1,4 +1,11 @@ + + + + $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', '$(OutputPath)', 'AppBundle')) + project.dll + + @@ -12,7 +19,7 @@ - + @@ -29,4 +36,12 @@ + + + + + diff --git a/eng/testing/linker/project.csproj.template b/eng/testing/linker/project.csproj.template index 6bf7c0172a586b..7ac21cbcb5b5f0 100644 --- a/eng/testing/linker/project.csproj.template +++ b/eng/testing/linker/project.csproj.template @@ -2,9 +2,14 @@ Exe + {MonoAOTCompilerDir} + {MonoProjectRoot} + {MonoAOTCompilerTasksAssemblyPath} + {WasmAppBuilderTasksAssemblyPath} + {MicrosoftNetCoreAppRuntimePackRidDir} + {RepositoryEngineeringDir} {NetCoreAppCurrent} {RuntimeIdentifier} - {RuntimePackDir} {TargetingPackDir} {NetCoreAppMaximumVersion} {MicrosoftNETCoreAppVersion} diff --git a/eng/testing/linker/trimmingTests.targets b/eng/testing/linker/trimmingTests.targets index 874204667fae57..0473cfcd03636c 100644 --- a/eng/testing/linker/trimmingTests.targets +++ b/eng/testing/linker/trimmingTests.targets @@ -29,13 +29,14 @@ %(ProjectDir)project.csproj - $([MSBuild]::NormalizePath('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'publish', 'project')) - $([MSBuild]::NormalizeDirectory('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'publish')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.%(TestRuntimeIdentifier)', '$(Configuration)')) + $([MSBuild]::NormalizePath('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'publish', 'project')) + $([MSBuild]::NormalizePath('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'AppBundle', 'run-v8.sh')) + $([MSBuild]::NormalizeDirectory('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'publish')) + $([MSBuild]::NormalizeDirectory('%(ProjectDir)', 'bin', '$(Configuration)', '$(NetCoreAppCurrent)', '%(TestRuntimeIdentifier)', 'AppBundle')) - + %(Identity) @@ -71,12 +72,17 @@ .Replace('{MicrosoftNETCoreAppVersion}', '$(MicrosoftNETCoreAppVersion)') .Replace('{NetCoreAppCurrent}', '$(NetCoreAppCurrent)') .Replace('{NetCoreAppMaximumVersion}', '$(NetCoreAppMaximumVersion)') - .Replace('{RuntimePackDir}', '%(TestConsoleApps.RuntimePackDirectory)') .Replace('{TargetingPackDir}','$(MicrosoftNetCoreAppRefPackDir)') .Replace('{RuntimeIdentifier}','%(TestConsoleApps.TestRuntimeIdentifier)') .Replace('{MicrosoftNETILLinkTasksVersion}', '$(MicrosoftNETILLinkTasksVersion)') .Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)') - .Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)'))" + .Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)') + .Replace('{RepositoryEngineeringDir}', '$(RepositoryEngineeringDir)') + .Replace('{MonoAOTCompilerDir}', '$(MonoAOTCompilerDir)') + .Replace('{MonoProjectRoot}', '$(MonoProjectRoot)') + .Replace('{MonoAOTCompilerTasksAssemblyPath}', '$(MonoAOTCompilerTasksAssemblyPath)') + .Replace('{WasmAppBuilderTasksAssemblyPath}', '$(WasmAppBuilderTasksAssemblyPath)') + .Replace('{MicrosoftNetCoreAppRuntimePackRidDir}', '$(MicrosoftNetCoreAppRuntimePackRidDir)'))" Overwrite="true" /> @@ -86,15 +92,21 @@ + + + + Properties="Configuration=$(Configuration);BuildProjectReferences=false" /> - + diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 74f4b64e1dd6e7..4fe3cadd832919 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -10,7 +10,7 @@ true - + $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT --expected-exit-code=$(ExpectedExitCode) -- $(RunTestsJSArguments) --run $(AssemblyName).dll --testing @@ -162,7 +162,9 @@ - + + link @@ -245,5 +247,5 @@ AfterTargets="Build" DependsOnTargets="Publish;BundleTestAppleApp;BundleTestAndroidApp;BundleTestWasmApp;ArchiveTests" /> - + diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/TrimmingTests/Microsoft.Extensions.Logging.Console.TrimmingTests.proj b/src/libraries/Microsoft.Extensions.Logging.Console/tests/TrimmingTests/Microsoft.Extensions.Logging.Console.TrimmingTests.proj index 353b9d16635aca..866b55f9a42db2 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/TrimmingTests/Microsoft.Extensions.Logging.Console.TrimmingTests.proj +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/TrimmingTests/Microsoft.Extensions.Logging.Console.TrimmingTests.proj @@ -3,6 +3,7 @@ Microsoft.Extensions.Logging.Console + browser-wasm diff --git a/src/libraries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj b/src/libraries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj index 2ab8b1999b438e..a5f024befdad92 100644 --- a/src/libraries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj +++ b/src/libraries/System.Net.HttpListener/tests/TrimmingTests/System.Net.HttpListener.TrimmingTests.proj @@ -1,6 +1,10 @@ + + browser-wasm + + CookieExtensionsTest.Helper.cs diff --git a/src/libraries/System.Reflection.DispatchProxy/tests/TrimmingTests/DispatchProxyTest.cs b/src/libraries/System.Reflection.DispatchProxy/tests/TrimmingTests/DispatchProxyTest.cs index b2bc9bbff9c8a8..55177e1c5ae5ec 100644 --- a/src/libraries/System.Reflection.DispatchProxy/tests/TrimmingTests/DispatchProxyTest.cs +++ b/src/libraries/System.Reflection.DispatchProxy/tests/TrimmingTests/DispatchProxyTest.cs @@ -26,7 +26,7 @@ static int Main() } } -interface IFoo +public interface IFoo { public int Property1 { get; set; } public int UnusedProperty { get; set; } @@ -46,7 +46,7 @@ public void Method2() { } public void UnusedMethod3() { } } -class CountingProxy : DispatchProxy +public class CountingProxy : DispatchProxy { private IFoo _inner; public int InvocationCount { get; private set; } diff --git a/src/libraries/System.Runtime/tests/TrimmingTests/System.Runtime.TrimmingTests.proj b/src/libraries/System.Runtime/tests/TrimmingTests/System.Runtime.TrimmingTests.proj index 80a1996c9b37f4..fd556a37d675ac 100644 --- a/src/libraries/System.Runtime/tests/TrimmingTests/System.Runtime.TrimmingTests.proj +++ b/src/libraries/System.Runtime/tests/TrimmingTests/System.Runtime.TrimmingTests.proj @@ -4,7 +4,7 @@ - osx-x64;linux-x64 + osx-x64;linux-x64;browser-wasm @@ -18,6 +18,11 @@ as a workaround while the linker bug is fixed. This bug has been logged in the linker repo here: https://github.com/mono/linker/issues/1285 --> /p:DebugType=Embedded + + browser-wasm + + diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/TrimmingTests/System.Security.Cryptography.Csp.TrimmingTests.proj b/src/libraries/System.Security.Cryptography.Csp/tests/TrimmingTests/System.Security.Cryptography.Csp.TrimmingTests.proj index 64b290af04e8bc..bf94bef8e39fe1 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/TrimmingTests/System.Security.Cryptography.Csp.TrimmingTests.proj +++ b/src/libraries/System.Security.Cryptography.Csp/tests/TrimmingTests/System.Security.Cryptography.Csp.TrimmingTests.proj @@ -1,6 +1,10 @@ + + browser-wasm + + diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 4f405dda4555c3..6a0eb404148391 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -261,9 +261,11 @@ Condition="'$(TestAssemblies)' == 'true'" /> - + Condition="'$(TestTrimming)' == 'true'" + AdditionalProperties="%(AdditionalProperties);SkipTrimmingProjectsRestore=true" /> + @@ -298,4 +300,19 @@ Condition="'$(TestAssemblies)' == 'true' and '$(Coverage)' == 'true'" /> + + + + + + + + +