Skip to content

Commit a926345

Browse files
authored
Run wasm tests on Helix (#37752)
Build Wasm for testing via Helix. A bunch of test suites are disabled on Wasm here, and will be re-enabled as we get the up and running.
1 parent 5c2d025 commit a926345

17 files changed

Lines changed: 207 additions & 41 deletions

eng/Version.Details.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,9 @@
178178
<Uri>https://github.com/dotnet/xharness</Uri>
179179
<Sha>19aa97963aa11b4818f3e3487b913244efa4ff0f</Sha>
180180
</Dependency>
181+
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="1.0.0-prerelease.20322.1">
182+
<Uri>https://github.com/dotnet/xharness</Uri>
183+
<Sha>19aa97963aa11b4818f3e3487b913244efa4ff0f</Sha>
184+
</Dependency>
181185
</ToolsetDependencies>
182186
</Dependencies>

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<!-- Testing -->
107107
<MicrosoftNETTestSdkVersion>16.7.0-release-20200612-02</MicrosoftNETTestSdkVersion>
108108
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>1.0.0-prerelease.20322.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
109+
<MicrosoftDotNetXHarnessCLIVersion>1.0.0-prerelease.20322.1</MicrosoftDotNetXHarnessCLIVersion>
109110
<XUnitVersion>2.4.1</XUnitVersion>
110111
<XUnitRunnerVisualStudioVersion>2.4.2</XUnitRunnerVisualStudioVersion>
111112
<CoverletCollectorVersion>1.3.0</CoverletCollectorVersion>

eng/pipelines/common/global-build-job.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ parameters:
1212
pool: ''
1313
condition: true
1414
isOfficialBuild: false
15+
runtimeFlavor: 'coreclr'
16+
helixQueues: ''
1517
extraStepsTemplate: ''
1618
extraStepsParameters: {}
1719

@@ -81,6 +83,8 @@ jobs:
8183
osSubgroup: ${{ parameters.osSubgroup }}
8284
archType: ${{ parameters.archType }}
8385
buildConfig: ${{ parameters.buildConfig }}
86+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
87+
helixQueues: ${{ parameters.helixQueues }}
8488
${{ insert }}: ${{ parameters.extraStepsParameters }}
8589

8690
- task: PublishBuildArtifacts@1

eng/pipelines/libraries/build-job.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,11 @@ jobs:
174174
- ${{ if eq(parameters.runTests, true) }}:
175175
- template: /eng/pipelines/libraries/helix.yml
176176
parameters:
177-
targetOS: ${{ parameters.osGroup }}
178-
archGroup: ${{ parameters.archType }}
179-
configuration: ${{ parameters.buildConfig }}
180-
helixQueues: ${{ join('+', parameters.helixQueues) }}
181-
msbuildScript: $(_msbuildCommand)
182-
framework: ${{ parameters.framework }}
177+
osGroup: ${{ parameters.osGroup }}
178+
archType: ${{ parameters.archType }}
179+
buildConfig: ${{ parameters.buildConfig }}
180+
helixQueues: ${{ parameters.helixQueues }}
183181
testScope: ${{ parameters.testScope }}
184182
creator: dotnet-bot
185-
helixToken: ''
186183
testRunNamePrefixSuffix: $(_testRunNamePrefixSuffix)
187184
extraHelixArguments: $(_extraHelixArguments)

eng/pipelines/libraries/helix-queues-setup.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,8 @@ jobs:
144144
- ${{ if eq(parameters.platform, 'Windows_NT_arm64') }}:
145145
- Windows.10.Arm64.Open
146146

147+
# WebAssembly
148+
- ${{ if eq(parameters.platform, 'Browser_wasm') }}:
149+
- Ubuntu.2004.Amd64.Open
150+
147151
${{ insert }}: ${{ parameters.jobParameters }}

eng/pipelines/libraries/helix.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
parameters:
22
runtimeFlavor: ''
3-
archGroup: ''
4-
configuration: ''
3+
archType: ''
4+
buildConfig: ''
55
creator: ''
6-
framework: ''
76
helixQueues: ''
8-
msbuildScript: ''
9-
targetOS: ''
7+
osGroup: ''
108
testRunNamePrefixSuffix: ''
119
testScope: 'innerloop' # innerloop | outerloop | all
1210
interpreter: ''
@@ -15,12 +13,12 @@ parameters:
1513
scenarios: ''
1614

1715
steps:
18-
- script: ${{ parameters.msbuildScript }}
16+
- script: $(_msbuildCommand)
1917
$(Build.SourcesDirectory)/src/libraries/sendtohelix.proj
2018
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
21-
/p:TargetArchitecture=${{ parameters.archGroup }}
22-
/p:Configuration=${{ parameters.configuration }}
23-
/p:TargetOS=${{ parameters.targetOS }}
19+
/p:TargetArchitecture=${{ parameters.archType }}
20+
/p:Configuration=${{ parameters.buildConfig }}
21+
/p:TargetOS=${{ parameters.osGroup }}
2422
/p:MonoEnableInterpreter=${{ parameters.interpreter }}
2523
/p:TestScope=${{ parameters.testScope }}
2624
/p:TestRunNamePrefixSuffix=${{ parameters.testRunNamePrefixSuffix }}
@@ -32,5 +30,5 @@ steps:
3230
condition: and(succeeded(), ${{ parameters.condition }})
3331
env:
3432
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
35-
HelixTargetQueues: ${{ parameters.helixQueues }} # Pass queues to MSBuild as env var to avoid need of escaping them
33+
HelixTargetQueues: ${{ join('+', parameters.helixQueues) }} # Pass queues to MSBuild as env var to avoid need of escaping them
3634
_Scenarios: ${{ join(',', parameters.scenarios) }} # Pass scenarios to MSBuild as env var to avoid need of escaping comma separated list

eng/pipelines/libraries/run-test-job.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,13 @@ jobs:
9292
- template: /eng/pipelines/libraries/helix.yml
9393
parameters:
9494
runtimeFlavor: ${{ parameters.runtimeFlavor }}
95-
targetOS: ${{ parameters.osGroup }}
96-
archGroup: ${{ parameters.archType }}
97-
configuration: ${{ parameters.buildConfig }}
98-
helixQueues: ${{ join('+', parameters.helixQueues) }}
99-
msbuildScript: $(_msbuildCommand)
100-
framework: ${{ parameters.framework }}
95+
osGroup: ${{ parameters.osGroup }}
96+
archType: ${{ parameters.archType }}
97+
buildConfig: ${{ parameters.buildConfig }}
98+
helixQueues: ${{ parameters.helixQueues }}
10199
testScope: ${{ parameters.testScope }}
102100
interpreter: ${{ parameters.interpreter }}
103101
creator: dotnet-bot
104-
helixToken: ''
105102
testRunNamePrefixSuffix: $(_testRunNamePrefixSuffix)
106103
extraHelixArguments: $(_extraHelixArguments)
107104

eng/pipelines/runtime.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ jobs:
247247
- tvOS_x64
248248
- iOS_arm64
249249
- iOS_x86
250-
- Browser_wasm
251250
- Linux_arm
252251
jobParameters:
253252
testGroup: innerloop
@@ -283,6 +282,33 @@ jobs:
283282
eq(dependencies.checkout.outputs['SetPathVars_installer.containsChange'], true),
284283
eq(variables['isFullMatrix'], true))
285284
285+
#
286+
# Build the whole product using Mono and run tests
287+
#
288+
- template: /eng/pipelines/common/platform-matrix.yml
289+
parameters:
290+
jobTemplate: /eng/pipelines/common/global-build-job.yml
291+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
292+
buildConfig: Release
293+
runtimeFlavor: mono
294+
platforms:
295+
- Browser_wasm
296+
jobParameters:
297+
testGroup: innerloop
298+
nameSuffix: AllSubsets_Mono
299+
buildArgs: -s mono+libs+installer+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true
300+
timeoutInMinutes: 120
301+
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
302+
extraStepsParameters:
303+
creator: dotnet-bot
304+
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
305+
condition: >-
306+
or(
307+
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
308+
eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
309+
eq(dependencies.checkout.outputs['SetPathVars_installer.containsChange'], true),
310+
eq(variables['isFullMatrix'], true))
311+
286312
#
287313
# Build Mono and Installer on LLVMJIT mode
288314
#

eng/testing/WasmRunnerTemplate.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#!/usr/bin/env bash
22

33
EXECUTION_DIR=$(dirname $0)
4-
JAVASCRIPT_ENGINE=$1
54

65
cd $EXECUTION_DIR
76

87
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
98

10-
dotnet xharness wasm test --engine=$JAVASCRIPT_ENGINE \
11-
--js-file=runtime.js -v \
12-
--output-directory=$XHARNESS_OUT \
13-
-- --enable-gc --run WasmTestRunner.dll ${@:2}
9+
if [ ! -x "$(command -v xharness)" ]; then
10+
HARNESS_RUNNER="dotnet"
11+
fi
12+
13+
# RunCommands defined in tests.mobile.targets
14+
[[RunCommands]]
1415

1516
_exitCode=$?
1617

eng/testing/tests.mobile.targets

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
<JSEngine Condition="'$(TargetOS)' == 'Browser' and '$(JSEngine)' == ''">V8</JSEngine>
88
</PropertyGroup>
99

10+
<ItemGroup>
11+
<RunScriptCommands Include="TARGET_ARCH=$(TargetArchitecture)" />
12+
</ItemGroup>
13+
14+
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
15+
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
16+
<RunScriptCommand>$HARNESS_RUNNER xharness wasm test --engine=$(JSEngine) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- --enable-gc --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
17+
</PropertyGroup>
18+
1019
<!-- Generate a self-contained app bundle for Android with tests. -->
1120
<UsingTask Condition="'$(TargetOS)' == 'Android'"
1221
TaskName="AndroidAppBuilderTask"
@@ -156,5 +165,5 @@
156165
<Target Name="PublishTestAsSelfContained"
157166
Condition="'$(IsCrossTargetingBuild)' != 'true'"
158167
AfterTargets="Build"
159-
DependsOnTargets="UpdateRuntimePack;Publish;BundleTestAppleApp;BundleTestAndroidApp;BundleTestWasmApp" />
168+
DependsOnTargets="UpdateRuntimePack;Publish;BundleTestAppleApp;BundleTestAndroidApp;BundleTestWasmApp;ArchiveTests" />
160169
</Project>

0 commit comments

Comments
 (0)