Skip to content

Commit

Permalink
Pass excludemonofailures in managed test build job for mono (#56434)
Browse files Browse the repository at this point in the history
* Pass excludemonofailures in managed test build job for mono
* Make test build scripts pass RuntimeFlavor when building tests (not just wrappers)
  • Loading branch information
elinor-fung authored Jul 29, 2021
1 parent 87769fb commit a943e37
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
9 changes: 8 additions & 1 deletion eng/pipelines/common/templates/runtimes/build-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ jobs:
- name: compilerArg
value: ''

- name: runtimeFlavorArgs
value: ''

- ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
- name: runtimeFlavorArgs
value: '-excludemonofailures'

steps:

# Install test build dependencies
Expand All @@ -120,7 +127,7 @@ jobs:
displayName: Disk Usage before Build
# Build managed test components
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) allTargets skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(crossArg) $(priorityArg) ci $(librariesOverrideArg)
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) allTargets skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(runtimeFlavorArgs) $(crossArg) $(priorityArg) ci $(librariesOverrideArg)
displayName: Build managed test components

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/mono/templates/xplat-pipeline-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
value: '$(binTestsPath)/$(osGroup).$(archType).$(buildConfigUpper)'

- name: managedGenericTestArtifactName
value: 'CoreCLRManagedTestArtifacts_AnyOS_AnyCPU_$(buildConfig)'
value: 'MonoManagedTestArtifacts_AnyOS_AnyCPU_$(buildConfig)'

- name: microsoftNetSdkIlFolderPath
value: '$(Build.SourcesDirectory)/.packages/microsoft.net.sdk.il'
Expand Down
15 changes: 8 additions & 7 deletions src/tests/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ if "%__TargetsWindows%"=="1" (
set TargetsWindowsMsbuildArg=/p:TargetsWindows=false
)

if "%__Mono%"=="1" (
set __RuntimeFlavor=mono
) else (
set __RuntimeFlavor=coreclr
)

@if defined _echo @echo on

set __CommonMSBuildArgs=/p:TargetOS=%__TargetOS% /p:Configuration=%__BuildType% /p:TargetArchitecture=%__BuildArch%
Expand Down Expand Up @@ -353,6 +359,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:CopyNativeProjectBinaries=!__CopyNativeProjectsAfterCombinedTestBuild!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:__SkipPackageRestore=true
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__NativeBinariesLayoutTypeArg!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:RuntimeFlavor=!__RuntimeFlavor!
echo Running: msbuild !__MSBuildBuildArgs!
!__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs!

Expand Down Expand Up @@ -476,14 +483,8 @@ set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!

if %%__Mono%%==1 (
set RuntimeFlavor="mono"
) else (
set RuntimeFlavor="coreclr"
)

REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well.
call "%__RepoRootDir%\dotnet.cmd" msbuild %__RepoRootDir%\src\tests\run.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__UnprocessedBuildArgs% /p:RuntimeFlavor=%RuntimeFlavor%
call "%__RepoRootDir%\dotnet.cmd" msbuild %__RepoRootDir%\src\tests\run.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__UnprocessedBuildArgs% /p:RuntimeFlavor=%__RuntimeFlavor%
if errorlevel 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: XUnit wrapper build failed. Refer to the build log files for details:
echo %__BuildLog%
Expand Down
14 changes: 7 additions & 7 deletions src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ build_test_wrappers()
if [[ "$__BuildTestWrappers" -ne -0 ]]; then
echo "${__MsgPrefix}Creating test wrappers..."

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

__Exclude="$__RepoRootDir/src/tests/issues.targets"
__BuildLogRootName="Tests_XunitWrapper"

Expand Down Expand Up @@ -274,7 +268,7 @@ build_Tests()
if [[ "$__SkipManaged" != 1 ]]; then
echo "Starting the Managed Tests Build..."

build_MSBuild_projects "Tests_Managed" "$__RepoRootDir/src/tests/build.proj" "Managed tests build (build tests)" "$__up"
build_MSBuild_projects "Tests_Managed" "$__RepoRootDir/src/tests/build.proj" "Managed tests build (build tests)" "$__up" "/p:RuntimeFlavor=$__RuntimeFlavor"

if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: managed test build failed. Refer to the build log files for details (above)"
Expand Down Expand Up @@ -577,6 +571,12 @@ if [[ "$__CrossBuild" == 1 ]]; then
__UnprocessedBuildArgs+=("/p:CrossBuild=true")
fi

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

# Set dependent variables
__LogsDir="$__RootBinDir/log"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
Expand Down

0 comments on commit a943e37

Please sign in to comment.