X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=build-test.sh;h=491f6187be3c92cd9083c96a31bd542340a8fcd8;hb=7ab27c46cfca8b2a751316d82ea864267d1fcda4;hp=af09e255d48544a33f860c38118b408743f801b7;hpb=df8dca2f2f3a5dd22b9db727e581a3c13fbe403a;p=platform%2Fupstream%2Fcoreclr.git diff --git a/build-test.sh b/build-test.sh index af09e25..491f618 100755 --- a/build-test.sh +++ b/build-test.sh @@ -2,15 +2,51 @@ initHostDistroRid() { + __HostDistroRid="" + + # Some OS groups should default to use the portable packages + if [ "$__BuildOS" == "OSX" ]; then + __PortableBuild=1 + fi + if [ "$__HostOS" == "Linux" ]; then - if [ ! -e /etc/os-release ]; then - echo "WARNING: Can not determine runtime id for current distro." - __HostDistroRid="" - else + if [ -e /etc/redhat-release ]; then + local redhatRelease=$( /dev/null + # Work hardcoded path around if [ ! -f "${__BuildToolsDir}/Microsoft.CSharp.Core.Targets" ]; then ln -s "${__BuildToolsDir}/Microsoft.CSharp.Core.targets" "${__BuildToolsDir}/Microsoft.CSharp.Core.Targets" @@ -142,6 +189,54 @@ build_Tests() if [ ! -f "${__BuildToolsDir}/Microsoft.CSharp.targets" ]; then ln -s "${__BuildToolsDir}/Microsoft.CSharp.Targets" "${__BuildToolsDir}/Microsoft.CSharp.targets" fi +} + +build_Tests() +{ + __TestDir=$__ProjectDir/tests + __ProjectFilesDir=$__TestDir + __TestBinDir=$__TestWorkingDir + + if [ $__RebuildTests -ne 0 ]; then + if [ -d "${__TestBinDir}" ]; then + echo "Removing tests build dir: ${__TestBinDir}" + rm -rf $__TestBinDir + fi + fi + + __CMakeBinDir="${__TestBinDir}" + + if [ -z "$__TestIntermediateDir" ]; then + __TestIntermediateDir="tests/obj/${__BuildOS}.${__BuildArch}.${__BuildType}" + fi + + echo "__BuildOS: ${__BuildOS}" + echo "__BuildArch: ${__BuildArch}" + echo "__BuildType: ${__BuildType}" + echo "__TestIntermediateDir: ${__TestIntermediateDir}" + + if [ ! -f "$__TestBinDir" ]; then + echo "Creating TestBinDir: ${__TestBinDir}" + mkdir -p $__TestBinDir + fi + if [ ! -f "$__LogsDir" ]; then + echo "Creating LogsDir: ${__LogsDir}" + mkdir -p $__LogsDir + fi + + __BuildProperties="-p:OSGroup=${__BuildOS} -p:BuildOS=${__BuildOS} -p:BuildArch=${__BuildArch} -p:BuildType=${__BuildType}" + + # ========================================================================================= + # === + # === Restore product binaries from packages + # === + # ========================================================================================= + + build_Tests_internal "Restore_Product" "${__ProjectDir}/tests/build.proj" " -BatchRestorePackages" "Restore product binaries (build tests)" + + if [ -n "$__BuildAgainstPackagesArg" ]; then + build_Tests_internal "Tests_GenerateRuntimeLayout" "${__ProjectDir}/tests/runtest.proj" "-BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct" "Restore product binaries (run tests)" + fi echo "Starting the Managed Tests Build..." @@ -149,7 +244,7 @@ build_Tests() if [ ! -f $__ManagedTestBuiltMarker ]; then - build_Tests_internal "Tests_Managed" "$__ProjectDir/tests/build.proj" "$__up" "Managed tests build (build tests)" + build_Tests_internal "Tests_Managed" "$__ProjectDir/tests/build.proj" "$__up" "Managed tests build (build tests)" if [ $? -ne 0 ]; then echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)" @@ -185,23 +280,13 @@ build_Tests() fi fi - echo "${__MsgPrefix}Creating test overlay..." - - if [ -z "$XuintTestBinBase" ]; then - XuintTestBinBase=$__TestWorkingDir - fi - - export CORE_ROOT=$XuintTestBinBase/Tests/Core_Root - - if [ ! -f "${CORE_ROOT}" ]; then - mkdir -p $CORE_ROOT - else - rm -rf $CORE_ROOT/* + if [ -n "$__UpdateInvalidPackagesArg" ]; then + __up=-updateinvalidpackageversion fi - cp -r $__BinDir/* $CORE_ROOT/ > /dev/null + echo "${__MsgPrefix}Creating test overlay..." - build_Tests_internal "Tests_Overlay_Managed" "$__ProjectDir/tests/runtest.proj" "-testOverlay" "Creating test overlay" + generate_layout if [ $__ZipTests -ne 0 ]; then echo "${__MsgPrefix}ZIP tests packages..." @@ -211,13 +296,13 @@ build_Tests() build_Tests_internal() { - subDirectoryName=$1 - projectName=$2 - extraBuildParameters=$3 - stepName="$4" + subDirectoryName=$1 + projectName=$2 + extraBuildParameters=$3 + stepName="$4" - # Set up directories and file names - __BuildLogRootName=$subDirectoryName + # Set up directories and file names + __BuildLogRootName=$subDirectoryName __BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log" __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn" __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err" @@ -259,8 +344,11 @@ usage() echo "crosscomponent - optional argument to build cross-architecture component," echo " - will use CAC_ROOTFS_DIR environment variable if set." echo "portableLinux - build for Portable Linux Distribution" + echo "portablebuild - Use portable build." echo "verbose - optional argument to enable verbose build output." echo "rebuild - if tests have already been built - rebuild them" + echo "generatelayoutonly - only pull down dependencies and build coreroot" + echo "buildagainstpackages - pull down and build using packages." echo "runtests - run tests after building them" echo "ziptests - zips CoreCLR tests & Core_Root for a Helix run" echo "bindir - output directory (defaults to $__ProjectRoot/bin)" @@ -373,6 +461,7 @@ __ClangMajorVersion=0 __ClangMinorVersion=0 __NuGetPath="$__PackagesDir/NuGet.exe" __HostDistroRid="" +__BuildAgainstPackagesArg= __DistroRid="" __cmakeargs="" __PortableLinux=0 @@ -382,9 +471,9 @@ __NativeTestIntermediatesDir= __RunTests=0 __RebuildTests=0 __BuildTestWrappers=0 +__GenerateLayoutOnly= CORE_ROOT= - while :; do if [ $# -le 0 ]; then break @@ -437,6 +526,10 @@ while :; do __CrossBuild=1 ;; + portableBuild) + __PortableBuild=1 + ;; + portablelinux) if [ "$__BuildOS" == "Linux" ]; then __PortableLinux=1 @@ -491,6 +584,14 @@ while :; do __ZipTests=1 ;; + generatelayoutonly) + __GenerateLayoutOnly=1 + ;; + + buildagainstpackages) + __BuildAgainstPackagesArg=1 + ;; + bindir) if [ -n "$2" ]; then __RootBinDir="$2" @@ -524,7 +625,7 @@ __RunArgs="-BuildArch=$__BuildArch -BuildType=$__BuildType -BuildOS=$__BuildOS" # Configure environment if we are doing a verbose build if [ $__VerboseBuild == 1 ]; then export VERBOSE=1 - __RunArgs="$__RunArgs -verbose" + __RunArgs="$__RunArgs -verbose" fi # Set default clang version @@ -585,8 +686,9 @@ export __CMakeBinDir="$__BinDir" if [ ! -d "$__BinDir" ] || [ ! -d "$__BinDir/bin" ]; then - echo "Has not been found built CoreCLR instance" - echo "Please build it before tests using './build.sh $__BuildArch $__BuildType'" + echo "Cannot find build directory for the CoreCLR Product." + echo "Please make sure CoreCLR is built before building tests." + echo "Example use: './build.sh $__BuildArch $__BuildType'" exit 1 fi @@ -608,7 +710,11 @@ __sharedFxDir=$__BuildToolsDir/dotnetcli/shared/Microsoft.NETCore.App/$__CoreClr echo "Building Tests..." -build_Tests +if [ -z "$__GenerateLayoutOnly" ]; then + build_Tests +else + generate_layout +fi if [ $? -ne 0 ]; then echo "Failed to build tests" @@ -636,6 +742,10 @@ else echo " coreFxBinDir = $CORE_ROOT" echo " testNativeBinDir = $__testNativeBinDir" echo " -------------------------------------------------- " + echo " Example runtest.sh command" + echo "" + echo " ./tests/runtest.sh --coreOverlayDir=$CORE_ROOT --testNativeBinDir=$__testNativeBinDir --testRootDir=$__TestBinDir --copyNativeTestBin" + echo " -------------------------------------------------- " echo "To run single test use the following command:" echo " bash ${__TestBinDir}/__TEST_PATH__/__TEST_NAME__.sh -coreroot=${CORE_ROOT}" fi