Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b49ce37

Browse files
committed
Merge pull request #3740 from ramarag/createlayouts
Creates RunTime Dependency Layout as a seperate step
2 parents 5d1a15e + ac6f19a commit b49ce37

File tree

2 files changed

+58
-44
lines changed

2 files changed

+58
-44
lines changed

tests/runtest.cmd

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if /i "%1" == "Exclude" (set __Exclude=%2&shift&shift&goto Arg_Loop)
5454
if /i "%1" == "Exclude0" (set __Exclude0=%2&shift&shift&goto Arg_Loop)
5555
if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
5656
if /i "%1" == "sequential" (set __BuildSequential=1&shift&goto Arg_Loop)
57+
if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&set __SkipWrapperGeneration=true&shift&goto Arg_Loop)
5758

5859
if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs
5960
:: All the rest of the args will be collected and passed directly to msbuild.
@@ -65,6 +66,7 @@ goto CollectMsbuildArgs
6566
:SkipMsbuildArgs
6667

6768
set CORE_ROOT=%1
69+
echo %__MsgPrefix%CORE_ROOT is initially set to: "%CORE_ROOT%"
6870
shift
6971
:ArgsDone
7072

@@ -126,27 +128,17 @@ if not defined __BuildSequential (
126128
set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount
127129
)
128130

129-
if not defined CORE_ROOT (
130-
set noCore_RootSet=true
131-
set "CORE_ROOT=%__BinDir%"
132-
)
131+
if defined CORE_ROOT goto SkipCoreRootSetup
133132

134-
::Check if the test Binaries are built
135-
if not exist %XunitTestBinBase% (
136-
echo %__MsgPrefix%Error: Ensure the Test Binaries are built and are present at %XunitTestBinBase%.
137-
echo %__MsgPrefix%Run "buildtest.cmd %__BuildArch% %__BuildType%" to build the tests first.
138-
exit /b 1
139-
)
133+
set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
134+
echo %__MsgPrefix%Using Default CORE_ROOT as %CORE_ROOT%
135+
echo %__MsgPrefix%Copying Built binaries from %__BinDir% to %CORE_ROOT%
136+
if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
137+
md "%CORE_ROOT%"
138+
xcopy /s "%__BinDir%" "%CORE_ROOT%"
140139

141-
if "%CORE_ROOT%" == "" (
142-
echo %__MsgPrefix%Error: Ensure you have done a successful build of the Product and Run - runtest BuildArch BuildType {path to product binaries}.
143-
exit /b 1
144-
)
140+
:SkipCoreRootSetup
145141

146-
if not exist %CORE_ROOT%\coreclr.dll (
147-
echo %__MsgPrefix%Error: Ensure you have done a successful build of the Product and %CORE_ROOT% contains runtime binaries.
148-
exit /b 1
149-
)
150142

151143
if defined __Exclude (if not exist %__Exclude% echo %__MsgPrefix%Error: Exclusion .targets file not found && exit /b 1)
152144
if defined __TestEnv (if not exist %__TestEnv% echo %__MsgPrefix%Error: Test Environment script not found && exit /b 1)
@@ -155,39 +147,37 @@ REM These log files are created automatically by the test run process. Q: what d
155147
set __TestRunHtmlLog=%__LogsDir%\TestRun_%__BuildOS%__%__BuildArch%__%__BuildType%.html
156148
set __TestRunXmlLog=%__LogsDir%\TestRun_%__BuildOS%__%__BuildArch%__%__BuildType%.xml
157149

158-
echo %__MsgPrefix%CORE_ROOT that will be used is: %CORE_ROOT%
159-
echo %__MsgPrefix%Starting the test run ...
160150

161151
if "%__SkipWrapperGeneration%"=="true" goto SkipWrapperGeneration
162152

163153
set __BuildLogRootName=Tests_XunitWrapper
164-
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:NoRun=true
154+
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:BuildWrappers=true
165155
if errorlevel 1 exit /b 1
166156

167157
:SkipWrapperGeneration
168158

169-
if not "%noCore_RootSet%"=="true" goto SkipCoreRootSetup
159+
call :ResolveDependecies
170160

171-
set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
172-
echo %__MsgPrefix%Using Default CORE_ROOT as %CORE_ROOT%
173-
echo %__MsgPrefix%Copying Built binaries from %__BinDir% to %CORE_ROOT%
174-
if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
175-
md "%CORE_ROOT%"
176-
xcopy /s "%__BinDir%" "%CORE_ROOT%"
161+
if defined __GenerateLayoutOnly (
162+
exit /b 1
163+
)
177164

178-
:SkipCoreRootSetup
165+
if not exist %CORE_ROOT%\coreclr.dll (
166+
echo %__MsgPrefix%Error: Ensure you have done a successful build of the Product and %CORE_ROOT% contains runtime binaries.
167+
exit /b 1
168+
)
179169

180-
:: Pull down dependent packages needed for testing
181-
setlocal
182-
if defined __TestEnv call %__TestEnv%
183-
if defined COMPlus_GCStress set __Result=true
184-
endlocal & set __IsGCTest=%__Result%
185-
if "%__IsGCTest%"=="true" (
186-
call tests\setup-runtime-dependencies.cmd /outputdir %CORE_ROOT%
170+
::Check if the test Binaries are built
171+
if not exist %XunitTestBinBase% (
172+
echo %__MsgPrefix%Error: Ensure the Test Binaries are built and are present at %XunitTestBinBase%.
173+
echo %__MsgPrefix%Run "buildtest.cmd %__BuildArch% %__BuildType%" to build the tests first.
174+
exit /b 1
187175
)
176+
echo %__MsgPrefix%CORE_ROOT that will be used is: %CORE_ROOT%
177+
echo %__MsgPrefix%Starting the test run ...
188178

189179
set __BuildLogRootName=TestRunResults
190-
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:NoBuild=true /clp:showcommandline
180+
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:Runtests=true /clp:showcommandline
191181

192182
if errorlevel 1 (
193183
echo Test Run failed. Refer to the following:
@@ -252,6 +242,29 @@ if errorlevel 1 (
252242

253243
exit /b 0
254244

245+
:ResolveDependecies:
246+
247+
if "%CORE_ROOT%" == "" (
248+
echo %__MsgPrefix%Error: Ensure you have done a successful build of the Product and Run - runtest BuildArch BuildType {path to product binaries}.
249+
exit /b 1
250+
)
251+
:: Pull down dependent packages needed for testing
252+
setlocal
253+
if defined __TestEnv call %__TestEnv%
254+
if defined COMPlus_GCStress set __Result=true
255+
endlocal & set __IsGCTest=%__Result%
256+
if "%__IsGCTest%"=="true" (
257+
call tests\setup-runtime-dependencies.cmd /outputdir %CORE_ROOT%
258+
)
259+
call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:GeneraRuntimeLayout=true
260+
echo %__MsgPrefix% Created the runtime layout with all dependencies in:%CORE_ROOT%
261+
exit /b 0
262+
263+
if errorlevel 1 (
264+
echo Test Depenedevy Resolution Failed
265+
exit /b 1
266+
)
267+
255268
:Usage
256269
echo.
257270
echo Usage:
@@ -267,6 +280,7 @@ echo Set to "" to disable default exclusion file.
267280
echo Exclude- Optional parameter - this will exclude individual tests from running, specified by ExcludeList ItemGroup in an .targets file.
268281
echo TestEnv- Optional parameter - this will run a custom script to set custom test environment settings.
269282
echo VSVersion- Optional parameter - VS2013 or VS2015 ^(default: VS2015^)
283+
echo GenerateLayoutOnly - If specified will not run the tests and will only create the Runtime Dependency Layout
270284
echo CORE_ROOT The path to the runtime
271285
exit /b 1
272286

tests/runtest.proj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="src\dir.props" />
4-
<Import Project="$(ToolsDir)Build.Post.targets" Condition="Exists('$(ToolsDir)Build.Post.targets') AND '$(NoBuild)' != 'true'" />
4+
<Import Project="$(ToolsDir)Build.Post.targets" Condition="Exists('$(ToolsDir)Build.Post.targets') AND '$(BuildWrappers)' == 'true'" />
55

66
<PropertyGroup>
77
<XunitTestBinBase Condition="'$(XunitTestBinBase)'==''" >$(BaseOutputPathWithConfig)</XunitTestBinBase>
@@ -403,29 +403,29 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
403403
<!-- generate project.json for runtime dependency -->
404404
<MSBuild Projects="$(MSBuildProjectFile)"
405405
Targets="CreateTestRuntimeJsonFile"
406-
Condition=" '$(NoBuild)'!='true' " />
406+
Condition=" '$(BuildWrappers)'=='true' " />
407407

408408
<!-- generate project.lock.json file corresponding to above json file -->
409409
<MSBuild Projects="src\Common\test_runtime\test_runtime.csproj"
410-
Condition=" '$(NoBuild)'!='true' " />
410+
Condition=" '$(BuildWrappers)'=='true' " />
411411

412412
<!-- Default for building -->
413413
<MSBuild Projects="$(MSBuildProjectFile)"
414414
Targets="CreateAllWrappers"
415415
Properties="_CMDDIR=%(TestDirectories.Identity)"
416-
Condition=" '$(NoBuild)'!='true' " />
416+
Condition=" '$(BuildWrappers)'=='true' " />
417417

418418
<!-- Execution -->
419419

420420
<MSBuild Projects="$(MSBuildProjectFile)"
421421
Targets="CreateTestOverlay"
422-
Condition=" '$(NoRun)'!='true' "/>
422+
Condition=" '$(GeneraRuntimeLayout)'=='true' "/>
423423

424424
<MSBuild Projects="$(MSBuildProjectFile)" Targets="RunTests"
425-
Condition=" '$(NoRun)'!='true' "/>
425+
Condition=" '$(RunTests)'=='true' "/>
426426
</Target>
427427

428428
<Target Name="Clean">
429-
<RemoveDir Condition=" '$(NoBuild)'!='true'" Directories="$(XunitWrapperGeneratedCSDirBase);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />
429+
<RemoveDir Condition=" '$(BuildWrappers)'=='true'" Directories="$(XunitWrapperGeneratedCSDirBase);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />
430430
</Target>
431431
</Project>

0 commit comments

Comments
 (0)