7 # Some OS groups should default to use the portable packages
8 if [ "$__BuildOS" == "OSX" ]; then
12 if [ "$__HostOS" == "Linux" ]; then
13 if [ -e /etc/redhat-release ]; then
14 local redhatRelease=$(</etc/redhat-release)
15 if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
16 __HostDistroRid="rhel.6-$__HostArch"
20 elif [ -e /etc/os-release ]; then
21 source /etc/os-release
22 if [[ $ID == "alpine" ]]; then
23 __HostDistroRid="linux-musl-$__HostArch"
26 __HostDistroRid="$ID.$VERSION_ID-$__HostArch"
29 elif [ "$__HostOS" == "FreeBSD" ]; then
30 __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
31 __HostDistroRid="freebsd.$__freebsd_version-$__HostArch"
34 # Portable builds target the base RID
35 if [ "$__PortableBuild" == 1 ]; then
36 if [ "$__BuildOS" == "OSX" ]; then
37 export __HostDistroRid="osx-$__BuildArch"
38 elif [ "$__BuildOS" == "Linux" ]; then
39 export __HostDistroRid="linux-$__BuildArch"
43 if [ "$__HostDistroRid" == "" ]; then
44 echo "WARNING: Cannot determine runtime id for current distro."
47 echo "Setting __HostDistroRid to $__HostDistroRid"
52 if [ $__CrossBuild == 1 ]; then
53 if [ "$__BuildOS" == "Linux" ]; then
54 if [ ! -e $ROOTFS_DIR/etc/os-release ]; then
55 if [ -e $ROOTFS_DIR/android_platform ]; then
56 source $ROOTFS_DIR/android_platform
57 export __DistroRid="$RID"
59 echo "WARNING: Cannot determine runtime id for current distro."
63 source $ROOTFS_DIR/etc/os-release
64 export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
68 export __DistroRid="$__HostDistroRid"
71 if [ "$ID.$VERSION_ID" == "ubuntu.16.04" ]; then
72 export __DistroRid="ubuntu.14.04-$__BuildArch"
75 # Portable builds target the base RID
76 if [ "$__PortableBuild" == 1 ]; then
77 if [ "$__BuildOS" == "Linux" ]; then
78 export __DistroRid="linux-$__BuildArch"
79 export __RuntimeId="linux-$__BuildArch"
80 elif [ "$__BuildOS" == "OSX" ]; then
81 export __DistroRid="osx-$__BuildArch"
82 export __RuntimeId="osx-$__BuildArch"
86 echo "__DistroRid: " $__DistroRid
89 isMSBuildOnNETCoreSupported()
91 __isMSBuildOnNETCoreSupported=$__msbuildonunsupportedplatform
93 if [ $__isMSBuildOnNETCoreSupported == 1 ]; then
97 if [ "$__HostArch" == "x64" ]; then
98 if [ "$__HostOS" == "Linux" ]; then
99 __isMSBuildOnNETCoreSupported=1
100 UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64")
101 for UNSUPPORTED_RID in "${UNSUPPORTED_RIDS[@]}"
103 if [ "$__HostDistroRid" == "$UNSUPPORTED_RID" ]; then
104 __isMSBuildOnNETCoreSupported=0
108 elif [ "$__HostOS" == "OSX" ]; then
109 __isMSBuildOnNETCoreSupported=1
116 __TestDir=$__ProjectDir/tests
117 __ProjectFilesDir=$__TestDir
118 __TestBinDir=$__TestWorkingDir
120 if [ $__RebuildTests -ne 0 ]; then
121 if [ -d "${__TestBinDir}" ]; then
122 echo "Removing tests build dir: ${__TestBinDir}"
127 __CMakeBinDir="${__TestBinDir}"
129 if [ -z "$__TestIntermediateDir" ]; then
130 __TestIntermediateDir="tests/obj/${__BuildOS}.${__BuildArch}.${__BuildType}"
133 echo "__BuildOS: ${__BuildOS}"
134 echo "__BuildArch: ${__BuildArch}"
135 echo "__BuildType: ${__BuildType}"
136 echo "__TestIntermediateDir: ${__TestIntermediateDir}"
138 if [ ! -f "$__TestBinDir" ]; then
139 echo "Creating TestBinDir: ${__TestBinDir}"
140 mkdir -p $__TestBinDir
142 if [ ! -f "$__LogsDir" ]; then
143 echo "Creating LogsDir: ${__LogsDir}"
147 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
149 # =========================================================================================
151 # === Restore product binaries from packages
153 # =========================================================================================
155 build_MSBuild_projects "Restore_Packages" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "-BatchRestorePackages"
157 if [ -n "$__UpdateInvalidPackagesArg" ]; then
158 __up=-updateinvalidpackageversion
161 echo "${__MsgPrefix}Creating test overlay..."
163 if [ -z "$xUnitTestBinBase" ]; then
164 xUnitTestBinBase=$__TestWorkingDir
167 export CORE_ROOT=$xUnitTestBinBase/Tests/Core_Root
169 if [ -d "${CORE_ROOT}" ]; then
175 build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/runtest.proj" "Creating test overlay" "-testOverlay"
177 chmod +x $__BinDir/corerun
178 chmod +x $__BinDir/crossgen
180 # Make sure to copy over the pulled down packages
181 cp -r $__BinDir/* $CORE_ROOT/ > /dev/null
187 export TEST_HOST=$xUnitTestBinBase/testhost
189 if [ -d "${TEST_HOST}" ]; then
193 echo "${__MsgPrefix}Creating test overlay..."
196 build_MSBuild_projects "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "Creating test host" "-testHost"
202 __TestDir=$__ProjectDir/tests
203 __ProjectFilesDir=$__TestDir
204 __TestBinDir=$__TestWorkingDir
206 if [ $__RebuildTests -ne 0 ]; then
207 if [ -d "${__TestBinDir}" ]; then
208 echo "Removing tests build dir: ${__TestBinDir}"
213 export __CMakeBinDir="${__TestBinDir}"
214 if [ ! -d "${__TestIntermediatesDir}" ]; then
215 mkdir -p ${__TestIntermediatesDir}
218 __NativeTestIntermediatesDir="${__TestIntermediatesDir}/Native"
219 if [ ! -d "${__NativeTestIntermediatesDir}" ]; then
220 mkdir -p ${__NativeTestIntermediatesDir}
223 __ManagedTestIntermediatesDir="${__TestIntermediatesDir}/Managed"
224 if [ ! -d "${__ManagedTestIntermediatesDir}" ]; then
225 mkdir -p ${__ManagedTestIntermediatesDir}
228 echo "__BuildOS: ${__BuildOS}"
229 echo "__BuildArch: ${__BuildArch}"
230 echo "__BuildType: ${__BuildType}"
231 echo "__TestIntermediatesDir: ${__TestIntermediatesDir}"
232 echo "__NativeTestIntermediatesDir: ${__NativeTestIntermediatesDir}"
233 echo "__ManagedTestIntermediatesDir: ${__ManagedTestIntermediatesDir}"
235 if [ ! -f "$__TestBinDir" ]; then
236 echo "Creating TestBinDir: ${__TestBinDir}"
237 mkdir -p $__TestBinDir
239 if [ ! -f "$__LogsDir" ]; then
240 echo "Creating LogsDir: ${__LogsDir}"
244 __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}"
246 # =========================================================================================
248 # === Restore product binaries from packages
250 # =========================================================================================
252 if [ ${__SkipRestorePackages} != 1 ]; then
253 build_MSBuild_projects "Restore_Product" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "-BatchRestorePackages"
256 if [ -n "$__BuildAgainstPackagesArg" ]; then
257 build_MSBuild_projects "Tests_GenerateRuntimeLayout" "${__ProjectDir}/tests/runtest.proj" "Restore product binaries (run tests)" "-BinPlaceRef" "-BinPlaceProduct" "-CopyCrossgenToProduct"
260 if [ $__SkipNative != 1 ]; then
261 build_native_projects "$__BuildArch" "${__NativeTestIntermediatesDir}"
263 if [ $? -ne 0 ]; then
264 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
269 echo "Starting the Managed Tests Build..."
271 build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "$__up"
273 if [ $? -ne 0 ]; then
274 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
277 echo "Checking the Managed Tests Build..."
279 build_MSBuild_projects "Check_Test_Build" "${__ProjectDir}/tests/runtest.proj" "Check Test Build" "-ExtraParameters:/t:CheckTestBuild"
281 if [ $? -ne 0 ]; then
282 echo "${__MsgPrefix}Error: Check Test Build failed."
286 echo "Managed tests build success!"
289 if [ $__BuildTestWrappers -ne -0 ]; then
290 echo "${__MsgPrefix}Creating test wrappers..."
292 # Always create the test wrappers and set the exclude file.
293 export __Exclude="$__TestDir/issues.targets"
294 echo "Exclude set to $__TestDir/issues.targets"
295 build_Tests_internal "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "Test Xunit Wrapper" "-BuildWrappers" "-MsBuildEventLogging= " "-TargetsWindows=false"
297 if [ $? -ne 0 ]; then
298 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
301 echo "XUnit Wrappers have been built."
302 echo "Create marker \"${__XUnitWrapperBuiltMarker}\""
303 touch $__XUnitWrapperBuiltMarker
307 if [ -n "$__UpdateInvalidPackagesArg" ]; then
308 __up=-updateinvalidpackageversion
311 echo "${__MsgPrefix}Creating test overlay..."
315 if [ $__ZipTests -ne 0 ]; then
316 echo "${__MsgPrefix}ZIP tests packages..."
317 build_MSBuild_projects "Helix_Prep" "$__ProjectDir/tests/helixprep.proj" "Prep test binaries for Helix publishing" " "
321 build_MSBuild_projects()
329 extraBuildParameters=("$@")
331 # Set up directories and file names
332 __BuildLogRootName=$subDirectoryName
333 __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
334 __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
335 __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
337 # Use binclashlogger by default if no other logger is specified
338 if [[ "${extraBuildParameters[*]}" == *"-MsBuildEventLogging"* ]]; then
339 msbuildEventLogging=""
341 msbuildEventLogging="-MsBuildEventLogging=\"/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log\""
344 if [[ "$subDirectoryName" == "Tests_Managed" ]]; then
345 # Execute msbuild managed test build in stages - workaround for excessive data retention in MSBuild ConfigCache
346 # See https://github.com/Microsoft/msbuild/issues/2993
348 # __SkipPackageRestore and __SkipTargetingPackBuild used to control build by tests/src/dirs.proj
349 export __SkipPackageRestore=false
350 export __SkipTargetingPackBuild=false
351 export __BuildLoopCount=2
352 export __TestGroupToBuild=1
355 if [ -n "$__priority1" ]; then
356 export __BuildLoopCount=16
357 export __TestGroupToBuild=2
360 for (( slice=1 ; slice <= __BuildLoopCount; slice = slice + 1 ))
362 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog};Append=${__AppendToLog}\""
363 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn};Append=${__AppendToLog}\""
364 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr};Append=${__AppendToLog}\""
366 export TestBuildSlice=$slice
368 # Generate build command
369 buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
370 buildArgs+=("$msbuildEventLogging")
371 buildArgs+=("${extraBuildParameters[@]}")
372 buildArgs+=("${__RunArgs[@]}")
373 buildArgs+=("${__UnprocessedBuildArgs[@]}")
375 echo "Building step '$stepName' slice=$slice via $buildCommand"
378 "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
380 # Make sure everything is OK
381 if [ $? -ne 0 ]; then
382 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
388 export __SkipPackageRestore=true
389 export __SkipTargetingPackBuild=true
393 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog}\""
394 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn}\""
395 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
397 # Generate build command
398 buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
399 buildArgs+=("$msbuildEventLogging")
400 buildArgs+=("${extraBuildParameters[@]}")
401 buildArgs+=("${__RunArgs[@]}")
402 buildArgs+=("${__UnprocessedBuildArgs[@]}")
404 echo "Building step '$stepName' via $buildCommand"
407 "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
409 # Make sure everything is OK
410 if [ $? -ne 0 ]; then
411 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
420 build_native_projects()
423 intermediatesForBuild="$2"
425 extraCmakeArguments="-DCLR_CMAKE_TARGET_OS=${__BuildOS} -DCLR_CMAKE_HOST_ARCH=${platformArch}"
426 message="native tests assets"
428 # All set to commence the build
429 echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
434 if [ $__UseNinja == 1 ]; then
436 buildFile="build.ninja"
437 if ! buildTool=$(command -v ninja || command -v ninja-build); then
438 echo "Unable to locate ninja!" 1>&2
443 if [ $__SkipConfigure == 0 ]; then
444 # if msbuild is not supported, then set __SkipGenerateVersion to 1
445 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
446 # Drop version.cpp file
447 __versionSourceFile="$intermediatesForBuild/version.cpp"
448 if [ $__SkipGenerateVersion == 0 ]; then
450 "$__ProjectRoot/run.sh" build -Project=$__ProjectDir/build.proj -generateHeaderUnix -NativeVersionSourceFile=$__versionSourceFile -MsBuildEventLogging="/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" $__RunArgs $__UnprocessedBuildArgs
452 # Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
453 __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
454 if [ -e $__versionSourceFile ]; then
455 read existingVersionSourceLine < $__versionSourceFile
457 if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
458 echo $__versionSourceLine > $__versionSourceFile
462 pushd "$intermediatesForBuild"
463 # Regenerate the CMake solution
464 echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__TestDir\" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator $extraCmakeArguments $__cmakeargs"
465 "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__TestDir" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator "$extraCmakeArguments" "$__cmakeargs"
469 if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
470 echo "Failed to generate $message build project!"
475 if [ $__ConfigureOnly == 1 ]; then
476 echo "Finish configuration & skipping $message build."
480 pushd "$intermediatesForBuild"
482 echo "Executing $buildTool install -j $__NumProc"
484 $buildTool install -j $__NumProc
486 echo "Failed to build $message."
491 echo "Native tests build success!"
496 echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [runtests] [bindir]"
497 echo "BuildArch can be: x64, x86, arm, armel, arm64"
498 echo "BuildType can be: debug, checked, release"
499 echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
500 echo "ninja - target ninja instead of GNU make"
501 echo "clangx.y - optional argument to build using clang version x.y - supported version 3.5 - 6.0"
502 echo "cross - optional argument to signify cross compilation,"
503 echo " - will use ROOTFS_DIR environment variable if set."
504 echo "crosscomponent - optional argument to build cross-architecture component,"
505 echo " - will use CAC_ROOTFS_DIR environment variable if set."
506 echo "portableLinux - build for Portable Linux Distribution"
507 echo "portablebuild - Use portable build."
508 echo "verbose - optional argument to enable verbose build output."
509 echo "rebuild - if tests have already been built - rebuild them"
510 echo "skipnative: skip the native tests build"
511 echo "generatelayoutonly - only pull down dependencies and build coreroot"
512 echo "generatetesthostonly - only pull down dependencies and build coreroot and the CoreFX testhost"
513 echo "buildagainstpackages - pull down and build using packages."
514 echo "skiprestorepackages - skip package restore"
515 echo "runtests - run tests after building them"
516 echo "ziptests - zips CoreCLR tests & Core_Root for a Helix run"
517 echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
518 echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
519 echo "priority1 - include priority=1 tests in the build"
524 # Obtain the location of the bash script to figure out where the root of the repo is.
525 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
527 # Use uname to determine what the CPU is.
530 # Some Linux platforms report unknown for platform, but the arch for machine.
531 if [ "$CPUName" == "unknown" ]; then
537 echo "Unsupported CPU $CPUName detected, build might not succeed!"
548 echo "Unsupported CPU $CPUName detected, build might not succeed!"
559 echo "Unknown CPU $CPUName detected, configuring as if for x64"
565 # Use uname to determine what the OS is.
599 echo "Unsupported OS $OSName detected, configuring as if for Linux"
607 __IncludeTests=INCLUDE_TESTS
609 # Set the various build properties here so that CMake and MSBuild can pick them up
610 export __ProjectDir="$__ProjectRoot"
611 __SourceDir="$__ProjectDir/src"
612 __PackagesDir="$__ProjectDir/packages"
613 __RootBinDir="$__ProjectDir/bin"
614 __BuildToolsDir="$__ProjectDir/Tools"
615 __UnprocessedBuildArgs=
621 __SkipNative=1 # [REMOVE] Temporarily default to skip native
623 __SkipGenerateVersion=0
626 __ClangMajorVersion=0
627 __ClangMinorVersion=0
628 __NuGetPath="$__PackagesDir/NuGet.exe"
630 __BuildAgainstPackagesArg=
631 __SkipRestorePackages=0
635 __msbuildonunsupportedplatform=0
637 __NativeTestIntermediatesDir=
640 __BuildTestWrappers=1
641 __GenerateLayoutOnly=
642 __GenerateTestHostOnly=
647 if [ $# -le 0 ]; then
651 lowerI="$(echo $1 | awk '{print tolower($0)}')"
691 __CodeCoverage=Coverage
703 if [ "$__BuildOS" == "Linux" ]; then
706 echo "ERROR: portableLinux not supported for non-Linux platforms."
716 __ClangMajorVersion=3
717 __ClangMinorVersion=5
721 __ClangMajorVersion=3
722 __ClangMinorVersion=6
726 __ClangMajorVersion=3
727 __ClangMinorVersion=7
731 __ClangMajorVersion=3
732 __ClangMinorVersion=8
736 __ClangMajorVersion=3
737 __ClangMinorVersion=9
741 __ClangMajorVersion=4
742 __ClangMinorVersion=0
746 __ClangMajorVersion=5
747 __ClangMinorVersion=0
751 __ClangMajorVersion=6
752 __ClangMinorVersion=0
767 skipnative|-skipnative)
771 # [REMOVE] Enable native build - the temporary default is to skip native
781 __GenerateLayoutOnly=1
783 generatetesthostonly)
784 __GenerateTestHostOnly=1
786 buildagainstpackages)
787 __BuildAgainstPackagesArg=1
790 __SkipRestorePackages=1
796 if [ ! -d $__RootBinDir ]; then
799 __RootBinParent=$(dirname $__RootBinDir)
800 __RootBinName=${__RootBinDir##*/}
801 __RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
804 echo "ERROR: 'bindir' requires a non-empty option argument"
809 msbuildonunsupportedplatform)
810 __msbuildonunsupportedplatform=1
814 __UnprocessedBuildArgs+=("-priority=1")
817 __UnprocessedBuildArgs+=("$1")
824 # Get the number of processors available to the scheduler
825 # Other techniques such as `nproc` only get the number of
826 # processors available to a single process.
827 if [ `uname` = "FreeBSD" ]; then
828 __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
829 elif [ `uname` = "NetBSD" ]; then
830 __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
831 elif [ `uname` = "Darwin" ]; then
832 __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
834 __NumProc=$(nproc --all)
837 __RunArgs=("-BuildArch=$__BuildArch" "-BuildType=$__BuildType" "-BuildOS=$__BuildOS")
839 # Configure environment if we are doing a verbose build
840 if [ $__VerboseBuild == 1 ]; then
842 __RunArgs+=("-verbose")
845 # Set default clang version
846 if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
847 if [ $__CrossBuild == 1 ]; then
848 __ClangMajorVersion=3
849 __ClangMinorVersion=6
851 __ClangMajorVersion=3
852 __ClangMinorVersion=5
856 # Set dependent variables
857 __LogsDir="$__RootBinDir/Logs"
859 # init the host distro name
862 # Set the remaining variables based upon the determined build configuration
863 __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
864 __PackagesBinDir="$__BinDir/.nuget"
865 __ToolsDir="$__RootBinDir/tools"
866 __TestDir="$__ProjectDir/tests"
867 __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
868 __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
869 __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
870 __isMSBuildOnNETCoreSupported=0
871 __CrossComponentBinDir="$__BinDir"
872 __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
874 __CrossArch="$__HostArch"
875 if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
878 if [ $__CrossBuild == 1 ]; then
879 __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
881 __CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
882 __CrossgenExe="$__CrossComponentBinDir/crossgen"
884 isMSBuildOnNETCoreSupported
886 # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
887 # This is needed by CLI to function.
888 if [ -z "$HOME" ]; then
889 if [ ! -d "$__ProjectDir/temp_home" ]; then
892 export HOME=$__ProjectDir/temp_home
893 echo "HOME not defined; setting it to $HOME"
896 # Configure environment if we are doing a cross compile.
897 if [ $__CrossBuild == 1 ]; then
898 export CROSSCOMPILE=1
899 if ! [[ -n "$ROOTFS_DIR" ]]; then
900 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
904 # init the target distro name
907 # Override tool directory
909 __CoreClrVersion=1.1.0
910 __sharedFxDir=$__BuildToolsDir/dotnetcli/shared/Microsoft.NETCore.App/$__CoreClrVersion/
912 if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") ]]; then
913 echo "Building Tests..."
916 echo "Generating test layout..."
918 if [ ! -z "$__GenerateTestHostOnly" ]; then
919 echo "Generating test host..."
924 if [ $? -ne 0 ]; then
925 echo "Failed to build tests"
929 echo "${__MsgPrefix}Test build successful."
930 echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
932 __testNativeBinDir=$__IntermediatesDir/tests
934 if [ $__RunTests -ne 0 ]; then
938 echo "${__TestDir}/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$__sharedFxDir --testNativeBinDir=$__testNativeBinDir"
940 $__TestDir/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir
942 echo "Tests run successful."
944 echo "To run all tests use 'tests/runtests.sh' where:"
945 echo " testRootDir = $__TestBinDir"
946 echo " coreClrBinDir = $__BinDir"
947 echo " coreFxBinDir = $CORE_ROOT"
948 echo " testNativeBinDir = $__testNativeBinDir"
949 echo " -------------------------------------------------- "
950 echo " Example runtest.sh command"
952 echo " ./tests/runtest.sh --coreOverlayDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir --testRootDir=$__TestBinDir --copyNativeTestBin"
953 echo " -------------------------------------------------- "
954 echo "To run single test use the following command:"
955 echo " bash ${__TestBinDir}/__TEST_PATH__/__TEST_NAME__.sh -coreroot=${CORE_ROOT}"