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"
70 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
73 echo "XUnit Wrappers have been built."
74 echo { "\"build_os\"": "\"${__BuildOS}\"", "\"build_arch\"": "\"${__BuildArch}\"", "\"build_type\"": "\"${__BuildType}\"" } > "${__TestWorkingDir}/build_info.json"
82 echo "${__MsgPrefix}Creating test overlay..."
84 __TestDir=$__ProjectDir/tests
85 __ProjectFilesDir=$__TestDir
86 __TestBinDir=$__TestWorkingDir
88 if [ $__RebuildTests -ne 0 ]; then
89 if [ -d "${__TestBinDir}" ]; then
90 echo "Removing tests build dir: ${__TestBinDir}"
95 __CMakeBinDir="${__TestBinDir}"
97 if [ -z "$__TestIntermediateDir" ]; then
98 __TestIntermediateDir="tests/obj/${__BuildOS}.${__BuildArch}.${__BuildType}"
101 echo "__BuildOS: ${__BuildOS}"
102 echo "__BuildArch: ${__BuildArch}"
103 echo "__BuildType: ${__BuildType}"
104 echo "__TestIntermediateDir: ${__TestIntermediateDir}"
106 if [ ! -f "$__TestBinDir" ]; then
107 echo "Creating TestBinDir: ${__TestBinDir}"
108 mkdir -p $__TestBinDir
110 if [ ! -f "$__LogsDir" ]; then
111 echo "Creating LogsDir: ${__LogsDir}"
114 if [ ! -f "$__MsbuildDebugLogsDir" ]; then
115 echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
116 mkdir -p $__MsbuildDebugLogsDir
119 # Set up the directory for MSBuild debug logs.
120 export MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
122 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
124 # =========================================================================================
126 # === Restore product binaries from packages
128 # =========================================================================================
130 build_MSBuild_projects "Restore_Packages" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
132 if [ -n "$__UpdateInvalidPackagesArg" ]; then
133 __up="/t:UpdateInvalidPackageVersions"
136 echo "${__MsgPrefix}Creating test overlay..."
138 if [ -z "$xUnitTestBinBase" ]; then
139 xUnitTestBinBase=$__TestWorkingDir
142 export CORE_ROOT=$xUnitTestBinBase/Tests/Core_Root
144 if [ -d "${CORE_ROOT}" ]; then
150 build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/runtest.proj" "Creating test overlay" "/t:CreateTestOverlay"
152 chmod +x $__BinDir/corerun
153 chmod +x $__BinDir/crossgen
155 # Make sure to copy over the pulled down packages
156 cp -r $__BinDir/* $CORE_ROOT/ > /dev/null
161 echo "${__MsgPrefix}Generating test host..."
163 export TEST_HOST=$xUnitTestBinBase/testhost
165 if [ -d "${TEST_HOST}" ]; then
171 build_MSBuild_projects "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "Creating test host" "/t:CreateTestHost"
177 echo "${__MsgPrefix}Building Tests..."
179 __TestDir=$__ProjectDir/tests
180 __ProjectFilesDir=$__TestDir
181 __TestBinDir=$__TestWorkingDir
183 if [ -f "${__TestWorkingDir}/build_info.json" ]; then
184 rm "${__TestWorkingDir}/build_info.json"
187 if [ $__RebuildTests -ne 0 ]; then
188 if [ -d "${__TestBinDir}" ]; then
189 echo "Removing tests build dir: ${__TestBinDir}"
194 export __CMakeBinDir="${__TestBinDir}"
195 if [ ! -d "${__TestIntermediatesDir}" ]; then
196 mkdir -p ${__TestIntermediatesDir}
199 __NativeTestIntermediatesDir="${__TestIntermediatesDir}/Native"
200 if [ ! -d "${__NativeTestIntermediatesDir}" ]; then
201 mkdir -p ${__NativeTestIntermediatesDir}
204 __ManagedTestIntermediatesDir="${__TestIntermediatesDir}/Managed"
205 if [ ! -d "${__ManagedTestIntermediatesDir}" ]; then
206 mkdir -p ${__ManagedTestIntermediatesDir}
209 echo "__BuildOS: ${__BuildOS}"
210 echo "__BuildArch: ${__BuildArch}"
211 echo "__BuildType: ${__BuildType}"
212 echo "__TestIntermediatesDir: ${__TestIntermediatesDir}"
213 echo "__NativeTestIntermediatesDir: ${__NativeTestIntermediatesDir}"
214 echo "__ManagedTestIntermediatesDir: ${__ManagedTestIntermediatesDir}"
216 if [ ! -f "$__TestBinDir" ]; then
217 echo "Creating TestBinDir: ${__TestBinDir}"
218 mkdir -p $__TestBinDir
220 if [ ! -f "$__LogsDir" ]; then
221 echo "Creating LogsDir: ${__LogsDir}"
224 if [ ! -f "$__MsbuildDebugLogsDir" ]; then
225 echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
226 mkdir -p $__MsbuildDebugLogsDir
229 # Set up the directory for MSBuild debug logs.
230 export MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
232 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
234 # =========================================================================================
236 # === Restore product binaries from packages
238 # =========================================================================================
240 if [ ${__SkipRestorePackages} != 1 ]; then
241 build_MSBuild_projects "Restore_Product" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
244 if [ $__SkipNative != 1 ]; then
245 build_native_projects "$__BuildArch" "${__NativeTestIntermediatesDir}"
247 if [ $? -ne 0 ]; then
248 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
253 if [ $__SkipManaged != 1 ]; then
254 echo "Starting the Managed Tests Build..."
256 build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "$__up"
258 if [ $? -ne 0 ]; then
259 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
262 echo "Checking the Managed Tests Build..."
264 build_MSBuild_projects "Check_Test_Build" "${__ProjectDir}/tests/runtest.proj" "Check Test Build" "/t:CheckTestBuild"
266 if [ $? -ne 0 ]; then
267 echo "${__MsgPrefix}Error: Check Test Build failed."
272 echo "Managed tests build success!"
277 if [ -n "$__UpdateInvalidPackagesArg" ]; then
278 __up="/t:UpdateInvalidPackageVersions"
284 build_MSBuild_projects()
292 extraBuildParameters=("$@")
294 # Set up directories and file names
295 __BuildLogRootName=$subDirectoryName
296 __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
297 __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
298 __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
300 # Use binclashlogger by default if no other logger is specified
301 if [[ "${extraBuildParameters[*]}" == *"/l:"* ]]; then
302 __msbuildEventLogging=
304 __msbuildEventLogging="/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log"
307 if [[ "$subDirectoryName" == "Tests_Managed" ]]; then
308 # Execute msbuild managed test build in stages - workaround for excessive data retention in MSBuild ConfigCache
309 # See https://github.com/Microsoft/msbuild/issues/2993
311 # __SkipPackageRestore and __SkipTargetingPackBuild used to control build by tests/src/dirs.proj
312 export __SkipPackageRestore=false
313 export __SkipTargetingPackBuild=false
314 export __NumberOfTestGroups=3
318 if [ -n "$__priority1" ]; then
319 export __NumberOfTestGroups=10
322 for (( testGroupToBuild=1 ; testGroupToBuild <= __NumberOfTestGroups; testGroupToBuild = testGroupToBuild + 1 ))
324 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog};Append=${__AppendToLog}\""
325 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn};Append=${__AppendToLog}\""
326 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr};Append=${__AppendToLog}\""
328 export __TestGroupToBuild=$testGroupToBuild
330 # Generate build command
331 buildArgs=("/nologo" "/verbosity:minimal" "/clp:Summary")
332 buildArgs+=("/p:RestoreDefaultOptimizationDataPackage=false" "/p:PortableBuild=true")
333 buildArgs+=("/p:UsePartialNGENOptimization=false" "/maxcpucount")
335 buildArgs+=("$projectName" "${__msbuildLog}" "${__msbuildWrn}" "${__msbuildErr}")
336 buildArgs+=("$__msbuildEventLogging")
337 buildArgs+=("${extraBuildParameters[@]}")
338 buildArgs+=("${__CommonMSBuildArgs[@]}")
339 buildArgs+=("${__UnprocessedBuildArgs[@]}")
341 nextCommand="\"$__ProjectRoot/dotnet.sh\" msbuild ${buildArgs[@]}"
342 echo "Building step '$stepName' testGroupToBuild=$testGroupToBuild via $nextCommand"
345 # Make sure everything is OK
346 if [ $? -ne 0 ]; then
347 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
353 export __SkipPackageRestore=true
354 export __SkipTargetingPackBuild=true
358 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog}\""
359 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn}\""
360 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
362 # Generate build command
363 buildArgs=("/nologo" "/verbosity:minimal" "/clp:Summary")
364 buildArgs+=("/p:RestoreDefaultOptimizationDataPackage=false" "/p:PortableBuild=true")
365 buildArgs+=("/p:UsePartialNGENOptimization=false" "/maxcpucount")
367 buildArgs+=("$projectName" "${__msbuildLog}" "${__msbuildWrn}" "${__msbuildErr}")
368 buildArgs+=("$__msbuildEventLogging")
369 buildArgs+=("${extraBuildParameters[@]}")
370 buildArgs+=("${__CommonMSBuildArgs[@]}")
371 buildArgs+=("${__UnprocessedBuildArgs[@]}")
373 nextCommand="\"$__ProjectRoot/dotnet.sh\" msbuild ${buildArgs[@]}"
374 echo "Building step '$stepName' via $nextCommand"
377 # Make sure everything is OK
378 if [ $? -ne 0 ]; then
379 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
388 build_native_projects()
391 intermediatesForBuild="$2"
393 extraCmakeArguments="-DCLR_CMAKE_TARGET_OS=${__BuildOS} -DCLR_CMAKE_HOST_ARCH=${platformArch}"
394 message="native tests assets"
396 # All set to commence the build
397 echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
402 if [ $__UseNinja == 1 ]; then
404 buildFile="build.ninja"
405 if ! buildTool=$(command -v ninja || command -v ninja-build); then
406 echo "Unable to locate ninja!" 1>&2
411 if [ $__SkipConfigure == 0 ]; then
412 # if msbuild is not supported, then set __SkipGenerateVersion to 1
413 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
414 # Drop version.c file
415 __versionSourceFile="$intermediatesForBuild/version.c"
416 if [ $__SkipGenerateVersion == 0 ]; then
418 $__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
419 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \
420 /p:UsePartialNGENOptimization=false /maxcpucount \
421 $__ProjectDir/build.proj /t:GenerateVersionHeader \
422 /p:GenerateVersionHeader=true /p:NativeVersionSourceFile=$__versionSourceFile \
423 /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
424 $__CommonMSBuildArgs $__UnprocessedBuildArgs
426 # Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
427 __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
428 if [ -e $__versionSourceFile ]; then
429 read existingVersionSourceLine < $__versionSourceFile
431 if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
432 echo $__versionSourceLine > $__versionSourceFile
436 pushd "$intermediatesForBuild"
437 # Regenerate the CMake solution
438 # Force cross dir to point to project root cross dir, in case there is a cross build.
439 nextCommand="CONFIG_DIR=\"$__ProjectRoot/cross\" \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__TestDir\" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator $extraCmakeArguments $__cmakeargs"
440 echo "Invoking $nextCommand"
445 if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
446 echo "Failed to generate $message build project!"
451 if [ $__ConfigureOnly == 1 ]; then
452 echo "Finish configuration & skipping $message build."
456 pushd "$intermediatesForBuild"
458 echo "Executing $buildTool install -j $__NumProc"
460 $buildTool install -j $__NumProc
462 echo "Failed to build $message."
467 echo "Native tests build success!"
472 echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [runtests] [bindir]"
473 echo "BuildArch can be: x64, x86, arm, armel, arm64"
474 echo "BuildType can be: debug, checked, release"
475 echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
476 echo "ninja - target ninja instead of GNU make"
477 echo "clangx.y - optional argument to build using clang version x.y - supported version 3.5 - 6.0"
478 echo "cross - optional argument to signify cross compilation,"
479 echo " - will use ROOTFS_DIR environment variable if set."
480 echo "portableLinux - build for Portable Linux Distribution"
481 echo "portablebuild - Use portable build."
482 echo "verbose - optional argument to enable verbose build output."
483 echo "rebuild - if tests have already been built - rebuild them"
484 echo "skipnative: skip the native tests build"
485 echo "skipmanaged: skip the managed section of the test build"
486 echo "buildtestwrappersonly - only build the test wrappers"
487 echo "generatelayoutonly - only pull down dependencies and build coreroot"
488 echo "generatetesthostonly - only pull down dependencies and build coreroot and the CoreFX testhost"
489 echo "skiprestorepackages - skip package restore"
490 echo "runtests - run tests after building them"
491 echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
492 echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
493 echo "priority1 - include priority=1 tests in the build"
498 # Obtain the location of the bash script to figure out where the root of the repo is.
499 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
501 # Use uname to determine what the CPU is.
504 # Some Linux platforms report unknown for platform, but the arch for machine.
505 if [ "$CPUName" == "unknown" ]; then
511 echo "Unsupported CPU $CPUName detected, build might not succeed!"
522 echo "Unsupported CPU $CPUName detected, build might not succeed!"
533 echo "Unknown CPU $CPUName detected, configuring as if for x64"
539 # Use uname to determine what the OS is.
573 echo "Unsupported OS $OSName detected, configuring as if for Linux"
581 __IncludeTests=INCLUDE_TESTS
583 # Set the various build properties here so that CMake and MSBuild can pick them up
584 export __ProjectDir="$__ProjectRoot"
585 __SourceDir="$__ProjectDir/src"
586 __PackagesDir="$__ProjectDir/packages"
587 __RootBinDir="$__ProjectDir/bin"
588 __BuildToolsDir="$__ProjectDir/Tools"
589 __DotNetCli="$__ProjectDir/dotnet.sh"
590 __UnprocessedBuildArgs=
599 __SkipGenerateVersion=0
602 __ClangMajorVersion=0
603 __ClangMinorVersion=0
604 __NuGetPath="$__PackagesDir/NuGet.exe"
605 __SkipRestorePackages=0
609 __msbuildonunsupportedplatform=0
610 __NativeTestIntermediatesDir=
613 __BuildTestWrappers=1
614 __GenerateLayoutOnly=
615 __GenerateTestHostOnly=
617 __BuildTestWrappersOnly=
621 if [ $# -le 0 ]; then
625 lowerI="$(echo $1 | awk '{print tolower($0)}')"
665 __CodeCoverage=Coverage
677 if [ "$__BuildOS" == "Linux" ]; then
680 echo "ERROR: portableLinux not supported for non-Linux platforms."
690 __ClangMajorVersion=3
691 __ClangMinorVersion=5
695 __ClangMajorVersion=3
696 __ClangMinorVersion=6
700 __ClangMajorVersion=3
701 __ClangMinorVersion=7
705 __ClangMajorVersion=3
706 __ClangMinorVersion=8
710 __ClangMajorVersion=3
711 __ClangMinorVersion=9
715 __ClangMajorVersion=4
716 __ClangMinorVersion=0
720 __ClangMajorVersion=5
721 __ClangMinorVersion=0
725 __ClangMajorVersion=6
726 __ClangMinorVersion=0
741 skipnative|-skipnative)
745 skipmanaged|-skipmanaged)
747 __BuildTestWrappers=0
750 buildtestwrappersonly)
751 __BuildTestWrappersOnly=1
755 __GenerateLayoutOnly=1
758 generatetesthostonly)
759 __GenerateTestHostOnly=1
763 __SkipRestorePackages=1
769 if [ ! -d $__RootBinDir ]; then
772 __RootBinParent=$(dirname $__RootBinDir)
773 __RootBinName=${__RootBinDir##*/}
774 __RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
777 echo "ERROR: 'bindir' requires a non-empty option argument"
782 msbuildonunsupportedplatform)
783 __msbuildonunsupportedplatform=1
788 __UnprocessedBuildArgs+=("/p:CLRTestPriorityToBuild=1")
792 __UnprocessedBuildArgs+=("$1")
799 # Get the number of processors available to the scheduler
800 # Other techniques such as `nproc` only get the number of
801 # processors available to a single process.
802 if [ `uname` = "FreeBSD" ]; then
803 __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
804 elif [ `uname` = "NetBSD" ]; then
805 __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
806 elif [ `uname` = "Darwin" ]; then
807 __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
809 __NumProc=$(nproc --all)
812 __CommonMSBuildArgs=("/p:__BuildArch=$__BuildArch" "/p:__BuildType=$__BuildType" "/p:__BuildOS=$__BuildOS")
814 # Configure environment if we are doing a verbose build
815 if [ $__VerboseBuild == 1 ]; then
817 __CommonMSBuildArgs+=("/v:detailed")
820 # Set default clang version
821 if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
822 if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
823 __ClangMajorVersion=5
824 __ClangMinorVersion=0
826 __ClangMajorVersion=3
827 __ClangMinorVersion=9
831 # Set dependent variables
832 __LogsDir="$__RootBinDir/Logs"
833 __MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
835 # Set the remaining variables based upon the determined build configuration
836 __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
837 __PackagesBinDir="$__BinDir/.nuget"
838 __TestDir="$__ProjectDir/tests"
839 __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
840 __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
841 __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
842 __isMSBuildOnNETCoreSupported=0
843 __CrossComponentBinDir="$__BinDir"
844 __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
846 __CrossArch="$__HostArch"
847 if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
850 if [ $__CrossBuild == 1 ]; then
851 __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
853 __CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
854 __CrossgenExe="$__CrossComponentBinDir/crossgen"
856 isMSBuildOnNETCoreSupported
858 # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
859 # This is needed by CLI to function.
860 if [ -z "$HOME" ]; then
861 if [ ! -d "$__ProjectDir/temp_home" ]; then
864 export HOME=$__ProjectDir/temp_home
865 echo "HOME not defined; setting it to $HOME"
868 # Configure environment if we are doing a cross compile.
869 if [ $__CrossBuild == 1 ]; then
870 export CROSSCOMPILE=1
871 if ! [[ -n "$ROOTFS_DIR" ]]; then
872 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
876 # init the target distro name
879 # Override tool directory
881 if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (-z "$__BuildTestWrappersOnly") ]]; then
883 elif [ ! -z "$__BuildTestWrappersOnly" ]; then
887 if [ ! -z "$__GenerateTestHostOnly" ]; then
892 if [ $? -ne 0 ]; then
893 echo "Failed to build tests"
897 echo "${__MsgPrefix}Test build successful."
898 echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
900 __testNativeBinDir=$__IntermediatesDir/tests
902 if [ $__RunTests -ne 0 ]; then
906 nextCommand="$__TestDir/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir"
910 echo "Tests run successful."
912 echo "To run all tests use 'tests/runtests.sh' where:"
913 echo " testRootDir = $__TestBinDir"
914 echo " coreClrBinDir = $__BinDir"
915 echo " coreFxBinDir = $CORE_ROOT"
916 echo " testNativeBinDir = $__testNativeBinDir"
917 echo " -------------------------------------------------- "
918 echo " Example runtest.sh command"
920 echo " ./tests/runtest.sh --coreOverlayDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir --testRootDir=$__TestBinDir --copyNativeTestBin"
921 echo " -------------------------------------------------- "
922 echo "To run single test use the following command:"
923 echo " bash ${__TestBinDir}/__TEST_PATH__/__TEST_NAME__.sh -coreroot=${CORE_ROOT}"