Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion docs/workflow/testing/libraries/testing-wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ e.g. for V8
```bash
PATH=/Users/<your_user>/.jsvu/:$PATH V8
```
### Using NodeJS
To run in NodeJS you will need to have both [NodeJS and NPM](https://nodejs.org/en/download/) installed and added to your PATH.
The minimum supported version is v14.

### Using Browser Instance
It's possible to run tests in a browser instance:
Expand Down Expand Up @@ -56,8 +59,10 @@ and even run tests one by one for each library:
./build.sh libs.tests -test -os Browser -c Release
```

**Note:** To use the Node environment append the following switches to your commands `/p:ForNode=true /p:JSEngine=NodeJS`. The first make the build to build for Node and the second will make make the test runner (XHarness) use the NodeJS engine.

### Running individual test suites using JavaScript engine
The following shows how to run tests for a specific library
The following shows how to run tests for a specific library on v8
```
./dotnet.sh build /t:Test src/libraries/System.AppContext/tests /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release
```
Expand All @@ -80,6 +85,7 @@ At the moment supported values are:
- `V8`
- `JavaScriptCore`
- `SpiderMonkey`
- `NodeJS` (will also require you to add the `/p:ForNode=true` and `/p:JSEngine=NodeJS` switches to work properly)

By default, `V8` engine is used.

Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
targetRid: browser-wasm
platform: Browser_wasm
container:
image: ubuntu-18.04-webassembly-20210531091624-f5c7a43
image: ubuntu-18.04-webassembly-20210707133424-12f133e
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ parameters:
runtimeFlavorDisplayName: 'CoreCLR'
runtimeVariant: ''
shouldContinueOnError: false
forNode: ''


steps:
- template: send-to-helix-inner-step.yml
parameters:
osGroup: ${{ parameters.osGroup }}
restoreParams: /p:DotNetPublishToBlobFeed=true -restore -projects $(Build.SourcesDirectory)$(dir)eng$(dir)empty.csproj
sendParams: ${{ parameters.helixProjectArguments }} /maxcpucount /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }}
sendParams: ${{ parameters.helixProjectArguments }} /maxcpucount /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }} /p:ForNode=${{ parameters.forNode }}
condition: and(succeeded(), ${{ parameters.condition }})
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
displayName: ${{ parameters.displayName }}
Expand All @@ -59,6 +60,7 @@ steps:
_TimeoutPerTestInMinutes: ${{ parameters.timeoutPerTestInMinutes }}
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
_RuntimeVariant: ${{ parameters.runtimeVariant }}
ForNode: ${{ parameters.forNode }}
${{ if eq(parameters.publishTestResults, 'true') }}:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ parameters:
enableMicrobuild: ''
gatherAssetManifests: false
shouldContinueOnError: false

forNode: ''

steps:
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) /p:RuntimeVariant=monointerpreter /p:LibrariesConfiguration=${{ parameters.buildConfig }} -ci -excludemonofailures os Browser wasm $(buildConfigUpper)
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) /p:RuntimeVariant=monointerpreter /p:LibrariesConfiguration=${{ parameters.buildConfig }} -ci -excludemonofailures os Browser wasm $(buildConfigUpper) /p:ForNode=${{ parameters.forNode }}
displayName: Build Tests

# Send tests to Helix
Expand All @@ -46,6 +46,7 @@ steps:
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
forNode: ${{ parameters.forNode }}

${{ if eq(variables['System.TeamProject'], 'public') }}:
creator: $(Build.DefinitionName)
Expand Down
18 changes: 18 additions & 0 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ stages:
extraStepsParameters:
name: MonoRuntimePacks

#
# Build Mono runtime packs for NodeJS
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: release
runtimeFlavor: mono
platforms:
- Browser_wasm
jobParameters:
buildArgs: -s mono+libs+host+packs+mono.mscordbi -c $(_BuildConfig) /p:ForNode=true
nameSuffix: AllSubsets_Mono_NodeJS
isOfficialBuild: ${{ variables.isOfficialBuild }}
extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
extraStepsParameters:
name: MonoRuntimePacks

# Build Mono AOT offset headers once, for consumption elsewhere
#
- template: /eng/pipelines/common/platform-matrix.yml
Expand Down
164 changes: 164 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,47 @@ jobs:
eq(variables['monoContainsChange'], true),
eq(variables['installerContainsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Build the whole product using Mono and run libraries tests, multi-scenario for NodeJS
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- Browser_wasm
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono_NodeJS
buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:ForNode=true /p:JSEngine=NodeJS
timeoutInMinutes: 180
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isFullMatrix'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:ForNode=true /p:JSEngine=NodeJS
scenarios:
- normal
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
eq(variables['isFullMatrix'], true))

#
# Build for Browser/wasm, with EnableAggressiveTrimming=true
Expand Down Expand Up @@ -394,6 +435,48 @@ jobs:
eq(variables['monoContainsChange'], true),
eq(variables['isFullMatrix'], true))

#
# Build for Browser/wasm, with EnableAggressiveTrimming=true for NodeJS
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- Browser_wasm
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono_EAT_NodeJS
buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=false /p:ForNode=true /p:JSEngine=NodeJS
timeoutInMinutes: 180
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isFullMatrix'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:ForNode=true /p:JSEngine=NodeJS
scenarios:
- normal
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
eq(variables['isFullMatrix'], true))

#
# Build for Browser/wasm with RunAOTCompilation=true
#
Expand Down Expand Up @@ -436,6 +519,48 @@ jobs:
eq(variables['monoContainsChange'], true),
eq(variables['isFullMatrix'], true))

#
# Build for Browser/wasm with RunAOTCompilation=true for NodeJS
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- Browser_wasm
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono_AOT_NodeJS
buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true /p:ForNode=true /p:JSEngine=NodeJS
timeoutInMinutes: 180
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isFullMatrix'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:ForNode=true /p:JSEngine=NodeJS
scenarios:
- normal
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
eq(variables['isFullMatrix'], true))

# Build and test libraries under single-file publishing
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
Expand Down Expand Up @@ -496,6 +621,45 @@ jobs:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)

#
# Build the whole product using Mono and run runtime tests for NodeJS
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- Browser_wasm
variables:
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- name: _HelixSource
value: pr/dotnet/runtime/$(Build.SourceBranch)
- ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- name: _HelixSource
value: ci/dotnet/runtime/$(Build.SourceBranch)
- name: timeoutPerTestInMinutes
value: 10
- name: timeoutPerTestCollectionInMinutes
value: 200
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono_RuntimeTests_NodeJS
buildArgs: -s mono+libs -c $(_BuildConfig) /p:ForNode=true
timeoutInMinutes: 180
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(variables['isFullMatrix'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
forNode: true

#
# Build the whole product using Mono for Android and run runtime tests with Android emulator
#
Expand Down
2 changes: 1 addition & 1 deletion eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">WasmTestRunner.dll</WasmMainAssemblyFileName>
<WasmMainJSPath Condition="'$(WasmMainJSPath)' == ''">$(MonoProjectRoot)\wasm\runtime-test.js</WasmMainJSPath>
<WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization>
<WasmGenerateRunV8Script>true</WasmGenerateRunV8Script>
<WasmGenerateRunScript>true</WasmGenerateRunScript>
<WasmNativeStrip>false</WasmNativeStrip>

<WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
Expand Down
9 changes: 5 additions & 4 deletions src/libraries/sendtohelix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
Creator=$(Creator);
HelixAccessToken=$(HelixAccessToken);
HelixTargetQueues=$(HelixTargetQueues);
BuildTargetFramework=$(BuildTargetFramework)
BuildTargetFramework=$(BuildTargetFramework);
ForNode=$(ForNode)
</_PropertiesToPass>
</PropertyGroup>

Expand Down Expand Up @@ -111,7 +112,7 @@

<ItemGroup>
<_ProjectsToBuild Include="$(RepoRoot)\src\tests\Common\testenvironment.proj">
<Properties>Scenario=$(Scenario);TestEnvFileName=$(TestEnvFilePath);TargetsWindows=$(TargetsWindows)</Properties>
<Properties>Scenario=$(Scenario);TestEnvFileName=$(TestEnvFilePath);TargetsWindows=$(TargetsWindows);ForNode=$(ForNode)</Properties>
</_ProjectsToBuild>
</ItemGroup>

Expand All @@ -130,11 +131,11 @@
<ItemGroup>
<_Scenario Include="$(Scenarios.Split(','))" />
<_ProjectsToBuild Include="$(MSBuildProjectFile)">
<AdditionalProperties>Scenario=%(_Scenario.Identity)</AdditionalProperties>
<AdditionalProperties>Scenario=%(_Scenario.Identity);ForNode=$(ForNode)</AdditionalProperties>
</_ProjectsToBuild>
</ItemGroup>

<MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true" />
<MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true"/>
</Target>

<Target Name="_CollectRuntimeInputs">
Expand Down
Loading