Skip to content

Commit 390b5ab

Browse files
committed
test
1 parent acadc53 commit 390b5ab

File tree

10 files changed

+233
-5
lines changed

10 files changed

+233
-5
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
parameters:
2+
alwaysRun: false
3+
extraBuildArgs: ''
4+
extraHelixArguments: ''
5+
isExtraPlatformsBuild: false
6+
isWasmOnlyBuild: false
7+
nameSuffix: ''
8+
platforms: []
9+
scenarios: ['WasmTestOnChrome']
10+
shouldContinueOnError: false
11+
shouldRunSmokeOnly: false
12+
13+
jobs:
14+
15+
#
16+
# Build for Browser/wasm and test it
17+
#
18+
- template: /eng/pipelines/common/platform-matrix.yml
19+
parameters:
20+
jobTemplate: /eng/pipelines/common/global-build-job.yml
21+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
22+
buildConfig: Debug
23+
runtimeFlavor: coreclr
24+
platforms: ${{ parameters.platforms }}
25+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
26+
variables:
27+
# map dependencies variables to local variables
28+
- name: alwaysRunVar
29+
value: ${{ parameters.alwaysRun }}
30+
# - wasm darc deps changed
31+
# - any libs that can have wasm specific changes
32+
# - any other wasm specific changes that are not wbt, or dbg
33+
- name: shouldRunOnDefaultPipelines
34+
value: $[
35+
or(
36+
eq(variables['wasmDarcDependenciesChanged'], true),
37+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true),
38+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
39+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_chrome.containsChange'], true),
40+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_specific_except_wbt_dbg.containsChange'], true))
41+
]
42+
# run smoke tests only if:
43+
# - explicitly requested
44+
# - libraries or illink changed and no wasm specific changes
45+
- name: shouldRunSmokeOnlyVar
46+
value: $[
47+
or(
48+
eq('${{ parameters.shouldRunSmokeOnly }}', 'true'),
49+
and(
50+
eq('${{ parameters.shouldRunSmokeOnly }}', 'onLibrariesAndIllinkChanges'),
51+
ne(variables['wasmDarcDependenciesChanged'], true),
52+
or(
53+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true),
54+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true)
55+
),
56+
ne(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_chrome.containsChange'], true),
57+
ne(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_specific_except_wbt_dbg.containsChange'], true)
58+
)
59+
)
60+
]
61+
- name: _wasmRunSmokeTestsOnlyArg
62+
value: /p:RunSmokeTestsOnly=$(shouldRunSmokeOnlyVar)
63+
- name: chromeInstallArg
64+
${{ if containsValue(parameters.scenarios, 'WasmTestOnChrome') }}:
65+
value: /p:InstallChromeForTests=true
66+
${{ else }}:
67+
value: ''
68+
- name: firefoxInstallArg
69+
${{ if containsValue(parameters.scenarios, 'WasmTestOnFirefox') }}:
70+
value: /p:InstallFirefoxForTests=true
71+
${{ else }}:
72+
value: ''
73+
- name: v8InstallArg
74+
${{ if containsValue(parameters.scenarios, 'WasmTestOnV8') }}:
75+
value: /p:InstallV8ForTests=true
76+
${{ else }}:
77+
value: ''
78+
79+
jobParameters:
80+
isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
81+
testGroup: innerloop
82+
nameSuffix: LibraryTests${{ parameters.nameSuffix }}
83+
buildArgs: -s clr+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) $(chromeInstallArg) $(firefoxInstallArg) $(v8InstallArg) /maxcpucount:1 ${{ parameters.extraBuildArgs }}
84+
timeoutInMinutes: 240
85+
# if !alwaysRun, then:
86+
# if this is runtime-wasm (isWasmOnlyBuild):
87+
# - then run only if it would not have run on default pipelines (based
88+
# on path changes)
89+
# - else run based on path changes
90+
condition: >-
91+
or(
92+
eq(variables['alwaysRunVar'], true),
93+
eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
94+
# extra steps, run tests
95+
postBuildSteps:
96+
- template: /eng/pipelines/libraries/helix.yml
97+
parameters:
98+
creator: dotnet-bot
99+
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)
100+
extraHelixArguments: /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) ${{ parameters.extraHelixArguments }}
101+
scenarios: ${{ parameters.scenarios }}

eng/pipelines/runtime.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,18 @@ extends:
862862
scenarios:
863863
- WasmTestOnChrome
864864

865+
# WebAssembly CoreCLR
866+
- template: /eng/pipelines/common/templates/wasm-coreclr-library-tests.yml
867+
parameters:
868+
platforms:
869+
- browser_wasm
870+
alwaysRun: ${{ variables.isRollingBuild }}
871+
shouldRunSmokeOnly: true
872+
# TODO consider shouldContinueOnError: true
873+
extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
874+
scenarios:
875+
- WasmTestOnChrome
876+
865877
# EAT Library tests - only run on linux
866878
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
867879
parameters:

eng/testing/tests.browser.targets

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<DisableBuildCompression>true</DisableBuildCompression>
1313
<PublishTrimmed>false</PublishTrimmed>
1414
<PublishTrimmed Condition="'$(RunAOTCompilation)' == 'true' or '$(TestTrimming)' == 'true'">true</PublishTrimmed>
15-
<WasmTestSupport Condition="'$(RuntimeFlavor)' == 'CoreCLR'">true</WasmTestSupport>
1615
<_WasmInTreeDefaults>false</_WasmInTreeDefaults>
1716

1817
<ResolveWasmOutputsDependsOn>
@@ -53,6 +52,12 @@
5352
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">true</EventSourceSupport>
5453
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">true</NullabilityInfoContextSupport>
5554
</PropertyGroup>
55+
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
56+
<WasmTestSupport>true</WasmTestSupport>
57+
<WasmTestExitOnUnhandledError>true</WasmTestExitOnUnhandledError>
58+
<WasmTestAppendElementOnExit>true</WasmTestAppendElementOnExit>
59+
<WasmTestLogExitCode>true</WasmTestLogExitCode>
60+
</PropertyGroup>
5661

5762
<ItemGroup>
5863
<Content Include="$(MonoProjectRoot)browser\test-main.js" Link="wwwroot\test-main.js" CopyToOutputDirectory="PreserveNewest" Condition="'$(IsFunctionalTest)' != 'true'" />

src/coreclr/interpreter/compiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4072,6 +4072,8 @@ void InterpCompiler::EmitCanAccessCallout(CORINFO_RESOLVED_TOKEN *pResolvedToken
40724072

40734073
void InterpCompiler::EmitCallsiteCallout(CorInfoIsAccessAllowedResult accessAllowed, CORINFO_HELPER_DESC* calloutDesc)
40744074
{
4075+
// WASM-TODO: https://github.com/dotnet/runtime/issues/121955
4076+
#ifndef TARGET_WASM
40754077
if (accessAllowed == CORINFO_ACCESS_ILLEGAL)
40764078
{
40774079
int32_t svars[CORINFO_ACCESS_ALLOWED_MAX_ARGS];
@@ -4142,6 +4144,7 @@ void InterpCompiler::EmitCallsiteCallout(CorInfoIsAccessAllowedResult accessAllo
41424144
}
41434145
m_pLastNewIns->data[0] = GetDataForHelperFtn(calloutDesc->helperNum);
41444146
}
4147+
#endif // !TARGET_WASM
41454148
}
41464149

41474150
static OpcodePeepElement peepRuntimeAsyncCall[] = {

src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@ namespace
4949
*((double*)pRet) = (*fptr)(ARG_F64(0), ARG_I32(1));
5050
}
5151

52+
static void CallFunc_I32_I32_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
53+
{
54+
double (*fptr)(int32_t, int32_t) = (double (*)(int32_t, int32_t))pcode;
55+
*((double*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
56+
}
57+
5258
static void CallFunc_I32_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
5359
{
5460
double (*fptr)(int32_t) = (double (*)(int32_t))pcode;
5561
*((double*)pRet) = (*fptr)(ARG_I32(0));
5662
}
5763

64+
static void CallFunc_RetF32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
65+
{
66+
float (*fptr)() = (float (*)())pcode;
67+
*((float*)pRet) = (*fptr)();
68+
}
69+
5870
static void CallFunc_F32_RetF32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
5971
{
6072
float (*fptr)(float) = (float (*)(float))pcode;
@@ -97,6 +109,12 @@ namespace
97109
*((int32_t*)pRet) = (*fptr)(ARG_F32(0), ARG_F32(1));
98110
}
99111

112+
static void CallFunc_F32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
113+
{
114+
int32_t (*fptr)(float) = (int32_t (*)(float))pcode;
115+
*((int32_t*)pRet) = (*fptr)(ARG_F32(0));
116+
}
117+
100118
static void CallFunc_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
101119
{
102120
int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode;
@@ -109,6 +127,12 @@ namespace
109127
*((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_F64(1));
110128
}
111129

130+
static void CallFunc_F64_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
131+
{
132+
int32_t (*fptr)(double) = (int32_t (*)(double))pcode;
133+
*((int32_t*)pRet) = (*fptr)(ARG_F64(0));
134+
}
135+
112136
static void CallFunc_I32_F32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
113137
{
114138
int32_t (*fptr)(int32_t, float) = (int32_t (*)(int32_t, float))pcode;
@@ -205,6 +229,12 @@ namespace
205229
*((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I64(1));
206230
}
207231

232+
static void CallFunc_I64_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
233+
{
234+
int32_t (*fptr)(int64_t) = (int32_t (*)(int64_t))pcode;
235+
*((int32_t*)pRet) = (*fptr)(ARG_I64(0));
236+
}
237+
208238
static void CallFunc_I32_I64_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
209239
{
210240
int32_t (*fptr)(int32_t, int64_t, int32_t) = (int32_t (*)(int32_t, int64_t, int32_t))pcode;
@@ -343,12 +373,24 @@ namespace
343373
*((int64_t*)pRet) = (*fptr)(ARG_I32(0));
344374
}
345375

376+
static void CallFunc_I64_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
377+
{
378+
int64_t (*fptr)(int64_t) = (int64_t (*)(int64_t))pcode;
379+
*((int64_t*)pRet) = (*fptr)(ARG_I64(0));
380+
}
381+
346382
static void CallFunc_I32_I32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
347383
{
348384
int64_t (*fptr)(int32_t, int32_t) = (int64_t (*)(int32_t, int32_t))pcode;
349385
*((int64_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
350386
}
351387

388+
static void CallFunc_I64_I32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
389+
{
390+
int64_t (*fptr)(int64_t, int32_t) = (int64_t (*)(int64_t, int32_t))pcode;
391+
*((int64_t*)pRet) = (*fptr)(ARG_I64(0), ARG_I32(1));
392+
}
393+
352394
static void CallFunc_I32_I32_I32_I64_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
353395
{
354396
int64_t (*fptr)(int32_t, int32_t, int32_t, int64_t) = (int64_t (*)(int32_t, int32_t, int32_t, int64_t))pcode;
@@ -379,6 +421,13 @@ namespace
379421
*((int64_t*)pRet) = (*fptr)(ARG_I64(0), ARG_I64(1));
380422
}
381423

424+
static void CallFunc_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
425+
{
426+
int32_t (*fptr)() = (int32_t (*)())pcode;
427+
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
428+
*((int32_t*)pRet) = (*fptr)();
429+
}
430+
382431
static void CallFunc_I32_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
383432
{
384433
int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode;
@@ -393,6 +442,20 @@ namespace
393442
*((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
394443
}
395444

445+
static void CallFunc_IND_I32_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
446+
{
447+
int32_t (*fptr)(int32_t, int32_t) = (int32_t (*)(int32_t, int32_t))pcode;
448+
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
449+
*((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_I32(1));
450+
}
451+
452+
static void CallFunc_IND_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
453+
{
454+
int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode;
455+
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
456+
*((int32_t*)pRet) = (*fptr)(ARG_IND(0));
457+
}
458+
396459
static void CallFunc_Void_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
397460
{
398461
void (*fptr)() = (void (*)())pcode;
@@ -405,12 +468,24 @@ namespace
405468
(*fptr)(ARG_F64(0), ARG_I32(1), ARG_I32(2));
406469
}
407470

471+
static void CallFunc_F64_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
472+
{
473+
void (*fptr)(double) = (void (*)(double))pcode;
474+
(*fptr)(ARG_F64(0));
475+
}
476+
408477
static void CallFunc_F32_I32_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
409478
{
410479
void (*fptr)(float, int32_t, int32_t) = (void (*)(float, int32_t, int32_t))pcode;
411480
(*fptr)(ARG_F32(0), ARG_I32(1), ARG_I32(2));
412481
}
413482

483+
static void CallFunc_F32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
484+
{
485+
void (*fptr)(float) = (void (*)(float))pcode;
486+
(*fptr)(ARG_F32(0));
487+
}
488+
414489
static void CallFunc_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
415490
{
416491
void (*fptr)(int32_t) = (void (*)(int32_t))pcode;
@@ -447,6 +522,12 @@ namespace
447522
(*fptr)(ARG_I32(0), ARG_I32(1), ARG_I32(2), ARG_I32(3), ARG_I32(4), ARG_I32(5));
448523
}
449524

525+
static void CallFunc_I32_I32_I32_I32_I32_I32_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
526+
{
527+
void (*fptr)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = (void (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))pcode;
528+
(*fptr)(ARG_I32(0), ARG_I32(1), ARG_I32(2), ARG_I32(3), ARG_I32(4), ARG_I32(5), ARG_I32(6));
529+
}
530+
450531
static void CallFunc_I32_I32_I32_IND_IND_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
451532
{
452533
void (*fptr)(int32_t, int32_t, int32_t, int32_t, int32_t) = (void (*)(int32_t, int32_t, int32_t, int32_t, int32_t))pcode;
@@ -569,15 +650,19 @@ const StringToWasmSigThunk g_wasmThunks[] = {
569650
{ "dddd", (void*)&CallFunc_F64_F64_F64_RetF64 },
570651
{ "ddi", (void*)&CallFunc_F64_I32_RetF64 },
571652
{ "di", (void*)&CallFunc_I32_RetF64 },
653+
{ "dii", (void*)&CallFunc_I32_I32_RetF64 },
654+
{ "f", (void*)&CallFunc_RetF32 },
572655
{ "ff", (void*)&CallFunc_F32_RetF32 },
573656
{ "fff", (void*)&CallFunc_F32_F32_RetF32 },
574657
{ "ffff", (void*)&CallFunc_F32_F32_F32_RetF32 },
575658
{ "ffi", (void*)&CallFunc_F32_I32_RetF32 },
576659
{ "i", (void*)&CallFunc_Void_RetI32 },
577660
{ "idi", (void*)&CallFunc_F64_I32_RetI32 },
578661
{ "iff", (void*)&CallFunc_F32_F32_RetI32 },
662+
{ "if", (void*)&CallFunc_F32_RetI32 },
579663
{ "ii", (void*)&CallFunc_I32_RetI32 },
580664
{ "iid", (void*)&CallFunc_I32_F64_RetI32 },
665+
{ "id", (void*)&CallFunc_F64_RetI32 },
581666
{ "iif", (void*)&CallFunc_I32_F32_RetI32 },
582667
{ "iifiif", (void*)&CallFunc_I32_F32_I32_I32_F32_RetI32 },
583668
{ "iii", (void*)&CallFunc_I32_I32_RetI32 },
@@ -594,6 +679,7 @@ const StringToWasmSigThunk g_wasmThunks[] = {
594679
{ "iiinii", (void*)&CallFunc_I32_I32_IND_I32_I32_RetI32 },
595680
{ "iiiniin", (void*)&CallFunc_I32_I32_IND_I32_I32_IND_RetI32 },
596681
{ "iil", (void*)&CallFunc_I32_I64_RetI32 },
682+
{ "il", (void*)&CallFunc_I64_RetI32 },
597683
{ "iili", (void*)&CallFunc_I32_I64_I32_RetI32 },
598684
{ "iiliiil", (void*)&CallFunc_I32_I64_I32_I32_I32_I64_RetI32 },
599685
{ "iill", (void*)&CallFunc_I32_I64_I64_RetI32 },
@@ -617,23 +703,31 @@ const StringToWasmSigThunk g_wasmThunks[] = {
617703
{ "innin", (void*)&CallFunc_IND_IND_I32_IND_RetI32 },
618704
{ "l", (void*)&CallFunc_Void_RetI64 },
619705
{ "li", (void*)&CallFunc_I32_RetI64 },
706+
{ "ll", (void*)&CallFunc_I64_RetI64 },
620707
{ "lii", (void*)&CallFunc_I32_I32_RetI64 },
708+
{ "lli", (void*)&CallFunc_I64_I32_RetI64 },
621709
{ "liiil", (void*)&CallFunc_I32_I32_I32_I64_RetI64 },
622710
{ "lil", (void*)&CallFunc_I32_I64_RetI64 },
623711
{ "lili", (void*)&CallFunc_I32_I64_I32_RetI64 },
624712
{ "lill", (void*)&CallFunc_I32_I64_I64_RetI64 },
625713
{ "lll", (void*)&CallFunc_I64_I64_RetI64 },
714+
{ "n", (void*)&CallFunc_RetIND },
626715
{ "ni", (void*)&CallFunc_I32_RetIND },
716+
{ "nn", (void*)&CallFunc_IND_RetIND },
717+
{ "nni", (void*)&CallFunc_IND_I32_RetIND },
627718
{ "nii", (void*)&CallFunc_I32_I32_RetIND },
628719
{ "v", (void*)&CallFunc_Void_RetVoid },
720+
{ "vd", (void*)&CallFunc_F64_RetVoid },
629721
{ "vdii", (void*)&CallFunc_F64_I32_I32_RetVoid },
630722
{ "vfii", (void*)&CallFunc_F32_I32_I32_RetVoid },
723+
{ "vf", (void*)&CallFunc_F32_RetVoid },
631724
{ "vi", (void*)&CallFunc_I32_RetVoid },
632725
{ "vii", (void*)&CallFunc_I32_I32_RetVoid },
633726
{ "viii", (void*)&CallFunc_I32_I32_I32_RetVoid },
634727
{ "viiii", (void*)&CallFunc_I32_I32_I32_I32_RetVoid },
635728
{ "viiiii", (void*)&CallFunc_I32_I32_I32_I32_I32_RetVoid },
636729
{ "viiiiii", (void*)&CallFunc_I32_I32_I32_I32_I32_I32_RetVoid },
730+
{ "viiiiiii", (void*)&CallFunc_I32_I32_I32_I32_I32_I32_I32_RetVoid },
637731
{ "viiinn", (void*)&CallFunc_I32_I32_I32_IND_IND_RetVoid },
638732
{ "viiinni", (void*)&CallFunc_I32_I32_I32_IND_IND_I32_RetVoid },
639733
{ "viin", (void*)&CallFunc_I32_I32_IND_RetVoid },

0 commit comments

Comments
 (0)