[wasm] WBT: Fix breaking tests (#88751)
authorAnkit Jain <radical@gmail.com>
Wed, 12 Jul 2023 21:10:58 +0000 (17:10 -0400)
committerGitHub <noreply@github.com>
Wed, 12 Jul 2023 21:10:58 +0000 (17:10 -0400)
commit47bb82146bb42ef881eb084160bf22e93be96f60
tree4ba32347b2adfaae60a66ed04edbd46a343576f9
parent11fbd151912a3c5d1e72386fb037595b71e214d6
[wasm] WBT: Fix breaking tests (#88751)

* [wasm] WBT: Fix breaking tests

`Wasm.Build.Tests.WasmTemplateTests.RunWithDifferentAppBundleLocations`
broke with the latest sdk:

`/root/helix/work/workitem/e/dotnet-latest/sdk/8.0.100-preview.7.23362.1/Roslyn/Microsoft.CSharp.Core.targets(80,5): error MSB6004: The specified task executable location "/root/helix/work/workitem/e/dotnet-latest/dotnet/dotnet" is invalid.`

This was because https://github.com/dotnet/roslyn/pull/68918 changed
to expect `DOTNET_ROOT` to be a directory instead of the exe path.

* [wasm] WBT: Set DOTNET_ROOT for tests

* [wasm] WBT: Set DOTNET_ROOT explicitly in the helix environment

The `NonWasmTemplateBuildTests` avoid using the default environment
variables used for all other tests, which includes `DOTNET_ROOT`. Set
`DOTNET_ROOT` explicitly in the helix setup script for windows, so we
always have a fallback.

```
    Wasm.Build.Tests.NonWasmTemplateBuildTests.NonWasmConsoleBuild_WithoutWorkload(config: "Debug", extraBuildArgs: "", targetFramework: "net6.0") [FAIL]
       Expected 0 exit code but got 1: C:\helix\work\workitem\e\dotnet-none\dotnet.exe build -restore -c Debug -bl:C:\helix\work\workitem\uploads\xharness-output\logs\nonwasm_net6.0_Debug_iyhtgmvj.uu4.binlog  -f net6.0
      Standard Output:
      [] MSBuild version 17.8.0-preview-23361-03+5ab64ed27 for .NET
      []   Determining projects to restore...
      []   Restored C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj (in 820 ms).
      []   Determining projects to restore...
      []   Restored C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj (in 11.21 sec).
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : You must install or update .NET to run this application. [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error :  [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : App: C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\bincore\csc.dll [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : Architecture: x64 [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : Framework: 'Microsoft.NETCore.App', version '8.0.0-preview.7.23361.9' (x64) [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : .NET location: C:\helix\work\correlation\dotnet-cli\ [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error :  [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : The following frameworks were found: [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error :   8.0.0-preview.5.23280.8 at [C:\helix\work\correlation\dotnet-cli\shared\Microsoft.NETCore.App] [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error :  [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : Learn more: [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : https://aka.ms/dotnet/app-launch-failed [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error :  [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : To install missing framework, download: [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      [] C:\helix\work\workitem\e\dotnet-none\sdk\8.0.100-preview.7.23362.1\Roslyn\Microsoft.CSharp.Core.targets(80,5): error : https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0-preview.7.23361.9&arch=x64&rid=win10-x64 [C:\helix\work\workitem\e\wbt\nonwasm_net6.0_Debug_iyhtgmvj.uu4\nonwasm_net6.0_Debug_iyhtgmvj.uu4.csproj]
      []
```
src/libraries/sendtohelixhelp.proj
src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
src/mono/wasm/Wasm.Build.Tests/Common/RunCommand.cs