Skip to content

Commit

Permalink
Run wasm console sample on Helix (#45768)
Browse files Browse the repository at this point in the history
- Included the WASM console sample project to the library test build. The sample can still be built/run locally using make file.
- Added zipping/copying the sample application to helix directory from where it can be consumed by CI.
- To run on Helix, tried to use a simple helix work item which wouldn't rely on generated RunTests.sh and just call the xharness command directly.  

Relates to #43865
  • Loading branch information
MaximLipnin authored Dec 16, 2020
1 parent f1876c2 commit 78efb92
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@
</HelixWorkItem>
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser'">
<!-- Create a work item for run-only WASM apps -->
<_RunOnlyWorkItem Include="$(TestArchiveRoot)runonly/**/*.zip" />
<HelixWorkItem Include="@(_RunOnlyWorkItem -> '%(FileName)')" >
<PayloadArchive>%(Identity)</PayloadArchive>
<!-- No RunTests script generated for the sample project so we just use the direct command -->
<Command>dotnet exec $XHARNESS_CLI_PATH wasm $XHARNESS_COMMAND --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=runtime.js --output-directory=$XHARNESS_OUT -- --run WasmSample.dll</Command>
</HelixWorkItem>
</ItemGroup>

<Message Condition="'$(Scenario)' != ''" Importance="High" Text="Done building Helix work items for scenario $(Scenario). Work item count: @(_WorkItem->Count())" />
<Message Condition="'$(Scenario)' == '' and ('$(TargetOS)' == 'Android' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS')" Importance="High" Text="Done building Helix work items. Work item count: @(XHarnessAppBundleToTest->Count())" />
<Message Condition="'$(Scenario)' == '' and '$(TargetOS)' != 'Android' and '$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'tvOS'" Importance="High" Text="Done building Helix work items. Work item count: @(_WorkItem->Count())" />
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
<ProjectReference Include="..\mono\netcore\sample\iOS\Program.csproj"
BuildInParallel="false"
Condition="'$(ArchiveTests)' == 'true' and ('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS')" />
<ProjectReference Include="..\mono\netcore\sample\wasm\console\WasmSample.csproj"
BuildInParallel="false"
Condition="'$(ArchiveTests)' == 'true' and '$(TargetOS)' == 'Browser'" />
</ItemGroup>

<Target Name="GenerateMergedCoverageReport"
Expand Down
19 changes: 18 additions & 1 deletion src/mono/netcore/sample/wasm/console/WasmSample.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="WasmBuildApp">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputPath>bin</OutputPath>
Expand Down Expand Up @@ -116,5 +116,22 @@
<Compile Include="Program.cs" />
</ItemGroup>

<Target Name="CopySampleAppToHelixTestDir"
Condition="'$(ArchiveTests)' == 'true'"
AfterTargets="Build"
DependsOnTargets="Publish" >
<PropertyGroup>
<!-- Helix properties -->
<!-- AnyCPU as Platform-->
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
<HelixArchiveRoot>$(ArtifactsDir)helix/</HelixArchiveRoot>
<HelixArchiveRunOnlyRoot>$(HelixArchiveRoot)runonly/</HelixArchiveRunOnlyRoot>
<HelixArchiveRunOnlyAppsDir>$(HelixArchiveRunOnlyRoot)$(OSPlatformConfig)/</HelixArchiveRunOnlyAppsDir>
<ZippedApp>$(OutputPath)/WasmConsoleSample.zip</ZippedApp>
</PropertyGroup>
<ZipDirectory SourceDirectory="$(AppDir)" DestinationFile="$(ZippedApp)" />
<Copy SourceFiles="$(ZippedApp)" DestinationFolder="$(HelixArchiveRunOnlyAppsDir)" />
</Target>

<Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.targets" />
</Project>

0 comments on commit 78efb92

Please sign in to comment.