Skip to content

Commit

Permalink
[wasm] Misc tests related fixes (#73884)
Browse files Browse the repository at this point in the history
* [wasm] Stop running crypto tests with subtlecrypto

* [wasm] Add --web-server-use-cop for samples when running on helix for a threaded build

* [wasm] Makefile, honor V=1 and emit binlog

* [wasm] PInvokeTableGenerator: emit the type name also, for the warning

* [wasm] Improve build for non-default runtime packs

.. by using `MSBuild` task to build them instead of invoking
`dotnet.sh`.
- And fix incremental builds

* [wasm] Run smoke tests only for AOT

- Building, and running all the tests for EAT case will help catch
linker errors that can slip through.

* [wasm] Fix linker errors for tests

Fixes #73901
  • Loading branch information
radical committed Aug 14, 2022
1 parent 88ba045 commit 7d986fa
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 21 deletions.
1 change: 0 additions & 1 deletion eng/pipelines/runtime.yml
Expand Up @@ -373,7 +373,6 @@ jobs:
- Browser_wasm
nameSuffix: _EAT
runAOT: false
runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
alwaysRun: ${{ variables.isRollingBuild }}

# AOT Library tests
Expand Down
File renamed without changes.
13 changes: 9 additions & 4 deletions eng/testing/tests.wasm.targets
Expand Up @@ -5,10 +5,6 @@
<WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle>
<BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets>
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' == 'Debug'">true</DebuggerSupport>
<!-- suppress warnings as these are tests, and not expected to be trim-safe -->
<SuppressTrimAnalysisWarnings Condition="'$(EnableAggressiveTrimming)' == 'true'">true</SuppressTrimAnalysisWarnings>
<!-- This warning code isn't yet included in SuppressTrimAnalysisWarnings -->
<NoWarn Condition="'$(EnableAggressiveTrimming)' == 'true'">$(NoWarn);IL2118</NoWarn>

<!-- set this when provisioning emsdk on CI -->
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>
Expand All @@ -33,6 +29,15 @@
<_UseWasmSymbolicator Condition="'$(TestTrimming)' != 'true'">true</_UseWasmSymbolicator>
</PropertyGroup>

<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
<!-- suppress warnings as these are tests, and not expected to be trim-safe -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<!-- This warning code isn't yet included in SuppressTrimAnalysisWarnings -->
<NoWarn>$(NoWarn);IL2118</NoWarn>
<!-- IL2121: Unnecessary UnconditionalSuppressMessage attribute -->
<NoWarn>$(NoWarn);IL2121</NoWarn>
</PropertyGroup>

<PropertyGroup>
<BuildAOTTestsOn Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(Scenario)' == 'BuildWasmApps'">helix</BuildAOTTestsOn>
<BuildAOTTestsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">helix</BuildAOTTestsOn>
Expand Down
24 changes: 13 additions & 11 deletions eng/testing/workloads-testing.targets
Expand Up @@ -116,25 +116,21 @@
</PropertyGroup>

<ItemGroup>
<_DefaultPropsForNuGetBuild Include="Configuration=$(Configuration)" />
<_DefaultPropsForNuGetBuild Include="TargetOS=Browser" />
<_DefaultPropsForNuGetBuild Include="TargetArchitecture=wasm" />
<_DefaultPropsForNuGetBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" />

<_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Ref.$(_PackageVersion).nupkg"
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj"
BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ')"
Properties="@(_DefaultPropsForNuGetBuild, ';')"
Descriptor="Ref pack"/>

<!-- AOT Cross compiler -->
<_PropsForAOTCrossBuild Include="@(_DefaultPropsForNuGetBuild)" />
<_PropsForAOTCrossBuild Include="TestingWorkloads=true" />
<_PropsForAOTCrossBuild Include="RuntimeIdentifier=$(NETCoreSdkRuntimeIdentifier)" />
<_PropsForAOTCrossBuild Include="TargetCrossRid=$(RuntimeIdentifier)" />
<_PropsForAOTCrossBuild Include="DisableSourceLink=true" />

<_NuGetsToBuild Include="$(_AOTCrossNuGetPath)"
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App\Microsoft.NETCore.App.MonoCrossAOT.sfxproj"
BuildArgs="@(_PropsForAOTCrossBuild -> '-p:%(Identity)', ' ')"
Properties="@(_PropsForAOTCrossBuild,';')"
Descriptor="AOT Cross compiler"/>
</ItemGroup>
</Target>
Expand All @@ -143,7 +139,13 @@
<Message Importance="High" Text="
** Building %(_NuGetsToBuild.Descriptor) **
" />
<Exec Command="dotnet build -bl -restore -v:q --nologo -t:Pack %(_NuGetsToBuild.BuildArgs) %(_NuGetsToBuild.Project)" />

<MSBuild Projects="%(_NuGetsToBuild.Project)"
Properties="%(_NuGetsToBuild.Properties)"
Targets="Restore" />
<MSBuild Projects="%(_NuGetsToBuild.Project)"
Properties="%(_NuGetsToBuild.Properties)"
Targets="Pack" />
</Target>

<!-- For local builds, only one of the 3 required runtime packs might be available. In that case,
Expand All @@ -158,7 +160,7 @@
<_DefaultBuildVariant Condition="'$(WasmEnablePerfTracing)' == 'true' or '$(MonoWasmBuildVariant)' == 'perftrace'">.perftrace.</_DefaultBuildVariant>
<_DefaultBuildVariant Condition="'$(_DefaultBuildVariant)' == ''">.</_DefaultBuildVariant>

<_DefaultRuntimePackNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono$(_DefaultBuildVariant)browser-wasm$(_PackageVersion).nupkg</_DefaultRuntimePackNuGetPath>
<_DefaultRuntimePackNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono$(_DefaultBuildVariant)browser-wasm.$(_PackageVersion).nupkg</_DefaultRuntimePackNuGetPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -175,13 +177,13 @@
<_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.%(_BuildVariants.Identity).browser-wasm.$(_PackageVersion).nupkg"
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
Dependencies="$(_DefaultRuntimePackNuGetPath)"
BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ') /p:MonoWasmBuildVariant=%(_BuildVariants.Identity)"
Properties="@(_DefaultPropsForNuGetBuild, ';');MonoWasmBuildVariant=%(_BuildVariants.Identity)"
Descriptor="runtime pack for %(_BuildVariants.Identity)" />

<!-- add for non-threaded runtime also -->
<_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.browser-wasm.$(_PackageVersion).nupkg"
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ')"
Properties="@(_DefaultPropsForNuGetBuild, ';')"
Dependencies="$(_DefaultRuntimePackNuGetPath)"
Descriptor="single threaded runtime pack"
Condition="'$(_DefaultBuildVariant)' != '.'" />
Expand Down
Expand Up @@ -14,8 +14,6 @@
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<HelixTargetsFile>wasm.helix.targets</HelixTargetsFile>

<WasmXHarnessMonoArgs Condition="'$(ContinuousIntegrationBuild)' != 'true' and '$(UseSubtleCryptoForTests)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=TEST_EXPECT_SUBTLE_CRYPTO=true</WasmXHarnessMonoArgs>
<WasmXHarnessArgs Condition="'$(ContinuousIntegrationBuild)' != 'true' and '$(UseSubtleCryptoForTests)' == 'true'">$(WasmXHarnessArgs) --web-server-use-cop</WasmXHarnessArgs>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/mono/sample/wasm/Directory.Build.props
Expand Up @@ -15,6 +15,7 @@
<PropertyGroup>
<OutputPath>bin</OutputPath>
<WasmAppDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\AppBundle\</WasmAppDir>
<WasmXHarnessArgs Condition="'$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true'">$(WasmXHarnessArgs) --web-server-use-cop</WasmXHarnessArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<WasmNativeStrip>false</WasmNativeStrip>
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/Makefile
Expand Up @@ -5,6 +5,7 @@ escape_quote = $(subst ",\",$(1))

ifneq ($(V),)
MSBUILD_ARGS+=/p:MonoVerboseBuild=true
MSBUILD_ARGS+=-bl
endif

DOTNET=$(TOP)/dotnet.sh
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/WasmAppBuilder/IcallTableGenerator.cs
Expand Up @@ -152,7 +152,7 @@ private void ProcessType(Type type)
}
catch (Exception ex) when (ex is not LogAsErrorException)
{
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Could not get icall, or callbacks for method '{method.Name}' because '{ex.Message}'");
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Could not get icall, or callbacks for method '{type.FullName}::{method.Name}' because '{ex.Message}'");
continue;
}

Expand Down
6 changes: 4 additions & 2 deletions src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs
Expand Up @@ -71,7 +71,8 @@ private void CollectPInvokes(List<PInvoke> pinvokes, List<PInvokeCallback> callb
}
catch (Exception ex) when (ex is not LogAsErrorException)
{
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Could not get pinvoke, or callbacks for method '{method.Name}' because '{ex.Message}'");
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0,
$"Could not get pinvoke, or callbacks for method '{type.FullName}::{method.Name}' because '{ex.Message}'");
}
}

Expand Down Expand Up @@ -301,7 +302,8 @@ private static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotN

if (TryIsMethodGetParametersUnsupported(pinvoke.Method, out string? reason))
{
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Skipping pinvoke '{pinvoke.Method}' because '{reason}'.");
Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0,
$"Skipping pinvoke '{pinvoke.Method.DeclaringType!.FullName}::{pinvoke.Method}' because '{reason}'.");

pinvoke.Skip = true;
return null;
Expand Down

0 comments on commit 7d986fa

Please sign in to comment.