[wasm] Fix Wasm.Build.Tests test failures on windows (#70328)
authorAnkit Jain <radical@gmail.com>
Tue, 7 Jun 2022 19:40:11 +0000 (15:40 -0400)
committerGitHub <noreply@github.com>
Tue, 7 Jun 2022 19:40:11 +0000 (15:40 -0400)
* [wasm] Workaround a python bug which can cause em* scripts to hang

Issue - https://github.com/emscripten-core/emscripten/pull/15146

Emscripten added a workaround enabled by setting
the environment variable - `EM_WORKAROUND_PYTHON_BUG_34780`.

* [wasm] Wasm.Build.Tests - use a local copy of `dotnet`

.. to avoid conflicting with other instances on helix.

* don't log output from robocopy

src/mono/wasm/build/WasmApp.Native.targets
src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs
src/tests/BuildWasmApps/Wasm.Build.Tests/data/RunScriptTemplate.cmd
src/tests/BuildWasmApps/Wasm.Build.Tests/data/RunScriptTemplate.sh

index 91eda97..a1d524c 100644 (file)
@@ -91,6 +91,7 @@
         See https://github.com/dotnet/runtime/issues/53367 for the motivating issue
       -->
       <EmscriptenEnvVars Include="PYTHONUTF8=1" />
+      <EmscriptenEnvVars Include="EM_WORKAROUND_PYTHON_BUG_34780=1" />
     </ItemGroup>
   </Target>
 
index 2db7094..73465e8 100644 (file)
@@ -97,6 +97,7 @@ namespace Wasm.Build.Tests
             EnvVars["_WasmStrictVersionMatch"] = "true";
             EnvVars["MSBuildSDKsPath"] = string.Empty;
             EnvVars["PATH"] = $"{sdkForWorkloadPath}{Path.PathSeparator}{Environment.GetEnvironmentVariable("PATH")}";
+            EnvVars["EM_WORKAROUND_PYTHON_BUG_34780"] = "1";
 
             // helps with debugging
             EnvVars["WasmNativeStrip"] = "false";
index bca245b..c252316 100644 (file)
@@ -94,14 +94,16 @@ exit /b %EXIT_CODE%
 REM Functions
 :SetEnvVars
 if [%TEST_USING_WORKLOADS%] == [true] (
-    set "PATH=%BASE_DIR%\dotnet-workload;%PATH%"
     set SDK_HAS_WORKLOAD_INSTALLED=true
-    set "SDK_FOR_WORKLOAD_TESTING_PATH=%BASE_DIR%\dotnet-workload"
+    robocopy /np /nfl /e %BASE_DIR%\dotnet-workload %EXECUTION_DIR%\dotnet-workload
+    set "SDK_FOR_WORKLOAD_TESTING_PATH=%EXECUTION_DIR%\dotnet-workload"
+    set "PATH=%EXECUTION_DIR%\dotnet-workload;%PATH%"
     set "AppRefDir=%BASE_DIR%\microsoft.netcore.app.ref"
 ) else (
-    set "PATH=%BASE_DIR%\sdk-no-workload;%PATH%"
     set SDK_HAS_WORKLOAD_INSTALLED=false
-    set "SDK_FOR_WORKLOAD_TESTING_PATH=%BASE_DIR%\sdk-no-workload"
+    robocopy /np /nfl /e %BASE_DIR%\sdk-no-workload %EXECUTION_DIR%\sdk-no-workload
+    set "SDK_FOR_WORKLOAD_TESTING_PATH=%EXECUTION_DIR%\sdk-no-workload"
+    set "PATH=%EXECUTION_DIR%\sdk-no-workload;%PATH%"
     set "AppRefDir=%BASE_DIR%\microsoft.netcore.app.ref"
 )
 EXIT /b 0
index 1130c80..97ed44c 100644 (file)
@@ -67,14 +67,16 @@ echo XHARNESS_ARGS=$XHARNESS_ARGS
 function set_env_vars()
 {
     if [ "x$TEST_USING_WORKLOADS" = "xtrue" ]; then
-        export PATH=$BASE_DIR/dotnet-workload:$PATH
+        cp -r $BASE_DIR/dotnet-workload $EXECUTION_DIR
+        export PATH=$EXECUTION_DIR/dotnet-workload:$PATH
         export SDK_HAS_WORKLOAD_INSTALLED=true
-        export SDK_FOR_WORKLOAD_TESTING_PATH=$BASE_DIR/dotnet-workload
+        export SDK_FOR_WORKLOAD_TESTING_PATH=$EXECUTION_DIR/dotnet-workload
         export AppRefDir=$BASE_DIR/microsoft.netcore.app.ref
     else
-        export PATH=$BASE_DIR/sdk-no-workload:$PATH
+        cp -r $BASE_DIR/sdk-no-workload $EXECUTION_DIR
+        export PATH=$EXECUTION_DIR/sdk-no-workload:$PATH
         export SDK_HAS_WORKLOAD_INSTALLED=false
-        export SDK_FOR_WORKLOAD_TESTING_PATH=$BASE_DIR/sdk-no-workload
+        export SDK_FOR_WORKLOAD_TESTING_PATH=$EXECUTION_DIR/sdk-no-workload
         export AppRefDir=$BASE_DIR/microsoft.netcore.app.ref
     fi
 }