Skip to content

Commit 8600ffc

Browse files
committed
rebase
1 parent 3bed537 commit 8600ffc

34 files changed

+769
-273
lines changed

docs/workflow/testing/libraries/testing-wasm.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ e.g. for V8
2424
```bash
2525
PATH=/Users/<your_user>/.jsvu/:$PATH V8
2626
```
27+
### Using NodeJS
28+
To run in NodeJS you will need to have both [NodeJS and NPM](https://nodejs.org/en/download/) installed and added to your PATH.
29+
The minimum supported version is v14.
2730

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

62+
**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.
63+
5964
### Running individual test suites using JavaScript engine
60-
The following shows how to run tests for a specific library
65+
The following shows how to run tests for a specific library on v8
6166
```
6267
./dotnet.sh build /t:Test src/libraries/System.AppContext/tests /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release
6368
```
@@ -80,6 +85,7 @@ At the moment supported values are:
8085
- `V8`
8186
- `JavaScriptCore`
8287
- `SpiderMonkey`
88+
- `NodeJS` (will also require you to add the `/p:ForNode=true` and `/p:JSEngine=NodeJS` switches to work properly)
8389

8490
By default, `V8` engine is used.
8591

eng/pipelines/common/platform-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
targetRid: browser-wasm
224224
platform: Browser_wasm
225225
container:
226-
image: ubuntu-18.04-webassembly-20210531091624-f5c7a43
226+
image: ubuntu-18.04-webassembly-20210707133424-12f133e
227227
registry: mcr
228228
jobParameters:
229229
runtimeFlavor: ${{ parameters.runtimeFlavor }}

eng/pipelines/common/templates/runtimes/send-to-helix-step.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ parameters:
2727
runtimeFlavorDisplayName: 'CoreCLR'
2828
runtimeVariant: ''
2929
shouldContinueOnError: false
30+
forNode: ''
3031

3132

3233
steps:
3334
- template: send-to-helix-inner-step.yml
3435
parameters:
3536
osGroup: ${{ parameters.osGroup }}
3637
restoreParams: /p:DotNetPublishToBlobFeed=true -restore -projects $(Build.SourcesDirectory)$(dir)eng$(dir)empty.csproj
37-
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 }}
38+
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 }}
3839
condition: and(succeeded(), ${{ parameters.condition }})
3940
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
4041
displayName: ${{ parameters.displayName }}
@@ -59,6 +60,7 @@ steps:
5960
_TimeoutPerTestInMinutes: ${{ parameters.timeoutPerTestInMinutes }}
6061
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
6162
_RuntimeVariant: ${{ parameters.runtimeVariant }}
63+
ForNode: ${{ parameters.forNode }}
6264
${{ if eq(parameters.publishTestResults, 'true') }}:
6365
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
6466
# TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed

eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ parameters:
2929
enableMicrobuild: ''
3030
gatherAssetManifests: false
3131
shouldContinueOnError: false
32-
32+
forNode: ''
3333

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

3838
# Send tests to Helix
@@ -46,6 +46,7 @@ steps:
4646
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
4747
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
4848
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
49+
forNode: ${{ parameters.forNode }}
4950

5051
${{ if eq(variables['System.TeamProject'], 'public') }}:
5152
creator: $(Build.DefinitionName)

eng/pipelines/runtime-official.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,24 @@ stages:
147147
extraStepsParameters:
148148
name: MonoRuntimePacks
149149

150+
#
151+
# Build Mono runtime packs for NodeJS
152+
#
153+
- template: /eng/pipelines/common/platform-matrix.yml
154+
parameters:
155+
jobTemplate: /eng/pipelines/common/global-build-job.yml
156+
buildConfig: release
157+
runtimeFlavor: mono
158+
platforms:
159+
- Browser_wasm
160+
jobParameters:
161+
buildArgs: -s mono+libs+host+packs+mono.mscordbi -c $(_BuildConfig) /p:ForNode=true
162+
nameSuffix: AllSubsets_Mono_NodeJS
163+
isOfficialBuild: ${{ variables.isOfficialBuild }}
164+
extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
165+
extraStepsParameters:
166+
name: MonoRuntimePacks
167+
150168
# Build Mono AOT offset headers once, for consumption elsewhere
151169
#
152170
- template: /eng/pipelines/common/platform-matrix.yml

eng/pipelines/runtime.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,47 @@ jobs:
351351
eq(variables['monoContainsChange'], true),
352352
eq(variables['installerContainsChange'], true),
353353
eq(variables['isFullMatrix'], true))
354+
#
355+
# Build the whole product using Mono and run libraries tests, multi-scenario for NodeJS
356+
#
357+
- template: /eng/pipelines/common/platform-matrix.yml
358+
parameters:
359+
jobTemplate: /eng/pipelines/common/global-build-job.yml
360+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
361+
buildConfig: Release
362+
runtimeFlavor: mono
363+
platforms:
364+
- Browser_wasm
365+
variables:
366+
# map dependencies variables to local variables
367+
- name: librariesContainsChange
368+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
369+
- name: monoContainsChange
370+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
371+
jobParameters:
372+
testGroup: innerloop
373+
nameSuffix: AllSubsets_Mono_NodeJS
374+
buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:ForNode=true /p:JSEngine=NodeJS
375+
timeoutInMinutes: 180
376+
condition: >-
377+
or(
378+
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
379+
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
380+
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
381+
eq(variables['isFullMatrix'], true))
382+
# extra steps, run tests
383+
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
384+
extraStepsParameters:
385+
creator: dotnet-bot
386+
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
387+
extraHelixArguments: /p:ForNode=true /p:JSEngine=NodeJS
388+
scenarios:
389+
- normal
390+
condition: >-
391+
or(
392+
eq(variables['librariesContainsChange'], true),
393+
eq(variables['monoContainsChange'], true),
394+
eq(variables['isFullMatrix'], true))
354395
355396
#
356397
# Build for Browser/wasm, with EnableAggressiveTrimming=true
@@ -394,6 +435,48 @@ jobs:
394435
eq(variables['monoContainsChange'], true),
395436
eq(variables['isFullMatrix'], true))
396437
438+
#
439+
# Build for Browser/wasm, with EnableAggressiveTrimming=true for NodeJS
440+
#
441+
- template: /eng/pipelines/common/platform-matrix.yml
442+
parameters:
443+
jobTemplate: /eng/pipelines/common/global-build-job.yml
444+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
445+
buildConfig: Release
446+
runtimeFlavor: mono
447+
platforms:
448+
- Browser_wasm
449+
variables:
450+
# map dependencies variables to local variables
451+
- name: librariesContainsChange
452+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
453+
- name: monoContainsChange
454+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
455+
jobParameters:
456+
testGroup: innerloop
457+
nameSuffix: AllSubsets_Mono_EAT_NodeJS
458+
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
459+
timeoutInMinutes: 180
460+
condition: >-
461+
or(
462+
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
463+
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
464+
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
465+
eq(variables['isFullMatrix'], true))
466+
# extra steps, run tests
467+
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
468+
extraStepsParameters:
469+
creator: dotnet-bot
470+
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
471+
extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:ForNode=true /p:JSEngine=NodeJS
472+
scenarios:
473+
- normal
474+
condition: >-
475+
or(
476+
eq(variables['librariesContainsChange'], true),
477+
eq(variables['monoContainsChange'], true),
478+
eq(variables['isFullMatrix'], true))
479+
397480
#
398481
# Build for Browser/wasm with RunAOTCompilation=true
399482
#
@@ -436,6 +519,48 @@ jobs:
436519
eq(variables['monoContainsChange'], true),
437520
eq(variables['isFullMatrix'], true))
438521
522+
#
523+
# Build for Browser/wasm with RunAOTCompilation=true for NodeJS
524+
#
525+
- template: /eng/pipelines/common/platform-matrix.yml
526+
parameters:
527+
jobTemplate: /eng/pipelines/common/global-build-job.yml
528+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
529+
buildConfig: Release
530+
runtimeFlavor: mono
531+
platforms:
532+
- Browser_wasm
533+
variables:
534+
# map dependencies variables to local variables
535+
- name: librariesContainsChange
536+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
537+
- name: monoContainsChange
538+
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
539+
jobParameters:
540+
testGroup: innerloop
541+
nameSuffix: AllSubsets_Mono_AOT_NodeJS
542+
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
543+
timeoutInMinutes: 180
544+
condition: >-
545+
or(
546+
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
547+
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
548+
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
549+
eq(variables['isFullMatrix'], true))
550+
# extra steps, run tests
551+
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
552+
extraStepsParameters:
553+
creator: dotnet-bot
554+
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
555+
extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:ForNode=true /p:JSEngine=NodeJS
556+
scenarios:
557+
- normal
558+
condition: >-
559+
or(
560+
eq(variables['librariesContainsChange'], true),
561+
eq(variables['monoContainsChange'], true),
562+
eq(variables['isFullMatrix'], true))
563+
439564
# Build and test libraries under single-file publishing
440565
- template: /eng/pipelines/common/platform-matrix.yml
441566
parameters:
@@ -496,6 +621,45 @@ jobs:
496621
creator: dotnet-bot
497622
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
498623

624+
#
625+
# Build the whole product using Mono and run runtime tests for NodeJS
626+
#
627+
- template: /eng/pipelines/common/platform-matrix.yml
628+
parameters:
629+
jobTemplate: /eng/pipelines/common/global-build-job.yml
630+
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
631+
buildConfig: Release
632+
runtimeFlavor: mono
633+
platforms:
634+
- Browser_wasm
635+
variables:
636+
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
637+
- name: _HelixSource
638+
value: pr/dotnet/runtime/$(Build.SourceBranch)
639+
- ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
640+
- name: _HelixSource
641+
value: ci/dotnet/runtime/$(Build.SourceBranch)
642+
- name: timeoutPerTestInMinutes
643+
value: 10
644+
- name: timeoutPerTestCollectionInMinutes
645+
value: 200
646+
jobParameters:
647+
testGroup: innerloop
648+
nameSuffix: AllSubsets_Mono_RuntimeTests_NodeJS
649+
buildArgs: -s mono+libs -c $(_BuildConfig) /p:ForNode=true
650+
timeoutInMinutes: 180
651+
condition: >-
652+
or(
653+
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
654+
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
655+
eq(variables['isFullMatrix'], true))
656+
# extra steps, run tests
657+
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml
658+
extraStepsParameters:
659+
creator: dotnet-bot
660+
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
661+
forNode: true
662+
499663
#
500664
# Build the whole product using Mono for Android and run runtime tests with Android emulator
501665
#

eng/testing/tests.wasm.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">WasmTestRunner.dll</WasmMainAssemblyFileName>
153153
<WasmMainJSPath Condition="'$(WasmMainJSPath)' == ''">$(MonoProjectRoot)\wasm\runtime-test.js</WasmMainJSPath>
154154
<WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization>
155-
<WasmGenerateRunV8Script>true</WasmGenerateRunV8Script>
155+
<WasmGenerateRunScript>true</WasmGenerateRunScript>
156156
<WasmNativeStrip>false</WasmNativeStrip>
157157

158158
<WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>

src/libraries/sendtohelix.proj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
Creator=$(Creator);
4848
HelixAccessToken=$(HelixAccessToken);
4949
HelixTargetQueues=$(HelixTargetQueues);
50-
BuildTargetFramework=$(BuildTargetFramework)
50+
BuildTargetFramework=$(BuildTargetFramework);
51+
ForNode=$(ForNode)
5152
</_PropertiesToPass>
5253
</PropertyGroup>
5354

@@ -111,7 +112,7 @@
111112

112113
<ItemGroup>
113114
<_ProjectsToBuild Include="$(RepoRoot)\src\tests\Common\testenvironment.proj">
114-
<Properties>Scenario=$(Scenario);TestEnvFileName=$(TestEnvFilePath);TargetsWindows=$(TargetsWindows)</Properties>
115+
<Properties>Scenario=$(Scenario);TestEnvFileName=$(TestEnvFilePath);TargetsWindows=$(TargetsWindows);ForNode=$(ForNode)</Properties>
115116
</_ProjectsToBuild>
116117
</ItemGroup>
117118

@@ -130,11 +131,11 @@
130131
<ItemGroup>
131132
<_Scenario Include="$(Scenarios.Split(','))" />
132133
<_ProjectsToBuild Include="$(MSBuildProjectFile)">
133-
<AdditionalProperties>Scenario=%(_Scenario.Identity)</AdditionalProperties>
134+
<AdditionalProperties>Scenario=%(_Scenario.Identity);ForNode=$(ForNode)</AdditionalProperties>
134135
</_ProjectsToBuild>
135136
</ItemGroup>
136137

137-
<MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true" />
138+
<MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true"/>
138139
</Target>
139140

140141
<Target Name="_CollectRuntimeInputs">

0 commit comments

Comments
 (0)