From: Aleksey Kliger (λgeek) Date: Tue, 25 May 2021 00:25:17 +0000 (-0400) Subject: Hot Reload: test on WebAssembly (#53050) X-Git-Tag: submit/tizen/20210909.063632~1187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b37d9becc6338104f4ae6308a73b7b309eba2c9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Hot Reload: test on WebAssembly (#53050) * Hot Reload: test on WebAssembly 1. Always build the assemblies in the ApplyUpdate/ subdirectory without optimization, with debug info. Hot reload depends on it. 2. Pass the required environment variable to the runtime via xharness to enable support for applying updates. * Add ApplyUpdate test assemblies to test project linker descriptor * Fix wasm EnableAggressiveTrimming lane --- diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/Directory.Build.props b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/Directory.Build.props index e2d777b..765d890 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/Directory.Build.props +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/Directory.Build.props @@ -12,4 +12,10 @@ + + + false + true + + diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs index baa5ac2..51873c0 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs @@ -20,10 +20,9 @@ namespace System.Reflection.Metadata /// We need: /// 1. Either DOTNET_MODIFIABLE_ASSEMBLIES=debug is set, or we can use the RemoteExecutor to run a child process with that environment; and, /// 2. Either Mono in a supported configuration (interpreter as the execution engine, and the hot reload feature enabled), or CoreCLR; and, - /// 3. The test assemblies are compiled in the Debug configuration. + /// 3. The test assemblies are compiled with Debug information (this is configured by setting EmitDebugInformation in ApplyUpdate\Directory.Build.props) public static bool IsSupported => (IsModifiableAssembliesSet || IsRemoteExecutorSupported) && - (!IsMonoRuntime || IsSupportedMonoConfiguration) && - IsSupportedTestConfiguration(); + (!IsMonoRuntime || IsSupportedMonoConfiguration); public static bool IsModifiableAssembliesSet => String.Equals(DotNetModifiableAssembliesValue, Environment.GetEnvironmentVariable(DotNetModifiableAssembliesSwitch), StringComparison.InvariantCultureIgnoreCase); @@ -61,16 +60,6 @@ namespace System.Reflection.Metadata return caps is string {Length: > 0}; } - // Only Debug assemblies are editable - internal static bool IsSupportedTestConfiguration() - { -#if DEBUG - return true; -#else - return false; -#endif - } - private static System.Collections.Generic.Dictionary assembly_count = new(); internal static void ApplyUpdate (System.Reflection.Assembly assm) diff --git a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj index 3e8e0bc..a69b4fe0 100644 --- a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj +++ b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj @@ -6,6 +6,8 @@ true false + + --setenv=DOTNET_MODIFIABLE_ASSEMBLIES=debug @@ -43,4 +45,30 @@ + + + + + + + + + + + + + + + + + diff --git a/src/mono/mono/metadata/metadata-update.c b/src/mono/mono/metadata/metadata-update.c index d5e9fc7..21797da 100644 --- a/src/mono/mono/metadata/metadata-update.c +++ b/src/mono/mono/metadata/metadata-update.c @@ -85,8 +85,10 @@ mono_metadata_update_enabled (int *modifiable_assemblies_out) if (!inited) { char *val = g_getenv (DOTNET_MODIFIABLE_ASSEMBLIES); - if (val && !g_strcasecmp (val, "debug")) + if (val && !g_strcasecmp (val, "debug")) { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_METADATA_UPDATE, "Metadata update enabled for debuggable assemblies"); modifiable = MONO_MODIFIABLE_ASSM_DEBUG; + } g_free (val); inited = TRUE; }