Skip to content

Commit

Permalink
Make test build scripts pass RuntimeFlavor when building tests (not j…
Browse files Browse the repository at this point in the history
…ust wrappers)
  • Loading branch information
elinor-fung committed Jul 28, 2021
1 parent 356e32e commit 4ce5050
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
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 4ce5050

Please sign in to comment.