Skip to content

Commit

Permalink
Merge branch 'main' into fix-wasm-mt-gc
Browse files Browse the repository at this point in the history
  • Loading branch information
lewing authored Apr 26, 2024
2 parents 99c156a + 4fc6d4c commit 9c3e55f
Show file tree
Hide file tree
Showing 219 changed files with 9,767 additions and 2,909 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@
<TestExclusionListTasksAssemblyPath>$([MSBuild]::NormalizePath('$(TestExclusionListTasksDir)', 'TestExclusionListTasks.dll'))</TestExclusionListTasksAssemblyPath>
<CoreCLRToolPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)'))</CoreCLRToolPath>
<ILAsmToolPath Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(BuildArchitecture)' == 's390x' or '$(BuildArchitecture)' == 'ppc64le'">$(CoreCLRToolPath)</ILAsmToolPath>
<!-- force download temmporarily https://github.com/dotnet/runtime/issues/101528
<WasmtimeDir Condition="'$(WasmtimeDir)' == '' and '$(WASMTIME_PATH)' != '' and Exists($(WASMTIME_PATH))">$(WASMTIME_PATH)</WasmtimeDir>
-->
<WasmtimeDir Condition="'$(WasmtimeDir)' == ''">$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
<InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
<WasmCommonTargetsPath>$([MSBuild]::NormalizeDirectory($(WasmProjectRoot), 'build'))</WasmCommonTargetsPath>
Expand Down
2 changes: 1 addition & 1 deletion docs/coding-guidelines/coding-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The general rule we follow is "use Visual Studio defaults".

An [EditorConfig](https://editorconfig.org "EditorConfig homepage") file (`.editorconfig`) has been provided at the root of the runtime repository, enabling C# auto-formatting conforming to the above guidelines.

We also use the [.NET Codeformatter Tool](https://github.com/dotnet/codeformatter) to ensure the code base maintains a consistent style over time, the tool automatically fixes the code base to conform to the guidelines outlined above.
We also use the [dotnet-format Tool](https://github.com/dotnet/format) to ensure the code base maintains a consistent style over time, the tool automatically fixes the code base to conform to the guidelines outlined above.

### Example File:

Expand Down
2 changes: 1 addition & 1 deletion eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if /i "%__Arch%" == "wasm" (
if /i "%__Os%" == "wasi" (
if "%WASI_SDK_PATH%" == "" (
if not exist "%__repoRoot%\src\mono\wasi\wasi-sdk" (
echo Error: Should set WASI_SDK_PATH environment variable pointing to emsdk root.
echo Error: Should set WASI_SDK_PATH environment variable pointing to WASI SDK root.
exit /B 1
)

Expand Down
19 changes: 19 additions & 0 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,25 @@ jobs:
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}

- ${{ if containsValue(parameters.platforms, 'linux_musl_x64_dev_innerloop') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
osGroup: linux
osSubgroup: _musl
archType: x64
targetRid: linux-musl-x64
platform: linux_musl_x64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: linux_musl_x64_dev_innerloop
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
${{ insert }}: ${{ parameters.jobParameters }}

# GCC Linux x64 Build

- ${{ if containsValue(parameters.platforms, 'gcc_linux_x64') }}:
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/common/templates/pipeline-with-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ extends:
linux_x64_dev_innerloop:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04

linux_musl_x64_dev_innerloop:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-WithNode

# We use a CentOS Stream 8 image here to test building from source on CentOS Stream 8.
SourceBuild_centos_x64:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
Expand Down
5 changes: 3 additions & 2 deletions eng/pipelines/common/templates/wasm-library-aot-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
alwaysRun: false
extraBuildArgs: ''
extraHelixArgs: ''
extraHelixArguments: ''
isExtraPlatformsBuild: false
isWasmOnlyBuild: false
buildAOTOnHelix: true
Expand All @@ -26,7 +26,7 @@ jobs:
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
extraBuildArgs: /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=${{ parameters.buildAOTOnHelix }} /p:RunAOTCompilation=${{ parameters.runAOT }} ${{ parameters.extraBuildArgs }}
extraHelixArgs: /p:NeedsToBuildWasmAppsOnHelix=true ${{ parameters.extraHelixArgs }}
extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true ${{ parameters.extraHelixArguments }}
alwaysRun: ${{ parameters.alwaysRun }}
shouldRunSmokeOnly: ${{ parameters.shouldRunSmokeOnly }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
Expand All @@ -35,5 +35,6 @@ jobs:
- WasmTestOnV8
- ${{ if eq(platform, 'browser_wasm_win') }}:
- WasmTestOnChrome
- WasmTestOnFirefox
- ${{ if or(eq(platform, 'wasi_wasm_win'), eq(platform, 'wasi_wasm')) }}:
- WasmTestOnWasmtime
4 changes: 2 additions & 2 deletions eng/pipelines/common/templates/wasm-library-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
alwaysRun: false
extraBuildArgs: ''
extraHelixArgs: ''
extraHelixArguments: ''
isExtraPlatformsBuild: false
isWasmOnlyBuild: false
nameSuffix: ''
Expand Down Expand Up @@ -97,5 +97,5 @@ jobs:
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) ${{ parameters.extraHelixArgs }}
extraHelixArguments: /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) ${{ parameters.extraHelixArguments }}
scenarios: ${{ parameters.scenarios }}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ jobs:
scenarios:
- WasmTestOnV8
- WasmTestOnChrome
- WasmTestOnFirefox
- WasmTestOnNodeJS

# Hybrid Globalization AOT tests
Expand Down Expand Up @@ -321,4 +322,4 @@ jobs:
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
scenarios:
- WasmTestOnV8
- WasmTestOnWasmtime
73 changes: 15 additions & 58 deletions eng/pipelines/global-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The purpose of this pipeline is to exercise local developer workflow in the consolidated
# runtime repo. In particular, it is supposed to run the root "build" script just like any
# normal developer normally would and monitor regressions w.r.t. this fundamental scenario.
# The purpose of this pipeline is to exercise various developer workflows in the repo.
# Primarily, it is meant to cover local (non-cross) build scenarios and
# source-build scenarios that commonly cause build breaks.

trigger: none

Expand Down Expand Up @@ -41,28 +41,6 @@ extends:
- stage: Build
jobs:

#
# Build with Release config and Debug runtimeConfiguration
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: release
platforms:
- windows_x86
- osx_x64
- osx_arm64
jobParameters:
testGroup: innerloop
nameSuffix: Runtime_Debug
buildArgs: -c release -runtimeConfiguration debug
timeoutInMinutes: 120
condition:
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))

#
# Build with Release config and runtimeConfiguration with MSBuild generator
#
Expand All @@ -83,26 +61,6 @@ extends:
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))

#
# Build with Debug config and Release runtimeConfiguration
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: debug
platforms:
- linux_x64_dev_innerloop
jobParameters:
testGroup: innerloop
nameSuffix: Runtime_Release
buildArgs: -c debug -runtimeConfiguration release
timeoutInMinutes: 120
condition:
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))

#
# Build with RuntimeFlavor only. This exercise code paths where only RuntimeFlavor is
# specified. Catches cases where we depend on Configuration also being specified
Expand All @@ -124,38 +82,37 @@ extends:
eq(variables['isRollingBuild'], true))

#
# Build Mono + Libraries. This exercises the code path where we build libraries without
# first building CoreCLR
# Build Libraries AllConfigurations. This exercises the code path where we build libraries for all
# configurations on a non Windows operating system.
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: debug
platforms:
- windows_x64
- linux_x64_dev_innerloop
jobParameters:
testGroup: innerloop
nameSuffix: Mono_Libraries
buildArgs: -subset mono+libs /p:RuntimeFlavor=Mono
nameSuffix: Libraries_AllConfigurations
buildArgs: -subset libs -allconfigurations
timeoutInMinutes: 120
condition:
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_wasm.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))

#
# Build Libraries AllConfigurations. This exercises the code path where we build libraries for all
# configurations on a non Windows operating system.
# Build native assets on Alpine. This exercises more modern musl libc changes that have a tendendy to break source-build.
# We don't add this as a source-build job as the repo source-build infrastructure isn't set up to run on alpine effectively.
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: debug
buildConfig: release
platforms:
- linux_x64_dev_innerloop
- linux_musl_x64_dev_innerloop
jobParameters:
nameSuffix: Libraries_AllConfigurations
buildArgs: -subset libs -allconfigurations
nameSuffix: Musl_Validation
buildArgs: -subset clr.native+libs.native+host.native -c $(_BuildConfig)
timeoutInMinutes: 120
condition:
or(
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ extends:
scenarios:
- WasmTestOnV8
- WasmTestOnChrome
- WasmTestOnFirefox

- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
Expand All @@ -861,10 +862,12 @@ extends:
#- browser_wasm_win
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
extraHelixArguments: /p:WasmEnableThreads=true
alwaysRun: ${{ variables.isRollingBuild }}
shouldRunSmokeOnly: onLibrariesAndIllinkChanges
scenarios:
- WasmTestOnChrome
- WasmTestOnFirefox
#- WasmTestOnNodeJS - this is not supported yet, https://github.com/dotnet/runtime/issues/85592

# EAT Library tests - only run on linux
Expand Down
4 changes: 3 additions & 1 deletion eng/testing/BrowserVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<win_ChromeRevision>1250580</win_ChromeRevision>
<win_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1250586</win_ChromeBaseSnapshotUrl>
<win_V8Version>12.3.219</win_V8Version>
<linux_FirefoxRevision>124.0.2</linux_FirefoxRevision>
<linux_FirefoxRevision>125.0.1</linux_FirefoxRevision>
<linux_GeckoDriverRevision>0.34.0</linux_GeckoDriverRevision>
<win_FirefoxRevision>125.0.1</win_FirefoxRevision>
<win_GeckoDriverRevision>0.34.0</win_GeckoDriverRevision>
</PropertyGroup>
</Project>
30 changes: 24 additions & 6 deletions eng/testing/WasmRunnerTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ if [%XHARNESS_COMMAND%] == [] (
if /I [%SCENARIO%]==[WasmTestOnChrome] (
set XHARNESS_COMMAND=test-browser
) else (
set XHARNESS_COMMAND=test
if /I [%SCENARIO%]==[WasmTestOnFirefox] (
set XHARNESS_COMMAND=test-browser
) else (
set XHARNESS_COMMAND=test
)
)
)

Expand All @@ -56,11 +60,25 @@ if /I [%XHARNESS_COMMAND%] == [test] (
)
)
) else (
if [%BROWSER_PATH%] == [] if not [%HELIX_CORRELATION_PAYLOAD%] == [] (
set "BROWSER_PATH=--browser-path^=%HELIX_CORRELATION_PAYLOAD%\chrome-win\chrome.exe"
)
if [%JS_ENGINE_ARGS%] == [] (
set "JS_ENGINE_ARGS=--browser-arg^=--js-flags^=--stack-trace-limit^=1000"
if /I [%SCENARIO%] == [WasmTestOnChrome] (
if [%BROWSER_PATH%] == [] if not [%HELIX_CORRELATION_PAYLOAD%] == [] (
set "BROWSER_PATH=--browser-path^=%HELIX_CORRELATION_PAYLOAD%\chrome-win\chrome.exe"
)
if [%JS_ENGINE_ARGS%] == [] (
set "JS_ENGINE_ARGS=--browser-arg^=--js-flags^=--stack-trace-limit^=1000"
)
) else (
if /I [%SCENARIO%] == [WasmTestOnFirefox] (
if [%BROWSER_PATH%] == [] if not [%HELIX_CORRELATION_PAYLOAD%] == [] (
set "BROWSER_PATH=--browser-path^=%HELIX_CORRELATION_PAYLOAD%\firefox\firefox.exe"
)
if [%JS_ENGINE%] == [] (
set "JS_ENGINE=--browser^=Firefox"
)
if [%JS_ENGINE_ARGS%] == [] (
set "JS_ENGINE_ARGS=--browser-arg^=-private-window"
)
)
)
)

Expand Down
17 changes: 14 additions & 3 deletions eng/testing/WasmRunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ else
fi

if [[ -z "$XHARNESS_COMMAND" ]]; then
if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then
if [[ "$SCENARIO" == "WasmTestOnFirefox" || "$SCENARIO" == "wasmtestonfirefox" ]]; then
XHARNESS_COMMAND="test-browser"
elif [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then
XHARNESS_COMMAND="test-browser"
else
XHARNESS_COMMAND="test"
Expand Down Expand Up @@ -59,8 +61,17 @@ if [[ "$XHARNESS_COMMAND" == "test" ]]; then
fi
fi
else
if [[ -z "$JS_ENGINE_ARGS" ]]; then
JS_ENGINE_ARGS="--browser-arg=--js-flags=--stack-trace-limit=1000"
if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then
if [[ -z "$JS_ENGINE_ARGS" ]]; then
JS_ENGINE_ARGS="--browser-arg=--js-flags=--stack-trace-limit=1000"
fi
elif [[ "$SCENARIO" == "WasmTestOnFirefox" || "$SCENARIO" == "wasmtestonfirefox" ]]; then
if [[ -z "$JS_ENGINE" ]]; then
JS_ENGINE="--browser=Firefox"
fi
if [[ -z "$JS_ENGINE_ARGS" ]]; then
JS_ENGINE_ARGS="--browser-arg=-private-window"
fi
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion eng/testing/scenarios/BuildWasmAppsJobsList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest
Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests
Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest
Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest
Wasm.Build.Templates.Tests.InterpPgoTests
Wasm.Build.Tests.TestAppScenarios.InterpPgoTests
Wasm.Build.Templates.Tests.NativeBuildTests
Wasm.Build.Tests.Blazor.AppsettingsTests
Wasm.Build.Tests.Blazor.BuildPublishTests
Expand Down
9 changes: 9 additions & 0 deletions eng/testing/tests.browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,18 @@
<_NodeNpmModuleStringTrimmed Include="@(_NodeNpmModuleString->Trim(':'))" />
</ItemGroup>
<PropertyGroup>
<Scenario Condition="'$(Scenario)' == ''">WasmTestOnV8</Scenario>
<NodeNpmModuleString>@(_NodeNpmModuleStringTrimmed, ',')</NodeNpmModuleString>
</PropertyGroup>

<Error Condition="'$(Scenario)' != 'WasmTestOnV8' and
'$(Scenario)' != 'WasmTestOnChrome' and
'$(Scenario)' != 'WasmTestOnFirefox' and
'$(Scenario)' != 'WasmTestOnNodeJS' and
'$(Scenario)' != 'WasmDebuggerTests' and
'$(Scenario)' != 'BuildWasmApps'"
Text="Only supported scenarios are WasmTestOnV8, WasmTestOnNodeJS, WasmTestOnChrome, WasmTestOnFirefox, WasmDebuggerTests and BuildWasmApps at the moment. It was $(Scenario)." />

<!-- Restore NPM packages -->
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<SetScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJS&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then export WasmXHarnessMonoArgs=&quot;$WasmXHarnessMonoArgs --setenv=NPM_MODULES=$(NodeNpmModuleString)&quot;; fi" />
Expand Down
9 changes: 8 additions & 1 deletion eng/testing/tests.wasi.targets
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs>
<_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs>
<_XHarnessArgs Condition="'$(WasmXHarnessTestsTimeout)' != ''" >$(_XHarnessArgs) &quot;--timeout=$(WasmXHarnessTestsTimeout)&quot;</_XHarnessArgs>
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--max-wasm-stack=134217728</_XHarnessArgs>
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=-W --engine-arg=max-wasm-stack=134217728</_XHarnessArgs>
<_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs>

<_InvariantGlobalization Condition="'$(InvariantGlobalization)' == 'true'">--env=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true</_InvariantGlobalization>
Expand Down Expand Up @@ -147,6 +147,13 @@
</Target>

<Target Name="_WasiAddToRunScript" BeforeTargets="GenerateRunScript">
<PropertyGroup>
<Scenario Condition="'$(Scenario)' == ''">WasmTestOnWasmtime</Scenario>
</PropertyGroup>
<Error Condition="'$(Scenario)' != 'WasmTestOnWasmtime' and
'$(Scenario)' != 'BuildWasmApps'"
Text="Only supported scenarios are WasmTestOnWasmtime and BuildWasmApps at the moment. It was $(Scenario)." />

<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<SetScriptCommands Condition="'$(InstallWasmtimeForTests)' == 'true' and Exists($(WasmtimeDir))" Include="export PREPEND_PATH=$(WasmtimeDir)" />
<SetScriptCommands Condition="'$(IsWasiProject)' == 'true'" Include="export RuntimeIdentifier=wasi-wasm" />
Expand Down
Loading

0 comments on commit 9c3e55f

Please sign in to comment.