Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Jain <radical@gmail.com>2022-06-17 23:24:28 +0300
committerGitHub <noreply@github.com>2022-06-17 23:24:28 +0300
commit2627ea380eb43eb532b19b1ab427a5bbb32bc39f (patch)
treeae8a10c43ecee340958955306cfd497d49e66968 /eng/testing
parent41d9c1cc0dca16743a54971930e81d60777af746 (diff)
[wasm] Add support for per-project customization of helix work items (#70461)
* [wasm] Add support for per-project customization of helix work items Currently, for sending tests to helix: 1. the project binaries are zipped, as part of the project build 2. then separate helix targets files build that adds helix items for those zip files. - for wasm, we test with multiple 'scenarios' - like v8, browser, and nodejs. - so, 3 helix work items are submitted per zip file - If a test project needs to have any customizations, for example, for testing crypto with a managed implementation, and subtlecrypto, which would require: - passing different arguments to xharness, in case of managed, and subtlecrypto - and this should be done only for the browser case - Currently, this would need this would need to be done in `sendtohelix-wasm.targets` special casing for the test project, and scenario. - We add support for importing `$(ProjectName).helix.targets`, and calling a special target in that to add helix items, as needed. - This targets file can be set in the test project like: ```xml <HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile> ``` - it will get deployed next to the zip file, and picked up automatically ```xml <Project> <PropertyGroup> <_CryptoProjectName>System.Security.Cryptography.Tests</_CryptoProjectName> <System_Security_Cryptography_Tests_TargetName Condition="'$(Scenario))' == 'WasmTestOnBrowser'">System_Security_Cryptography_Tests_Targ et</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"> <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive> <Command>$(HelixCommand)</Command> <Timeout>$(_workItemTimeout)</Timeout> <PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands> <PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands> </HelixWorkItem> </ItemGroup> </Target> ``` - The targets file *must* have these: - a property named like `System_Security_Cryptography_Tests_TargetName`, for a test project named `System.Security.Cryptography.Tests` - if this property is not set, then the default behavior of adding work items will run - The target should add any items it needs to to `@(HelixWorkItem)`. - Examples of adding these can be seen in `sendtohelix*` project files - Remember that all these properties, and targets get imported into the msbuild *global* namespace, so make sure to use unique names to avoid conflicts with other test projects. Future work: this commit only enables it for wasm/library tests, but it should be easy to extract it out, but needs some testing. * [wasm] Helix: test with, and without subtle crypto * disable non-wasm builds * address review feedback * Address review feedback * Fix typo * Revert "disable non-wasm builds" This reverts commit 7ef99e81f82200189dd3f61eeaf00d6ca4ced6d4. * Update src/libraries/System.Security.Cryptography/tests/wasm.helix.targets Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> * Address review feedback * remove debug spew * Change the way helix extension targets are discovered. The new approach: To run a custom project specific target for adding/editing @(HelixWorkItem): - In the project add: `<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>` - This file gets copied next to the test archive as $(MSBuildProjectName).helix.targets - In this `wasm.helix.targets` file, add to $(HelixExtensionTargets) to run your custom target ```xml <PropertyGroup Condition="'$(IsRunningLibraryTests)' == 'true' and '$(Scenario)' == 'WasmTestOnBrowser'"> <HelixExtensionTargets>$(HelixExtensionTargets);_AddHelixCrypoItems</HelixExtensionTargets> ``` - The extension target will be called after the default items are added to `@(HelixWorkItem)`. - Useful properties to condition on: $(Scenario), $(IsRunningLibraryTests) - And add to, change, or remove from @(HelixWorkItem) Example: ```xml <Target Name="_AddHelixCrypoItems"> <ItemGroup> <!-- remove the existing item --> <HelixWorkItem Remove="@(HelixWorkItem)" Condition="'%(OriginalFileName)' == '$(_CryptoProjectName)'" /> <!-- add two new ones - managed, and subtylecrypto --> <HelixWorkItem Include="$(WorkItemPrefix)managed-$(_CryptoProjectName)"> <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive> <Command>$(HelixCommand)</Command> <Timeout>$(_workItemTimeout)</Timeout> <OriginalFileName>$(_CryptoProjectName)</OriginalFileName> </HelixWorkItem> <HelixWorkItem Include="$(WorkItemPrefix)subtlecrypto-$(_CryptoProjectName)"> <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive> <Command>$(HelixCommand)</Command> <Timeout>$(_workItemTimeout)</Timeout> <OriginalFileName>$(_CryptoProjectName)</OriginalFileName> <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> <_CryptoHelixItem Include="@(HelixWorkItem)" Condition="$([System.String]::new('%(HelixWorkItem.Identity)').EndsWith('-$(_CryptoProjectName)'))" /> </ItemGroup> <Error Text="Something went wrong. Expected to have only two work items for $(_CryptoProjectName). But got @(_CryptoHelixItem)" Condition="@(_CryptoHelixItem->Count()) != 2" /> </Target> ``` * cleanup * Move WBT specific stuff into the target too. This will make it simpler to move it off into a targets file later * fix build * fix libtests * fix wbt * [wasm] Bump helix timeout to 90mins for debugger tests on windows Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Diffstat (limited to 'eng/testing')
-rw-r--r--eng/testing/tests.wasm.targets4
1 files changed, 4 insertions, 0 deletions
diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets
index 9a915de0918..4c5310cb696 100644
--- a/eng/testing/tests.wasm.targets
+++ b/eng/testing/tests.wasm.targets
@@ -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>