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

Avoid special casing work items in sendtohelixhelp.proj #46315

Closed
wants to merge 11 commits into from
22 changes: 2 additions & 20 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@
<HelixCorrelationPayload Include="chromedriver" Uri="$(SeleniumUrl)" Condition="'$(TargetOS)' == 'Browser'" />

<_WorkItem Include="$(WorkItemArchiveWildCard)" Exclude="$(HelixCorrelationPayload)" />
<_WorkItem Include="$(TestArchiveRoot)runonly/**/console/*.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' != 'WasmTestOnBrowser'" />
<_WorkItem Include="$(TestArchiveRoot)runonly/**/browser/*.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'" />

<HelixWorkItem Include="@(_WorkItem -> '%(FileName)')">
<PayloadArchive>%(Identity)</PayloadArchive>
Expand All @@ -250,26 +252,6 @@
</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>
<!-- 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=$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output -- --run WasmSample.dll</Command>
</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>

<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
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'" >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do the same as we did for the console sample, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll push that one up too.

<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"
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
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
14 changes: 14 additions & 0 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 @@ -53,6 +54,19 @@
<Compile Include="Program.cs" />
</ItemGroup>

<Target Name="PrepareRunScript" BeforeTargets="CopySampleAppToHelixTestDir" Condition="'$(ArchiveTests)' == 'true'" >
<PropertyGroup>
<RunScriptCommand>
$HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run $(AssemblyName).dll
</RunScriptCommand>
</PropertyGroup>

<MSBuild Projects ="$(RepoRoot)eng/testing/tests.targets"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not import the tests.targets file and just set your target to depend on GenerateRunScript? Would that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the "tests.targets" file is imported into the project, there will be such error during build:
error MSB4011: "/runtime/src/mono/wasm/build/WasmApp.targets" cannot be imported again. It was already imported at "/runtime/src/mono/netcore/sample/wasm/console/WasmSample.csproj (73,3)". This is most likely a build authoring error. This subsequent import will be ignored.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... what you could do is remove the WasmApp.targets import in WasmSample.csproj and then that issue would be gone.

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

Condition="'$(ArchiveTests)' == 'true'"
Properties="OutDir=$(AppBundleDir);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