mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 18:11:04 +09:00
[wasm] Fix support for debugging wasm debugger tests with VSCode (#77148)
* [wasm] Generate, and use a .runsettings file for debugger tests * [wasm] Disable test timeout when debugging the tests * [wasm] Automatically detect RuntimeConfiguration * Add a wasm workspace for vscode * [wasm][debugger] Remove debug spew * Fix path to dotnet in .runtsettings * Add missing file
This commit is contained in:
parent
399c6dc66e
commit
cc5ba0994d
9 changed files with 80 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -10,6 +9,10 @@
|
|||
<BrowserHost Condition="$([MSBuild]::IsOSPlatform('windows'))">windows</BrowserHost>
|
||||
<InstallChromeForTests Condition="'$(InstallChromeForTests)' == '' and '$(DebuggerHost)' == 'chrome' and ('$(ContinuousIntegrationBuild)' == 'true' or Exists('/.dockerenv'))">true</InstallChromeForTests>
|
||||
<InstallFirefoxForTests Condition="'$(DebuggerHost)' == 'firefox' and '$(InstallFirefoxForTests)' == '' and '$(ContinuousIntegrationBuild)' != 'true' and Exists('/.dockerenv')">true</InstallFirefoxForTests>
|
||||
|
||||
<!-- Set RunSettingsFilePath property which is read by VSTest. -->
|
||||
<RunSettingsFilePath Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(OutputPath).runsettings</RunSettingsFilePath>
|
||||
<RunSettingsFilePath Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(ArtifactsObjDir)vscode\.runsettings</RunSettingsFilePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(RepositoryEngineeringDir)testing\wasm-provisioning.targets" />
|
||||
|
@ -45,4 +48,32 @@
|
|||
<Copy SourceFiles="@(_FilesToCopy)" DestinationFiles="$(ArchiveDirForHelix)\%(TargetPath)\%(RecursiveDir)%(FileName)%(Extension)" />
|
||||
</Target>
|
||||
|
||||
<!-- Copy of `GenerateRunSettingsFile` from eng/testing/runsettings.targets -->
|
||||
<Target Name="_GenerateRunSettingsFile" AfterTargets="Build" BeforeTargets="Test">
|
||||
<Message Text="*** Generating .runsettings file in $(RunSettingsFilePath)" Importance="High" />
|
||||
<PropertyGroup>
|
||||
<DotNetForTests Condition="'$(DotNetForTests)' == '' and $([System.IO.Path]::IsPathRooted($(DotNetTool)))">$(DotNetTool)</DotNetForTests>
|
||||
<DotNetForTests Condition="'$(DotNetForTests)' == ''">$([System.IO.Path]::Combine($(DotNetRoot), $(DotNetTool)))</DotNetForTests>
|
||||
|
||||
<_RunSettingsInputFilePath>$(RepositoryEngineeringDir)testing\.runsettings</_RunSettingsInputFilePath>
|
||||
<RunSettingsFileContent>$([System.IO.File]::ReadAllText('$(_RunSettingsInputFilePath)'))</RunSettingsFileContent>
|
||||
<RunSettingsFileContent Condition="'$(TestDisableParallelization)' == 'true'">$(RunSettingsFileContent.Replace('$$MAXCPUCOUNT$$', '1'))</RunSettingsFileContent>
|
||||
<RunSettingsFileContent Condition="'$(TestDisableParallelization)' != 'true'">$(RunSettingsFileContent.Replace('$$MAXCPUCOUNT$$', '0'))</RunSettingsFileContent>
|
||||
<RunSettingsFileContent>$(RunSettingsFileContent.Replace('$$TARGETPLATFORM$$', ''))</RunSettingsFileContent>
|
||||
<RunSettingsFileContent>$(RunSettingsFileContent.Replace('$$COVERAGE_INCLUDE$$', '$(CoverageIncludeFilter)')
|
||||
.Replace('$$COVERAGE_EXCLUDEBYFILE$$', '$(CoverageExcludeByFileFilter)')
|
||||
.Replace('$$COVERAGE_INCLUDEDIRECTORY$$', '$(CoverageIncludeDirectoryFilter)')
|
||||
.Replace('$$COVERAGE_ENABLED$$', '$([MSBuild]::ValueOrDefault('$(Coverage)', 'false'))')
|
||||
.Replace('$$DISABLEPARALLELIZATION$$', '$([MSBuild]::ValueOrDefault('$(TestDisableParallelization)', 'false'))')
|
||||
.Replace('$$DISABLEAPPDOMAIN$$', '$([MSBuild]::ValueOrDefault('$(TestDisableAppDomain)', 'false'))')
|
||||
.Replace('$$TESTCASEFILTER$$', '$(_testFilter)')
|
||||
.Replace('$$DOTNETHOSTPATH$$', '$(DotNetForTests)'))</RunSettingsFileContent>
|
||||
</PropertyGroup>
|
||||
|
||||
<WriteLinesToFile File="$(RunSettingsFilePath)"
|
||||
Lines="$(RunSettingsFileContent)"
|
||||
WriteOnlyWhenDifferent="true"
|
||||
Overwrite="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<Project>
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\DetectRuntimeConfiguration.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
|
||||
</Project>
|
|
@ -273,7 +273,8 @@ namespace DebuggerTests
|
|||
|
||||
public async Task LaunchBrowser(DateTime start, TimeSpan span)
|
||||
{
|
||||
_cancellationTokenSource.CancelAfter(span);
|
||||
if (!System.Diagnostics.Debugger.IsAttached)
|
||||
_cancellationTokenSource.CancelAfter(span);
|
||||
string uriStr = $"ws://{TestHarnessProxy.Endpoint.Authority}/launch-host-and-connect/?test_id={Id}";
|
||||
if (!DebuggerTestBase.RunningOnChrome)
|
||||
{
|
||||
|
|
|
@ -857,7 +857,7 @@ namespace DebuggerTests
|
|||
[InlineData(1272, 8, 1266, 8, "StepOverHiddenSP3", "HiddenSequencePointTest.StepOverHiddenSP3")]
|
||||
public async Task BreakpointOnHiddenLineShouldStopAtEarliestNextAvailableLine(int line_bp, int column_bp, int line_pause, int column_pause, string method_to_call, string method_name)
|
||||
{
|
||||
Console.WriteLine(await SetBreakpoint("dotnet://debugger-test.dll/debugger-test.cs", line_bp, column_bp));
|
||||
await SetBreakpoint("dotnet://debugger-test.dll/debugger-test.cs", line_bp, column_bp);
|
||||
await EvaluateAndCheck(
|
||||
"window.setTimeout(function() { invoke_static_method ('[debugger-test] HiddenSequencePointTest:" + method_to_call + "'); }, 1);",
|
||||
"dotnet://debugger-test.dll/debugger-test.cs", line_pause, column_pause,
|
||||
|
|
22
src/mono/wasm/debugger/DetectRuntimeConfiguration.props
Normal file
22
src/mono/wasm/debugger/DetectRuntimeConfiguration.props
Normal file
|
@ -0,0 +1,22 @@
|
|||
<Project TreeatAsLocalProperty="RuntimeConfiguration">
|
||||
<PropertyGroup>
|
||||
<_TopDir>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', '..', '..', '..'))</_TopDir>
|
||||
<_DotnetJsRelativePath>$([System.IO.Path]::Combine('runtimes', 'browser-wasm', 'native', 'dotnet.js'))</_DotnetJsRelativePath>
|
||||
<_ReleaseConfigDetected Condition="Exists('$(_TopDir)artifacts/bin/microsoft.netcore.app.runtime.browser-wasm/Release/runtimes/browser-wasm/native/dotnet.js')">true</_ReleaseConfigDetected>
|
||||
<_DebugConfigDetected Condition="Exists('$(_TopDir)artifacts/bin/microsoft.netcore.app.runtime.browser-wasm/Debug/runtimes/browser-wasm/native/dotnet.js')">true</_DebugConfigDetected>
|
||||
|
||||
<_OriginalRuntimeConfiguration>$(RuntimeConfiguration)</_OriginalRuntimeConfiguration>
|
||||
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == '' and '$(_ReleaseConfigDetected)' == 'true'">Release</RuntimeConfiguration>
|
||||
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == '' and '$(_DebugConfigDetected)' == 'true'">Debug</RuntimeConfiguration>
|
||||
|
||||
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">Release</RuntimeConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_CheckRuntimeConfigDetected" BeforeTargets="Build">
|
||||
<Error Condition="'$(_OriginalRuntimeConfiguration)' == '' and '$(_ReleaseConfigDetected)' == 'true' and '$(_DebugConfigDetected)' == 'true'"
|
||||
Text="Found both Debug, and Release config dotnet.js in artifacts.
|
||||
Using %24(RuntimeConfiguration)=$(RuntimeConfiguration). Override this property to pick a specific one." />
|
||||
|
||||
<Message Text="** Using RuntimeConfiguration=$(RuntimeConfiguration) **" Importance="High" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,6 +1,3 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">Release</RuntimeConfiguration>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\Directory.Build.props" />
|
||||
</Project>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
ReferenceOutputAssembly="false"
|
||||
Private="false"
|
||||
GlobalPropertiesToRemove="TargetFramework;TargetFrameworks;Configuration;TargetOS;TargetArchitecture"
|
||||
AdditionalProperties="RuntimeConfiguration=$(Configuration);ArchiveTests=$(ArchiveTests);ArchiveDirForHelix=$(TargetDir)" />
|
||||
AdditionalProperties="RuntimeConfiguration=$(Configuration);ArchiveTests=$(ArchiveTests);ArchiveDirForHelix=$(TargetDir);DotNetForTests=dotnet" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="UpdateRunScriptCommands" BeforeTargets="GenerateRunScript">
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<OutputType>Library</OutputType>
|
||||
<IsWasmProject>true</IsWasmProject>
|
||||
<Configuration>Debug</Configuration>
|
||||
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)'==''">Release</RuntimeConfiguration>
|
||||
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn>219</NoWarn>
|
||||
|
|
18
src/mono/wasm/wasm.code-workspace
Normal file
18
src/mono/wasm/wasm.code-workspace
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "../mono"
|
||||
},
|
||||
{
|
||||
"path": "../wasi"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
|
||||
"omnisharp.defaultLaunchSolution": "${workspaceFolder}sln/WasmBuild.sln",
|
||||
"omnisharp.enableRoslynAnalyzers": true
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue