Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm][tests] Enable line numbers in stack traces #50893

Merged
merged 2 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/workflow/testing/libraries/testing-wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ At the moment supported values are:

By default, `chrome` browser is used.

## Debugging

### Getting more information

- Line numbers: add `/p:DebuggerSupport=true` to the command line, for `Release` builds. It's enabled by default for `Debug` builds.

## Kicking off outer loop tests from GitHub Interface

Add the following to the comment of a PR.
Expand Down
21 changes: 20 additions & 1 deletion eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
<PropertyGroup>
<BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets>
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' == 'Debug'">true</DebuggerSupport>
</PropertyGroup>

<PropertyGroup Condition="'$(RunScriptCommand)' == ''">
Expand All @@ -27,7 +28,9 @@
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
<DebuggerSupport>false</DebuggerSupport>

<!-- we want to default to what Blazor has, except if we are building in Debug config -->
<DebuggerSupport Condition="'$(Configuration)' != 'Debug'">false</DebuggerSupport>
</PropertyGroup>

<!-- Don't include InTree.props here, because the test projects themselves can set the target* properties -->
Expand Down Expand Up @@ -62,6 +65,9 @@
<WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization>
<WasmGenerateRunV8Script>true</WasmGenerateRunV8Script>
<WasmNativeStrip>false</WasmNativeStrip>

<WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
<WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel>
</PropertyGroup>

<ItemGroup>
Expand All @@ -79,4 +85,17 @@
<WasmFilesToIncludeInFileSystem Include="@(WasmFilesToIncludeFromPublishDir -> '$(PublishDir)%(Identity)')" />
</ItemGroup>
</Target>

<!-- linker automatically picks up the .pdb files, but they are not added to the publish list.
Add them explicitly here, so they can be used with WasmAppBuilder -->
<Target Name="AddPdbFilesToPublishList" AfterTargets="ILLink" Condition="'$(DebuggerSupport)' == 'true'">
<ItemGroup>
<_PdbFilesToCheck Include="$([System.IO.Path]::ChangeExtension('%(ResolvedFileToPublish.Identity)', '.pdb'))"
Condition="'%(ResolvedFileToPublish.Extension)' == '.dll'" />

<ResolvedFileToPublish Include="@(_PdbFilesToCheck)"
Condition="Exists(%(_PdbFilesToCheck.Identity))"
RelativePath="%(_PdbFilesToCheck.FileName)%(_PdbFilesToCheck.Extension)" />
</ItemGroup>
</Target>
</Project>
5 changes: 5 additions & 0 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
- $(WasmNativeStrip) - Whenever to strip the native executable. Defaults to true.
- $(WasmLinkIcalls) - Whenever to link out unused icalls. Defaults to $(WasmBuildNative).
- $(RunAOTCompilation) - Defaults to false.

- $(WasmDebugLevel)
> 0 enables debugging and sets the debug log level to debug_level
== 0 disables debugging and enables interpreter optimizations
< 0 enabled debugging and disables debug logging.

- $(WasmNativeDebugSymbols) - Build with native debug symbols, useful only with `$(RunAOTCompilation)`, or `$(WasmBuildNative)`
Defaults to true.
- $(WasmDedup) - Whenever to dedup generic instances when using AOT. Defaults to true.
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/WasmAppBuilder/WasmAppBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override bool Execute ()
foreach (var assembly in _assemblies)
{
FileCopyChecked(assembly, Path.Join(asmRootPath, Path.GetFileName(assembly)), "Assemblies");
if (DebugLevel > 0)
if (DebugLevel != 0)
{
var pdb = assembly;
pdb = Path.ChangeExtension(pdb, ".pdb");
Expand All @@ -173,7 +173,7 @@ public override bool Execute ()
foreach (var assembly in _assemblies)
{
config.Assets.Add(new AssemblyEntry(Path.GetFileName(assembly)));
if (DebugLevel > 0) {
if (DebugLevel != 0) {
var pdb = assembly;
pdb = Path.ChangeExtension(pdb, ".pdb");
if (File.Exists(pdb))
Expand Down