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] Add support for per-project customization of helix work items #70461

Merged
merged 20 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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 eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,8 @@
<RunScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( call npm ci )" />
</ItemGroup>
</Target>

<Target Name="DeployHelixTargetsFile" AfterTargets="ArchiveTests" Condition="'$(HelixTargetsFile)' != ''">
<Copy SourceFiles="$(HelixTargetsFile)" DestinationFiles="$(TestArchiveTestsDir)$(TestProjectName).helix.targets" SkipUnchangedFiles="true" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableLibraryImportGenerator>true</EnableLibraryImportGenerator>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<Scenario>WasmTestOnBrowser</Scenario>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --web-server-use-cop</WasmXHarnessArgs>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'Android'">
<UseAndroidCrypto>true</UseAndroidCrypto>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project>
<PropertyGroup>
<_CryptoProjectName>System.Security.Cryptography.Tests</_CryptoProjectName>
<System_Security_Cryptography_Tests_TargetName Condition="'$(Scenario)' == 'WasmTestOnBrowser'">System_Security_Cryptography_Tests_Target</System_Security_Cryptography_Tests_TargetName>
</PropertyGroup>

<Target Name="System_Security_Cryptography_Tests_Target">
<ItemGroup>
<HelixWorkItem Include="$(Scenario)-managed-$(_CryptoProjectName)">
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
</HelixWorkItem>

<HelixWorkItem Include="$(Scenario)-subtlecrypto-System.Security.Cryptography.Tests">
radical marked this conversation as resolved.
Show resolved Hide resolved
<PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>

<PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=%WasmXHarnessArgs% --web-server-use-cop&quot;</PreCommands>
<PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=$WasmXHarnessArgs --web-server-use-cop&quot;</PreCommands>
</HelixWorkItem>
</ItemGroup>
</Target>
</Project>
33 changes: 32 additions & 1 deletion src/libraries/sendtohelix-wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<BuildHelixWorkItemsDependsOn>$(BuildHelixWorkItemsDependsOn);StageEmSdkForHelix;PrepareForBuildHelixWorkItems_Wasm</BuildHelixWorkItemsDependsOn>
<BuildHelixWorkItemsDependsOn Condition="'$(WindowsShell)' != 'true'">$(BuildHelixWorkItemsDependsOn);DownloadFirefoxToSendToHelix</BuildHelixWorkItemsDependsOn>
<IncludeHelixCorrelationPayload>false</IncludeHelixCorrelationPayload>
<EnableDefaultBuildHelixWorkItems Condition="'$(IsRunningLibraryTests)' != 'true'">false</EnableDefaultBuildHelixWorkItems>
<EnableDefaultBuildHelixWorkItems>false</EnableDefaultBuildHelixWorkItems>

<BuildWasmAppsJobsList>$(RepositoryEngineeringDir)\testing\scenarios\BuildWasmAppsJobsList.txt</BuildWasmAppsJobsList>

Expand All @@ -32,6 +32,8 @@
<IncludeNodePayload Condition="'$(NeedsEMSDKNode)' == 'true' and '$(NeedsEMSDK)' != 'true'">true</IncludeNodePayload>
</PropertyGroup>

<Import Condition="'$(IsRunningLibraryTests)' == 'true'" Project="$(TestArchiveTestsDir)*.helix.targets" />

<PropertyGroup>
<_HelixLocalNodePath Condition="'$(NeedsEMSDKNode)' == 'true' and '$(WindowsShell)' != 'true'">$HELIX_CORRELATION_PAYLOAD/build/emsdk-node</_HelixLocalNodePath>
<_HelixLocalNodePath Condition="'$(NeedsEMSDKNode)' == 'true' and '$(WindowsShell)' == 'true'">%HELIX_CORRELATION_PAYLOAD%\build\emsdk-node</_HelixLocalNodePath>
Expand Down Expand Up @@ -194,7 +196,27 @@
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
</HelixWorkItem>

<!-- collect the targets files for the tests -->
<_TestWithCustomTarget Include="$(TestArchiveTestsDir)\*.helix.targets" />
<_TestWithCustomTarget
TestName="$([System.IO.Path]::GetFileNameWithoutExtension(%(FileName)))"
ArchivePath="$([System.String]::new(%(Identity)).Replace('.helix.targets', '.zip'))" />

<!-- construct the property name that will contain the target to call for adding
helix items -->
<_TestWithCustomTarget PropertyName="$([System.String]::new(%(TestName)).Replace('.', '_').Replace('-', '_'))_TargetName" />
radical marked this conversation as resolved.
Show resolved Hide resolved

<!-- Remove any empty ones. This can happen if the targets file wants to use the default
items. For example, it might want to add custom helix items only for a nodejs scenario -->
<_TestWithCustomTarget Remove="@(_TestWithCustomTarget)" Condition="'$(%(_TestWithCustomTarget.PropertyName))' == ''" />
</ItemGroup>
<Message Text="_TestWithCustomTarget: %(_TestWithCustomTarget.Identity) prop: %(_TestWithCustomTarget.PropertyName) archivePath: %(_TestWithCustomTarget.ArchivePath) tname: %(_TestWithCustomTarget.TestName)" />
radical marked this conversation as resolved.
Show resolved Hide resolved

<CallTarget Condition="'$(IsRunningLibraryTests)' == 'true'"
RunEachTargetSeparately="true"
Targets="$(%(_TestWithCustomTarget.PropertyName))">
</CallTarget>

<!-- for testing with workloads, we use separate items -->
<ItemGroup Condition="'$(Scenario)' == 'BuildWasmApps'">
Expand Down Expand Up @@ -232,6 +254,15 @@
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
</HelixWorkItem>

<_DefaultWorkItems Include="$(WorkItemArchiveWildCard)" Exclude="$(HelixCorrelationPayload);@(_TestWithCustomTarget->'%(ArchivePath)')" />

<HelixWorkItem Include="@(_DefaultWorkItems -> '$(WorkItemPrefix)%(FileName)')">
<PayloadArchive>%(Identity)</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
</HelixWorkItem>

</ItemGroup>
</Target>

Expand Down