diff options
-rw-r--r-- | build-test.cmd | 76 | ||||
-rw-r--r-- | config.json | 96 | ||||
-rw-r--r-- | publish-packages.cmd | 2 | ||||
-rwxr-xr-x | publish-packages.sh | 3 | ||||
-rw-r--r-- | src/publish.proj | 13 | ||||
-rw-r--r-- | src/syncAzure.proj | 7 | ||||
-rw-r--r-- | sync.cmd | 3 | ||||
-rw-r--r-- | tests/publishdependency.targets | 183 | ||||
-rw-r--r-- | tests/runtest.cmd | 9 | ||||
-rw-r--r-- | tests/runtest.proj | 22 | ||||
-rw-r--r-- | tests/src/Common/build_against_pkg_dependencies/build_against_pkg_dependencies.csproj | 15 | ||||
-rw-r--r-- | tests/src/Common/build_against_pkg_dependencies/project.json | 32 | ||||
-rw-r--r-- | tests/src/Common/targeting_pack_ref/project.json | 22 | ||||
-rw-r--r-- | tests/src/Common/targeting_pack_ref/targeting_pack_ref.csproj | 12 |
14 files changed, 478 insertions, 17 deletions
diff --git a/build-test.cmd b/build-test.cmd index d6e96cb6a9..baa12ce207 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -28,6 +28,9 @@ set "__args= %*" set processedArgs= set __unprocessedBuildArgs= set __RunArgs= +set __BuildAgainstPackages= +set __BuildAgainstPackagesArg= +set __RuntimeId= :Arg_Loop if "%1" == "" goto ArgsDone @@ -48,6 +51,8 @@ if /i "%1" == "checked" (set __BuildType=Checked&set processedArgs if /i "%1" == "skipmanaged" (set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "buildagainstpackages" (set __BuildAgainstPackages=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&shift&goto Arg_Loop) +if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) if [!processedArgs!]==[] ( call set __UnprocessedBuildArgs=!__args! @@ -176,29 +181,77 @@ if errorlevel 1 ( :skipnative -if defined __SkipManaged exit /b 0 +set __BuildLogRootName=Restore_Product +set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log +set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn +set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err +set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%" +set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%" +set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%" +if not defined __BuildAgainstPackages goto SkipRestoreProduct REM ========================================================================================= REM === -REM === Managed test build section +REM === Restore product binaries from packages REM === REM ========================================================================================= -echo %__MsgPrefix%Starting the Managed Tests Build +set "__TestWorkingDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%" +if not defined XunitTestBinBase set XunitTestBinBase=%__TestWorkingDir% +set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root" +set "CORE_OVERLAY=%XunitTestBinBase%\Tests\coreoverlay" -if not defined VSINSTALLDIR ( - echo %__MsgPrefix%Error: buildtest.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. +call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\build.proj -UpdateDependencies -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% + +set __BuildLogRootName=Tests_GenerateRuntimeLayout + +call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% +if errorlevel 1 ( + echo BinPlace of mscorlib.dll failed exit /b 1 ) +if defined __RuntimeId ( + + if not exist %__PackagesDir%\TestNativeBins ( + echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages + exit /b 1 + ) + + call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -CreateNonWindowsTestOverlay -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% + for /R %__PackagesDir%\TestNativeBins\%__RuntimeId% %%f in (*.so) do copy %%f %Core_Overlay% + for /R %__PackagesDir%\TestNativeBins\%__RuntimeId% %%f in (*.dylib) do copy %%f %Core_Overlay% + + echo %__MsgPrefix% Created the runtime layout for %__RuntimeId% in %CORE_OVERLAY% +) + +echo %__MsgPrefix% Created the runtime layout with all dependencies in %CORE_ROOT% + +:SkipRestoreProduct + +if defined __SkipManaged exit /b 0 + set __BuildLogRootName=Tests_Managed set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err -set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%" +set __msbuildLog=/flp:Verbosity=diag;LogFile="%__BuildLog%" set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%" set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%" +REM ========================================================================================= +REM === +REM === Managed test build section +REM === +REM ========================================================================================= + +echo %__MsgPrefix%Starting the Managed Tests Build + +if not defined VSINSTALLDIR ( + echo %__MsgPrefix%Error: buildtest.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. + exit /b 1 +) + if defined __UpdateInvalidPackagesArg ( set __up=-updateinvalidpackageversions ) @@ -253,6 +306,17 @@ echo. -? -h -help: view this message. echo Build architecture: -buildArch: only x64 is currently allowed ^(default: x64^). echo Build type: -buildType: one of Debug, Checked, Release ^(default: Debug^). echo updateinvalidpackageversions: Runs the target to update package versions. +echo buildagainstpackages: builds tests against restored packages, instead of against a built product. +echo runtimeid ^<ID^>: Builds a test overlay for the specified OS (Only supported when building against packages). Supported IDs are: +echo debian.8-x64: Builds overlay for Debian 8 +echo fedora.23-x64: Builds overlay for Fedora 23 +echo opensuse.13.2-x64: Builds overlay for OpenSUSE 13.2 +echo opensuse.42.1-x64: Builds overlay for OpenSUSE 42.1 +echo osx.10.10-x64: Builds overlay for OSX 10.10 +echo rhel.7-x64: Builds overlay for RHEL 7 or CentOS +echo ubuntu.14.04-x64: Builds overlay for Ubuntu 14.04 +echo ubuntu.16.04-x64: Builds overlay for Ubuntu 16.04 +echo ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10 echo -- ... : all arguments following this tag will be passed directly to msbuild. echo -priority=^<N^> : specify a set of test that will be built and run, with priority N. echo 0: Build only priority 0 cases as essential testcases (default) diff --git a/config.json b/config.json index 1ddb2f94f5..1214e0f040 100644 --- a/config.json +++ b/config.json @@ -24,6 +24,12 @@ "values": [], "defaultValue": "" }, + "__Container": { + "description": "Container name for Azure upload.", + "valueType": "property", + "values": [], + "defaultValue": "" + }, "MsBuildFileLogging": { "description": "MsBuild logging options.", "valueType": "passThrough", @@ -240,6 +246,12 @@ "values": [], "defaultValue": "" }, + "CreateNonWindowsTestOverlay": { + "description": "Runs CreateNonWindowsTestOverlay target.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, "Verbosity": { "description": "Sets build verbosity.", "valueType": "passThrough", @@ -264,6 +276,60 @@ "values": [], "defaultValue": "" }, + "GenerateRuntimeLayout": { + "description": "Generates Core_Root folder", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "BuildTestsAgainstPackages": { + "description": "Sets the property specifying if we're building tests against packages", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "PublishTestNativeBins": { + "description": "Publishes test native binaries to Azure on non-windows", + "valueType": "property", + "values": [ true, false ], + "defaultValue": true + }, + "RuntimeId": { + "description": "Specifies the OS to build Core_Root for", + "valueType": "property", + "values": [ "debian.8-x64", "fedora.23-x64", "opensuse.13.2-x64", "opensuse.42.1-x64", "osx.10.10-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64" ], + "defaultValue": "${__RuntimeId}" + }, + "UpdateDependencies": { + "description": "MsBuild target that updates project.json dependencies.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "BatchRestorePackages": { + "description": "MsBuild target that restores the packages.", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "BinPlaceRef": { + "description": "Place mscorlib.dll in bin/Product ref folder for building tests against", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "BinPlaceProduct": { + "description": "Place test dependencies in bin/Product folder for building tests against", + "valueType": "target", + "values": [], + "defaultValue": "" + }, + "CopyCrossgenToProduct": { + "description": "Place crossgen.exe in bin/Product folder for building tests against", + "valueType": "target", + "values": [], + "defaultValue": "" + }, "ExtraParameters": { "description": "Extra parameters will be passed to the selected command.", "valueType": "passThrough", @@ -380,6 +446,12 @@ "CloudDropAccountName": "default" } }, + "container": { + "description": "Container name to download from in Azure Blob storage.", + "settings": { + "__Container": "default" + } + }, "verbose": { "description": "Passes /flp:v=diag to the msbuild command or the value passed by the user.", "settings": { @@ -397,6 +469,12 @@ "settings": { "BuildNumberMinor": "default" } + }, + "PublishTestNativeBins": { + "description": "Downloads Published test native binaries.", + "settings": { + "PublishTestNativeBins": "default" + } } }, "defaultValues": { @@ -420,6 +498,12 @@ "CloudDropAccountName": "default" } }, + "container": { + "description": "Container name to upload into in Azure Blob storage.", + "settings": { + "__Container": "default" + } + }, "buildArch": { "description": "Specifies architecture to publish, can be x64, x86, arm or arm64", "settings": { @@ -437,6 +521,18 @@ "settings": { "__BuildOS": "default" } + }, + "distroRid": { + "description": "Specifies distro rid for Unix OS.", + "settings": { + "__DistroRid": "default" + } + }, + "PublishTestNativeBins": { + "description": "Publishes test native binaries.", + "settings": { + "PublishTestNativeBins": "default" + } } }, "defaultValues": { diff --git a/publish-packages.cmd b/publish-packages.cmd index 82f659d825..d23ff2373f 100644 --- a/publish-packages.cmd +++ b/publish-packages.cmd @@ -18,6 +18,8 @@ echo -AzureAccount="account name" echo -AzureToken="access token" echo -BuildType="Configuration" echo -BuildArch="Architecture" +echo To specify the name of the container to publish into, use the following property: +echo -Container="container name" echo Architecture can be x64, x86, arm, or arm64 echo Configuration can be Release, Debug, or Checked exit /b
\ No newline at end of file diff --git a/publish-packages.sh b/publish-packages.sh index 8170419fb5..d5d4caa524 100755 --- a/publish-packages.sh +++ b/publish-packages.sh @@ -8,6 +8,8 @@ usage() echo " -AzureToken=\"access token\"" echo " -BuildType=\"Configuration\"" echo " -BuildArch=\"Architecture\"" + echo "To specify the name of the container to publish into, use the following property:" + echo " -Container=\"container name\"" echo "Configuration can be Release, Checked, or Debug" echo "Architecture can be x64, x86, arm, or arm64" exit 1 @@ -16,6 +18,7 @@ usage() working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" $working_tree_root/run.sh publish-packages -BuildOS $* +$working_tree_root/run.sh publish-packages -BuildOS -distroRid -PublishTestNativeBins $* if [ $? -ne 0 ] then echo "ERROR: An error occurred while publishing packages; see $working_tree_root/publish-packages.log for more details. There may have been networking problems, so please try again in a few minutes." diff --git a/src/publish.proj b/src/publish.proj index 66aeb7e5e1..d4e4a7f24b 100644 --- a/src/publish.proj +++ b/src/publish.proj @@ -13,21 +13,26 @@ <!-- add relative blob path metadata --> <ItemGroup> <ForPublishing> - <RelativeBlobPath>$(__BuildType)/%(RecursiveDir)%(Filename)%(Extension)</RelativeBlobPath> + <RelativeBlobPath Condition="'$(PublishTestNativeBins)' != 'true'">$(__BuildType)/%(RecursiveDir)%(Filename)%(Extension)</RelativeBlobPath> + <RelativeBlobPath Condition="'$(PublishTestNativeBins)' == 'true'">$(__DistroRid)-$(__BuildArch)/$(__BuildType)/%(RecursiveDir)%(Filename)%(Extension)</RelativeBlobPath> </ForPublishing> </ItemGroup> <Error Condition="'@(ForPublishing)' == ''" Text="No items were found matching pattern '$(PublishPattern)'." /> </Target> <PropertyGroup> - <PublishPattern Condition="'$(PublishPattern)' == ''">$(PackagesBinDir)**\*.nupkg</PublishPattern> + <PublishPattern Condition="'$(PublishPattern)' == '' and '$(PublishTestNativeBins)' != 'true'">$(PackagesBinDir)**\*.nupkg</PublishPattern> + <PublishPattern Condition="'$(PublishPattern)' == '' and '$(PublishTestNativeBins)' == 'true'">$(OutputPath)\tests\src\**</PublishPattern> </PropertyGroup> <Target Name="CreateContainerName" DependsOnTargets="CreateVersionFileDuringBuild" - Condition="'$(ContainerName)' == ''"> + Condition="'$(ContainerName)' == '' or '$(PublishTestNativeBins)' == 'true'"> <PropertyGroup> - <ContainerName>coreclr-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName> + <ContainerName Condition="'$(__Container)' == '' and '$(PublishTestNativeBins)' != 'true'">coreclr-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName> + <ContainerName Condition="'$(__Container)' == '' and '$(PublishTestNativeBins)' == 'true'">coreclr-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)-test-native-bins</ContainerName> + <ContainerName Condition="'$(__Container)' != '' and '$(PublishTestNativeBins)' != 'true'">$(__Container)</ContainerName> + <ContainerName Condition="'$(__Container)' != '' and '$(PublishTestNativeBins)' == 'true'">$(__Container)-test-native-bins</ContainerName> </PropertyGroup> </Target> diff --git a/src/syncAzure.proj b/src/syncAzure.proj index fbfbea0bff..0b71a3bdcd 100644 --- a/src/syncAzure.proj +++ b/src/syncAzure.proj @@ -4,8 +4,11 @@ <PropertyGroup> <ContainerNamePrefix Condition="'$(ContainerNamePrefix)' == ''">coreclr-$(PreReleaseLabel)</ContainerNamePrefix> - <ContainerName Condition="'$(ContainerNamePrefix)' != '' and '$(BuildNumberMajor)' != '' and '$(BuildNumberMinor)' != ''">$(ContainerNamePrefix)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName> - <DownloadDirectory>$(PackagesDir)AzureTransfer</DownloadDirectory> + <ContainerName Condition="'$(__Container)' == '' and '$(ContainerNamePrefix)' != '' and '$(BuildNumberMajor)' != '' and '$(BuildNumberMinor)' != ''">$(ContainerNamePrefix)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName> + <ContainerName Condition="'$(__Container)' != '' and '$(PublishTestNativeBins)' != 'true'">$(__Container)</ContainerName> + <ContainerName Condition="'$(__Container)' != '' and '$(PublishTestNativeBins)' == 'true'">$(__Container)-test-native-bins</ContainerName> + <DownloadDirectory Condition="'$(PublishTestNativeBins)' != 'true'">$(PackagesDir)AzureTransfer</DownloadDirectory> + <DownloadDirectory Condition="'$(PublishTestNativeBins)' == 'true'">$(PackagesDir)TestNativeBins</DownloadDirectory> </PropertyGroup> <Import Project="$(ToolsDir)SyncCloudContent.targets" /> @@ -7,6 +7,7 @@ if /I [%1] == [-help] goto Usage @if [%1]==[] set __args=-p @call %~dp0run.cmd sync %__args% %* + @call %~dp0run.cmd sync -PublishTestNativeBins %__args% %* @exit /b %ERRORLEVEL% :Usage @@ -24,6 +25,8 @@ echo -AzureToken="Access token" echo To download a specific group of product packages, specify: echo -BuildMajor echo -BuildMinor +echo To download from a specific container, specify: +echo -Container="container name" echo. echo. echo If no option is specified then sync.cmd -p is implied.
\ No newline at end of file diff --git a/tests/publishdependency.targets b/tests/publishdependency.targets index 997a5237d4..9e286fc3ba 100644 --- a/tests/publishdependency.targets +++ b/tests/publishdependency.targets @@ -8,13 +8,45 @@ </TestTargetFramework> </ItemGroup> + <PropertyGroup> + <!-- defined in buildtools packaging.targets, but we need this before targets are imported --> + <PackagePlatform Condition="'$(PackagePlatform)' == ''">$(__BuildArch)</PackagePlatform> + <PackagePlatform Condition="'$(PackagePlatform)' == 'amd64'">x64</PackagePlatform> + <MinOSForArch>win7</MinOSForArch> + <MinOSForArch Condition="'$(PackagePlatform)' == 'arm'">win8</MinOSForArch> + <MinOSForArch Condition="'$(PackagePlatform)' == 'arm64'">win10</MinOSForArch> + </PropertyGroup> + + <ItemGroup> + <CoreRootProjectLockJsonFiles Include="$(SourceDir)Common\test_runtime\project.lock.json"/> + <CoreRootProjectLockJsonFiles Include="$(SourceDir)Common\test_dependencies\project.lock.json"/> + </ItemGroup> + <ItemGroup> - <ProjectLockJsonFiles Include="$(SourceDir)Common\test_runtime\project.lock.json"/> - <ProjectLockJsonFiles Include="$(SourceDir)Common\test_dependencies\project.lock.json"/> + <NonWindowsProjectLockJsonFiles Include="@(CoreRootProjectLockJsonFiles)"/> + <NonWindowsProjectLockJsonFiles Include="$(SourceDir)Common\build_against_pkg_dependencies\project.lock.json"/> </ItemGroup> + <ItemGroup> + <RefProjectLockJsonFiles Include="$(SourceDir)Common\targeting_pack_ref\project.lock.json"/> + </ItemGroup> + + <ItemGroup> + <ProductProjectLockJsonFiles Include="$(SourceDir)Common\build_against_pkg_dependencies\project.lock.json"/> + </ItemGroup> + + <ItemGroup> + <CrossGenFiles Include="..\packages\runtime.$(MinOSForArch)-$(PackagePlatform).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen.exe"/> + </ItemGroup> + + <PropertyGroup> + <ProductDestination>$(ProjectDir)\..\bin\Product\$(BuildOS).$(BuildArch).$(BuildType)</ProductDestination> + <RefDestination>$(ProductDestination)\ref</RefDestination> + <CoreOverlay>$(CORE_ROOT)\..\coreoverlay</CoreOverlay> + </PropertyGroup> + <Target Name="CopyDependecyToCoreRoot" - Inputs="@(ProjectLockJsonFiles)" + Inputs="@(CoreRootProjectLockJsonFiles)" Outputs="$(CORE_ROOT)\*.*"> <MSBuild Projects="$(SourceDir)Common\test_runtime\test_runtime.csproj"/> @@ -28,7 +60,7 @@ NuGetPackagesDirectory="$(PackagesDir)" RuntimeIdentifier="$(TestNugetRuntimeId)" ProjectLanguage="$(Language)" - ProjectLockFile="%(ProjectLockJsonFiles.Identity)" + ProjectLockFile="%(CoreRootProjectLockJsonFiles.Identity)" TargetMonikers="@(TestTargetFramework)"> <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" /> <Output TaskParameter="ResolvedReferences" ItemName="Reference" /> @@ -58,4 +90,147 @@ </Copy> </Target> + <Target Name="CopyNonWindowsDependecyToCoreRoot" + Inputs="@(NonWindowsProjectLockJsonFiles)" + Outputs="$(CoreOverlay)\*.*"> + + <MSBuild Projects="$(SourceDir)Common\test_runtime\test_runtime.csproj"/> + + <MSBuild Projects="$(SourceDir)Common\test_dependencies\test_dependencies.csproj"/> + + <MSBuild Projects="$(SourceDir)Common\build_against_pkg_dependencies\build_against_pkg_dependencies.csproj"/> + + <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items + for the xunit wrapper projects --> + <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true" + IncludeFrameworkReferences="false" + NuGetPackagesDirectory="$(PackagesDir)" + RuntimeIdentifier="$(RuntimeId)" + ProjectLanguage="$(Language)" + ProjectLockFile="%(NonWindowsProjectLockJsonFiles.Identity)" + TargetMonikers="@(TestTargetFramework)"> + <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" /> + <Output TaskParameter="ResolvedReferences" ItemName="Reference" /> + <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RunTimeCopyLocal" /> + </PrereleaseResolveNuGetPackageAssets> + <ItemGroup> + <RunTimeDependecyExclude Include="$(CoreOverlay)\**\*.*" /> + <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName)%(Extension)')" /> + <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).ni%(Extension)')" /> + <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).pdb')" /> + <AllResolvedRuntimeDependencies Include="@(RunTimeCopyLocal -> '%(FileName)%(Extension)')"> + <File>%(Identity)</File> + </AllResolvedRuntimeDependencies> + <RunTimeDependecyCopyLocalFile Include="@(AllResolvedRuntimeDependencies)" Exclude="@(RunTimeDependecyExcludeFiles)"/> + <RunTimeDependecyCopyLocal Include="@(RunTimeDependecyCopyLocalFile -> '%(File)')" /> + </ItemGroup> + + <Copy + SourceFiles="@(RunTimeDependecyCopyLocal)" + DestinationFolder="$(CoreOverlay)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + + <ItemGroup> + <NonWindowsCrossGenFiles Include="..\packages\runtime.$(RuntimeID).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen"/> + </ItemGroup> + + <Copy + SourceFiles="@(NonWindowsCrossGenFiles)" + DestinationFolder="$(CoreOverlay)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + + </Target> + + <Target Name="CopyDependencyToRef" + Inputs="@(RefProjectLockJsonFiles)" + Outputs="$(RefDestination)\*.*"> + + <MSBuild Projects="$(SourceDir)Common\targeting_pack_ref\targeting_pack_ref.csproj"/> + + <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items + for the xunit wrapper projects --> + <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true" + IncludeFrameworkReferences="false" + NuGetPackagesDirectory="$(PackagesDir)" + RuntimeIdentifier="$(TestNugetRuntimeId)" + ProjectLanguage="$(Language)" + ProjectLockFile="%(RefProjectLockJsonFiles.Identity)" + TargetMonikers="@(TestTargetFramework)"> + <Output TaskParameter="ResolvedAnalyzers" ItemName="RefAnalyzer" /> + <Output TaskParameter="ResolvedReferences" ItemName="RefReference" /> + <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RefRunTimeCopyLocal" /> + </PrereleaseResolveNuGetPackageAssets> + + <Copy + SourceFiles="@(RefRunTimeCopyLocal)" + DestinationFolder="$(RefDestination)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + </Target> + + <Target Name="CopyDependencyToProduct" + Inputs="@(ProductProjectLockJsonFiles)" + Outputs="$(ProductDestination)\*.*"> + + <MSBuild Projects="$(SourceDir)Common\build_against_pkg_dependencies\build_against_pkg_dependencies.csproj"/> + + <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items + for the xunit wrapper projects --> + <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true" + IncludeFrameworkReferences="false" + NuGetPackagesDirectory="$(PackagesDir)" + RuntimeIdentifier="$(TestNugetRuntimeId)" + ProjectLanguage="$(Language)" + ProjectLockFile="%(ProductProjectLockJsonFiles.Identity)" + TargetMonikers="@(TestTargetFramework)"> + <Output TaskParameter="ResolvedAnalyzers" ItemName="RefAnalyzer" /> + <Output TaskParameter="ResolvedReferences" ItemName="RefReference" /> + <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RefRunTimeCopyLocal" /> + </PrereleaseResolveNuGetPackageAssets> + + <Copy + SourceFiles="@(RefRunTimeCopyLocal)" + DestinationFolder="$(ProductDestination)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + </Target> + + <Target Name="CopyCrossgenToProduct" + Outputs="$(ProductDestination)\crossgen.exe;$(CoreOverlay)\crossgen.exe"> + + <Copy + SourceFiles="@(CrossGenFiles)" + DestinationFolder="$(ProductDestination)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + + </Target> + </Project> diff --git a/tests/runtest.cmd b/tests/runtest.cmd index ebb038e9eb..2ffd7bc12a 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -31,6 +31,7 @@ set __Sequential= set __msbuildExtraArgs= set __LongGCTests= set __GCSimulatorTests= +set __AgainstPackages= :Arg_Loop if "%1" == "" goto ArgsDone @@ -56,6 +57,7 @@ if /i "%1" == "SkipWrapperGeneration" (set __SkipWrapperGeneration=true&shift&go if /i "%1" == "Exclude" (set __Exclude=%2&shift&shift&goto Arg_Loop) if /i "%1" == "Exclude0" (set __Exclude0=%2&shift&shift&goto Arg_Loop) if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop) if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop) if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop) if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop) @@ -68,7 +70,7 @@ if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&set __SkipWrap if /i "%1" == "PerfTests" (set __PerfTests=true&set __SkipWrapperGeneration=true&shift&goto Arg_Loop) if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop) REM change it to COMPlus_GCStress when we stop using xunit harness -if /i "%1" == "gcstresslevel" (set __GCSTRESSLEVEL=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop) +if /i "%1" == "gcstresslevel" (set __GCSTRESSLEVEL=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop) if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs :: All the rest of the args will be collected and passed directly to msbuild. @@ -143,6 +145,10 @@ if not defined __Sequential ( set __msbuildCommonArgs=%__msbuildCommonArgs% /p:ParallelRun=false ) +if defined __AgainstPackages ( + set __msbuildCommonArgs=%__msbuildCommonArgs% /p:BuildTestsAgainstPackages=true +) + REM Prepare the Test Drop REM Cleans any NI from the last run powershell "Get-ChildItem -path %__TestWorkingDir% -Include '*.ni.*' -Recurse -Force | Remove-Item -force" @@ -361,6 +367,7 @@ echo Set to "" to disable default exclusion file. echo Exclude- Optional parameter - this will exclude individual tests from running, specified by ExcludeList ItemGroup in an .targets file. echo TestEnv- Optional parameter - this will run a custom script to set custom test environment settings. echo VSVersion- Optional parameter - VS2013 or VS2015 ^(default: VS2015^) +echo AgainstPackages - Optional parameter - this indicates that we are running tests that were built against packages echo GenerateLayoutOnly - If specified will not run the tests and will only create the Runtime Dependency Layout echo RunCrossgenTests - Runs ReadytoRun tests echo jitstress n - Runs the tests with COMPlus_JitStress=n diff --git a/tests/runtest.proj b/tests/runtest.proj index e1c07e4101..acc4545d92 100644 --- a/tests/runtest.proj +++ b/tests/runtest.proj @@ -323,6 +323,28 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). Properties="Language=C#" /> </Target> + <Target Name="CreateNonWindowsTestOverlay"> + <MSBuild Projects="$(MSBuildProjectFile)" + Targets="CopyNonWindowsDependecyToCoreRoot" + Properties="Language=C#;NonWindowsRuntimeId=$(NonWindowsRuntimeId)" /> + </Target> + + <Target Name="BinPlaceRef"> + <!-- Copy mscorlib.dll from TargetingPack to bin/Product/ref, if we're building against packages --> + <MSBuild Projects="$(MSBuildProjectFile)" + Targets="CopyDependencyToRef" + Properties="Language=C#" + Condition=" '$(BuildTestsAgainstPackages)'=='true' " /> + </Target> + + <Target Name="BinPlaceProduct"> + <!-- Copy test dependencies to bin/Product, if we're building against packages --> + <MSBuild Projects="$(MSBuildProjectFile)" + Targets="CopyDependencyToProduct" + Properties="Language=C#" + Condition=" '$(BuildTestsAgainstPackages)'=='true' " /> + </Target> + <!-- All the test projects need to add dependency to currently built runtime as they require that to run. In addition the version number of built runtime can change so all project.json needs to be dynamically generated. Instead the following task creates a project.json with dependencies like Microsoft.netcore.runtime.coreclr ..etc. diff --git a/tests/src/Common/build_against_pkg_dependencies/build_against_pkg_dependencies.csproj b/tests/src/Common/build_against_pkg_dependencies/build_against_pkg_dependencies.csproj new file mode 100644 index 0000000000..63c54488f2 --- /dev/null +++ b/tests/src/Common/build_against_pkg_dependencies/build_against_pkg_dependencies.csproj @@ -0,0 +1,15 @@ +<?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> + </PropertyGroup> + <ItemGroup> + <DnuSourceList Include="$(CORE_ROOT)\.nuget\pkg" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <Target Name="Build" + DependsOnTargets="ResolveReferences" /> +</Project> diff --git a/tests/src/Common/build_against_pkg_dependencies/project.json b/tests/src/Common/build_against_pkg_dependencies/project.json new file mode 100644 index 0000000000..16c6045923 --- /dev/null +++ b/tests/src/Common/build_against_pkg_dependencies/project.json @@ -0,0 +1,32 @@ +{ + "dependencies": { + "Microsoft.NETCore.ILAsm": "1.2.0-beta-24616-02", + "Microsoft.NETCore.ILDAsm": "1.2.0-beta-24616-02", + "Microsoft.NETCore.Jit": "1.2.0-beta-24616-02", + "Microsoft.NETCore.Runtime.CoreCLR": "1.2.0-beta-24616-02", + "Microsoft.NETCore.TestHost": "1.2.0-beta-24616-02" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dnxcore50", + "portable-net45+win8" + ] + } + }, + "runtimes": { + "win7-x86": {}, + "win7-x64": {}, + "win10-arm64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "ubuntu.16.10-x64": {}, + "osx.10.10-x64": {}, + "centos.7-x64": {}, + "rhel.7-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {}, + "opensuse.42.1-x64": {}, + } +} diff --git a/tests/src/Common/targeting_pack_ref/project.json b/tests/src/Common/targeting_pack_ref/project.json new file mode 100644 index 0000000000..8ded577626 --- /dev/null +++ b/tests/src/Common/targeting_pack_ref/project.json @@ -0,0 +1,22 @@ +{ + "dependencies": { + "Microsoft.TargetingPack.Private.CoreCLR": "1.2.0-beta-24616-02" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dnxcore50", + "portable-net45+win8" + ] + } + }, + "runtimes": { + "win7-x86": {}, + "win7-x64": {}, + "ubuntu.14.04-x64": {}, + "osx.10.10-x64": {}, + "centos.7-x64": {}, + "rhel.7-x64": {}, + "debian.8-x64": {} + } +} diff --git a/tests/src/Common/targeting_pack_ref/targeting_pack_ref.csproj b/tests/src/Common/targeting_pack_ref/targeting_pack_ref.csproj new file mode 100644 index 0000000000..65e37c03c3 --- /dev/null +++ b/tests/src/Common/targeting_pack_ref/targeting_pack_ref.csproj @@ -0,0 +1,12 @@ +<?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> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <Target Name="Build" + DependsOnTargets="ResolveReferences" /> +</Project> |