7 source init-distro-rid.sh
9 # Only pass ROOTFS_DIR if cross is specified.
10 if (( ${__CrossBuild} == 1 )); then
11 passedRootfsDir=${ROOTFS_DIR}
14 initDistroRidGlobal ${__BuildOS} ${__BuildArch} ${__PortableBuild} ${passedRootfsDir}
17 isMSBuildOnNETCoreSupported()
19 __isMSBuildOnNETCoreSupported=$__msbuildonunsupportedplatform
21 if [ $__isMSBuildOnNETCoreSupported == 1 ]; then
25 if [ "$__HostArch" == "x64" ]; then
26 if [ "$__HostOS" == "Linux" ]; then
27 __isMSBuildOnNETCoreSupported=1
28 UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64")
29 for UNSUPPORTED_RID in "${UNSUPPORTED_RIDS[@]}"
31 if [ "${__DistroRid}" == "$UNSUPPORTED_RID" ]; then
32 __isMSBuildOnNETCoreSupported=0
36 elif [ "$__HostOS" == "OSX" ]; then
37 __isMSBuildOnNETCoreSupported=1
44 if [ $__BuildTestWrappers -ne -0 ]; then
45 echo "${__MsgPrefix}Creating test wrappers..."
47 export __Exclude="${__ProjectDir}/tests/issues.targets"
48 export __BuildLogRootName="Tests_XunitWrapper"
50 buildVerbosity="Summary"
52 if [ $__VerboseBuild == 1 ]; then
56 # Set up directories and file names
57 __BuildLogRootName=$subDirectoryName
58 __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
59 __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
60 __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
61 __MsbuildLog="/fileloggerparameters:\"Verbosity=normal;LogFile=${__BuildLog}\""
62 __MsbuildWrn="/fileloggerparameters1:\"WarningsOnly;LogFile=${__BuildWrn}\""
63 __MsbuildErr="/fileloggerparameters2:\"ErrorsOnly;LogFile=${__BuildErr}\""
64 __Logging="$__MsbuildLog $__MsbuildWrn $__MsbuildErr /consoleloggerparameters:$buildVerbosity"
66 nextCommand="\"${__DotNetCli}\" msbuild \"${__ProjectDir}/tests/runtest.proj\" /p:RestoreAdditionalProjectSources=https://dotnet.myget.org/F/dotnet-core/ /p:BuildWrappers=true /p:TargetsWindows=false $__Logging /p:__BuildOS=$__BuildOS /p:__BuildType=$__BuildType /p:__BuildArch=$__BuildArch"
71 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
74 echo "XUnit Wrappers have been built."
75 echo { "\"build_os\"": "\"${__BuildOS}\"", "\"build_arch\"": "\"${__BuildArch}\"", "\"build_type\"": "\"${__BuildType}\"" } > "${__TestWorkingDir}/build_info.json"
83 echo "${__MsgPrefix}Creating test overlay..."
85 __TestDir=$__ProjectDir/tests
86 __ProjectFilesDir=$__TestDir
87 __TestBinDir=$__TestWorkingDir
89 if [ $__RebuildTests -ne 0 ]; then
90 if [ -d "${__TestBinDir}" ]; then
91 echo "Removing tests build dir: ${__TestBinDir}"
96 __CMakeBinDir="${__TestBinDir}"
98 if [ -z "$__TestIntermediateDir" ]; then
99 __TestIntermediateDir="tests/obj/${__BuildOS}.${__BuildArch}.${__BuildType}"
102 echo "__BuildOS: ${__BuildOS}"
103 echo "__BuildArch: ${__BuildArch}"
104 echo "__BuildType: ${__BuildType}"
105 echo "__TestIntermediateDir: ${__TestIntermediateDir}"
107 if [ ! -f "$__TestBinDir" ]; then
108 echo "Creating TestBinDir: ${__TestBinDir}"
109 mkdir -p $__TestBinDir
111 if [ ! -f "$__LogsDir" ]; then
112 echo "Creating LogsDir: ${__LogsDir}"
115 if [ ! -f "$__MsbuildDebugLogsDir" ]; then
116 echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
117 mkdir -p $__MsbuildDebugLogsDir
120 # Set up the directory for MSBuild debug logs.
121 export MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
123 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
125 # =========================================================================================
127 # === Restore product binaries from packages
129 # =========================================================================================
131 build_MSBuild_projects "Restore_Packages" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
133 if [ -n "$__UpdateInvalidPackagesArg" ]; then
134 __up="/t:UpdateInvalidPackageVersions"
137 echo "${__MsgPrefix}Creating test overlay..."
139 if [ -z "$xUnitTestBinBase" ]; then
140 xUnitTestBinBase=$__TestWorkingDir
143 export CORE_ROOT=$xUnitTestBinBase/Tests/Core_Root
145 if [ -d "${CORE_ROOT}" ]; then
151 build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/runtest.proj" "Creating test overlay" "/t:CreateTestOverlay"
153 chmod +x $__BinDir/corerun
154 chmod +x $__BinDir/crossgen
156 # Make sure to copy over the pulled down packages
157 cp -r $__BinDir/* $CORE_ROOT/ > /dev/null
162 echo "${__MsgPrefix}Generating test host..."
164 export TEST_HOST=$xUnitTestBinBase/testhost
166 if [ -d "${TEST_HOST}" ]; then
172 build_MSBuild_projects "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "Creating test host" "/t:CreateTestHost"
178 echo "${__MsgPrefix}Building Tests..."
180 __TestDir=$__ProjectDir/tests
181 __ProjectFilesDir=$__TestDir
182 __TestBinDir=$__TestWorkingDir
184 if [ -f "${__TestWorkingDir}/build_info.json" ]; then
185 rm "${__TestWorkingDir}/build_info.json"
188 if [ $__RebuildTests -ne 0 ]; then
189 if [ -d "${__TestBinDir}" ]; then
190 echo "Removing tests build dir: ${__TestBinDir}"
195 export __CMakeBinDir="${__TestBinDir}"
196 if [ ! -d "${__TestIntermediatesDir}" ]; then
197 mkdir -p ${__TestIntermediatesDir}
200 __NativeTestIntermediatesDir="${__TestIntermediatesDir}/Native"
201 if [ ! -d "${__NativeTestIntermediatesDir}" ]; then
202 mkdir -p ${__NativeTestIntermediatesDir}
205 __ManagedTestIntermediatesDir="${__TestIntermediatesDir}/Managed"
206 if [ ! -d "${__ManagedTestIntermediatesDir}" ]; then
207 mkdir -p ${__ManagedTestIntermediatesDir}
210 echo "__BuildOS: ${__BuildOS}"
211 echo "__BuildArch: ${__BuildArch}"
212 echo "__BuildType: ${__BuildType}"
213 echo "__TestIntermediatesDir: ${__TestIntermediatesDir}"
214 echo "__NativeTestIntermediatesDir: ${__NativeTestIntermediatesDir}"
215 echo "__ManagedTestIntermediatesDir: ${__ManagedTestIntermediatesDir}"
217 if [ ! -f "$__TestBinDir" ]; then
218 echo "Creating TestBinDir: ${__TestBinDir}"
219 mkdir -p $__TestBinDir
221 if [ ! -f "$__LogsDir" ]; then
222 echo "Creating LogsDir: ${__LogsDir}"
225 if [ ! -f "$__MsbuildDebugLogsDir" ]; then
226 echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
227 mkdir -p $__MsbuildDebugLogsDir
230 # Set up the directory for MSBuild debug logs.
231 export MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
233 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
235 # =========================================================================================
237 # === Restore product binaries from packages
239 # =========================================================================================
241 if [ ${__SkipRestorePackages} != 1 ]; then
242 build_MSBuild_projects "Restore_Product" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
245 if [ $__SkipNative != 1 ]; then
246 build_native_projects "$__BuildArch" "${__NativeTestIntermediatesDir}"
248 if [ $? -ne 0 ]; then
249 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
254 if [ $__SkipManaged != 1 ]; then
255 echo "Starting the Managed Tests Build..."
257 build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "$__up"
259 if [ $? -ne 0 ]; then
260 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
263 echo "Checking the Managed Tests Build..."
265 build_MSBuild_projects "Check_Test_Build" "${__ProjectDir}/tests/runtest.proj" "Check Test Build" "/t:CheckTestBuild"
267 if [ $? -ne 0 ]; then
268 echo "${__MsgPrefix}Error: Check Test Build failed."
273 echo "Managed tests build success!"
278 if [ -n "$__UpdateInvalidPackagesArg" ]; then
279 __up="/t:UpdateInvalidPackageVersions"
285 build_MSBuild_projects()
293 extraBuildParameters=("$@")
295 # Set up directories and file names
296 __BuildLogRootName=$subDirectoryName
297 __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
298 __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
299 __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
301 # Use binclashlogger by default if no other logger is specified
302 if [[ "${extraBuildParameters[*]}" == *"/l:"* ]]; then
303 __msbuildEventLogging=
305 __msbuildEventLogging="/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log"
308 if [[ "$subDirectoryName" == "Tests_Managed" ]]; then
309 # Execute msbuild managed test build in stages - workaround for excessive data retention in MSBuild ConfigCache
310 # See https://github.com/Microsoft/msbuild/issues/2993
312 # __SkipPackageRestore and __SkipTargetingPackBuild used to control build by tests/src/dirs.proj
313 export __SkipPackageRestore=false
314 export __SkipTargetingPackBuild=false
315 export __NumberOfTestGroups=3
319 if [ -n "$__priority1" ]; then
320 export __NumberOfTestGroups=10
323 for (( testGroupToBuild=1 ; testGroupToBuild <= __NumberOfTestGroups; testGroupToBuild = testGroupToBuild + 1 ))
325 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog};Append=${__AppendToLog}\""
326 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn};Append=${__AppendToLog}\""
327 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr};Append=${__AppendToLog}\""
329 export __TestGroupToBuild=$testGroupToBuild
331 # Generate build command
332 buildArgs=("/nologo" "/verbosity:minimal" "/clp:Summary")
333 buildArgs+=("/p:RestoreDefaultOptimizationDataPackage=false" "/p:PortableBuild=true")
334 buildArgs+=("/p:UsePartialNGENOptimization=false" "/maxcpucount")
336 buildArgs+=("$projectName" "${__msbuildLog}" "${__msbuildWrn}" "${__msbuildErr}")
337 buildArgs+=("$__msbuildEventLogging")
338 buildArgs+=("${extraBuildParameters[@]}")
339 buildArgs+=("${__CommonMSBuildArgs[@]}")
340 buildArgs+=("${__UnprocessedBuildArgs[@]}")
342 nextCommand="\"$__ProjectRoot/dotnet.sh\" msbuild ${buildArgs[@]}"
343 echo "Building step '$stepName' testGroupToBuild=$testGroupToBuild via $nextCommand"
346 # Make sure everything is OK
347 if [ $? -ne 0 ]; then
348 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
354 export __SkipPackageRestore=true
355 export __SkipTargetingPackBuild=true
359 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog}\""
360 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn}\""
361 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
363 # Generate build command
364 buildArgs=("/nologo" "/verbosity:minimal" "/clp:Summary")
365 buildArgs+=("/p:RestoreDefaultOptimizationDataPackage=false" "/p:PortableBuild=true")
366 buildArgs+=("/p:UsePartialNGENOptimization=false" "/maxcpucount")
368 buildArgs+=("$projectName" "${__msbuildLog}" "${__msbuildWrn}" "${__msbuildErr}")
369 buildArgs+=("$__msbuildEventLogging")
370 buildArgs+=("${extraBuildParameters[@]}")
371 buildArgs+=("${__CommonMSBuildArgs[@]}")
372 buildArgs+=("${__UnprocessedBuildArgs[@]}")
374 nextCommand="\"$__ProjectRoot/dotnet.sh\" msbuild ${buildArgs[@]}"
375 echo "Building step '$stepName' via $nextCommand"
378 # Make sure everything is OK
379 if [ $? -ne 0 ]; then
380 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
389 build_native_projects()
392 intermediatesForBuild="$2"
394 extraCmakeArguments="-DCLR_CMAKE_TARGET_OS=${__BuildOS} -DCLR_CMAKE_HOST_ARCH=${platformArch}"
395 message="native tests assets"
397 # All set to commence the build
398 echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
403 if [ $__UseNinja == 1 ]; then
405 buildFile="build.ninja"
406 if ! buildTool=$(command -v ninja || command -v ninja-build); then
407 echo "Unable to locate ninja!" 1>&2
412 if [ $__SkipConfigure == 0 ]; then
413 # if msbuild is not supported, then set __SkipGenerateVersion to 1
414 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
415 # Drop version.c file
416 __versionSourceFile="$intermediatesForBuild/version.c"
417 if [ $__SkipGenerateVersion == 0 ]; then
419 $__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
420 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \
421 /p:UsePartialNGENOptimization=false /maxcpucount \
422 $__ProjectDir/build.proj /t:GenerateVersionHeader \
423 /p:GenerateVersionHeader=true /p:NativeVersionSourceFile=$__versionSourceFile \
424 /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
425 $__CommonMSBuildArgs $__UnprocessedBuildArgs
427 # Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
428 __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
429 if [ -e $__versionSourceFile ]; then
430 read existingVersionSourceLine < $__versionSourceFile
432 if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
433 echo $__versionSourceLine > $__versionSourceFile
437 pushd "$intermediatesForBuild"
438 # Regenerate the CMake solution
439 # Force cross dir to point to project root cross dir, in case there is a cross build.
440 nextCommand="CONFIG_DIR=\"$__ProjectRoot/cross\" \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__TestDir\" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator $extraCmakeArguments $__cmakeargs"
441 echo "Invoking $nextCommand"
446 if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
447 echo "Failed to generate $message build project!"
452 if [ $__ConfigureOnly == 1 ]; then
453 echo "Finish configuration & skipping $message build."
457 pushd "$intermediatesForBuild"
459 echo "Executing $buildTool install -j $__NumProc"
461 $buildTool install -j $__NumProc
463 echo "Failed to build $message."
468 echo "Native tests build success!"
473 echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [runtests] [bindir]"
474 echo "BuildArch can be: x64, x86, arm, armel, arm64"
475 echo "BuildType can be: debug, checked, release"
476 echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
477 echo "ninja - target ninja instead of GNU make"
478 echo "clangx.y - optional argument to build using clang version x.y - supported version 3.5 - 6.0"
479 echo "cross - optional argument to signify cross compilation,"
480 echo " - will use ROOTFS_DIR environment variable if set."
481 echo "portableLinux - build for Portable Linux Distribution"
482 echo "portablebuild - Use portable build."
483 echo "verbose - optional argument to enable verbose build output."
484 echo "rebuild - if tests have already been built - rebuild them"
485 echo "skipnative: skip the native tests build"
486 echo "skipmanaged: skip the managed section of the test build"
487 echo "buildtestwrappersonly - only build the test wrappers"
488 echo "generatelayoutonly - only pull down dependencies and build coreroot"
489 echo "generatetesthostonly - only pull down dependencies and build coreroot and the CoreFX testhost"
490 echo "skiprestorepackages - skip package restore"
491 echo "runtests - run tests after building them"
492 echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
493 echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
494 echo "priority1 - include priority=1 tests in the build"
499 # Obtain the location of the bash script to figure out where the root of the repo is.
500 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
502 # Use uname to determine what the CPU is.
505 # Some Linux platforms report unknown for platform, but the arch for machine.
506 if [ "$CPUName" == "unknown" ]; then
512 echo "Unsupported CPU $CPUName detected, build might not succeed!"
523 echo "Unsupported CPU $CPUName detected, build might not succeed!"
534 echo "Unknown CPU $CPUName detected, configuring as if for x64"
540 # Use uname to determine what the OS is.
574 echo "Unsupported OS $OSName detected, configuring as if for Linux"
582 __IncludeTests=INCLUDE_TESTS
584 # Set the various build properties here so that CMake and MSBuild can pick them up
585 export __ProjectDir="$__ProjectRoot"
586 __SourceDir="$__ProjectDir/src"
587 __PackagesDir="$__ProjectDir/packages"
588 __RootBinDir="$__ProjectDir/bin"
589 __BuildToolsDir="$__ProjectDir/Tools"
590 __DotNetCli="${__BuildToolsDir}/dotnetcli/dotnet"
591 __UnprocessedBuildArgs=
600 __SkipGenerateVersion=0
603 __ClangMajorVersion=0
604 __ClangMinorVersion=0
605 __NuGetPath="$__PackagesDir/NuGet.exe"
606 __SkipRestorePackages=0
610 __msbuildonunsupportedplatform=0
611 __NativeTestIntermediatesDir=
614 __BuildTestWrappers=1
615 __GenerateLayoutOnly=
616 __GenerateTestHostOnly=
618 __BuildTestWrappersOnly=
622 if [ $# -le 0 ]; then
626 lowerI="$(echo $1 | awk '{print tolower($0)}')"
666 __CodeCoverage=Coverage
678 if [ "$__BuildOS" == "Linux" ]; then
681 echo "ERROR: portableLinux not supported for non-Linux platforms."
691 __ClangMajorVersion=3
692 __ClangMinorVersion=5
696 __ClangMajorVersion=3
697 __ClangMinorVersion=6
701 __ClangMajorVersion=3
702 __ClangMinorVersion=7
706 __ClangMajorVersion=3
707 __ClangMinorVersion=8
711 __ClangMajorVersion=3
712 __ClangMinorVersion=9
716 __ClangMajorVersion=4
717 __ClangMinorVersion=0
721 __ClangMajorVersion=5
722 __ClangMinorVersion=0
726 __ClangMajorVersion=6
727 __ClangMinorVersion=0
742 skipnative|-skipnative)
746 skipmanaged|-skipmanaged)
748 __BuildTestWrappers=0
751 buildtestwrappersonly)
752 __BuildTestWrappersOnly=1
756 __GenerateLayoutOnly=1
759 generatetesthostonly)
760 __GenerateTestHostOnly=1
764 __SkipRestorePackages=1
770 if [ ! -d $__RootBinDir ]; then
773 __RootBinParent=$(dirname $__RootBinDir)
774 __RootBinName=${__RootBinDir##*/}
775 __RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
778 echo "ERROR: 'bindir' requires a non-empty option argument"
783 msbuildonunsupportedplatform)
784 __msbuildonunsupportedplatform=1
789 __UnprocessedBuildArgs+=("/p:CLRTestPriorityToBuild=1")
793 __UnprocessedBuildArgs+=("$1")
800 # Get the number of processors available to the scheduler
801 # Other techniques such as `nproc` only get the number of
802 # processors available to a single process.
803 if [ `uname` = "FreeBSD" ]; then
804 __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
805 elif [ `uname` = "NetBSD" ]; then
806 __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
807 elif [ `uname` = "Darwin" ]; then
808 __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
810 __NumProc=$(nproc --all)
813 __CommonMSBuildArgs=("/p:__BuildArch=$__BuildArch" "/p:__BuildType=$__BuildType" "/p:__BuildOS=$__BuildOS")
815 # Configure environment if we are doing a verbose build
816 if [ $__VerboseBuild == 1 ]; then
818 __CommonMSBuildArgs+=("/v:detailed")
821 # Set default clang version
822 if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
823 if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
824 __ClangMajorVersion=5
825 __ClangMinorVersion=0
827 __ClangMajorVersion=3
828 __ClangMinorVersion=9
832 # Set dependent variables
833 __LogsDir="$__RootBinDir/Logs"
834 __MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
836 # Set the remaining variables based upon the determined build configuration
837 __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
838 __PackagesBinDir="$__BinDir/.nuget"
839 __TestDir="$__ProjectDir/tests"
840 __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
841 __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
842 __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
843 __isMSBuildOnNETCoreSupported=0
844 __CrossComponentBinDir="$__BinDir"
845 __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
847 __CrossArch="$__HostArch"
848 if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
851 if [ $__CrossBuild == 1 ]; then
852 __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
854 __CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
855 __CrossgenExe="$__CrossComponentBinDir/crossgen"
857 isMSBuildOnNETCoreSupported
859 # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
860 # This is needed by CLI to function.
861 if [ -z "$HOME" ]; then
862 if [ ! -d "$__ProjectDir/temp_home" ]; then
865 export HOME=$__ProjectDir/temp_home
866 echo "HOME not defined; setting it to $HOME"
869 # Configure environment if we are doing a cross compile.
870 if [ $__CrossBuild == 1 ]; then
871 export CROSSCOMPILE=1
872 if ! [[ -n "$ROOTFS_DIR" ]]; then
873 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
877 # init the target distro name
880 # Override tool directory
882 __CoreClrVersion=1.1.0
883 __sharedFxDir=$__BuildToolsDir/dotnetcli/shared/Microsoft.NETCore.App/$__CoreClrVersion/
885 if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (-z "$__BuildTestWrappersOnly") ]]; then
887 elif [ ! -z "$__BuildTestWrappersOnly" ]; then
891 if [ ! -z "$__GenerateTestHostOnly" ]; then
896 if [ $? -ne 0 ]; then
897 echo "Failed to build tests"
901 echo "${__MsgPrefix}Test build successful."
902 echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
904 __testNativeBinDir=$__IntermediatesDir/tests
906 if [ $__RunTests -ne 0 ]; then
910 nextCommand="$__TestDir/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir"
914 echo "Tests run successful."
916 echo "To run all tests use 'tests/runtests.sh' where:"
917 echo " testRootDir = $__TestBinDir"
918 echo " coreClrBinDir = $__BinDir"
919 echo " coreFxBinDir = $CORE_ROOT"
920 echo " testNativeBinDir = $__testNativeBinDir"
921 echo " -------------------------------------------------- "
922 echo " Example runtest.sh command"
924 echo " ./tests/runtest.sh --coreOverlayDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir --testRootDir=$__TestBinDir --copyNativeTestBin"
925 echo " -------------------------------------------------- "
926 echo "To run single test use the following command:"
927 echo " bash ${__TestBinDir}/__TEST_PATH__/__TEST_NAME__.sh -coreroot=${CORE_ROOT}"