Skip to content

Commit d033e1a

Browse files
authored
Don't build ReferenceSystemPrivateCoreLib tests with Mono (#58232)
New tests that extend the System.Private.CoreLib API should add to the ref assemblies in src/libraries and the tests themselves should be library tests. Updated the workflow doc: the Clr.Native subset is all that is need if we're interested in testing Mono. Contributes to #58266 * [tests] Use RuntimeFlavor to build ReferenceSystemPrivateCoreLib tests When building tests that reference System.Private.CoreLib, use the one from the specified RuntimeFlavor (or fall back to coreclr if it's unset - although src/tests/build.sh sets it always) * Update docs: We only need to build the Clr.Native subset if we're interested in testing Mono. * flavor the pipelines to build the runtime-specific System.Private.CoreLib for the runtime tests. * Don't build ReferenceSystemPrivateCoreLib tests with Mono We should avoid adding new ReferenceSystemPrivateCoreLib tests
1 parent 3feafa8 commit d033e1a

File tree

8 files changed

+28
-5
lines changed

8 files changed

+28
-5
lines changed

docs/workflow/testing/mono/testing.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ Before running tests, [build Mono](../../building/mono/README.md) using the desi
55
## Runtime Tests
66
### Desktop Mono:
77

8-
To build the runtime tests for Mono JIT or interpreter, build CoreCLR and execute the following command from `$(REPO_ROOT)/src/tests`
8+
To build the runtime tests for Mono JIT or interpreter:
9+
10+
1. Build CoreCLR - the `clr.native` subset is enough but you can build the whole thing, optionally. From the `$(REPO_ROOT)`:
11+
12+
```
13+
./build.sh clr.native -c <release|debug>
14+
```
15+
16+
2. Build the tests (in `$(REPO_ROOT)/src/tests`)
17+
918
```
19+
cd src/tests
1020
./build.sh excludemonofailures <release|debug>
1121
```
1222

eng/pipelines/common/templates/runtimes/build-test-job.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ jobs:
4848
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
4949
pool: ${{ parameters.pool }}
5050
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
51-
liveRuntimeBuildParams: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
51+
${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
52+
liveRuntimeBuildParams: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
53+
${{ if eq(parameters.runtimeFlavor, 'mono') }}:
54+
liveRuntimeBuildParams: ${{ format('mono.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
55+
5256
${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc'), not(and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64'))), not(eq(parameters.osGroup, 'OSX'))) }}:
5357
compilerArg: '-clang9'
5458
${{ if not(and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc'), not(and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64'))), not(eq(parameters.osGroup, 'OSX')))) }}:
@@ -82,8 +86,12 @@ jobs:
8286
variables:
8387
- ${{ each variable in parameters.variables }}:
8488
- ${{ variable }}
85-
- name: liveRuntimeBuildParams
86-
value: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
89+
- ${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
90+
- name: liveRuntimeBuildParams
91+
value: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
92+
- ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
93+
- name: liveRuntimeBuildParams
94+
value: ${{ format('mono.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
8795
- name: compilerArg
8896
value: ''
8997
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc')) }}:

src/tests/Common/override.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515

1616
<ItemGroup>
17-
<ReferencePath Include="$(RepoRoot)\artifacts\bin\coreclr\$(TargetOS).$(TargetArchitecture).$(Configuration)\IL\System.Private.CoreLib.dll" />
17+
<ReferencePath Include="$(RepoRoot)\artifacts\bin\$(RuntimeFlavor)\$(TargetOS).$(TargetArchitecture).$(Configuration)\IL\System.Private.CoreLib.dll"/>
1818
</ItemGroup>
1919
</Target>
2020

src/tests/Directory.Build.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != 'true'">true</_WillCLRTestProjectBuild>
8282
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' == 'true' And '$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
8383
<_WillCLRTestProjectBuild Condition="'$(CLRTestBuildAllTargets)' != 'allTargets' And '$(CLRTestTargetUnsupported)' == 'true'">false</_WillCLRTestProjectBuild>
84+
<_WillCLRTestProjectBuild Condition="'$(ReferenceSystemPrivateCoreLib)' == 'true' and '$(RuntimeFlavor)' == 'mono'">false</_WillCLRTestProjectBuild>
8485
<_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' == 'true'">false</_WillCLRTestProjectBuild>
8586
</PropertyGroup>
8687
<PropertyGroup>

src/tests/Interop/COM/Activator/Activator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4+
<!-- Internal.Runtime.InteropServices is CoreCLR-only -->
45
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
56
<RequiresMockHostPolicy>true</RequiresMockHostPolicy>
67
<!-- The test fails casting from ClassFromA from the default ALC to type IGetTypeFromC from a custom ALC -->

src/tests/Interop/COM/Activator/ActivatorBuiltInComDisabled.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4+
<!-- Internal.Runtime.InteropServices is CoreCLR-only -->
45
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
56
<RequiresMockHostPolicy>true</RequiresMockHostPolicy>
67
<!-- The test fails casting from ClassFromA from the default ALC to type IGetTypeFromC from a custom ALC -->

src/tests/Interop/ICastable/Castable.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4+
<!-- Internal.Console is not in the CoreLib reference assemblies. ICastable is CoreCLR-only -->
45
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
56
<CLRTestTargetUnsupported Condition="'$(TargetOS)' == 'Browser' Or '$(TargetOS)' == 'Android' Or '$(TargetOS)' == 'iOS' Or '$(TargetOS)' == 'iOSSimulator'">true</CLRTestTargetUnsupported>
67
</PropertyGroup>

src/tests/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4+
<!-- Internal.Runtime.InteropServices is CoreCLR-only -->
45
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
56
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
67
<RequiresMockHostPolicy>true</RequiresMockHostPolicy>

0 commit comments

Comments
 (0)