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 __XUnitWrapperBuiltMarker=${__TestBinDir}/xunit_wrapper_build
294 if [ ! -f $__XUnitWrapperBuiltMarker ]; then
296 build_MSBuild_projects "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "Test Xunit Wrapper" "-BuildWrappers" "-MsBuildEventLogging= " "-TargetsWindows=false"
298 if [ $? -ne 0 ]; then
299 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
302 echo "XUnit Wrappers have been built."
303 echo "Create marker \"${__XUnitWrapperBuiltMarker}\""
304 touch $__XUnitWrapperBuiltMarker
307 echo "XUnit Wrappers had been built before."
311 if [ -n "$__UpdateInvalidPackagesArg" ]; then
312 __up=-updateinvalidpackageversion
315 echo "${__MsgPrefix}Creating test overlay..."
319 if [ $__ZipTests -ne 0 ]; then
320 echo "${__MsgPrefix}ZIP tests packages..."
321 build_MSBuild_projects "Helix_Prep" "$__ProjectDir/tests/helixprep.proj" "Prep test binaries for Helix publishing" " "
325 build_MSBuild_projects()
333 extraBuildParameters=("$@")
335 # Set up directories and file names
336 __BuildLogRootName=$subDirectoryName
337 __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
338 __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
339 __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
341 # Use binclashlogger by default if no other logger is specified
342 if [[ "${extraBuildParameters[*]}" == *"-MsBuildEventLogging"* ]]; then
343 msbuildEventLogging=""
345 msbuildEventLogging="-MsBuildEventLogging=\"/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log\""
348 if [[ "$subDirectoryName" == "Tests_Managed" ]]; then
349 # Execute msbuild managed test build in stages - workaround for excessive data retention in MSBuild ConfigCache
350 # See https://github.com/Microsoft/msbuild/issues/2993
352 # __SkipPackageRestore and __SkipTargetingPackBuild used to control build by tests/src/dirs.proj
353 export __SkipPackageRestore=false
354 export __SkipTargetingPackBuild=false
355 export __BuildLoopCount=2
356 export __TestGroupToBuild=1
359 if [ -n __priority1 ]; then
360 export __BuildLoopCount=16
361 export __TestGroupToBuild=2
364 for (( slice=1 ; slice <= __BuildLoopCount; slice = slice + 1 ))
366 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog};Append=${__AppendToLog}\""
367 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn};Append=${__AppendToLog}\""
368 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr};Append=${__AppendToLog}\""
370 export TestBuildSlice=$slice
372 # Generate build command
373 buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
374 buildArgs+=("$msbuildEventLogging")
375 buildArgs+=("${extraBuildParameters[@]}")
376 buildArgs+=("${__RunArgs[@]}")
377 buildArgs+=("${__UnprocessedBuildArgs[@]}")
379 echo "Building step '$stepName' slice=$slice via $buildCommand"
382 "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
384 # Make sure everything is OK
385 if [ $? -ne 0 ]; then
386 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
392 export __SkipPackageRestore=true
393 export __SkipTargetingPackBuild=true
397 __msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog}\""
398 __msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn}\""
399 __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
401 # Generate build command
402 buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
403 buildArgs+=("$msbuildEventLogging")
404 buildArgs+=("${extraBuildParameters[@]}")
405 buildArgs+=("${__RunArgs[@]}")
406 buildArgs+=("${__UnprocessedBuildArgs[@]}")
408 echo "Building step '$stepName' via $buildCommand"
411 "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
413 # Make sure everything is OK
414 if [ $? -ne 0 ]; then
415 echo "${__MsgPrefix}Failed to build $stepName. See the build logs:"
424 build_native_projects()
427 intermediatesForBuild="$2"
429 extraCmakeArguments="-DCLR_CMAKE_TARGET_OS=${__BuildOS} -DCLR_CMAKE_HOST_ARCH=${platformArch}"
430 message="native tests assets"
432 # All set to commence the build
433 echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
438 if [ $__UseNinja == 1 ]; then
440 buildFile="build.ninja"
441 if ! buildTool=$(command -v ninja || command -v ninja-build); then
442 echo "Unable to locate ninja!" 1>&2
447 if [ $__SkipConfigure == 0 ]; then
448 # if msbuild is not supported, then set __SkipGenerateVersion to 1
449 if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
450 # Drop version.cpp file
451 __versionSourceFile="$intermediatesForBuild/version.cpp"
452 if [ $__SkipGenerateVersion == 0 ]; then
454 "$__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
456 # Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
457 __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
458 if [ -e $__versionSourceFile ]; then
459 read existingVersionSourceLine < $__versionSourceFile
461 if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
462 echo $__versionSourceLine > $__versionSourceFile
466 pushd "$intermediatesForBuild"
467 # Regenerate the CMake solution
468 echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__TestDir\" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator $extraCmakeArguments $__cmakeargs"
469 "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__TestDir" $__ClangMajorVersion $__ClangMinorVersion $platformArch $__BuildType $__CodeCoverage $generator "$extraCmakeArguments" "$__cmakeargs"
473 if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
474 echo "Failed to generate $message build project!"
479 if [ $__ConfigureOnly == 1 ]; then
480 echo "Finish configuration & skipping $message build."
484 pushd "$intermediatesForBuild"
486 echo "Executing $buildTool install -j $__NumProc"
488 $buildTool install -j $__NumProc
490 echo "Failed to build $message."
495 echo "Native tests build success!"
500 echo "Usage: $0 [BuildArch] [BuildType] [verbose] [coverage] [cross] [clangx.y] [ninja] [runtests] [bindir]"
501 echo "BuildArch can be: x64, x86, arm, armel, arm64"
502 echo "BuildType can be: debug, checked, release"
503 echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
504 echo "ninja - target ninja instead of GNU make"
505 echo "clangx.y - optional argument to build using clang version x.y - supported version 3.5 - 6.0"
506 echo "cross - optional argument to signify cross compilation,"
507 echo " - will use ROOTFS_DIR environment variable if set."
508 echo "crosscomponent - optional argument to build cross-architecture component,"
509 echo " - will use CAC_ROOTFS_DIR environment variable if set."
510 echo "portableLinux - build for Portable Linux Distribution"
511 echo "portablebuild - Use portable build."
512 echo "verbose - optional argument to enable verbose build output."
513 echo "rebuild - if tests have already been built - rebuild them"
514 echo "skipnative: skip the native tests build"
515 echo "generatelayoutonly - only pull down dependencies and build coreroot"
516 echo "generatetesthostonly - only pull down dependencies and build coreroot and the CoreFX testhost"
517 echo "buildagainstpackages - pull down and build using packages."
518 echo "skiprestorepackages - skip package restore"
519 echo "runtests - run tests after building them"
520 echo "ziptests - zips CoreCLR tests & Core_Root for a Helix run"
521 echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
522 echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
523 echo "priority1 - include priority=1 tests in the build"
528 # Obtain the location of the bash script to figure out where the root of the repo is.
529 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
531 # Use uname to determine what the CPU is.
534 # Some Linux platforms report unknown for platform, but the arch for machine.
535 if [ "$CPUName" == "unknown" ]; then
541 echo "Unsupported CPU $CPUName detected, build might not succeed!"
552 echo "Unsupported CPU $CPUName detected, build might not succeed!"
563 echo "Unknown CPU $CPUName detected, configuring as if for x64"
569 # Use uname to determine what the OS is.
603 echo "Unsupported OS $OSName detected, configuring as if for Linux"
611 __IncludeTests=INCLUDE_TESTS
613 # Set the various build properties here so that CMake and MSBuild can pick them up
614 export __ProjectDir="$__ProjectRoot"
615 __SourceDir="$__ProjectDir/src"
616 __PackagesDir="$__ProjectDir/packages"
617 __RootBinDir="$__ProjectDir/bin"
618 __BuildToolsDir="$__ProjectDir/Tools"
619 __UnprocessedBuildArgs=
625 __SkipNative=1 # [REMOVE] Temporarily default to skip native
627 __SkipGenerateVersion=0
630 __ClangMajorVersion=0
631 __ClangMinorVersion=0
632 __NuGetPath="$__PackagesDir/NuGet.exe"
634 __BuildAgainstPackagesArg=
635 __SkipRestorePackages=0
639 __msbuildonunsupportedplatform=0
641 __NativeTestIntermediatesDir=
644 __BuildTestWrappers=1
645 __GenerateLayoutOnly=
646 __GenerateTestHostOnly=
651 if [ $# -le 0 ]; then
655 lowerI="$(echo $1 | awk '{print tolower($0)}')"
695 __CodeCoverage=Coverage
707 if [ "$__BuildOS" == "Linux" ]; then
710 echo "ERROR: portableLinux not supported for non-Linux platforms."
720 __ClangMajorVersion=3
721 __ClangMinorVersion=5
725 __ClangMajorVersion=3
726 __ClangMinorVersion=6
730 __ClangMajorVersion=3
731 __ClangMinorVersion=7
735 __ClangMajorVersion=3
736 __ClangMinorVersion=8
740 __ClangMajorVersion=3
741 __ClangMinorVersion=9
745 __ClangMajorVersion=4
746 __ClangMinorVersion=0
750 __ClangMajorVersion=5
751 __ClangMinorVersion=0
755 __ClangMajorVersion=6
756 __ClangMinorVersion=0
771 skipnative|-skipnative)
775 # [REMOVE] Enable native build - the temporary default is to skip native
785 __GenerateLayoutOnly=1
787 generatetesthostonly)
788 __GenerateTestHostOnly=1
790 buildagainstpackages)
791 __BuildAgainstPackagesArg=1
794 __SkipRestorePackages=1
800 if [ ! -d $__RootBinDir ]; then
803 __RootBinParent=$(dirname $__RootBinDir)
804 __RootBinName=${__RootBinDir##*/}
805 __RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
808 echo "ERROR: 'bindir' requires a non-empty option argument"
813 msbuildonunsupportedplatform)
814 __msbuildonunsupportedplatform=1
818 __UnprocessedBuildArgs+=("-priority=1")
821 __UnprocessedBuildArgs+=("$1")
828 # Get the number of processors available to the scheduler
829 # Other techniques such as `nproc` only get the number of
830 # processors available to a single process.
831 if [ `uname` = "FreeBSD" ]; then
832 __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
833 elif [ `uname` = "NetBSD" ]; then
834 __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
835 elif [ `uname` = "Darwin" ]; then
836 __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
838 __NumProc=$(nproc --all)
841 __RunArgs=("-BuildArch=$__BuildArch" "-BuildType=$__BuildType" "-BuildOS=$__BuildOS")
843 # Configure environment if we are doing a verbose build
844 if [ $__VerboseBuild == 1 ]; then
846 __RunArgs+=("-verbose")
849 # Set default clang version
850 if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
851 if [ $__CrossBuild == 1 ]; then
852 __ClangMajorVersion=3
853 __ClangMinorVersion=6
855 __ClangMajorVersion=3
856 __ClangMinorVersion=5
860 # Set dependent variables
861 __LogsDir="$__RootBinDir/Logs"
863 # init the host distro name
866 # Set the remaining variables based upon the determined build configuration
867 __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
868 __PackagesBinDir="$__BinDir/.nuget"
869 __ToolsDir="$__RootBinDir/tools"
870 __TestDir="$__ProjectDir/tests"
871 __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
872 __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
873 __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
874 __isMSBuildOnNETCoreSupported=0
875 __CrossComponentBinDir="$__BinDir"
876 __CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
878 __CrossArch="$__HostArch"
879 if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
882 if [ $__CrossBuild == 1 ]; then
883 __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
885 __CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
886 __CrossgenExe="$__CrossComponentBinDir/crossgen"
888 isMSBuildOnNETCoreSupported
890 # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
891 # This is needed by CLI to function.
892 if [ -z "$HOME" ]; then
893 if [ ! -d "$__ProjectDir/temp_home" ]; then
896 export HOME=$__ProjectDir/temp_home
897 echo "HOME not defined; setting it to $HOME"
900 # Configure environment if we are doing a cross compile.
901 if [ $__CrossBuild == 1 ]; then
902 export CROSSCOMPILE=1
903 if ! [[ -n "$ROOTFS_DIR" ]]; then
904 export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
908 # init the target distro name
911 # Override tool directory
913 __CoreClrVersion=1.1.0
914 __sharedFxDir=$__BuildToolsDir/dotnetcli/shared/Microsoft.NETCore.App/$__CoreClrVersion/
916 if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") ]]; then
917 echo "Building Tests..."
920 echo "Generating test layout..."
922 if [ ! -z "$__GenerateTestHostOnly" ]; then
923 echo "Generating test host..."
928 if [ $? -ne 0 ]; then
929 echo "Failed to build tests"
933 echo "${__MsgPrefix}Test build successful."
934 echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
936 __testNativeBinDir=$__IntermediatesDir/tests
938 if [ $__RunTests -ne 0 ]; then
942 echo "${__TestDir}/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$__sharedFxDir --testNativeBinDir=$__testNativeBinDir"
944 $__TestDir/runtest.sh --testRootDir=$__TestBinDir --coreClrBinDir=$__BinDir --coreFxBinDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir
946 echo "Tests run successful."
948 echo "To run all tests use 'tests/runtests.sh' where:"
949 echo " testRootDir = $__TestBinDir"
950 echo " coreClrBinDir = $__BinDir"
951 echo " coreFxBinDir = $CORE_ROOT"
952 echo " testNativeBinDir = $__testNativeBinDir"
953 echo " -------------------------------------------------- "
954 echo " Example runtest.sh command"
956 echo " ./tests/runtest.sh --coreOverlayDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir --testRootDir=$__TestBinDir --copyNativeTestBin"
957 echo " -------------------------------------------------- "
958 echo "To run single test use the following command:"
959 echo " bash ${__TestBinDir}/__TEST_PATH__/__TEST_NAME__.sh -coreroot=${CORE_ROOT}"