Skip to content

Commit

Permalink
Update wasm samples to use run script
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximLipnin committed Dec 22, 2020
1 parent 0c122fe commit e9d4bf4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,19 @@
</HelixWorkItem>
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' != 'WasmTestOnBrowser'">
<!-- Create a work item for run-only WASM console app -->
<_RunOnlyWorkItem Include="$(TestArchiveRoot)runonly/**/console/*.zip" />
<HelixWorkItem Include="@(_RunOnlyWorkItem -> '%(FileName)')" >
<PayloadArchive>%(Identity)</PayloadArchive>
</HelixWorkItem>
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'">
<!-- Create a work item for run-only WASM browser app -->
<_RunOnlyWorkItem Include="$(TestArchiveRoot)runonly/**/browser/*.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=. --browser=Chrome --html-file=index.html --output-directory=$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output -- WasmSample.dll --testing</Command>
</HelixWorkItem>
</ItemGroup>

Expand Down
13 changes: 13 additions & 0 deletions src/mono/netcore/sample/wasm/browser/WasmSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@
</Content>
</ItemGroup>

<Target Name="PrepareRunScript" BeforeTargets="CopySampleAppToHelixTestDir" Condition="'$(ArchiveTests)' == 'true'" >
<PropertyGroup>
<RunScriptCommand>
$HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --browser=Chrome --html-file=index.html --output-directory=$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output -- WasmSample.dll --testing
</RunScriptCommand>
</PropertyGroup>

<MSBuild Projects ="$(RepoRoot)eng/testing/tests.targets"
Condition="'$(ArchiveTests)' == 'true'"
Properties="OutDir=$(AppDir);RunScriptInputPath=$(RepoRoot)eng/testing/WasmRunnerTemplate.sh;InstallerTasksAssemblyPath=$(RepoRoot)artifacts/obj/installer.tasks/Debug/netstandard2.0/installer.tasks.dll;RunScriptCommand=$(RunScriptCommand)"
Targets="GenerateRunScript" />
</Target>

<Target Name="CopySampleAppToHelixTestDir"
Condition="'$(ArchiveTests)' == 'true'"
AfterTargets="Build"
Expand Down
7 changes: 5 additions & 2 deletions src/mono/netcore/sample/wasm/console/WasmSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<RunAOTCompilation Condition="'$(RunAOTCompilation)' == ''">false</RunAOTCompilation>
<RunAnalyzers>false</RunAnalyzers>
<JSEngine>V8</JSEngine>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
Expand Down Expand Up @@ -56,7 +57,7 @@
<Target Name="PrepareRunScript" BeforeTargets="CopySampleAppToHelixTestDir" Condition="'$(ArchiveTests)' == 'true'" >
<PropertyGroup>
<RunScriptCommand>
TEST_NAME=WasmConsoleSample%0aTARGET_OS=Browser%0aTARGET_ARCH=wasm%0a$HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=V8 $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run $(AssemblyName).dll
$HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run $(AssemblyName).dll
</RunScriptCommand>
</PropertyGroup>

Expand All @@ -75,10 +76,12 @@
<!-- AnyCPU as Platform-->
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
<HelixArchiveRoot>$(ArtifactsDir)helix/</HelixArchiveRoot>
<HelixArchiveRunOnlyRoot>$(HelixArchiveRoot)runonly/</HelixArchiveRunOnlyRoot>
<HelixArchiveRunOnlyAppsDir>$(HelixArchiveRunOnlyRoot)$(OSPlatformConfig)/console/</HelixArchiveRunOnlyAppsDir>
<ZippedApp>$(OutputPath)/WasmConsoleSample.zip</ZippedApp>
</PropertyGroup>
<ZipDirectory SourceDirectory="$(AppBundleDir)" DestinationFile="$(ZippedApp)" />
<Copy SourceFiles="$(ZippedApp)" DestinationFolder="$(HelixArchiveRoot)tests/$(OSPlatformConfig)/" />
<Copy SourceFiles="$(ZippedApp)" DestinationFolder="$(HelixArchiveRunOnlyAppsDir)" />
</Target>

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

0 comments on commit e9d4bf4

Please sign in to comment.