Skip to content

[mono][tests] Stop using CoreCLR-specific properties when building mono runtime tests #111919

@ivanpovazan

Description

@ivanpovazan

Description

When building runtime tests the build system always imports CoreCLR specific .props file which causes series of workarounds to make the runtime tests on mobile set up properly (especially in AndroidBuild.props and AppleBuild.props).

Here is the import sequence when building a runtime tests for Android with Mono:
Image

Proposal

We should fix this as a prerequisite on improving test coverage with other .NET runtimes on mobile, especially since we need a way to determine early which target runtime the tests (and the whole SDK) are using (whether it is RuntimeFlavor property or UseMonoRuntime).

Tentative list of problematic areas

  1. The imported coreclr-specific file unconditionally sets UseMonoRuntime=false:

    <UseMonoRuntime>false</UseMonoRuntime>

  2. The output paths unconditionally use coreclr subdir:

    <BaseOutputPath>$(ArtifactsDir)tests\coreclr</BaseOutputPath>

  3. The build script sets various runtime-specific global properties and exports them to MSBuild:

    runtime/src/tests/build.sh

    Lines 414 to 422 in f1901a0

    __OSPlatformConfig="$__TargetOS.$__TargetArch.$__BuildType"
    __BinDir="$__RootBinDir/bin/coreclr/$__OSPlatformConfig"
    __PackagesBinDir="$__BinDir/.nuget"
    __TestDir="$__RepoRootDir/src/tests"
    __TestBinDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
    __IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
    __TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
    __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
    __MonoBinDir="$__RootBinDir/bin/mono/$__OSPlatformConfig"

  4. RuntimeFlavor is set from the build script:

    runtime/src/tests/build.sh

    Lines 387 to 391 in f1901a0

    if [[ $__Mono -eq 1 ]]; then
    __RuntimeFlavor="mono"
    else
    __RuntimeFlavor="coreclr"
    fi

    and used in the builds through:
    <RuntimeFlavor Condition="'$(__RuntimeFlavor)' != ''">$(__RuntimeFlavor)</RuntimeFlavor>

    and not via:
    <PropertyGroup Condition="'$(RuntimeFlavor)' == ''">

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions