diff options
author | wtgodbe <wigodbe@microsoft.com> | 2017-06-05 13:17:25 -0700 |
---|---|---|
committer | wtgodbe <wigodbe@microsoft.com> | 2017-06-05 13:26:01 -0700 |
commit | 407d13b004c982a70d0aa081245ddc3a5fdbfa75 (patch) | |
tree | 9031c20678f331633d46d32b5248ea97e2ec8aa4 | |
parent | be28ab1ad1159f784254e4a77e2fe9cd99dc34c8 (diff) | |
download | coreclr-407d13b004c982a70d0aa081245ddc3a5fdbfa75.tar.gz coreclr-407d13b004c982a70d0aa081245ddc3a5fdbfa75.tar.bz2 coreclr-407d13b004c982a70d0aa081245ddc3a5fdbfa75.zip |
Explicitly download correct version of CoreDisTools package
-rw-r--r-- | build-test.cmd | 8 | ||||
-rwxr-xr-x | tests/runtest.sh | 12 | ||||
-rw-r--r-- | tests/setup-stress-dependencies.cmd | 117 | ||||
-rw-r--r-- | tests/setup-stress-dependencies.sh | 133 | ||||
-rw-r--r-- | tests/src/Common/stress_dependencies/stress_dependencies.csproj | 28 | ||||
-rw-r--r-- | tests/src/Common/test_dependencies/test_dependencies.csproj | 3 |
6 files changed, 298 insertions, 3 deletions
diff --git a/build-test.cmd b/build-test.cmd index 6291f502ec..6a320e30d7 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -147,6 +147,14 @@ call "%__ProjectDir%\init-tools.cmd" REM ========================================================================================= REM === +REM === Resolve runtime dependences +REM === +REM ========================================================================================= + +call "%__TestDir%\setup-stress-dependencies.cmd" /arch %__BuildArch% /outputdir %__BinDir% + +REM ========================================================================================= +REM === REM === Native test build section REM === REM ========================================================================================= diff --git a/tests/runtest.sh b/tests/runtest.sh index 439bbb66e6..82bbaff7e7 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -1202,6 +1202,18 @@ else load_failing_tests fi +# Other architectures are not supported yet. +if [ "$ARCH" == "x64" ] +then + scriptPath=$(dirname $0) + ${scriptPath}/setup-stress-dependencies.sh --outputDir=$coreOverlayDir +else + if [ "$ARCH" != "arm64" ] + then + echo "Skip preparing for GC stress test. Dependent package is not supported on this architecture." + fi +fi + export __TestEnv=$testEnv cd "$testRootDir" diff --git a/tests/setup-stress-dependencies.cmd b/tests/setup-stress-dependencies.cmd new file mode 100644 index 0000000000..0770e858a5 --- /dev/null +++ b/tests/setup-stress-dependencies.cmd @@ -0,0 +1,117 @@ +@if not defined _echo @echo off +setlocal + +set __ThisScriptShort=%0 +set __ThisScriptFull=%~f0 +set __ThisScriptPath=%~dp0 + +REM ========================================================================================= +REM === +REM === Parse arguments +REM === +REM ========================================================================================= + +set __OutputDir= +set __Arch= + +:Arg_Loop +if "%1" == "" goto ArgsDone + +if /i "%1" == "/?" goto Usage +if /i "%1" == "-?" goto Usage +if /i "%1" == "/h" goto Usage +if /i "%1" == "-h" goto Usage +if /i "%1" == "/help" goto Usage +if /i "%1" == "-help" goto Usage + +if /i "%1" == "/arch" (set __Arch=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "/outputdir" (set __OutputDir=%2&shift&shift&goto Arg_Loop) + +echo Invalid command-line argument: %1 +goto Usage + +:ArgsDone + +if not defined __OutputDir goto Usage +if not defined __Arch goto Usage + +REM Check if the platform is supported +if /i %__Arch% == "arm" ( + echo No runtime dependencies for Arm32. + exit /b 0 + ) + +REM ========================================================================================= +REM === +REM === Check if dotnet CLI and necessary directories exist +REM === +REM ========================================================================================= + +set __DotNetToolDir=%__ThisScriptPath%..\Tools +set __DotNetCmd=%__DotNetToolDir%\dotnetcli\dotnet.exe +set __PackageDir=%__ThisScriptPath%..\Packages +set __CsprojPath=%__ThisScriptPath%\src\Common\stress_dependencies\stress_dependencies.csproj + +REM Check if dotnet cli exists +if not exist "%__DotNetToolDir%" ( + echo Directory containing dotnet CLI does not exist: %__DotNetToolDir% + goto Fail +) +if not exist "%__DotNetCmd%" ( + echo dotnet.exe does not exist: %__DotNetCmd% + goto Fail +) + +REM Create directories needed +if not exist "%__PackageDir%" md "%__PackageDir%" +if not exist "%__OutputDir%" md "%__OutputDir%" + +REM ========================================================================================= +REM === +REM === Download packages +REM === +REM ========================================================================================= + +REM Download the package +echo Downloading CoreDisTools package +set DOTNETCMD="%__DotNetCmd%" restore "%__CsprojPath%" --source https://dotnet.myget.org/F/dotnet-core/ --packages "%__PackageDir%" +echo %DOTNETCMD% +call %DOTNETCMD% +if errorlevel 1 goto Fail + +REM Get downloaded dll path +echo Locating coredistools.dll +FOR /F "delims=" %%i IN ('dir %__PackageDir%\coredistools.dll /b/s ^| findstr /R "runtime.win[0-9]*-%__Arch%"') DO set __LibPath=%%i +echo CoreDisTools library path: %__LibPath% +if not exist "%__LibPath%" ( + echo Failed to locate the downloaded library: %__LibPath% + goto Fail +) + +REM Copy library to output directory +echo Copy library: %__LibPath% to %__OutputDir% +copy /y "%__LibPath%" "%__OutputDir%" +if errorlevel 1 ( + echo Failed to copy %__LibPath% to %__OutputDir% + goto Fail +) + +exit /b 0 + +:Fail +exit /b 1 + +REM ========================================================================================= +REM === +REM === Helper routines +REM === +REM ========================================================================================= + +:Usage +echo. +echo Download coredistools for GC stress testing +echo. +echo Usage: +echo %__ThisScriptShort% /arch ^<TargetArch^> /outputdir ^<coredistools_lib_install_path^> +echo. +exit /b 1
\ No newline at end of file diff --git a/tests/setup-stress-dependencies.sh b/tests/setup-stress-dependencies.sh new file mode 100644 index 0000000000..a7f3c498c1 --- /dev/null +++ b/tests/setup-stress-dependencies.sh @@ -0,0 +1,133 @@ +#!/usr/bin/env bash +# set -x + +# +# Constants +# +readonly EXIT_CODE_SUCCESS=0 + +# +# This script should be located in coreclr/tests. +# + +function print_usage { + echo '' + echo 'Download coredistools for GC stress testing' + echo '' + echo 'Command line:' + echo '' + echo './setup-gcstress.sh --outputDir=<coredistools_lib_install_path>' + echo '' + echo 'Required arguments:' + echo ' --outputDir=<path> : Directory to install libcoredistools.so' + echo '' +} + +function exit_with_error { + local errorCode=$1 + local errorMsg=$2 + + if [ ! -z "$2" ]; then + echo $2 + fi + + exit $errorCode +} + +function handle_ctrl_c { + exit_with_error 1 'Aborted by Ctrl+C' + } + +# Register the Ctrl-C handler +trap handle_ctrl_c INT + +# Argument variables +libInstallDir= + +# Handle arguments +verbose=0 +for i in "$@" +do + case $i in + -h|--help) + exit $EXIT_CODE_SUCCESS + ;; + -v|--verbose) + verbose=1 + ;; + --outputDir=*) + libInstallDir=${i#*=} + ;; + *) + echo "Unknown switch: $i" + print_usage + exit $EXIT_CODE_SUCCESS + ;; + esac +done + +if [ -z "$libInstallDir" ]; then + echo "--libInstallDir is required." + print_usage + exit_with_error 1 +fi + +# This script must be located in coreclr/tests. +scriptDir=$(cd "$(dirname "$0")"; pwd -P) + +echo "Running init-tools.sh" +$scriptDir/../init-tools.sh + +dotnetToolsDir=$scriptDir/../Tools +dotnetCmd=${dotnetToolsDir}/dotnetcli/dotnet +packageDir=${scriptDir}/../packages +csprojPath=${scriptDir}/src/Common/stress_dependencies/stress_dependencies.csproj + +# Check tool directory +if [ ! -e $dotnetToolsDir ]; then + exit_with_error 1 'Directory containing dotnet commandline does not exist:'$dotnetToolsDir +fi +if [ ! -e $dotnetCmd ]; then + exit_with_error 1 'dotnet commandline does not exist:'$dotnetCmd +fi + +# make package directory +if [ ! -e $packageDir ]; then + mkdir -p $packageDir +fi + +# make output directory +if [ ! -e $libInstallDir ]; then + mkdir -p $libInstallDir +fi + +# Query runtime Id +rid=`$dotnetCmd --info | grep 'RID:' | sed 's/^ *RID: *//g'` +if [ -z "$rid" ]; then + exit_with_error 1 "Failed to query runtime Id" +fi + +# Download the package +echo Downloading CoreDisTools package +bash -c -x "$dotnetCmd restore $csprojPath --source https://dotnet.myget.org/F/dotnet-core/ --packages $packageDir" +if [ $? -ne 0 ] +then + exit_with_error 1 "Failed to restore the package" +fi + +# Get library path +libPath=`find $packageDir | grep $rid | grep -m 1 libcoredistools` +if [ ! -e $libPath ]; then + exit_with_error 1 'Failed to locate the downloaded library' +fi + +# Copy library to output directory +echo 'Copy library:' $libPath '-->' $libInstallDir/ +cp -f $libPath $libInstallDir +if [ $? -ne 0 ] +then + exit_with_error 1 "Failed to copy the library" +fi + +# Return success +exit $EXIT_CODE_SUCCESS diff --git a/tests/src/Common/stress_dependencies/stress_dependencies.csproj b/tests/src/Common/stress_dependencies/stress_dependencies.csproj new file mode 100644 index 0000000000..e33ee1efd3 --- /dev/null +++ b/tests/src/Common/stress_dependencies/stress_dependencies.csproj @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <CLRTestKind>BuildOnly</CLRTestKind> + <NugetTargetMoniker>.NETCoreApp,Version=v2.0</NugetTargetMoniker> + <NugetTargetMonikerShort>netcoreapp2.0</NugetTargetMonikerShort> + <IsTestProject>false</IsTestProject> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.NETCore.CoreDisTools"> + <Version>1.0.1-prerelease-*</Version> + </PackageReference> + </ItemGroup> + <PropertyGroup> + <TargetFramework>netcoreapp2.0</TargetFramework> + <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier> + <PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback> + <RuntimeIdentifiers>win7-x64;ubuntu.14.04-x64;osx.10.10-x64;win7-x86;ubuntu.14.04-x86;osx.10.10-x86</RuntimeIdentifiers> + <ContainsPackageReferences>true</ContainsPackageReferences> + <PrereleaseResolveNuGetPackages>false</PrereleaseResolveNuGetPackages> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <Target Name="Build" + DependsOnTargets="ResolveReferences" /> +</Project>
\ No newline at end of file diff --git a/tests/src/Common/test_dependencies/test_dependencies.csproj b/tests/src/Common/test_dependencies/test_dependencies.csproj index 53b51f7d3b..c225dee36b 100644 --- a/tests/src/Common/test_dependencies/test_dependencies.csproj +++ b/tests/src/Common/test_dependencies/test_dependencies.csproj @@ -10,9 +10,6 @@ <IsTestProject>false</IsTestProject> </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.NETCore.CoreDisTools"> - <Version>1.0.1-prerelease-*</Version> - </PackageReference> <PackageReference Include="Microsoft.Private.CoreFx.NETCoreApp"> <Version>$(CoreFxPackageVersion)</Version> </PackageReference> |