Permalink
Browse files

Build tests against packages & produce Core_Root for arbitrary OS

  • Loading branch information...
1 parent 27c0001 commit 69ab16ac55d423935dd40c12237903b0c3a0c170 @wtgodbe wtgodbe committed Sep 6, 2016
View
@@ -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)
View
@@ -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": {
@@ -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
View
@@ -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."
View
@@ -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>
View
@@ -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" />
View
@@ -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.
Oops, something went wrong.

0 comments on commit 69ab16a

Please sign in to comment.