Skip to content
Draft
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
2 changes: 1 addition & 1 deletion docs/workflow/ci/triaging-failures.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Note that all you really need to know is the set of environment variables set, a

However, here are some useful links if you need to dig deeper into what configuration settings are used, and how.
The mapping from Azure DevOps pipeline to configuration settings is set by the `scenarios` tags for coreclr
tests [here](../../../eng/pipelines/common/templates/runtimes/run-test-job.yml) and for libraries tests
tests [here](../../../eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml) and for libraries tests
[here](../../../eng/pipelines/libraries/run-test-job.yml).
These tags are converted to configuration variables [here](../../../src/tests/Common/testenvironment.proj).

Expand Down
14 changes: 5 additions & 9 deletions docs/workflow/testing/coreclr/unix-test-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,23 @@ Please use the following command for help.

### Unsupported and temporarily disabled tests

To support building all tests for all targets on single target, we use
the conditional property
To mark a test as unsupported on a particular target, we use the
conditional property

```xml
<CLRTestTargetUnsupported Condition="...">true</CLRTestTargetUnsupported>
```

This property disables building of a test in a default build. It also
disables running a test in the bash/batch wrapper scripts. It allows the
test to be built on any target in CI when the `allTargets` option is
passed to the `build.*` scripts.
This property disables building of a test in a default build for the
targets matched by its condition. It also disables running a test in the
bash/batch wrapper scripts for those targets.

Tests which never should be built or run are marked

```xml
<DisableProjectBuild>true</DisableProjectBuild>
```

This propoerty should not be conditioned on Target properties to allow
all tests to be built for `allTargets`.

## Running Individual Tests

After [building an individual test](#building-individual-tests), to run the test:
Expand Down
3 changes: 0 additions & 3 deletions eng/RuntimeIdentifier.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
<PortableOS>$(TargetOS.ToLowerInvariant())</PortableOS>
<PortableOS Condition="'$(PortableOS)' == 'windows'">win</PortableOS>

<!-- TargetOS=AnyOS is a sentinel value used by tests, ignore it. -->
<PortableOS Condition="'$(PortableOS)' == 'anyos'">$(__PortableTargetOS)</PortableOS>

<!-- Detect linux flavors using __PortableTargetOS from the native script. -->
<PortableOS Condition="'$(PortableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-musl'">linux-musl</PortableOS>
<PortableOS Condition="'$(PortableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-bionic'">linux-bionic</PortableOS>
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>d1920aa3fa8523a7b8d04d6e442faccb0b0bb68e</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.CMake.Sdk" Version="12.0.0-beta.26471.108">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>d1920aa3fa8523a7b8d04d6e442faccb0b0bb68e</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="12.0.0-beta.26471.108">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>d1920aa3fa8523a7b8d04d6e442faccb0b0bb68e</Sha>
Expand Down
12 changes: 0 additions & 12 deletions eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ build_native()
cmakeArgs="$6"
message="$7"

# When sccache is enabled, use it as the compiler launcher.
# On macOS, CMake wraps PCH includes with -Xarch_<arch> which sccache
# cannot parse. Use a thin wrapper that strips -Xarch_<arch> flags
# (safe in single-architecture builds) before forwarding to sccache.
if [[ "${USE_SCCACHE:-}" == "true" ]]; then
local __sccacheLauncher="sccache"
if [[ "$targetOS" == osx || "$targetOS" == maccatalyst ]]; then
__sccacheLauncher="$__RepoRootDir/eng/native/sccache-xarch-wrapper.sh"
fi
cmakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=$__sccacheLauncher -DCMAKE_CXX_COMPILER_LAUNCHER=$__sccacheLauncher $cmakeArgs"
fi

# All set to commence the build
echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__TargetArch.$__BuildType in $intermediatesDir"

Expand Down
36 changes: 6 additions & 30 deletions eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,8 @@ set "__repoRoot=%~dp0..\.."
:: normalize
for %%i in ("%__repoRoot%") do set "__repoRoot=%%~fi"

:: Set up the EMSDK environment before setlocal so that it propagates to the caller.
:: Written without a parenthesized block so that %WASM_TOOL_CACHE_RESULT% expands without
:: delayed expansion, which cannot be enabled here without discarding emsdk_env's variables.
if /i not "%__Os%" == "browser" goto :AfterEmsdkEnv
if not "%EMSDK_PATH%" == "" goto :CallEmsdkEnv

call "%__repoRoot%\eng\wasm\wasm-tool-cache.cmd" emscripten "%__repoRoot%\src\mono\browser\emscripten-version.txt" "%__repoRoot%"
if "%WASM_TOOL_CACHE_RESULT%" == "" (
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
exit /B 1
)
set "EMSDK_PATH=%WASM_TOOL_CACHE_RESULT%"

:CallEmsdkEnv
set "EMSDK_QUIET=1"
call "%EMSDK_PATH%\emsdk_env.cmd"

:AfterEmsdkEnv
call "%~dp0init-cmake-toolchain.cmd" "%~4" "%~5"
if errorlevel 1 exit /b 1

setlocal enabledelayedexpansion

Expand Down Expand Up @@ -65,23 +49,15 @@ if /i "%__Arch%" == "wasm" (
)
if /i "%__Os%" == "browser" (
rem emcmake may be a batch file; call it so that control returns to this script.
set "CMakeToolPrefix=call emcmake"
set "CMakeToolPrefix=call %CMAKE_CONFIGURE_COMMAND_WRAPPER%"
for %%i in (emcmake.exe emcmake.bat) do set "__CompilerInputs=!__CompilerInputs!;%%i=%%~$PATH:i"
rem Use WASM-specific tryrun cache to speed up CMake configure
set __ExtraCmakeParams="-C %__repoRoot%/eng/native/tryrun.browser.cmake" !__ExtraCmakeParams!
set __ExtraCmakeParams="-C %CMAKE_INITIAL_CACHE%" !__ExtraCmakeParams!
)
if /i "%__Os%" == "wasi" (
if "%WASI_SDK_PATH%" == "" (
call "%__repoRoot%\eng\wasm\wasm-tool-cache.cmd" wasi-sdk "%__repoRoot%\eng\wasm\wasi-sdk-version.txt" "%__repoRoot%"
if "!WASM_TOOL_CACHE_RESULT!" == "" (
echo Error: Should set WASI_SDK_PATH environment variable pointing to WASI SDK root.
exit /B 1
)
set "WASI_SDK_PATH=!WASM_TOOL_CACHE_RESULT!"
)
set __CmakeGenerator=Ninja
set "__CompilerInputs=!__CompilerInputs!;-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake"
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake"
set "__CompilerInputs=!__CompilerInputs!;-DCMAKE_TOOLCHAIN_FILE=%CMAKE_TOOLCHAIN_FILE%"
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=%CLR_CMAKE_TARGET_OS% "-DCMAKE_TOOLCHAIN_FILE=%CMAKE_TOOLCHAIN_FILE%"
)
) else (
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"
Expand Down
70 changes: 21 additions & 49 deletions eng/native/gen-buildsys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ target_os="$4"
compiler="$5"

if [[ "$compiler" != "default" ]]; then
nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
build_arch="$host_arch" compiler="$compiler" . "$nativescriptroot/init-compiler.sh"
build_arch="$host_arch" compiler="$compiler" . "$scriptroot/../common/native/init-compiler.sh"

CCC_CC="$CC"
CCC_CXX="$CXX"
fi

export CCC_CC CCC_CXX

build_arch="$host_arch" target_os="$target_os" . "$scriptroot/init-cmake-toolchain.sh"

buildtype=DEBUG
code_coverage=OFF
build_tests=OFF
Expand Down Expand Up @@ -93,59 +94,29 @@ if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then
cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
fi

cmake_extra_defines_wasm=()
if [[ "$host_arch" == "wasm" ]]; then
. "$scriptroot"/../wasm/wasm-tool-cache.sh
if [[ "$target_os" == "browser" ]]; then
if [[ -z "$EMSDK_PATH" ]]; then
if EMSDK_PATH="$(wasm_tool_cache_dir emscripten "$reporoot"/src/mono/browser/emscripten-version.txt "$reporoot")"; then
export EMSDK_PATH
else
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
exit 1
fi
fi
export EMSDK_QUIET=1 && source "$EMSDK_PATH"/emsdk_env.sh
cmake_command="emcmake $cmake_command"
# Use WASM-specific tryrun cache to speed up CMake configure
# The -C flag must be early in the command line to be effective
cmake_extra_defines="-C $scriptroot/tryrun.browser.cmake $cmake_extra_defines"
elif [[ "$target_os" == "wasi" ]]; then
# Like eng/AcquireWasiSdk.targets, only use $WASI_SDK_PATH when it is the expected version,
# so native code built here links with the runtime built by MSBuild.
if [[ -n "$WASI_SDK_PATH" ]]; then
wasi_sdk_expected_version="$(tr -d '[:space:]' < "$reporoot"/eng/wasm/wasi-sdk-version.txt)"
wasi_sdk_actual_version=
if [[ -f "$WASI_SDK_PATH/VERSION" ]]; then
read -r wasi_sdk_actual_version _ < "$WASI_SDK_PATH/VERSION"
fi
if [[ "$wasi_sdk_actual_version" != "$wasi_sdk_expected_version" ]] && \
wasi_sdk_cache_path="$(wasm_tool_cache_dir wasi-sdk "$reporoot"/eng/wasm/wasi-sdk-version.txt "$reporoot")"; then
echo "WASI_SDK_PATH is version '$wasi_sdk_actual_version', not '$wasi_sdk_expected_version'; using $wasi_sdk_cache_path"
export WASI_SDK_PATH="$wasi_sdk_cache_path"
fi
fi
if [[ -z "$WASI_SDK_PATH" ]]; then
if WASI_SDK_PATH="$(wasm_tool_cache_dir wasi-sdk "$reporoot"/eng/wasm/wasi-sdk-version.txt "$reporoot")"; then
export WASI_SDK_PATH
else
echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root."
exit 1
fi
fi
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake")
else
echo "target_os was not specified"
exit 1
fi
if [[ -n "$CMAKE_CONFIGURE_COMMAND_WRAPPER" ]]; then
cmake_command="$CMAKE_CONFIGURE_COMMAND_WRAPPER $cmake_command"
fi

cmake_initial_cache_args=()
if [[ -n "$CMAKE_INITIAL_CACHE" ]]; then
cmake_initial_cache_args+=("-C" "$CMAKE_INITIAL_CACHE")
fi

cmake_toolchain_args=()
if [[ -n "$CLR_CMAKE_TARGET_OS" ]]; then
cmake_toolchain_args+=("-DCLR_CMAKE_TARGET_OS=$CLR_CMAKE_TARGET_OS")
fi
if [[ -n "$CMAKE_TOOLCHAIN_FILE" ]]; then
cmake_toolchain_args+=("-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE")
fi

# CMake detects the compiler only on a build directory's first configure. Later configures keep the
# cached compiler even when the toolchain file, CC/CXX or a cmake wrapper such as emcmake now select a
# different one, for example a new SDK version in the versioned wasm tool cache. Record those inputs
# next to the cache and reconfigure from scratch when they change.
compiler_inputs="CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE:-}"$'\n'"CC=${CC:-}"$'\n'"CXX=${CXX:-}"
for arg in $cmake_extra_defines "${__UnprocessedCMakeArgs[@]}" "${cmake_extra_defines_wasm[@]}"; do
for arg in $cmake_extra_defines "${__UnprocessedCMakeArgs[@]}" "${cmake_toolchain_args[@]}"; do
case "$arg" in
-DCMAKE_TOOLCHAIN_FILE=*|-DCMAKE_TOOLCHAIN_FILE:*=*) compiler_inputs+=$'\n'"$arg" ;;
esac
Expand Down Expand Up @@ -175,12 +146,13 @@ fi
$cmake_command \
"${cmake_fresh[@]}" \
--no-warn-unused-cli \
"${cmake_initial_cache_args[@]}" \
-G "$generator" \
"-DCMAKE_BUILD_TYPE=$buildtype" \
"-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \
$cmake_extra_defines \
"${__UnprocessedCMakeArgs[@]}" \
"${cmake_extra_defines_wasm[@]}" \
"${cmake_toolchain_args[@]}" \
-S "$1" \
-B "$2" \
&& printf '%s\n' "$compiler_inputs" > "$compiler_inputs_file"
Expand Down
70 changes: 70 additions & 0 deletions eng/native/init-cmake-toolchain.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@if not defined _echo @echo off

if "%~1" == "" goto :Usage
if "%~2" == "" goto :Usage

set "__CMakeToolchainArch=%~1"
set "__CMakeToolchainOS=%~2"
set "__CMakeToolchainRepoRoot=%~dp0..\.."
for %%i in ("%__CMakeToolchainRepoRoot%") do set "__CMakeToolchainRepoRoot=%%~fi"

set "CMAKE_CONFIGURE_COMMAND_WRAPPER="
set "CMAKE_INITIAL_CACHE="
set "CMAKE_TOOLCHAIN_FILE="
set "CLR_CMAKE_TARGET_OS="

if /i not "%__CMakeToolchainArch%" == "wasm" goto :ConfigureLauncher
if /i "%__CMakeToolchainOS%" == "browser" goto :ConfigureEmscripten
if /i "%__CMakeToolchainOS%" == "wasi" goto :ConfigureWasi

echo Error: target OS must be browser or wasi when the target architecture is wasm.
exit /b 1

:ConfigureEmscripten
if not "%EMSDK_PATH%" == "" goto :InitializeEmscripten

call "%__CMakeToolchainRepoRoot%\eng\wasm\wasm-tool-cache.cmd" emscripten "%__CMakeToolchainRepoRoot%\src\mono\browser\emscripten-version.txt" "%__CMakeToolchainRepoRoot%"
if "%WASM_TOOL_CACHE_RESULT%" == "" (
echo Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root.
exit /b 1
)
set "EMSDK_PATH=%WASM_TOOL_CACHE_RESULT%"

:InitializeEmscripten
set "EMSDK_QUIET=1"
call "%EMSDK_PATH%\emsdk_env.cmd"
if errorlevel 1 exit /b 1
set "CMAKE_CONFIGURE_COMMAND_WRAPPER=emcmake"
set "CMAKE_INITIAL_CACHE=%__CMakeToolchainRepoRoot%\eng\native\tryrun.browser.cmake"
goto :ConfigureLauncher

:ConfigureWasi
if not "%WASI_SDK_PATH%" == "" goto :SetWasiToolchain

call "%__CMakeToolchainRepoRoot%\eng\wasm\wasm-tool-cache.cmd" wasi-sdk "%__CMakeToolchainRepoRoot%\eng\wasm\wasi-sdk-version.txt" "%__CMakeToolchainRepoRoot%"
if "%WASM_TOOL_CACHE_RESULT%" == "" (
echo Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root.
exit /b 1
)
set "WASI_SDK_PATH=%WASM_TOOL_CACHE_RESULT%"

:SetWasiToolchain
set "CMAKE_TOOLCHAIN_FILE=%WASI_SDK_PATH%\share\cmake\wasi-sdk-p2.cmake"
set "CLR_CMAKE_TARGET_OS=wasi"

:ConfigureLauncher
if /i not "%USE_SCCACHE%" == "true" goto :Success
set "CMAKE_C_COMPILER_LAUNCHER=sccache"
if /i "%__CMakeToolchainOS%" == "osx" set "CMAKE_C_COMPILER_LAUNCHER=%__CMakeToolchainRepoRoot%\eng\native\sccache-xarch-wrapper.sh"
if /i "%__CMakeToolchainOS%" == "maccatalyst" set "CMAKE_C_COMPILER_LAUNCHER=%__CMakeToolchainRepoRoot%\eng\native\sccache-xarch-wrapper.sh"
set "CMAKE_CXX_COMPILER_LAUNCHER=%CMAKE_C_COMPILER_LAUNCHER%"

:Success
set "__CMakeToolchainArch="
set "__CMakeToolchainOS="
set "__CMakeToolchainRepoRoot="
exit /b 0

:Usage
echo Usage: init-cmake-toolchain.cmd ^<architecture^> ^<target OS^>
exit /b 1
Loading
Loading