Skip to content

Commit

Permalink
[debugger][mt] Unify multithreading switches (#97861)
Browse files Browse the repository at this point in the history
* Use only one env var for debugger.

* Improve bool value processing.

* Nit: Keep original layout.

* fix build
  • Loading branch information
ilonatommy committed Feb 2, 2024
1 parent 7f02aef commit 2b07375
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static bool ReleaseRuntime
#else
=> false;
#endif
public static bool WasmMultiThreaded => EnvironmentVariables.WasmTestsUsingVariant == "multithreaded";
public static bool WasmMultiThreaded => EnvironmentVariables.WasmEnableThreads;

public static bool WasmSingleThreaded => !WasmMultiThreaded;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ namespace DebuggerTests;

internal static class EnvironmentVariables
{
public static readonly string? DebuggerTestPath = Environment.GetEnvironmentVariable("DEBUGGER_TEST_PATH");
public static readonly string? TestLogPath = Environment.GetEnvironmentVariable("TEST_LOG_PATH");
public static readonly bool SkipCleanup = Environment.GetEnvironmentVariable("SKIP_CLEANUP") == "1" ||
Environment.GetEnvironmentVariable("SKIP_CLEANUP") == "true";
public static readonly string? WasmTestsUsingVariant = Environment.GetEnvironmentVariable("WASM_TESTS_USING_VARIANT");
public static readonly string? DebuggerTestPath = Environment.GetEnvironmentVariable("DEBUGGER_TEST_PATH");
public static readonly string? TestLogPath = Environment.GetEnvironmentVariable("TEST_LOG_PATH");
public static readonly bool SkipCleanup = GetEnvironmentVariableValue("SKIP_CLEANUP");
public static readonly bool WasmEnableThreads = GetEnvironmentVariableValue("WasmEnableThreads");

private static bool GetEnvironmentVariableValue(string envVariable)
{
string? str = Environment.GetEnvironmentVariable(envVariable);
if (str is null)
return false;

if (str == "1" || str.ToLower() == "true")
return true;

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<_DotnetCommand Condition="'$(OS)' == 'Windows_NT'">dotnet.exe</_DotnetCommand>

<RunScriptCommand>$(_DotnetCommand) test DebuggerTestSuite/DebuggerTestSuite.dll</RunScriptCommand>
<RunScriptCommand Condition="'$(WasmEnableThreads)' == 'true'">$(RunScriptCommand) /e:WASM_TESTS_USING_VARIANT=multithreaded</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) /e:WasmEnableThreads=$(WasmEnableThreads)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) &quot;-l:trx%3BLogFileName=testResults.trx&quot;</RunScriptCommand>
<RunScriptCommand Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(RunScriptCommand) &quot;-l:console%3BVerbosity=normal&quot;</RunScriptCommand>

Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ a worker thread will use `async_run_in_main_thread` to queue up work for the mai

To run the debugger tests in the runtime [built with enabled support for multi-threading](#building-the-runtime) we use:
```
dotnet test src/mono/wasm/debugger/DebuggerTestSuite -e RuntimeConfiguration=Debug -e Configuration=Debug -e DebuggerHost=chrome -e WasmEnableThreads=true -e WASM_TESTS_USING_VARIANT=multithreaded
dotnet test src/mono/wasm/debugger/DebuggerTestSuite -e RuntimeConfiguration=Debug -e Configuration=Debug -e DebuggerHost=chrome -e WasmEnableThreads=true
```

## JS interop on dedicated threads ##
Expand Down

0 comments on commit 2b07375

Please sign in to comment.