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] Run Wasm.Build.Tests against workloads #54451

Merged
merged 25 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
880073b
[wasm] Emcc.props -> emcc-props.json
radical Jul 12, 2021
c8c6cee
[wasm] Build samples, functional tests, and Wasm.Build.Tests only when
radical Jul 12, 2021
f04daf2
[wasm] Use %(ResolvedRuntimePack.PackageDirectory) to get the runtime
radical Jul 12, 2021
1e23eba
[wasm] Wasm.Build.Tests cleanup
radical Jul 12, 2021
cf11f19
cross-aot: Allow the project to be built directly for packing
radical Jul 12, 2021
c87f5cf
Add support for building Wasm.Build.Tests with workloads
radical Jul 12, 2021
fa86d41
[wasm] Add support for running Wasm.Build.Tests on windows
radical Jul 12, 2021
23c428c
cleanup
radical Jul 12, 2021
d7ad91b
Set PYTHONPATH for emsdk case
radical Jul 12, 2021
fede431
Testing the build
radical Jul 12, 2021
2282814
Add missing EnvironmentVariables.cs
radical Jul 12, 2021
0f13abc
Add doc for workloads testing
radical Jul 12, 2021
0a6532a
cleanup
radical Jul 12, 2021
df94014
Log directories in the dotnet sdk-manifests, and packs dir if install…
radical Jul 12, 2021
dd92d28
Fix typo
radical Jul 13, 2021
5d897b8
fix typo
radical Jul 13, 2021
1dbae80
Fix skipping tests on windows
radical Jul 13, 2021
cc38268
Add a prefix to helix jobs for wasm.build.tests
radical Jul 13, 2021
364dc80
re-enable all the jobs
radical Jul 13, 2021
d7d8b27
cleanup
radical Jul 13, 2021
7b8a4ae
Merge remote-tracking branch 'origin/main' into wasm-workloads-staging2
radical Jul 13, 2021
236b644
lock access to the stringbuilder for output, to prevent it from getti…
radical Jul 13, 2021
31d41b9
Add a separate build job for wasm.build.tests
radical Jul 13, 2021
32fa9c4
dummy commit in mono, to trigger the builds
radical Jul 13, 2021
b9f99a8
Lock around ToString to ensure the handlers have flushed
lewing Jul 14, 2021
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
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</AndroidAppBuilderDir>
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WasmBuildTasksDir>
<WorkloadBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WorkloadBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish'))</WorkloadBuildTasksDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
<RuntimeConfigParserDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'RuntimeConfigParser', 'Debug', '$(NetCoreAppToolCurrent)'))</RuntimeConfigParserDir>
<JsonToItemsTaskFactoryDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'JsonToItemsTaskFactory', 'Debug', '$(NetCoreAppToolCurrent)'))</JsonToItemsTaskFactoryDir>

<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', 'Debug', '$(NetCoreAppToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', 'Debug', 'net461', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
Expand All @@ -84,8 +86,10 @@
<AndroidAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll'))</AndroidAppBuilderTasksAssemblyPath>
<WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
<WasmBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))</WasmBuildTasksAssemblyPath>
<WorkloadBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WorkloadBuildTasksDir)', 'WorkloadBuildTasks.dll'))</WorkloadBuildTasksAssemblyPath>
<MonoAOTCompilerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))</MonoAOTCompilerTasksAssemblyPath>
<RuntimeConfigParserTasksAssemblyPath>$([MSBuild]::NormalizePath('$(RuntimeConfigParserDir)', 'RuntimeConfigParser.dll'))</RuntimeConfigParserTasksAssemblyPath>
<JsonToItemsTaskFactoryTasksAssemblyPath>$([MSBuild]::NormalizePath('$(JsonToItemsTaskFactoryDir)', 'JsonToItemsTaskFactory.dll'))</JsonToItemsTaskFactoryTasksAssemblyPath>
<ILAsmToolPath Condition="'$(DotNetBuildFromSource)' == 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)'))</ILAsmToolPath>
</PropertyGroup>

Expand Down
28 changes: 28 additions & 0 deletions docs/workflow/testing/testing-workloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Testing Workloads

Workloads based on packages in `artifacts` can be installed, and used for testing.

- This is done by installing a specified SDK version (`$(SdkVersionForWorkloadTesting)`) in `artifacts/bin/dotnet-workload`.
- Then the manifest for the workload in `@(WorkloadIdForTesting)` is installed
- Then workload packs are installed
- packs, or manifests not generated by `runtime`, are restored from nuget

- The SDK is installed by `ProvisionSdkForWorkloadTesting` target
- and the workload is installed by `InstallWorkloadUsingArtifacts` target, using the `InstallWorkloadFromArtifacts` task

- `@(WorkloadIdForTesting)`:

Example for wasm:
```xml
<WorkloadIdForTesting Include="wasm-tools"
Name="microsoft.net.workload.mono.toolchain"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain"
Version="$(PackageVersion)"
VersionBand="$(SdkBandVersion)" />
```

- Currently, this is used only by `src/tests/BuildWasmApps/Wasm.Build.Tests`

## Limitations:

- The cross compiler package is built manually from the `InstallWorkloadUsingArtifacts` target
2 changes: 1 addition & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" />
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" />
</ItemGroup>
<ItemGroup>
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" />
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<SdkVersionForWorkloadTesting>6.0.100-preview.7.21362.5</SdkVersionForWorkloadTesting>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
Expand Down
2 changes: 1 addition & 1 deletion eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
$(LibrariesNativeArtifactsPath)src\*.c;
$(LibrariesNativeArtifactsPath)src\*.js;
$(LibrariesNativeArtifactsPath)src\emcc-default.rsp;
$(LibrariesNativeArtifactsPath)src\Emcc.props;"
$(LibrariesNativeArtifactsPath)src\emcc-props.json;"
NativeSubDirectory="src"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
Expand Down
4 changes: 2 additions & 2 deletions eng/testing/WasmRunnerTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set EXECUTION_DIR=%~dp0
set SCENARIO=%3

if [%HELIX_WORKITEM_UPLOAD_ROOT%] == [] (
set XHARNESS_OUT="%EXECUTION_DIR%xharness-output"
set "XHARNESS_OUT=%EXECUTION_DIR%xharness-output"
) else (
set XHARNESS_OUT="%HELIX_WORKITEM_UPLOAD_ROOT%\xharness-output"
set "XHARNESS_OUT=%HELIX_WORKITEM_UPLOAD_ROOT%\xharness-output"
)

if [%XHARNESS_CLI_PATH%] NEQ [] (
Expand Down
1 change: 1 addition & 0 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<MonoProjectRoot>{MonoProjectRoot}</MonoProjectRoot>
<MonoAOTCompilerTasksAssemblyPath>{MonoAOTCompilerTasksAssemblyPath}</MonoAOTCompilerTasksAssemblyPath>
<WasmAppBuilderTasksAssemblyPath>{WasmAppBuilderTasksAssemblyPath}</WasmAppBuilderTasksAssemblyPath>
<JsonToItemsTaskFactoryTasksAssemblyPath>{JsonToItemsTaskFactoryTasksAssemblyPath}</JsonToItemsTaskFactoryTasksAssemblyPath>
<MicrosoftNetCoreAppRuntimePackRidDir>{MicrosoftNetCoreAppRuntimePackRidDir}</MicrosoftNetCoreAppRuntimePackRidDir>
<RepositoryEngineeringDir>{RepositoryEngineeringDir}</RepositoryEngineeringDir>
<TargetFramework>{TestTargetFramework}</TargetFramework>
Expand Down
2 changes: 2 additions & 0 deletions eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@
.Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)')
.Replace('{RepositoryEngineeringDir}', '$(RepositoryEngineeringDir)')
.Replace('{MonoAOTCompilerDir}', '$(MonoAOTCompilerDir)')
.Replace('{JsonToItemsTaskFactoryDir}', '$(JsonToItemsTaskFactoryDir)')
.Replace('{MonoProjectRoot}', '$(MonoProjectRoot)')
.Replace('{MonoAOTCompilerTasksAssemblyPath}', '$(MonoAOTCompilerTasksAssemblyPath)')
.Replace('{JsonToItemsTaskFactoryTasksAssemblyPath}', '$(JsonToItemsTaskFactoryTasksAssemblyPath)')
.Replace('{WasmAppBuilderTasksAssemblyPath}', '$(WasmAppBuilderTasksAssemblyPath)')
.Replace('{MicrosoftNetCoreAppRuntimePackRidDir}', '$(MicrosoftNetCoreAppRuntimePackRidDir)'))"
Overwrite="true" />
Expand Down
9 changes: 9 additions & 0 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

<PublishingTestsRun>true</PublishingTestsRun>
<BundleTestAppTargets>BundleTestAppleApp;BundleTestAndroidApp</BundleTestAppTargets>

<!-- this catches the case when we are running tests, but not archiving them.
In case of archiving, the workload gets installed by code elsewhere -->
<InstallWorkloadForTesting Condition="'$(TestUsingWorkloads)' == 'true' and '$(ArchiveTests)' != 'true'">true</InstallWorkloadForTesting>
</PropertyGroup>

<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
Expand Down Expand Up @@ -291,5 +295,10 @@
AfterTargets="Build"
DependsOnTargets="Publish;$(BundleTestAppTargets);ArchiveTests" />

<Target Name="PrepareForTestUsingWorkloads"
BeforeTargets="Test"
DependsOnTargets="InstallWorkloadUsingArtifacts"
Condition="'$(InstallWorkloadForTesting)' == 'true'" />

<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(SkipImportRepoLinkerTargets)' != 'true'" />
</Project>
7 changes: 7 additions & 0 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
<BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn>
</PropertyGroup>

<ItemGroup>
<WorkloadIdForTesting Include="wasm-tools"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain"
Version="$(PackageVersion)"
VersionBand="$(SdkBandVersion)" />
</ItemGroup>

<Target Name="BundleTestWasmApp" DependsOnTargets="$(BundleTestWasmAppDependsOn)" />

<UsingTask Condition="'$(BuildAOTTestsOnHelix)' == 'true'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
<PlatformManifestFileEntry Include="pinvoke.c" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke.h" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-default.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="Emcc.props" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-props.json" IsNative="true" />
<!-- ICU-specific files -->
<PlatformManifestFileEntry Include="libicudata.a" IsNative="true" />
<PlatformManifestFileEntry Include="libicui18n.a" IsNative="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@
</PropertyGroup>

<ItemGroup>
<_ToolFile Include="$(MonoAotCrossDir)$(TargetCrossRid)\**" />
<NativeRuntimeAsset Include="@(_ToolFile)" TargetPath="tools/" />
<NativeRuntimeAsset Include="$(MonoAotCrossDir)$(TargetCrossRid).Sdk.props" TargetPath="Sdk/Sdk.props" />
<NativeRuntimeAsset Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Include="$(MonoAotCrossDir)Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml" TargetPath="data/UnixFilePermissions.xml" />
<NativeRuntimeAsset Include="$(IntermediateOutputPath)$(TargetCrossRid).Sdk.props" TargetPath="Sdk/Sdk.props" />
<NativeRuntimeAsset Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Include="$(IntermediateOutputPath)Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml" TargetPath="data/UnixFilePermissions.xml" />
</ItemGroup>

<Target Name="WriteTemplateFiles" BeforeTargets="ValidateProperties">
<PropertyGroup>
<AotCompilerPath Condition="'$(TestingWorkloads)' == 'true'">$(MonoAotCrossDir)</AotCompilerPath>
<AotCompilerPath Condition="'$(TestingWorkloads)' != 'true'">$(MonoAotCrossDir)$(TargetCrossRid)\</AotCompilerPath>
</PropertyGroup>

<ItemGroup>
<_ToolFile Include="$(AotCompilerPath)**" />
<NativeRuntimeAsset Include="@(_ToolFile)" TargetPath="tools/" />

<_SdkPropsProperties Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Include="ExeSuffix" Value="" />
<_SdkPropsProperties Condition="$([MSBuild]::IsOsPlatform('Windows'))" Include="ExeSuffix" Value=".exe" />
<_SdkPropsProperties Include="TargetRid" Value="$(TargetCrossRid)" />
Expand All @@ -36,19 +42,20 @@
<ItemGroup>
<_PermissionsProperties Include="PermissionsProperties" Value="$(_PermissionsFiles)" />
</ItemGroup>

<GenerateFileFromTemplate
Condition="!$([MSBuild]::IsOsPlatform('Windows'))"
TemplateFile="Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml.in"
Properties="@(_PermissionsProperties)"
OutputPath="$(MonoAotCrossDir)Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml" />
OutputPath="$(IntermediateOutputPath)Microsoft.NETCore.App.MonoCrossAOT.UnixFilePermissions.xml" />
<GenerateFileFromTemplate
TemplateFile="Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in"
Properties="@(_SdkPropsProperties)"
OutputPath="$(MonoAotCrossDir)$(TargetCrossRid).Sdk.props" />
OutputPath="$(IntermediateOutputPath)$(TargetCrossRid).Sdk.props" />
</Target>

<Target Name="ValidateProperties" BeforeTargets="GenerateNuspec">
<Target Name="ValidateProperties" BeforeTargets="GetFilesToPackage">
<Error Condition="'$(TargetCrossRid)' == ''" Text="TargetCrossRid not set" />
<Error Condition="!Exists('$(MonoAotCrossDir)$(TargetCrossRid)\$(AotCompilerFileName)')" Text="Cross compiler not found in $(MonoAotCrossDir)$(TargetCrossRid)" />
<Error Condition="!Exists('$(AotCompilerPath)$(AotCompilerFileName)')" Text="Cross compiler not found in $(AotCompilerPath). MonoAotCrossDir=$(MonoAotCrossDir)" />
</Target>
</Project>
7 changes: 7 additions & 0 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@
<MonoEnvOptions Condition="'$(MonoEnvOptions)' == '' and '$(TargetsMobile)' != 'true' and '$(MonoForceInterpreter)' == 'true'">--interpreter</MonoEnvOptions>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsMobile)' == 'true'">
<SdkPathForWorkloadTesting Condition="'$(SdkPathForWorkloadTesting)' == ''">$(ArtifactsBinDir)dotnet-workload\</SdkPathForWorkloadTesting>
<SdkPathForWorkloadTesting>$([MSBuild]::NormalizeDirectory($(SdkPathForWorkloadTesting)))</SdkPathForWorkloadTesting>

<SdkForWorkloadTestingStampPath>$(SdkPathForWorkloadTesting)version-$(SdkVersionForWorkloadTesting).stamp</SdkForWorkloadTestingStampPath>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)testing\tests.props" Condition="'$(EnableTestSupport)' == 'true'" />

<!-- Use msbuild path functions as that property is used in bash scripts. -->
Expand Down
Loading